Search in sources :

Example 76 with ChaiUnavailableException

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);
}
Also used : ChaiUnavailableException(com.novell.ldapchai.exception.ChaiUnavailableException) ChaiProvider(com.novell.ldapchai.provider.ChaiProvider) ChaiUser(com.novell.ldapchai.ChaiUser) InetSocketAddress(java.net.InetSocketAddress) ChaiEntry(com.novell.ldapchai.ChaiEntry) TcpProxy(com.novell.ldapchai.tests.util.TcpProxy) ChaiConfiguration(com.novell.ldapchai.provider.ChaiConfiguration)

Aggregations

ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)76 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)51 ErrorInformation (password.pwm.error.ErrorInformation)37 ChaiOperationException (com.novell.ldapchai.exception.ChaiOperationException)32 PwmOperationalException (password.pwm.error.PwmOperationalException)25 IOException (java.io.IOException)22 ChaiUser (com.novell.ldapchai.ChaiUser)20 PwmException (password.pwm.error.PwmException)16 UserIdentity (password.pwm.bean.UserIdentity)15 ChaiProvider (com.novell.ldapchai.provider.ChaiProvider)13 PwmApplication (password.pwm.PwmApplication)12 LinkedHashMap (java.util.LinkedHashMap)11 ServletException (javax.servlet.ServletException)10 Configuration (password.pwm.config.Configuration)10 Instant (java.time.Instant)9 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)7 List (java.util.List)7 FormConfiguration (password.pwm.config.value.data.FormConfiguration)7 ChaiException (com.novell.ldapchai.exception.ChaiException)6