use of com.kixeye.chassis.bootstrap.configuration.zookeeper.ZookeeperConfigurationProvider in project chassis by Kixeye.
the class ConfigurationBuilderTest method zookeeperOverridesApplicationProperties.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void zookeeperOverridesApplicationProperties() throws Exception {
String key1 = UUID.randomUUID().toString();
String value1 = UUID.randomUUID().toString();
String key2 = UUID.randomUUID().toString();
String value2 = UUID.randomUUID().toString();
TestUtils.writePropertiesToFile(TEST_APP_CONFIG_PROPERTIES, filesCreated, new SimpleEntry(key1, value1), new SimpleEntry(key2, value2));
curatorFramework.create().creatingParentsIfNeeded().forPath(ZOOKEEPER_CONFIG_ROOT + "/" + key1, "zookeepervalue".getBytes());
configurationBuilder.withConfigurationProvider(new ZookeeperConfigurationProvider(zookeeperServer.getConnectString()));
configurationBuilder.withApplicationProperties(TEST_APP_CONFIG_PROPERTIES_SPRING_PATH);
Configuration configuration = configurationBuilder.build();
//assert that the zookeeper config overrode the app properties config
Assert.assertEquals("zookeepervalue", configuration.getString(key1));
//assert that the proper which exists in app properties but not in zookeeper is found.
Assert.assertEquals(value2, configuration.getString(key2));
}
Aggregations