use of io.vertx.ext.unit.TestCompletion in project apiman by apiman.
the class LdapBindTests method bindPasswordSuccess.
@Test
public void bindPasswordSuccess() {
config.setBindDn("uid=admin,ou=system");
config.setBindPassword("secret");
TestCompletion completion = TestSuite.create("").test("", context -> {
Async async = context.async();
ldapClientComponent.bind(config, result -> {
if (result.isError())
result.getError().printStackTrace(System.out);
context.assertTrue(result.isSuccess());
context.assertEquals(LdapResultCode.SUCCESS, result.getResult().getResultCode());
async.complete();
});
async.awaitSuccess();
}).run();
completion.awaitSuccess();
}
use of io.vertx.ext.unit.TestCompletion in project apiman by apiman.
the class LdapBindTests method shouldFailWhenPasswordInvalid.
@Test
public void shouldFailWhenPasswordInvalid() {
config.setBindDn("uid=admin,ou=system");
config.setBindPassword("miso-soup");
TestCompletion completion = TestSuite.create("").test("", context -> {
Async async = context.async();
ldapClientComponent.bind(config, result -> {
context.assertTrue(result.isSuccess());
context.assertEquals(LdapResultCode.INVALID_CREDENTIALS, result.getResult().getResultCode());
async.complete();
});
async.awaitSuccess();
}).run();
completion.awaitSuccess();
}
use of io.vertx.ext.unit.TestCompletion in project apiman by apiman.
the class LdapQueryTests method connect.
private void connect(DoubleHandler<ILdapClientConnection, TestContext> handler) {
TestCompletion completion = TestSuite.create("").test("", context -> {
Async async = context.async();
ldapClientComponent.connect(config, connectionResult -> {
context.assertTrue(connectionResult.isSuccess());
connection = connectionResult.getResult();
handler.handle(connection, context);
async.complete();
});
async.awaitSuccess();
}).run();
completion.awaitSuccess();
}
use of io.vertx.ext.unit.TestCompletion in project apiman by apiman.
the class LdapBindTests method shouldFailWhenUidInvalid.
@Test
public void shouldFailWhenUidInvalid() {
config.setBindDn("uid=tacos,ou=system");
config.setBindPassword("secret");
TestCompletion completion = TestSuite.create("").test("", context -> {
Async async = context.async();
ldapClientComponent.bind(config, result -> {
if (result.isError())
result.getError().printStackTrace(System.out);
context.assertTrue(result.isSuccess());
context.assertEquals(LdapResultCode.INVALID_CREDENTIALS, result.getResult().getResultCode());
async.complete();
});
async.awaitSuccess();
}).run();
completion.awaitSuccess();
}
use of io.vertx.ext.unit.TestCompletion in project apiman by apiman.
the class LdapBindTests method shouldFailWhenOuInvalid.
@Test
public void shouldFailWhenOuInvalid() {
config.setBindDn("uid=admin,ou=tacos");
config.setBindPassword("secret");
TestCompletion completion = TestSuite.create("").test("", context -> {
Async async = context.async();
ldapClientComponent.bind(config, result -> {
if (result.isError())
result.getError().printStackTrace(System.out);
context.assertTrue(result.isSuccess());
context.assertEquals(LdapResultCode.INVALID_CREDENTIALS, result.getResult().getResultCode());
async.complete();
});
async.awaitSuccess();
}).run();
completion.awaitSuccess();
}
Aggregations