Package org.apache.curator.test

Examples of org.apache.curator.test.TestingServer


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

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


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

            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

  protected TestingServer zkServer;
  protected CuratorFramework client;

  @Before
  public void setUp() throws Exception {
    zkServer = new TestingServer();
    client = CuratorFrameworkFactory
        .newClient("localhost:" + zkServer.getPort(),
            new ExponentialBackoffRetry(1000, 3));
    client.start();
View Full Code Here

    private TestingServer zooKeeperTestServer;
    private ZooKeeperSamplingTraceFilter traceFilter;

    @Before
    public void setup() throws Exception {
        zooKeeperTestServer = new TestingServer();
        traceFilter = new ZooKeeperSamplingTraceFilter(zooKeeperTestServer.getConnectString(), SAMPLE_RATE_NODE);

    }
View Full Code Here

    private CuratorFramework zookeeper;
    private TestingServer server;

    @Before
    public void setUp() throws Exception {
        server = new TestingServer();
        String connectionString = server.getConnectString();
        Map conf = new HashMap();
        conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 1000);
        conf.put(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT, 1000);
        conf.put(Config.STORM_ZOOKEEPER_RETRY_TIMES, 4);
View Full Code Here

    private CuratorFramework zookeeper;
    private File logDir;

    public KafkaTestBroker() {
        try {
            server = new TestingServer();
            String zookeeperConnectionString = server.getConnectString();
            ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3);
            zookeeper = CuratorFrameworkFactory.newClient(zookeeperConnectionString, retryPolicy);
            zookeeper.start();
            port = InstanceSpec.getRandomPort();
View Full Code Here

    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

            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

            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

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.