當前位置: 首頁>>代碼示例>>Java>>正文


Java TestingServer.getConnectString方法代碼示例

本文整理匯總了Java中org.apache.curator.test.TestingServer.getConnectString方法的典型用法代碼示例。如果您正苦於以下問題:Java TestingServer.getConnectString方法的具體用法?Java TestingServer.getConnectString怎麽用?Java TestingServer.getConnectString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.curator.test.TestingServer的用法示例。


在下文中一共展示了TestingServer.getConnectString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: before

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void before() throws Exception {
    zkTestServer = new TestingServer(2182);

    zkTestServer.start();
    String registerUrl = zkTestServer.getConnectString();
    client = RegisterHolder.getClient(registerUrl);
    servicePath = joinNodePath(namespace, serviceNode);
    groupPath = joinNodePath(namespace, groupNode);
    group_1_path = joinNodePath(namespace, groupNode, "group_1");
    group_2_path = joinNodePath(namespace, groupNode, "group_2");
    groupProxyPath = joinNodePath(namespace, proxyNode, groupProxyNode);
    ipProxyPath = joinNodePath(namespace, proxyNode, ipProxyNode);
    balancePath = joinNodePath(namespace, balanceNode);
    client.create().forPath(servicePath);
    client.create().forPath(groupPath);
    client.create().forPath(group_1_path);
    client.create().forPath(group_2_path);
    client.create().forPath(groupProxyPath);
    client.create().forPath(ipProxyPath);
    client.create().forPath(balancePath);

}
 
開發者ID:netboynb,項目名稱:coco,代碼行數:24,代碼來源:CuratorTest.java

示例2: beforeAll

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void beforeAll() throws Exception {
    server = new TestingServer();
    server.start();
    Capabilities mockCapabilities = Mockito.mock(Capabilities.class);
    when(mockCapabilities.supportsNamedVips()).thenReturn(true);
    taskFactory = new CassandraDaemonTask.Factory(mockCapabilities);
    configurationFactory = new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper()
                            .registerModule(new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");
    connectString = server.getConnectString();
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:17,代碼來源:ConfigurationManagerTest.java

示例3: init

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void init() throws Exception {
    testingServer = new TestingServer();

    String testConnectString = testingServer.getConnectString();
    String testHost = testConnectString.split(":")[0];
    int testPort = testingServer.getPort();

    zkBinLogStateConfig = new ZkBinLogStateConfig.Builder("my-test-spout")
                                                    .servers(Lists.newArrayList(testHost))
                                                    .port(testPort)
                                                    .sessionTimeOutInMs(10000)
                                                    .retryTimes(5)
                                                    .sleepMsBetweenRetries(50)
                                                    .connectionTimeOutInMs(10000)
                                                    .build();

    ZkConf zkConf = new ZkConf(new HashMap<String, Object>(), zkBinLogStateConfig);
    zkClient = new ZkClient(zkConf);
    zkClient.start();
}
 
開發者ID:flipkart-incubator,項目名稱:storm-mysql,代碼行數:22,代碼來源:ZkClientTest.java

示例4: before

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Override
protected void before() throws Throwable {
  testingServer = new TestingServer(true);
  zkClient = new CuratorZookeeperClient(testingServer.getConnectString(), 5000, 5000, null, new RetryOneTime(1000));
  zkClient.start();
  zkClient.blockUntilConnectedOrTimedOut();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:8,代碼來源:TestZKClusterClient.java

示例5: initEmbededZKServer

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Bean
public TestingServer initEmbededZKServer() throws Exception {
  TestingServer zkServer = new TestingServer();
  zkServer.start();
  ZooKeeperCredentials credendials = new ZooKeeperCredentials(zkServer.getConnectString(), user, password);
  ZooKeeperTestOperations.createSecuredNode(credendials, brokerStoreNode);
  return zkServer;
}
 
開發者ID:trustedanalytics,項目名稱:hive-broker,代碼行數:9,代碼來源:ZkLocalConfiguration.java

示例6: before

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void before() throws Exception {
    zkServer = new TestingServer(2182);
    zkServer.start();
    zkUrl = zkServer.getConnectString();
    curator = RegisterHolder.getClient(zkUrl);
    namespace = "api-service";
}
 
開發者ID:netboynb,項目名稱:coco,代碼行數:9,代碼來源:CenterModelTest.java

示例7: before

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void before() throws Exception {
    zkServer = new TestingServer(2182);

    zkServer.start();
    String zkUrl = zkServer.getConnectString();
    curator = RegisterHolder.getClient(zkUrl);
}
 
開發者ID:netboynb,項目名稱:coco,代碼行數:9,代碼來源:CuratorTest.java

示例8: curatorFramework

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Bean
public CuratorFramework curatorFramework() throws Exception {
  final TestingServer zkTestServer = new TestingServer(true);

  String connectString = zkTestServer.getConnectString();

  CuratorFramework curator = CuratorFrameworkFactory.newClient(connectString, new ExponentialBackoffRetry(500, 15));
  curator.start();
  curator.blockUntilConnected();

  return curator;
}
 
開發者ID:tommyxu,項目名稱:curator-service-api-client,代碼行數:13,代碼來源:AccountApiTestConfig.java

示例9: setUp

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    zkTestServer = new TestingServer(findFreePort(2181));
    zkHolder = new ZKHolder(zkTestServer.getConnectString(), "", null);
    zkTestServer.start();
    zkHolder.init();
}
 
開發者ID:zalando-nakadi,項目名稱:paradox-nakadi-consumer,代碼行數:8,代碼來源:AbstractZKTest.java

示例10: beforeEach

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void beforeEach() throws Exception {
    server = new TestingServer();

    server.start();

    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");

    config = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());

    ServiceConfig initial = config.createConfig().getServiceConfig();

    final CassandraSchedulerConfiguration targetConfig = config.createConfig();
    clusterTaskConfig = targetConfig.getClusterTaskConfig();

    final CuratorFrameworkConfig curatorConfig = config.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    stateStore = new CuratorStateStore(
            targetConfig.getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);
    stateStore.storeFrameworkId(Protos.FrameworkID.newBuilder().setValue("1234").build());
    identity = new IdentityManager(
            initial,stateStore);

    identity.register("test_id");

    DefaultConfigurationManager configurationManager =
            new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
            config.createConfig().getServiceConfig().getName(),
            server.getConnectString(),
            config.createConfig(),
            new ConfigValidator(),
            stateStore);

    Capabilities mockCapabilities = Mockito.mock(Capabilities.class);
    when(mockCapabilities.supportsNamedVips()).thenReturn(true);
    configuration = new ConfigurationManager(
            new CassandraDaemonTask.Factory(mockCapabilities),
            configurationManager);

    cassandraState = new CassandraState(
            configuration,
            clusterTaskConfig,
            stateStore);
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:66,代碼來源:CassandraStateTest.java

示例11: beforeAll

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@BeforeClass
public static void beforeAll() throws Exception {

    server = new TestingServer();

    server.start();

    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");

    config = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());

    final CuratorFrameworkConfig curatorConfig = config.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    stateStore = new CuratorStateStore(
            config.createConfig().getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);

    final CassandraSchedulerConfiguration configuration = config.createConfig();
    try {
        final ConfigValidator configValidator = new ConfigValidator();
        final DefaultConfigurationManager defaultConfigurationManager =
                new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
                configuration.getServiceConfig().getName(),
                server.getConnectString(),
                configuration,
                configValidator,
                stateStore);
        Capabilities mockCapabilities = Mockito.mock(Capabilities.class);
        when(mockCapabilities.supportsNamedVips()).thenReturn(true);
        configurationManager = new ConfigurationManager(
                new CassandraDaemonTask.Factory(mockCapabilities),
                defaultConfigurationManager);
    } catch (ConfigStoreException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:57,代碼來源:ServiceConfigResourceTest.java

示例12: beforeAll

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@BeforeClass
public static void beforeAll() throws Exception {
    server = new TestingServer();
    server.start();
    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");
    MutableSchedulerConfiguration mutable = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());
    config = mutable.createConfig();

    final CuratorFrameworkConfig curatorConfig = mutable.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    StateStore stateStore = new CuratorStateStore(
            config.getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);
    configurationManager =
            new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
            config.getServiceConfig().getName(),
            server.getConnectString(),
            config,
            new ConfigValidator(),
            stateStore);
    config = (CassandraSchedulerConfiguration) configurationManager.getTargetConfig();
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:43,代碼來源:ConfigurationResourceTest.java

示例13: beforeEach

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void beforeEach() throws Exception {
    MockitoAnnotations.initMocks(this);
    server = new TestingServer();
    server.start();

    Capabilities mockCapabilities = mock(Capabilities.class);
    when(mockCapabilities.supportsNamedVips()).thenReturn(true);
    taskFactory = new CassandraDaemonTask.Factory(mockCapabilities);

    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");

    config = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());

    final CassandraSchedulerConfiguration targetConfig = config.createConfig();
    clusterTaskConfig = targetConfig.getClusterTaskConfig();

    final CuratorFrameworkConfig curatorConfig = config.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    stateStore = new CuratorStateStore(
            targetConfig.getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);
    stateStore.storeFrameworkId(Protos.FrameworkID.newBuilder().setValue("1234").build());

    configurationManager = new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
                    config.createConfig().getServiceConfig().getName(),
                    server.getConnectString(),
                    config.createConfig(),
                    new ConfigValidator(),
                    stateStore);

    cassandraState = new CassandraState(
            new ConfigurationManager(taskFactory, configurationManager),
            clusterTaskConfig,
            stateStore);
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:57,代碼來源:CassandraDaemonStepTest.java

示例14: beforeAll

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@BeforeClass
public static void beforeAll() throws Exception {

    server = new TestingServer();

    server.start();

    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");

    MutableSchedulerConfiguration mutable = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());

    config = mutable.createConfig();
    ServiceConfig initial = config.getServiceConfig();

    clusterTaskConfig = config.getClusterTaskConfig();

    final CuratorFrameworkConfig curatorConfig = mutable.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    stateStore = new CuratorStateStore(
            config.getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);
    stateStore.storeFrameworkId(Protos.FrameworkID.newBuilder().setValue("1234").build());

    identity = new IdentityManager(
            initial,stateStore);

    identity.register("test_id");

    DefaultConfigurationManager configurationManager =
            new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
            config.getServiceConfig().getName(),
            server.getConnectString(),
            config,
            new ConfigValidator(),
            stateStore);
    Capabilities mockCapabilities = Mockito.mock(Capabilities.class);
    when(mockCapabilities.supportsNamedVips()).thenReturn(true);
    configuration = new ConfigurationManager(
            new CassandraDaemonTask.Factory(mockCapabilities),
            configurationManager);

    provider = new ClusterTaskOfferRequirementProvider();
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:64,代碼來源:ClusterTaskOfferRequirementProviderTest.java

示例15: beforeEach

import org.apache.curator.test.TestingServer; //導入方法依賴的package包/類
@Before
public void beforeEach() throws Exception {
    MockitoAnnotations.initMocks(this);
    server = new TestingServer();
    server.start();

    final ConfigurationFactory<MutableSchedulerConfiguration> factory =
            new ConfigurationFactory<>(
                    MutableSchedulerConfiguration.class,
                    BaseValidator.newValidator(),
                    Jackson.newObjectMapper().registerModule(
                            new GuavaModule())
                            .registerModule(new Jdk8Module()),
                    "dw");

    config = factory.build(
            new SubstitutingSourceProvider(
                    new FileConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false, true)),
            Resources.getResource("scheduler.yml").getFile());

    ServiceConfig initial = config.createConfig().getServiceConfig();

    final CassandraSchedulerConfiguration targetConfig = config.createConfig();
    clusterTaskConfig = targetConfig.getClusterTaskConfig();

    final CuratorFrameworkConfig curatorConfig = config.getCuratorConfig();
    RetryPolicy retryPolicy =
            (curatorConfig.getOperationTimeout().isPresent()) ?
                    new RetryUntilElapsed(
                            curatorConfig.getOperationTimeoutMs()
                                    .get()
                                    .intValue()
                            , (int) curatorConfig.getBackoffMs()) :
                    new RetryForever((int) curatorConfig.getBackoffMs());

    stateStore = new CuratorStateStore(
            targetConfig.getServiceConfig().getName(),
            server.getConnectString(),
            retryPolicy);
    stateStore.storeFrameworkId(Protos.FrameworkID.newBuilder().setValue("1234").build());
    identity = new IdentityManager(initial,stateStore);

    identity.register("test_id");

    DefaultConfigurationManager configurationManager =
            new DefaultConfigurationManager(CassandraSchedulerConfiguration.class,
                    config.createConfig().getServiceConfig().getName(),
                    server.getConnectString(),
                    config.createConfig(),
                    new ConfigValidator(),
                    stateStore);

    Capabilities mockCapabilities = Mockito.mock(Capabilities.class);
    when(mockCapabilities.supportsNamedVips()).thenReturn(true);
    configuration = new ConfigurationManager(
            new CassandraDaemonTask.Factory(mockCapabilities),
            configurationManager);

    cassandraState = new CassandraState(
            configuration,
            clusterTaskConfig,
            stateStore);

    taskFactory = new CassandraTaskFactory(executorDriver);
}
 
開發者ID:mesosphere,項目名稱:dcos-cassandra-service,代碼行數:67,代碼來源:CassandraTaskFactoryTest.java


注:本文中的org.apache.curator.test.TestingServer.getConnectString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。