Search in sources :

Example 41 with TestingServer

use of org.apache.curator.test.TestingServer in project drill by apache.

the class TestZookeeperClient method setUp.

@Before
public void setUp() throws Exception {
    server = new TestingServer();
    final RetryPolicy policy = new RetryNTimes(1, 1000);
    curator = CuratorFrameworkFactory.newClient(server.getConnectString(), policy);
    client = new ClientWithMockCache(curator, root, mode);
    server.start();
    curator.start();
    client.start();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) RetryNTimes(org.apache.curator.retry.RetryNTimes) RetryPolicy(org.apache.curator.RetryPolicy) Before(org.junit.Before)

Example 42 with TestingServer

use of org.apache.curator.test.TestingServer in project ignite by apache.

the class TestKafkaBroker method setupZooKeeper.

/**
     * Sets up ZooKeeper test server.
     *
     * @throws Exception If failed.
     */
private void setupZooKeeper() throws Exception {
    zkServer = new TestingServer(ZK_PORT, true);
    Tuple2<ZkClient, ZkConnection> zkTuple = ZkUtils.createZkClientAndConnection(zkServer.getConnectString(), ZK_SESSION_TIMEOUT, ZK_CONNECTION_TIMEOUT);
    zkUtils = new ZkUtils(zkTuple._1(), zkTuple._2(), false);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) ZkClient(org.I0Itec.zkclient.ZkClient) ZkUtils(kafka.utils.ZkUtils) ZkConnection(org.I0Itec.zkclient.ZkConnection)

Aggregations

TestingServer (org.apache.curator.test.TestingServer)42 Before (org.junit.Before)17 Test (org.junit.Test)7 File (java.io.File)6 RetryOneTime (org.apache.curator.retry.RetryOneTime)6 BeforeClass (org.junit.BeforeClass)6 IOException (java.io.IOException)5 CuratorFramework (org.apache.curator.framework.CuratorFramework)5 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)5 HashMap (java.util.HashMap)4 Configuration (org.apache.hadoop.conf.Configuration)4 Properties (java.util.Properties)3 ActorSystem (akka.actor.ActorSystem)2 ConcurrentCompositeConfiguration (com.netflix.config.ConcurrentCompositeConfiguration)2 SocketTimeoutException (java.net.SocketTimeoutException)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 SimpleConsumer (kafka.javaapi.consumer.SimpleConsumer)2 ZkClient (org.I0Itec.zkclient.ZkClient)2 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)2