Search in sources :

Example 11 with PollResult

use of com.netflix.config.PollResult in project java-chassis by ServiceComb.

the class TestYAMLConfigurationSource method testPullFromGivenFiles.

@Test
public void testPullFromGivenFiles() throws Exception {
    YAMLConfigurationSource configSource = new YAMLConfigurationSource(new File(System.getProperty("user.dir") + "/target/test-classes", "m1.yaml"));
    PollResult result = configSource.poll(true, null);
    Map<String, Object> configMap = result.getComplete();
    assertNotNull(configMap);
    assertNotNull(configMap.get("trace.handler.sampler.percent"));
    assertEquals("okok", configMap.get("zq.test"));
    System.getProperties().clear();
}
Also used : File(java.io.File) PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 12 with PollResult

use of com.netflix.config.PollResult in project java-chassis by ServiceComb.

the class TestYAMLConfigurationSource method testPullFroGivenURL.

@Test
public void testPullFroGivenURL() throws Exception {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    URL test1URL = loader.getResource("test1.yaml");
    URL test2URL = loader.getResource("test2.yaml");
    System.setProperty("cse.configurationSource.additionalUrls", test1URL.toString() + "," + test2URL.toString());
    YAMLConfigurationSource configSource = new YAMLConfigurationSource();
    PollResult result = configSource.poll(true, null);
    Map<String, Object> configMap = result.getComplete();
    assertNotNull(configMap);
    assertEquals(29, configMap.size());
    assertNotNull(configMap.get("trace.handler.sampler.percent"));
    assertEquals(0.5, configMap.get("trace.handler.sampler.percent"));
    System.getProperties().clear();
}
Also used : URL(java.net.URL) PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Aggregations

PollResult (com.netflix.config.PollResult)12 Test (org.junit.Test)10 AmazonDynamoDB (com.amazonaws.services.dynamodbv2.AmazonDynamoDB)2 ScanRequest (com.amazonaws.services.dynamodbv2.model.ScanRequest)2 File (java.io.File)1 URL (java.net.URL)1