Skip to content

Commit

Permalink
[misc] codestyle correction
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 9, 2016
1 parent 6d156a1 commit 4a19119
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/test/java/org/mariadb/jdbc/DatatypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 21 additions & 6 deletions src/test/java/org/mariadb/jdbc/SslTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 4a19119

Please sign in to comment.