Search in sources :

Example 41 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestRegistry method initSetup.

@BeforeClass
public static void initSetup() {
    AbstractConfiguration dynamicConfig = ConfigUtil.createLocalConfig();
    ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
    configuration.addConfiguration(dynamicConfig);
    configuration.addConfiguration(inMemoryConfig);
    ConfigurationManager.install(configuration);
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) BeforeClass(org.junit.BeforeClass)

Example 42 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestMicroServiceInstance method testCreateMicroserviceInstanceFromFile.

@Test
public void testCreateMicroserviceInstanceFromFile() {
    AbstractConfiguration config = ConfigUtil.createLocalConfig();
    ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
    configuration.addConfiguration(config);
    ConfigurationManager.install(configuration);
    MicroserviceInstance instance = MicroserviceInstance.createFromDefinition(config);
    Assert.assertEquals(instance.getDataCenterInfo().getName(), "myDC");
    Assert.assertEquals(instance.getDataCenterInfo().getRegion(), "my-Region");
    Assert.assertEquals(instance.getDataCenterInfo().getAvailableZone(), "my-Zone");
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) Test(org.junit.Test)

Example 43 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestConfigUtil method testCreateDynamicConfigNoConfigCenterSPI.

@Test
public void testCreateDynamicConfigNoConfigCenterSPI() {
    AbstractConfiguration dynamicConfig = ConfigUtil.createLocalConfig();
    Assert.assertNotEquals(DynamicWatchedConfiguration.class, ((ConcurrentCompositeConfiguration) dynamicConfig).getConfiguration(0).getClass());
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) Test(org.junit.Test)

Example 44 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class BootStrapProperties method toStringMap.

private static Map<String, String> toStringMap(AbstractConfiguration configuration) {
    AbstractConfiguration root = findRoot(configuration);
    Map<String, String> map = new LinkedHashMap<>();
    configuration.getKeys().forEachRemaining(key -> {
        Object value = configuration.getProperty(key);
        // support placeholder
        value = PropertyConverter.interpolate(value, root);
        map.put(key, Objects.toString(value, null));
    });
    return map;
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) LinkedHashMap(java.util.LinkedHashMap)

Example 45 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestLocalServiceRegistry method initSetup.

@BeforeClass
public static void initSetup() throws Exception {
    AbstractConfiguration localConfig = ConfigUtil.createLocalConfig();
    ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration();
    configuration.addConfiguration(localConfig);
    configuration.addConfiguration(inMemoryConfig);
    ConfigurationManager.install(configuration);
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) BeforeClass(org.junit.BeforeClass)

Aggregations

AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)80 Test (org.junit.Test)29 ConcurrentCompositeConfiguration (com.netflix.config.ConcurrentCompositeConfiguration)18 BeforeClass (org.junit.BeforeClass)10 Configuration (org.apache.commons.configuration.Configuration)9 URI (java.net.URI)6 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)6 HttpRequest (com.netflix.client.http.HttpRequest)5 ArrayList (java.util.ArrayList)5 DynamicConfiguration (com.netflix.config.DynamicConfiguration)4 EnvironmentConfiguration (org.apache.commons.configuration.EnvironmentConfiguration)4 SystemConfiguration (org.apache.commons.configuration.SystemConfiguration)4 HttpResponse (com.netflix.client.http.HttpResponse)3 ConcurrentMapConfiguration (com.netflix.config.ConcurrentMapConfiguration)3 ExpandedConfigurationListenerAdapter (com.netflix.config.ExpandedConfigurationListenerAdapter)3 LinkedHashMap (java.util.LinkedHashMap)3 Properties (java.util.Properties)3 AggregatedConfiguration (com.netflix.config.AggregatedConfiguration)2 ConfigurationManager (com.netflix.config.ConfigurationManager)2 DynamicURLConfiguration (com.netflix.config.DynamicURLConfiguration)2