Search in sources :

Example 36 with TestingServer

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

the class BlobSynchronizerTest method testNimbodesWithLatestVersionOfBlob.

@Test
public void testNimbodesWithLatestVersionOfBlob() throws Exception {
    TestingServer server = new TestingServer();
    CuratorFramework zkClient = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
    zkClient.start();
    // Creating nimbus hosts containing latest version of blob
    zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
    zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
    Set<NimbusInfo> set = BlobStoreUtils.getNimbodesWithLatestSequenceNumberOfBlob(zkClient, "key1");
    assertEquals("Failed to get the correct nimbus hosts with latest blob version", (set.iterator().next()).getHost(), "nimbus2");
    zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
    zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
    zkClient.close();
    server.close();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) CuratorFramework(org.apache.curator.framework.CuratorFramework) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) NimbusInfo(org.apache.storm.nimbus.NimbusInfo) Test(org.junit.Test)

Example 37 with TestingServer

use of org.apache.curator.test.TestingServer in project Mycat-Server by MyCATApache.

the class DistributedSequenceHandlerTest method initialize.

@Before
public void initialize() throws Exception {
    distributedSequenceHandler = new DistributedSequenceHandler[16];
    MycatConfig mycatConfig = new MycatConfig();
    testingServer = new TestingServer();
    testingServer.start();
    for (int i = 0; i < 16; i++) {
        distributedSequenceHandler[i] = new DistributedSequenceHandler(mycatConfig.getSystem());
        distributedSequenceHandler[i].initializeZK(testingServer.getConnectString());
        distributedSequenceHandler[i].nextId("");
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) DistributedSequenceHandler(io.mycat.route.sequence.handler.DistributedSequenceHandler) MycatConfig(io.mycat.config.MycatConfig) Before(org.junit.Before)

Example 38 with TestingServer

use of org.apache.curator.test.TestingServer in project Mycat-Server by MyCATApache.

the class IncrSequenceZKHandlerTest method initialize.

@Before
public void initialize() throws Exception {
    testingServer = new TestingServer();
    testingServer.start();
    incrSequenceZKHandler = new IncrSequenceZKHandler[MAX_CONNECTION];
    results = new ConcurrentSkipListSet();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) ConcurrentSkipListSet(java.util.concurrent.ConcurrentSkipListSet) Before(org.junit.Before)

Example 39 with TestingServer

use of org.apache.curator.test.TestingServer in project heron by twitter.

the class ZkCoordinatorTest method setUp.

@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<String, Object> conf = buildZookeeperConfig(server);
    state = new ZkState(conf);
    simpleConsumer = new SimpleConsumer("localhost", broker.getPort(), 60000, 1024, "testClient");
    when(dynamicPartitionConnections.register(any(Broker.class), any(String.class), anyInt())).thenReturn(simpleConsumer);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) SimpleConsumer(kafka.javaapi.consumer.SimpleConsumer) Before(org.junit.Before)

Example 40 with TestingServer

use of org.apache.curator.test.TestingServer in project pinpoint by naver.

the class ClusterTest method createZookeeperServer.

private static TestingServer createZookeeperServer(int port) throws Exception {
    TestingServer mockZookeeperServer = new TestingServer(port);
    mockZookeeperServer.start();
    return mockZookeeperServer;
}
Also used : TestingServer(org.apache.curator.test.TestingServer)

Aggregations

TestingServer (org.apache.curator.test.TestingServer)60 Before (org.junit.Before)23 Test (org.junit.Test)13 TestingServerStarter (io.pravega.test.common.TestingServerStarter)9 Cleanup (lombok.Cleanup)8 BeforeClass (org.junit.BeforeClass)8 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)7 Controller (io.pravega.client.stream.impl.Controller)7 StreamSegmentStore (io.pravega.segmentstore.contracts.StreamSegmentStore)7 PravegaConnectionListener (io.pravega.segmentstore.server.host.handler.PravegaConnectionListener)7 ServiceBuilder (io.pravega.segmentstore.server.store.ServiceBuilder)7 File (java.io.File)7 IOException (java.io.IOException)7 HashMap (java.util.HashMap)7 CuratorFramework (org.apache.curator.framework.CuratorFramework)7 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)7 RetryOneTime (org.apache.curator.retry.RetryOneTime)6 ConnectionFactoryImpl (io.pravega.client.netty.impl.ConnectionFactoryImpl)5 Stream (io.pravega.client.stream.Stream)5 StreamImpl (io.pravega.client.stream.impl.StreamImpl)5