diff --git a/src/test/java/org/mariadb/jdbc/DatatypeTest.java b/src/test/java/org/mariadb/jdbc/DatatypeTest.java index f6c3b4ef2..d3cdb100d 100644 --- a/src/test/java/org/mariadb/jdbc/DatatypeTest.java +++ b/src/test/java/org/mariadb/jdbc/DatatypeTest.java @@ -402,7 +402,7 @@ private void setObjectTestResult(ResultSet rs) throws SQLException, IOException, Object theInt = rs.getObject(1); assertTrue(theInt instanceof Integer); Object theInt2 = rs.getObject("int_test"); - assertTrue(theInt instanceof Integer); + assertTrue(theInt2 instanceof Integer); Object theString = rs.getObject(2); assertTrue(theString instanceof String); Object theTimestamp = rs.getObject(3); diff --git a/src/test/java/org/mariadb/jdbc/SslTest.java b/src/test/java/org/mariadb/jdbc/SslTest.java index 9bd77e0f9..f021c8a94 100644 --- a/src/test/java/org/mariadb/jdbc/SslTest.java +++ b/src/test/java/org/mariadb/jdbc/SslTest.java @@ -139,6 +139,15 @@ public void testConnect(Properties info, boolean sslExpected) throws SQLExceptio testConnect(info, sslExpected, username, password); } + /** + * Test connection. + * + * @param info connection properties + * @param sslExpected is SSL expected + * @param user user + * @param pwd password + * @throws SQLException if exception occur + */ public void testConnect(Properties info, boolean sslExpected, String user, String pwd) throws SQLException { Connection conn = null; Statement stmt = null; @@ -268,7 +277,8 @@ public void testTruststoreWithPassword() throws IOException, KeyStoreException, } @Test(expected = SQLException.class) - public void testTruststoreWithWrongPassword() throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, SQLException { + public void testTruststoreWithWrongPassword() throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, + SQLException { // generate a truststore from the canned serverCertificate File tempKeystore = File.createTempFile("keystore", ".tmp"); String keystorePath = tempKeystore.getAbsolutePath(); @@ -304,10 +314,12 @@ public void testTruststoreWithWrongCert() throws IOException, KeyStoreException, } @Test - public void testTruststoreAndClientKeystore() throws SQLException, IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException { + public void testTruststoreAndClientKeystore() throws SQLException, IOException, KeyStoreException, CertificateException, + NoSuchAlgorithmException { // This test only runs if a client keystore and password have been passed in as properties (-DkeystorePath and -DkeystorePassword) // You can create a keystore as follows: - // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" -out "${clientKeystoreFile}" -name "mysqlAlias" -pass stdin + // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" -out "${clientKeystoreFile}" + // -name "mysqlAlias" -pass stdin Assume.assumeTrue(clientKeystorePathDefined()); String testUser = "testTsAndKs"; @@ -336,7 +348,8 @@ public void testTruststoreAndClientKeystore() throws SQLException, IOException, public void testClientKeystore() throws SQLException, IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException { // This test only runs if a client keystore and password have been passed in as properties (-DkeystorePath and -DkeystorePassword) // You can create a keystore as follows: - // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" -out "${clientKeystoreFile}" -name "mysqlAlias" -pass stdin + // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" -out "${clientKeystoreFile}" + // -name "mysqlAlias" -pass stdin Assume.assumeTrue(clientKeystorePathDefined()); String testUser = "testKeystore"; @@ -360,7 +373,8 @@ public void testTruststoreAndClientKeystoreWrongPassword() throws SQLException, NoSuchAlgorithmException { // This test only runs if a client keystore and password have been passed in as properties (-DkeystorePath and -DkeystorePassword) // You can create a keystore as follows: - // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" -out "${clientKeystoreFile}" -name "mysqlAlias" -pass stdin + // echo "kspass" | openssl pkcs12 -export -in "${clientCertFile}" -inkey "${clientKeyFile}" + // -out "${clientKeystoreFile}" -name "mysqlAlias" -pass stdin Assume.assumeTrue(clientKeystorePathDefined()); String testUser = "testWrongPwd"; @@ -399,7 +413,8 @@ private void deleteSslTestUser(String user) throws SQLException { st.execute("drop user '" + user + "'@'localhost'"); } - private void generateKeystoreFromFile(String certificateFile, String keystoreFile, String password) throws KeyStoreException, CertificateException, + private void generateKeystoreFromFile(String certificateFile, String keystoreFile, String password) + throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException { InputStream inStream = null; KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); diff --git a/src/test/java/org/mariadb/jdbc/failover/ReplicationFailoverTest.java b/src/test/java/org/mariadb/jdbc/failover/ReplicationFailoverTest.java index ac399d17b..bc497c8a2 100644 --- a/src/test/java/org/mariadb/jdbc/failover/ReplicationFailoverTest.java +++ b/src/test/java/org/mariadb/jdbc/failover/ReplicationFailoverTest.java @@ -69,7 +69,6 @@ public void pingReconnectAfterFailover() throws Throwable { Statement st = connection.createStatement(); final int masterServerId = getServerId(connection); stopProxy(masterServerId); - long stoppedTime = System.nanoTime(); try { st.execute("SELECT 1");