use of org.apache.curator.test.TestingCluster in project druid by druid-io.
the class KafkaSupervisorTest method setUp.
@Before
public void setUp() throws Exception {
taskStorage = createMock(TaskStorage.class);
taskMaster = createMock(TaskMaster.class);
taskRunner = createMock(TaskRunner.class);
indexerMetadataStorageCoordinator = createMock(IndexerMetadataStorageCoordinator.class);
taskClient = createMock(KafkaIndexTaskClient.class);
taskQueue = createMock(TaskQueue.class);
zkServer = new TestingCluster(1);
zkServer.start();
kafkaServer = new TestBroker(zkServer.getConnectString(), tempFolder.newFolder(), 1, ImmutableMap.of("num.partitions", String.valueOf(NUM_PARTITIONS)));
kafkaServer.start();
kafkaHost = String.format("localhost:%d", kafkaServer.getPort());
dataSchema = getDataSchema(DATASOURCE);
tuningConfig = new KafkaSupervisorTuningConfig(1000, 50000, new Period("P1Y"), new File("/test"), null, null, true, false, null, null, numThreads, TEST_CHAT_THREADS, TEST_CHAT_RETRIES, TEST_HTTP_TIMEOUT, TEST_SHUTDOWN_TIMEOUT);
}
use of org.apache.curator.test.TestingCluster in project druid by druid-io.
the class KafkaIndexTaskTest method setUp.
@Before
public void setUp() throws Exception {
emitter = new ServiceEmitter("service", "host", new LoggingEmitter(log, LoggingEmitter.Level.ERROR, new DefaultObjectMapper()));
emitter.start();
EmittingLogger.registerEmitter(emitter);
makeToolboxFactory();
zkServer = new TestingCluster(1);
zkServer.start();
kafkaServer = new TestBroker(zkServer.getConnectString(), tempFolder.newFolder(), 1, ImmutableMap.of("num.partitions", "2"));
kafkaServer.start();
taskExec = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool(Execs.makeThreadFactory("kafka-task-test-%d")));
handoffConditionTimeout = 0;
reportParseExceptions = false;
doHandoff = true;
}
use of org.apache.curator.test.TestingCluster in project helios by spotify.
the class ZooKeeperTestingClusterManager method start0.
private void start0() {
zkPeers = createPeers(3);
zkAddresses = allocateAddresses(zkPeers);
peerCurators = createCurators(zkAddresses);
System.setProperty("zookeeper.jmx.log4j.disable", "true");
cluster = new TestingCluster(zkPeers);
zkServers = cluster.getServers();
try {
cluster.start();
} catch (Exception e) {
stop();
throw Throwables.propagate(e);
}
}
use of org.apache.curator.test.TestingCluster in project ignite by apache.
the class ZookeeperIpFinderTest method testFourNodesKillRestartZookeeper.
/**
* @throws Exception If failed.
*/
public void testFourNodesKillRestartZookeeper() throws Exception {
allowDuplicateRegistrations = false;
// start 4 nodes
System.setProperty(TcpDiscoveryZookeeperIpFinder.PROP_ZK_CONNECTION_STRING, zkCluster.getConnectString());
startGrids(4);
// wait until all grids are started
waitForRemoteNodes(grid(0), 3);
// each node will only register itself
assertEquals(4, zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size());
// remember ZK server configuration and stop the cluster
Collection<InstanceSpec> instances = zkCluster.getInstances();
zkCluster.stop();
Thread.sleep(1000);
// start the cluster with the previous configuration
zkCluster = new TestingCluster(instances);
zkCluster.start();
// block the client until connected
zkCurator.blockUntilConnected();
// check that the nodes have registered again
assertEquals(4, zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size());
// stop all grids
stopAllGrids();
assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override
public boolean apply() {
try {
return 0 == zkCurator.getChildren().forPath(SERVICES_IGNITE_ZK_PATH).size();
} catch (Exception e) {
U.error(log, "Failed to wait for zk condition", e);
return false;
}
}
}, 20000));
}
use of org.apache.curator.test.TestingCluster in project ignite by apache.
the class ZookeeperIpFinderTest method beforeTest.
/**
* Before test.
*
* @throws Exception
*/
@Override
public void beforeTest() throws Exception {
super.beforeTest();
// remove stale system properties
System.getProperties().remove(TcpDiscoveryZookeeperIpFinder.PROP_ZK_CONNECTION_STRING);
// disable JMX for tests
System.setProperty("zookeeper.jmx.log4j.disable", "true");
// start the ZK cluster
zkCluster = new TestingCluster(ZK_CLUSTER_SIZE);
zkCluster.start();
// start the Curator client so we can perform assertions on the ZK state later
zkCurator = CuratorFrameworkFactory.newClient(zkCluster.getConnectString(), new RetryNTimes(10, 1000));
zkCurator.start();
}
Aggregations