use of com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration in project elastic-job by dangdangdotcom.
the class RegistryCenterFactoryTest method assertCreateCoordinatorRegistryCenterWithoutDigest.
@Test
public void assertCreateCoordinatorRegistryCenterWithoutDigest() throws ReflectiveOperationException {
ZookeeperConfiguration zkConfig = getZookeeperConfiguration(RegistryCenterFactory.createCoordinatorRegistryCenter(getConnectionString(), "namespace", Optional.<String>absent()));
assertThat(zkConfig.getNamespace(), is("namespace"));
assertNull(zkConfig.getDigest());
}
use of com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration in project elastic-job by dangdangdotcom.
the class RegistryCenterFactoryTest method assertCreateCoordinatorRegistryCenterWithDigest.
@Test
public void assertCreateCoordinatorRegistryCenterWithDigest() throws ReflectiveOperationException {
ZookeeperConfiguration zkConfig = getZookeeperConfiguration(RegistryCenterFactory.createCoordinatorRegistryCenter(getConnectionString(), "namespace", Optional.of("digest")));
assertThat(zkConfig.getNamespace(), is("namespace"));
assertThat(zkConfig.getDigest(), is("digest"));
}
use of com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration in project elastic-job by dangdangdotcom.
the class BootstrapEnvironmentTest method assertGetZookeeperConfiguration.
@Test
public void assertGetZookeeperConfiguration() throws NoSuchFieldException {
Properties properties = new Properties();
properties.setProperty(EnvironmentArgument.ZOOKEEPER_DIGEST.getKey(), "test");
ReflectionUtils.setFieldValue(bootstrapEnvironment, "properties", properties);
ZookeeperConfiguration zkConfig = bootstrapEnvironment.getZookeeperConfiguration();
assertThat(zkConfig.getServerLists(), is("localhost:2181"));
assertThat(zkConfig.getNamespace(), is("elastic-job-cloud"));
assertThat(zkConfig.getDigest(), is("test"));
}
use of com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration in project elastic-job by dangdangdotcom.
the class BootstrapEnvironment method getZookeeperConfiguration.
/**
* 获取Zookeeper配置对象.
*
* @return Zookeeper配置对象
*/
// TODO 其他zkConfig的值可配置
public ZookeeperConfiguration getZookeeperConfiguration() {
ZookeeperConfiguration result = new ZookeeperConfiguration(getValue(EnvironmentArgument.ZOOKEEPER_SERVERS), getValue(EnvironmentArgument.ZOOKEEPER_NAMESPACE));
String digest = getValue(EnvironmentArgument.ZOOKEEPER_DIGEST);
if (!Strings.isNullOrEmpty(digest)) {
result.setDigest(digest);
}
return result;
}
use of com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration in project elastic-job by dangdangdotcom.
the class JavaMain method setUpRegistryCenter.
private static CoordinatorRegistryCenter setUpRegistryCenter() {
ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(ZOOKEEPER_CONNECTION_STRING, JOB_NAMESPACE);
CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(zkConfig);
result.init();
return result;
}
Aggregations