本文整理汇总了Java中org.apache.curator.test.TestingCluster.start方法的典型用法代码示例。如果您正苦于以下问题:Java TestingCluster.start方法的具体用法?Java TestingCluster.start怎么用?Java TestingCluster.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.curator.test.TestingCluster
的用法示例。
在下文中一共展示了TestingCluster.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doEvaluate
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
void doEvaluate(Statement base) throws Throwable {
try {
cluster = new TestingCluster(3);
cluster.start();
client = newClient(cluster.getConnectString(), new RetryOneTime(200 /* ms */));
client.start();
checkState(client.blockUntilConnected(5, TimeUnit.SECONDS),
"failed to connect to zookeeper in 5 seconds");
base.evaluate();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException("Interrupted while connecting to ZooKeeper", e);
} finally {
client.close();
cluster.close();
}
}
示例2: beforeTest
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
/**
* 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();
}
示例3: setup
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@BeforeMethod
public void setup() throws Exception
{
timing = new Timing();
cluster = new TestingCluster(3);
cluster.start();
client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
client.start();
}
示例4: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
//registerService("localhost-1", 9000, 1);
//registerService("localhost-2", 9000, 1);
//registerService("localhost-3", 9000, 2);
}
示例5: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
registerService("localhost-1", 9000, 1);
//registerService("localhost-2", 9000, 1);
registerService("localhost-3", 9000, 2);
}
示例6: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
registerService("localhost-1", 9000, 1);
registerService("localhost-2", 9000, 1);
registerService("localhost-3", 9000, 1);
registerService("localhost-4", 9000, 2);
}
示例7: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
registerService("localhost-1", 9000, 1, 2);
registerService("localhost-2", 9000, 1, 3);
registerService("localhost-3", 9000, 2, 3);
}
示例8: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
curatorFramework = CuratorFrameworkFactory.builder()
.namespace("test")
.connectString(testingCluster.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 100)).build();
curatorFramework.start();
registerService("localhost-1", 9000, 1);
registerService("localhost-2", 9000, 1);
registerService("localhost-3", 9000, 2);
}
示例9: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
registerService("localhost-1", 9000, 1);
registerService("localhost-2", 9000, 1);
registerService("localhost-3", 9000, 2);
}
示例10: startTestCluster
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void startTestCluster() throws Exception {
objectMapper = new ObjectMapper();
testingCluster = new TestingCluster(3);
testingCluster.start();
/* registering 3 with RotationMonitor on file and 1 on anotherFile */
registerService("localhost-1", 9000, 1, file);
registerService("localhost-2", 9000, 1, file);
registerService("localhost-3", 9000, 2, file);
registerService("localhost-4", 9000, 2, anotherFile);
serviceFinder = ServiceFinderBuilders.unshardedFinderBuilder()
.withConnectionString(testingCluster.getConnectString())
.withNamespace("test")
.withServiceName("test-service")
.withDeserializer(new Deserializer<UnshardedClusterInfo>() {
@Override
public ServiceNode<UnshardedClusterInfo> deserialize(byte[] data) {
try {
return objectMapper.readValue(data,
new TypeReference<ServiceNode<UnshardedClusterInfo>>() {
});
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
})
.build();
serviceFinder.start();
}
示例11: setup
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@BeforeMethod
@Override
public void setup() throws Exception
{
super.setup();
QuorumPeerConfig.setReconfigEnabled(true);
System.setProperty("zookeeper.DigestAuthenticationProvider.superDigest", superUserPasswordDigest);
CloseableUtils.closeQuietly(server);
server = null;
cluster = new TestingCluster(3);
cluster.start();
}
示例12: setup
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@BeforeMethod
public void setup() throws Exception
{
cluster = new TestingCluster(3);
cluster.start();
clients = Lists.newArrayList();
executedTasks = Sets.newConcurrentHashSet();
executedTasksLatch = new CountDownLatch(6);
}
示例13: beforeTest
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
@Before
public void beforeTest() {
try {
cluster = new TestingCluster(3);
cluster.start();
zkClient = CuratorFrameworkFactory.newClient(cluster.getConnectString(), buildDefaultRetryPolicy());
zkClient.start();
} catch (Exception e) {
System.err.println("Unable to initialize cluster before test! " + e);
}
}
示例14: checkStarted
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
/**
* Check started.
*
* @param kaaNodeInitializationService the kaa node initialization service
* @throws Exception the exception
*/
public static void checkStarted(KaaNodeInitializationService kaaNodeInitializationService) throws Exception {
if (!kaaNodeServerStarted) {
zkCluster = new TestingCluster(new InstanceSpec(null, 2185, -1, -1, true, -1, -1, -1));
zkCluster.start();
BootstrapNodeInfo bootstrapNodeInfo = buildBootstrapNodeInfo();
CuratorFramework zkClient = CuratorFrameworkFactory.newClient(zkCluster.getConnectString(), buildDefaultRetryPolicy());
bootstrapNode = new BootstrapNode(bootstrapNodeInfo, zkClient);
bootstrapNode.start();
OperationsNodeInfo endpointNodeInfo = buildEndpointNodeInfo();
endpointNode = new OperationsNode(endpointNodeInfo, zkClient);
endpointNode.start();
kaaNodeInstance = kaaNodeInitializationService;
kaaNodeServerThread = new Thread(new Runnable() {
@Override
public void run() {
LOG.info("Kaa Node Started.");
kaaNodeInstance.start();
LOG.info("Kaa Node Stoped.");
}
});
kaaNodeServerThread.start();
Thread.sleep(3000);
kaaNodeServerStarted = true;
}
}
示例15: checkStarted
import org.apache.curator.test.TestingCluster; //导入方法依赖的package包/类
/**
* Start.
*
* @throws Exception the exception
*/
public static void checkStarted() throws Exception {
zkCluster = new TestingCluster(new InstanceSpec(null, EventServiceThriftTestIT.ZK_PORT, -1, -1, true, -1, -1, -1));
zkCluster.start();
LOG.info("ZK Cluster started");
OperationsNodeInfo endpointNodeInfo = buildOperationsNodeInfo();
CuratorFramework zkClient = CuratorFrameworkFactory.newClient(zkCluster.getConnectString(), buildDefaultRetryPolicy());
operationsNode = new OperationsNode(endpointNodeInfo, zkClient);
operationsNode.start();
}