当前位置: 首页>>代码示例>>Java>>正文


Java TestingCluster.start方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:21,代码来源:ZooKeeperRule.java

示例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();
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:ZookeeperIpFinderTest.java

示例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();
}
 
开发者ID:dcos,项目名称:exhibitor,代码行数:11,代码来源:TestZookeeperConfigProvider.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:10,代码来源:ServiceNoProviderTest.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:10,代码来源:ServiceProviderHealthcheckTest.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:11,代码来源:ServiceProviderTest.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:10,代码来源:CustomShardSelectorTest.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:15,代码来源:ServiceProviderExtCuratorTest.java

示例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);
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:10,代码来源:SimpleServiceProviderTest.java

示例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();
}
 
开发者ID:flipkart-incubator,项目名称:ranger,代码行数:34,代码来源:ServiceProviderIntegrationTest.java

示例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();
}
 
开发者ID:apache,项目名称:curator,代码行数:15,代码来源:TestReconfiguration.java

示例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);
}
 
开发者ID:NirmataOSS,项目名称:workflow,代码行数:11,代码来源:TestDisruptedScheduler.java

示例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);
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:12,代码来源:OperationsNodeIT.java

示例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;
  }


}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:43,代码来源:TestCluster.java

示例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();

}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:16,代码来源:TestCluster.java


注:本文中的org.apache.curator.test.TestingCluster.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。