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();
}
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("");
}
}
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();
}
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);
}
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;
}
Aggregations