use of com.kixeye.chassis.bootstrap.configuration.zookeeper.DynamicZookeeperConfigurationSource in project chassis by Kixeye.
the class DynamicZookeeperConfigurationSourceTest method instanceConfigExistsAtStartup.
@Test
public void instanceConfigExistsAtStartup() throws Exception {
curatorFramework.create().forPath(CONFIG_BASE_PATH + "/" + node);
String key = CONFIG_BASE_PATH + "/" + node + "/" + DEF_KEY1;
curatorFramework.create().forPath(key, "val1-override".getBytes());
Assert.assertNotNull(curatorFramework.checkExists().forPath(key));
config.addConfiguration(new DynamicWatchedConfiguration(new DynamicZookeeperConfigurationSource(curatorFramework, CONFIG_BASE_PATH, node)));
config.addConfiguration(defaultConfiguration);
Assert.assertEquals("val1-override", config.getString(DEF_KEY1));
Assert.assertEquals(DEF_VAL2, config.getString(DEF_KEY2));
}
use of com.kixeye.chassis.bootstrap.configuration.zookeeper.DynamicZookeeperConfigurationSource in project chassis by Kixeye.
the class DynamicZookeeperConfigurationSourceTest method instanceConfigDoesNotExistAtStartup.
@Test
public void instanceConfigDoesNotExistAtStartup() {
config.addConfiguration(new DynamicWatchedConfiguration(new DynamicZookeeperConfigurationSource(curatorFramework, CONFIG_BASE_PATH, node)));
config.addConfiguration(defaultConfiguration);
Assert.assertEquals(DEF_VAL1, config.getString(DEF_KEY1));
Assert.assertEquals(DEF_VAL2, config.getString(DEF_KEY2));
}
use of com.kixeye.chassis.bootstrap.configuration.zookeeper.DynamicZookeeperConfigurationSource in project chassis by Kixeye.
the class DynamicZookeeperConfigurationSourceTest method instanceConfigPropertyDeleted.
@Test
public void instanceConfigPropertyDeleted() throws Exception {
curatorFramework.create().forPath(CONFIG_BASE_PATH + "/" + node);
config.addConfiguration(new DynamicWatchedConfiguration(new DynamicZookeeperConfigurationSource(curatorFramework, CONFIG_BASE_PATH, node)));
config.addConfiguration(defaultConfiguration);
Assert.assertEquals(DEF_VAL1, config.getString(DEF_KEY1));
curatorFramework.create().forPath(CONFIG_BASE_PATH + "/" + node + "/" + DEF_KEY1, "override".getBytes());
Thread.sleep(1000);
Assert.assertEquals("override", config.getString(DEF_KEY1));
curatorFramework.delete().forPath(CONFIG_BASE_PATH + "/" + node + "/" + DEF_KEY1);
Thread.sleep(1000);
Assert.assertEquals(DEF_VAL1, config.getString(DEF_KEY1));
}
Aggregations