use of org.apache.servicecomb.config.archaius.scheduler.NeverStartPollingScheduler in project java-chassis by ServiceComb.
the class ConfigUtil method createLocalConfig.
private static ConcurrentCompositeConfiguration createLocalConfig(List<ConfigModel> configModelList) {
ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
duplicateCseConfigToServicecomb(config, new ConcurrentMapConfigurationExt(new SystemConfiguration()), "configFromSystem");
duplicateCseConfigToServicecomb(config, convertEnvVariable(new ConcurrentMapConfigurationExt(new EnvironmentConfiguration())), "configFromEnvironment");
// If there is extra configurations, add it into config.
EXTRA_CONFIG_MAP.entrySet().stream().filter(mapEntry -> !mapEntry.getValue().isEmpty()).forEachOrdered(configMapEntry -> duplicateCseConfigToServicecomb(config, new ConcurrentMapConfigurationExt(configMapEntry.getValue()), configMapEntry.getKey()));
// we have already copy the cse config to the serviceComb config when we load the config from local yaml files
// hence, we do not need duplicate copy it.
config.addConfiguration(new DynamicConfigurationExt(new MicroserviceConfigurationSource(configModelList), new NeverStartPollingScheduler()), "configFromYamlFile");
duplicateCseConfigToServicecombAtFront(config, new ConcurrentMapConfigurationExt(ConfigMapping.getConvertedMap(config)), "configFromMapping");
return config;
}
use of org.apache.servicecomb.config.archaius.scheduler.NeverStartPollingScheduler in project incubator-servicecomb-java-chassis by apache.
the class ConfigUtil method createLocalConfig.
private static ConcurrentCompositeConfiguration createLocalConfig(List<ConfigModel> configModelList) {
ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
duplicateCseConfigToServicecomb(config, new ConcurrentMapConfigurationExt(new SystemConfiguration()), "configFromSystem");
duplicateCseConfigToServicecomb(config, convertEnvVariable(new ConcurrentMapConfigurationExt(new EnvironmentConfiguration())), "configFromEnvironment");
// If there is extra configurations, add it into config.
EXTRA_CONFIG_MAP.entrySet().stream().filter(mapEntry -> !mapEntry.getValue().isEmpty()).forEachOrdered(configMapEntry -> duplicateCseConfigToServicecomb(config, new ConcurrentMapConfigurationExt(configMapEntry.getValue()), configMapEntry.getKey()));
// we have already copy the cse config to the serviceComb config when we load the config from local yaml files
// hence, we do not need duplicate copy it.
config.addConfiguration(new DynamicConfigurationExt(new MicroserviceConfigurationSource(configModelList), new NeverStartPollingScheduler()), "configFromYamlFile");
duplicateCseConfigToServicecombAtFront(config, new ConcurrentMapConfigurationExt(ConfigMapping.getConvertedMap(config)), "configFromMapping");
return config;
}
use of org.apache.servicecomb.config.archaius.scheduler.NeverStartPollingScheduler in project incubator-servicecomb-java-chassis by apache.
the class TestYAMLConfigurationSource method testFullOperation.
@Test
public void testFullOperation() {
// configuration from system properties
ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration());
// configuration from yaml file
DynamicConfiguration configFromYamlFile = new DynamicConfiguration(yamlConfigSource(), new NeverStartPollingScheduler());
// create a hierarchy of configuration that makes
// 1) dynamic configuration source override system properties
ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
finalConfig.addConfiguration(configFromYamlFile, "yamlConfig");
finalConfig.addConfiguration(configFromSystemProperties, "systemEnvConfig");
Assert.assertEquals(0.5, finalConfig.getDouble("trace.handler.sampler.percent"), 0.5);
Object o = finalConfig.getProperty("zq");
@SuppressWarnings("unchecked") List<Map<String, Object>> listO = (List<Map<String, Object>>) o;
Assert.assertEquals(3, listO.size());
}
use of org.apache.servicecomb.config.archaius.scheduler.NeverStartPollingScheduler in project java-chassis by ServiceComb.
the class TestYAMLConfigurationSource method testFullOperation.
@Test
public void testFullOperation() {
// configuration from system properties
ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration());
// configuration from yaml file
DynamicConfiguration configFromYamlFile = new DynamicConfiguration(yamlConfigSource(), new NeverStartPollingScheduler());
// create a hierarchy of configuration that makes
// 1) dynamic configuration source override system properties
ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration();
finalConfig.addConfiguration(configFromYamlFile, "yamlConfig");
finalConfig.addConfiguration(configFromSystemProperties, "systemEnvConfig");
Assert.assertEquals(0.5, finalConfig.getDouble("trace.handler.sampler.percent"), 0.5);
Object o = finalConfig.getProperty("zq");
@SuppressWarnings("unchecked") List<Map<String, Object>> listO = (List<Map<String, Object>>) o;
Assert.assertEquals(3, listO.size());
}
Aggregations