Examples of TestingServer


Examples of org.apache.curator.test.TestingServer

    private SimpleConsumer simpleConsumer;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        server = new TestingServer();
        String connectionString = server.getConnectString();
        ZkHosts hosts = new ZkHosts(connectionString);
        hosts.refreshFreqSecs = 1;
        spoutConfig = new SpoutConfig(hosts, "topic", "/test", "id");
        Map conf = buildZookeeperConfig(server);
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            client.getConnectionStateListenable().addListener(listener);

            // due to CURATOR-72, this was causing a LOST event to precede the CONNECTED event
            client.create().inBackground().forPath("/foo");

            server = new TestingServer(server.getPort());

            Assert.assertTrue(timing.awaitLatch(connectedLatch));
            Assert.assertFalse(firstListenerAction.get());
            ConnectionState firstconnectionState = firstListenerState.get();
            Assert.assertEquals(firstconnectionState, ConnectionState.CONNECTED, "First listener state MUST BE CONNECTED but is " + firstconnectionState);
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            leader.start();

            timing.sleepABit();

            // Start the new server
            server = new TestingServer(server.getPort(), server.getTempDirectory());

            Assert.assertTrue(timing.awaitLatch(leaderCounter), "Not elected leader");

            Assert.assertEquals(leaderCount.get(), 1, "Elected too many times");
            Assert.assertEquals(notLeaderCount.get(), 0, "Unelected too many times");
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            };
            client.getConnectionStateListenable().addListener(listener);

            timing.sleepABit();

            server = new TestingServer(server.getPort());

            Assert.assertTrue(timing.awaitLatch(connectedLatch));

            timing.sleepABit();
View Full Code Here

Examples of org.apache.curator.test.TestingServer

                                {
                                    timing.sleepABit();

                                    server.stop();
                                    Assert.assertTrue(timing.awaitLatch(latch));
                                    server = new TestingServer(server.getPort(), server.getTempDirectory());
                                }
                            }
                            finally
                            {
                                try
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            server.stop();
            Assert.assertTrue(timing.awaitLatch(lostLatch));
            timing.sleepABit();
            debugLeadershipWaitLatch.countDown();

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

            Assert.assertFalse(takeLeadershipLatch.await(3, TimeUnit.SECONDS));
        }
        finally
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            catch ( KeeperException.ConnectionLossException e )
            {
                // correct
            }

            server = new TestingServer(server.getPort());
            client.checkExists().forPath("/");
        }
        finally
        {
            CloseableUtils.closeQuietly(client);
View Full Code Here

Examples of org.apache.curator.test.TestingServer

                            semaphore.release();
                            if ( retries.incrementAndGet() == MAX_RETRIES )
                            {
                                try
                                {
                                    server = new TestingServer(serverPort);
                                }
                                catch ( Exception e )
                                {
                                    throw new Error(e);
                                }
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            catch ( KeeperException.ConnectionLossException e )
            {
                // expected
            }

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            try
            {
                client.setData().forPath("/test", "test".getBytes());
            }
            catch ( KeeperException.NoAuthException e )
View Full Code Here

Examples of org.apache.curator.test.TestingServer

            }
            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
TOP
Copyright © 2018 www.massapi.com. 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.