-
Notifications
You must be signed in to change notification settings - Fork 59
Added test for sslMode=prefer #43 #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,4 +106,53 @@ public void testNoSslConfiguration(TestContext context) { | |
}); | ||
} | ||
|
||
|
||
@Test | ||
public void testPreferSslConfiguration(TestContext context) { | ||
Async async = context.async(); | ||
SQLClient clientSsl = createClient(vertx, | ||
new JsonObject() | ||
.put("host", System.getProperty("db.host", "localhost")) | ||
.put("port", Integer.parseInt(System.getProperty("dbssl.port", "54321"))) | ||
.put("sslMode", "prefer") | ||
); | ||
SQLClient clientNoSsl = createClient(vertx, | ||
new JsonObject() | ||
.put("host", System.getProperty("db.host", "localhost")) | ||
.put("port", Integer.parseInt(System.getProperty("dbssl.port", "54321"))) | ||
.put("sslMode", "prefer") | ||
); | ||
|
||
System.out.println("testPreferSslConfiguration"); | ||
|
||
clientSsl.getConnection(sqlConnectionAsyncResult -> { | ||
context.assertTrue(sqlConnectionAsyncResult.succeeded()); | ||
conn = sqlConnectionAsyncResult.result(); | ||
System.out.println("testPreferSslConfiguration step2"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could get rid of these debug messages I think |
||
conn.query("SELECT 1", ar -> { | ||
System.out.println("testPreferSslConfiguration callback2"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could get rid of these debug messages I think |
||
if (ar.failed()) { | ||
context.fail("Should not fail on ssl connection"); | ||
} else { | ||
System.out.println("testPreferSslConfiguration SSL OK"); | ||
|
||
clientNoSsl.getConnection(sqlConnectionAsyncResult2 -> { | ||
context.assertTrue(sqlConnectionAsyncResult2.succeeded()); | ||
conn = sqlConnectionAsyncResult2.result(); | ||
System.out.println("testPreferSslConfiguration step3"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could get rid of these debug messages I think |
||
conn.query("SELECT 1", ar2 -> { | ||
System.out.println("testPreferSslConfiguration callback4"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could get rid of these debug messages I think |
||
if (ar2.failed()) { | ||
context.fail("Should not fail on non-ssl connection"); | ||
} else { | ||
System.out.println("testPreferSslConfiguration non-SSL OK"); | ||
System.out.println("testPreferSslConfiguration all good!"); | ||
async.complete(); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get rid of these debug messages I think