当前位置: 首页>>代码示例>>Java>>正文


Java Util.isEnterpriseEdition方法代码示例

本文整理汇总了Java中com.mysql.jdbc.Util.isEnterpriseEdition方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isEnterpriseEdition方法的具体用法?Java Util.isEnterpriseEdition怎么用?Java Util.isEnterpriseEdition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysql.jdbc.Util的用法示例。


在下文中一共展示了Util.isEnterpriseEdition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTLSVersion

import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
 * Tests fix for WL#8196, Support for TLSv1.2 Protocol.
 * 
 * This test requires community server (with yaSSL) in -Dcom.mysql.jdbc.testsuite.url and
 * commercial server (with OpenSSL) in -Dcom.mysql.jdbc.testsuite.url.sha256default
 * 
 * Test certificates from testsuite/ssl-test-certs must be installed on both servers.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testTLSVersion() throws Exception {

    final String[] testDbUrls;
    Properties props = new Properties();
    props.setProperty("allowPublicKeyRetrieval", "true");
    props.setProperty("useSSL", "true");
    props.setProperty("requireSSL", "true");
    props.setProperty("trustCertificateKeyStoreUrl", "file:src/testsuite/ssl-test-certs/ca-truststore");
    props.setProperty("trustCertificateKeyStoreType", "JKS");
    props.setProperty("trustCertificateKeyStorePassword", "password");

    if (this.sha256Conn != null && ((MySQLConnection) this.sha256Conn).versionMeetsMinimum(5, 5, 7)) {
        testDbUrls = new String[] { BaseTestCase.dbUrl, sha256Url };
    } else {
        testDbUrls = new String[] { BaseTestCase.dbUrl };
    }

    for (String testDbUrl : testDbUrls) {
        System.out.println(testDbUrl);
        System.out.println(System.getProperty("java.version"));
        Connection sslConn = getConnectionWithProps(testDbUrl, props);
        assertTrue(((MySQLConnection) sslConn).getIO().isSSLEstablished());

        ResultSet rset = sslConn.createStatement().executeQuery("SHOW STATUS LIKE 'ssl_version'");
        assertTrue(rset.next());
        String tlsVersion = rset.getString(2);
        System.out.println("TLS version: " + tlsVersion);
        System.out.println();
        System.out.println("MySQL version: " + ((MySQLConnection) sslConn).getServerVersion());
        String etp = ((MySQLConnection) sslConn).getEnabledTLSProtocols();
        System.out.println("enabledTLSProtocols: " + etp);
        System.out.println();
        System.out.println("JVM version: " + Util.getJVMVersion());
        System.out.println();

        if (((MySQLConnection) sslConn).versionMeetsMinimum(5, 7, 10) && Util.getJVMVersion() > 6) {
            if (Util.isEnterpriseEdition(((MySQLConnection) sslConn).getServerVersion())) {
                assertEquals("TLSv1.2", tlsVersion);
            } else {
                assertEquals("TLSv1.1", tlsVersion);
            }
        } else {
            assertEquals("TLSv1", tlsVersion);
        }

        sslConn.close();
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:60,代码来源:ConnectionRegressionTest.java

示例2: isEnterpriseEdition

import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
 * Checks whether the server we're connected to is an MySQL Enterprise edition
 */
protected boolean isEnterpriseEdition() {
    return Util.isEnterpriseEdition(((MySQLConnection) this.conn).getServerVersion());
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:7,代码来源:BaseTestCase.java

示例3: testTLSVersion

import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
 * Tests fix for WL#8196, Support for TLSv1.2 Protocol.
 * 
 * This test requires community server (with yaSSL) in -Dcom.mysql.jdbc.testsuite.url and
 * commercial server (with OpenSSL) in -Dcom.mysql.jdbc.testsuite.url.sha256default
 * 
 * Test certificates from testsuite/ssl-test-certs must be installed on both servers.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testTLSVersion() throws Exception {

    final String[] testDbUrls;
    Properties props = new Properties();
    props.setProperty("allowPublicKeyRetrieval", "true");
    props.setProperty("useSSL", "true");
    props.setProperty("requireSSL", "true");
    props.setProperty("trustCertificateKeyStoreUrl", "file:src/testsuite/ssl-test-certs/ca-truststore");
    props.setProperty("trustCertificateKeyStoreType", "JKS");
    props.setProperty("trustCertificateKeyStorePassword", "password");

    if (this.sha256Conn != null && ((MySQLConnection) this.sha256Conn).versionMeetsMinimum(5, 5, 7)) {
        testDbUrls = new String[] { BaseTestCase.dbUrl, sha256Url };
    } else {
        testDbUrls = new String[] { BaseTestCase.dbUrl };
    }

    for (String testDbUrl : testDbUrls) {
        System.out.println(testDbUrl);
        System.out.println(System.getProperty("java.version"));
        Connection sslConn = getConnectionWithProps(testDbUrl, props);
        assertTrue(((MySQLConnection) sslConn).getIO().isSSLEstablished());

        ResultSet rset = sslConn.createStatement().executeQuery("SHOW STATUS LIKE 'ssl_version'");
        assertTrue(rset.next());
        String tlsVersion = rset.getString(2);
        System.out.println(tlsVersion);
        System.out.println();

        if (((MySQLConnection) sslConn).versionMeetsMinimum(5, 7, 10) && Util.getJVMVersion() > 6) {
            if (Util.isEnterpriseEdition(((MySQLConnection) sslConn).getServerVersion())) {
                assertEquals("TLSv1.2", tlsVersion);
            } else {
                assertEquals("TLSv1.1", tlsVersion);
            }
        } else {
            assertEquals("TLSv1", tlsVersion);
        }

        sslConn.close();
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:54,代码来源:ConnectionRegressionTest.java


注:本文中的com.mysql.jdbc.Util.isEnterpriseEdition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。