Package org.apache.curator.test

Examples of org.apache.curator.test.TestingServer


        JaasConfiguration.addEntry("Client", getPrincipal(), keytabFile.getAbsolutePath());
        Configuration.setConfiguration(JaasConfiguration.getInstance());

        setSystemProperty(ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY, "Server");

        return new TestingServer();
    }
View Full Code Here


    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    Logger rootLogger = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.WARN);

    this.ts = new TestingServer();
  }
View Full Code Here

    }

    @Test
    public void     testChanging() throws Exception
    {
        TestingServer               secondServer = new TestingServer();
        try
        {
            String                          mainConnectionString = "count=1&port=" + server.getPort() + "&server0=localhost";
            String                          secondConnectionString = "count=1&port=" + secondServer.getPort() + "&server0=localhost";

            final Semaphore                 semaphore = new Semaphore(0);
            final AtomicReference<String>   connectionString = new AtomicReference<String>(mainConnectionString);
            Exhibitors                      exhibitors = new Exhibitors(Lists.newArrayList("foo", "bar"), 1000, dummyConnectionStringProvider);
            ExhibitorRestClient             mockRestClient = new ExhibitorRestClient()
View Full Code Here

                    }
                }
            };
            client.getConnectionStateListenable().addListener(listener);
            timing.sleepABit();
            server = new TestingServer(server.getPort());
            Assert.assertTrue(timing.awaitLatch(connectedLatch));
            timing.sleepABit();
            Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS));
            server.close();
            timing.sleepABit();
            server = new TestingServer(server.getPort());
            timing.sleepABit();
            Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
            timing.sleepABit();
            Assert.assertEquals(lastState.get(), ConnectionState.RECONNECTED);
        }
View Full Code Here

            };

            Timing waitingTiming = timing.forWaiting();

            client.getConnectionStateListenable().addListener(listener);
            server = new TestingServer(server.getPort());
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.CONNECTED);
            server.close();
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.SUSPENDED);
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.LOST);
            server = new TestingServer(server.getPort());
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.RECONNECTED);
            server.close();
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.SUSPENDED);
            Assert.assertEquals(stateVector.poll(waitingTiming.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.LOST);
        }
View Full Code Here

                }
            };

            client.getConnectionStateListenable().addListener(listener1);
            log.debug("Starting ZK server");
            server = new TestingServer(server.getPort());
            timing.forWaiting().sleepABit();

            log.debug("Stopping ZK server");
            server.close();
            timing.forWaiting().sleepABit();

            log.debug("Starting ZK server");
            server = new TestingServer(server.getPort());
            timing.forWaiting().sleepABit();

            log.debug("Stopping ZK server");
            server.close();
            timing.forWaiting().sleepABit();
View Full Code Here

            }
            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(client.checkExists().forPath("/test-me"));
View Full Code Here

            }
            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(client.checkExists().forPath("/test-me"));
View Full Code Here

            }
            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(namespaceClient.checkExists().forPath("/test-me"));
View Full Code Here

            catch ( KeeperException.ConnectionLossException e )
            {
                // expected
            }
           
            server = new TestingServer(serverPort, serverDir);
            Assert.assertNotNull(client.checkExists().forPath(PATH));

            server.stop(); // cause the next delete to fail
            server = null;
            try
            {
                client.delete().guaranteed().forPath(PATH);
                Assert.fail();
            }
            catch ( KeeperException.ConnectionLossException e )
            {
                // expected
            }

            server = new TestingServer(serverPort, serverDir);

            final int       TRIES = 5;
            for ( int i = 0; i < TRIES; ++i )
            {
                if ( client.checkExists().forPath(PATH) != null )
View Full Code Here

TOP

Related Classes of org.apache.curator.test.TestingServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.