use of com.novell.ldapchai.exception.ChaiUnavailableException in project ldapchai by ldapchai.
the class FailOverTester method testMultiServerFailover.
public void testMultiServerFailover() throws Exception {
TestHelper.configureLogging();
final InetSocketAddress destinationAddress = figureDestSocketAddress();
final TcpProxy proxy1 = new TcpProxy(basePort + 1, destinationAddress);
final TcpProxy proxy2 = new TcpProxy(basePort + 2, destinationAddress);
final TcpProxy proxy3 = new TcpProxy(basePort + 3, destinationAddress);
proxy2.start();
final ChaiConfiguration testConfig = makeChaiConfig(figureUrlForProxy(proxy1, proxy2, proxy3));
final ChaiProvider testProvider = ChaiProviderFactory.createProvider(testConfig);
final ChaiEntry testContainer = TestHelper.createTestContainer(testProvider);
final ChaiUser testUser = TestHelper.createNewTestUser(testContainer);
TestHelper.doBasicNonDestructiveUserTest(testUser);
proxy2.stop();
TestHelper.pause(1000);
{
// test to make sure we get unavailable error
boolean gotError = false;
try {
TestHelper.doBasicNonDestructiveUserTest(testUser);
} catch (ChaiUnavailableException e) {
System.out.println("got expected unavailable error: " + e.getMessage());
gotError = true;
}
Assert.assertTrue(gotError);
}
proxy1.start();
TestHelper.pause(1000);
TestHelper.doBasicNonDestructiveUserTest(testUser);
proxy1.stop();
proxy3.start();
TestHelper.pause(1000);
TestHelper.doBasicNonDestructiveUserTest(testUser);
}
Aggregations