use of com.questdb.net.ha.krb.SSOCredentialProvider in project questdb by bluestreak01.
the class AuthorizationTest method testExceptionInCredentialProvider.
@Test
public void testExceptionInCredentialProvider() throws Exception {
JournalServer server = new JournalServer(new ServerConfig() {
{
setHeartbeatFrequency(TimeUnit.MILLISECONDS.toMillis(500));
setEnableMultiCast(false);
}
}, getFactory(), (token, requestedKeys) -> "SECRET".equals(new String(token)));
final AtomicInteger authErrorCount = new AtomicInteger();
final CountDownLatch terminated = new CountDownLatch(1);
JournalClient client = new JournalClient(local, getFactory(), new SSOCredentialProvider("HOST/test"), evt -> {
switch(evt) {
case JournalClientEvents.EVT_AUTH_CONFIG_ERROR:
authErrorCount.incrementAndGet();
break;
case JournalClientEvents.EVT_TERMINATED:
terminated.countDown();
break;
default:
break;
}
});
server.start();
try {
client.start();
Assert.assertTrue(terminated.await(5, TimeUnit.SECONDS));
Assert.assertEquals(1, authErrorCount.get());
Assert.assertFalse(client.isRunning());
} finally {
server.halt();
}
}
Aggregations