本文整理匯總了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);
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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";
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}