@Test public void testWrongSslConfiguration(TestContext context) { Async async = context.async(); client = createClient(vertx,new JsonObject() .put("sslMode", "verify-ca") .put("sslRootCert", "something-wrong.crt") ); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.failed()); async.complete(); }); }
@Test public void testWrongSslConfiguration(TestContext context) { Async async = context.async(); client = createClient(vertx,new JsonObject() .put("sslMode", "verify-ca") .put("sslRootCert", "something-wrong.crt") ); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.failed()); async.complete(); }); }
@Test public void testWrongSslConfiguration(TestContext context) { Async async = context.async(); client = createClient(vertx,new JsonObject() .put("sslMode", "verify-ca") .put("sslRootCert", "something-wrong.crt") ); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.failed()); async.complete(); }); }
@Test public void testCorrectSslConfiguration(TestContext context) { Async async = context.async(); String path = getClass() .getResource("/ssl-docker/server.crt") .getPath(); JsonObject sslConfig = new JsonObject() .put("sslMode", "require") .put("sslRootCert", path); client = createClient(vertx, sslConfig); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); }
@Test public void testCorrectSslConfiguration(TestContext context) { Async async = context.async(); String path = getClass() .getResource("/ssl-docker/server.crt") .getPath(); JsonObject sslConfig = new JsonObject() .put("sslMode", "require") .put("sslRootCert", path); client = createClient(vertx, sslConfig); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); }
@Test public void testCorrectSslConfiguration(TestContext context) { Async async = context.async(); String path = getClass() .getResource("/ssl-docker/server.crt") .getPath(); JsonObject sslConfig = new JsonObject() .put("sslMode", "require") .put("sslRootCert", path); client = createClient(vertx, sslConfig); client.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); }
@Test public void testPreferSslConfiguration(TestContext context) { Async async = context.async(); SQLClient clientSsl = createClient(vertx, new JsonObject().put("sslMode", "prefer")); clientSsl.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); } }
@Test public void testPreferSslConfiguration(TestContext context) { Async async = context.async(); SQLClient clientSsl = createClient(vertx, new JsonObject().put("sslMode", "prefer")); clientSsl.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); } }
@Test public void testPreferSslConfiguration(TestContext context) { Async async = context.async(); SQLClient clientSsl = createClient(vertx, new JsonObject().put("sslMode", "prefer")); clientSsl.getConnection(sqlConnectionAsyncResult -> { context.assertTrue(sqlConnectionAsyncResult.succeeded()); conn = sqlConnectionAsyncResult.result(); conn.query("SELECT 1", ar -> { if (ar.failed()) { context.fail("Should not fail on ssl connection"); } else { async.complete(); } }); }); } }