use of org.apache.commons.configuration.MapConfiguration in project chassis by Kixeye.
the class ZookeeperConfigurationWriterTest method basePathExists_noOverwrite.
@Test
public void basePathExists_noOverwrite() throws Exception {
Assert.assertNull(curatorFramework.checkExists().forPath(base));
try (CuratorFramework zkCurator = createCuratorFramework()) {
ZookeeperConfigurationWriter writer = new ZookeeperConfigurationWriter(applicationName, environmentName, version, zkCurator, false);
writer.write(new MapConfiguration(props), new DefaultPropertyFilter());
Assert.assertEquals(val1, new String(curatorFramework.getData().forPath(base + "/" + key1)));
Assert.assertEquals(val2, new String(curatorFramework.getData().forPath(base + "/" + key2)));
try {
writer.write(new MapConfiguration(props), new DefaultPropertyFilter());
Assert.fail();
} catch (BootstrapException e) {
//expected
}
}
}
use of org.apache.commons.configuration.MapConfiguration in project chassis by Kixeye.
the class CuratorFrameworkBuilderTest method buildWithConfiguration.
@Test
public void buildWithConfiguration() {
HashMap<String, Object> map = new HashMap<>();
map.put(BootstrapConfigKeys.ZOOKEEPER_MAX_RETRIES.getPropertyName(), 1);
MapConfiguration configuration = new MapConfiguration(map);
try (CuratorFramework curatorFramework = new CuratorFrameworkBuilder(false).withZookeeper("localhost:2181").withConfiguration(configuration).build()) {
}
}
Aggregations