Search in sources :

Example 1 with PollResult

use of com.netflix.config.PollResult in project archaius by Netflix.

the class DynamoDbConfigurationSourceTest method testPoll.

@Test
public void testPoll() throws Exception {
    AmazonDynamoDB mockBasicDbClient = mock(AmazonDynamoDB.class);
    when(mockBasicDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.basicScanResult1);
    DynamoDbConfigurationSource testConfigSource = new DynamoDbConfigurationSource(mockBasicDbClient);
    PollResult result = testConfigSource.poll(false, null);
    assertEquals(3, result.getComplete().size());
    assertEquals("bar", result.getComplete().get("foo"));
    assertEquals("goo", result.getComplete().get("goo"));
    assertEquals("who", result.getComplete().get("boo"));
}
Also used : ScanRequest(com.amazonaws.services.dynamodbv2.model.ScanRequest) AmazonDynamoDB(com.amazonaws.services.dynamodbv2.AmazonDynamoDB) PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 2 with PollResult

use of com.netflix.config.PollResult in project archaius by Netflix.

the class DynamoDbDeploymentContextConfigurationSourceTest method testPoll.

@Test
public void testPoll() throws Exception {
    DynamoDbDeploymentContextTableCache mockedCache = mock(DynamoDbDeploymentContextTableCache.class);
    when(mockedCache.getProperties()).thenReturn(propCollection1, propCollection2);
    DynamoDbDeploymentContextConfigurationSource testConfigSource = new DynamoDbDeploymentContextConfigurationSource(mockedCache, DeploymentContext.ContextKey.environment);
    PollResult result = testConfigSource.poll(false, null);
    assertEquals(3, result.getComplete().size());
    assertEquals(result.getComplete().get("foo"), "bar");
    assertEquals(result.getComplete().get("goo"), "goo");
    assertEquals(result.getComplete().get("boo"), "who");
    result = testConfigSource.poll(false, null);
    assertEquals(3, result.getComplete().size());
    assertEquals(result.getComplete().get("foo"), "bar");
    assertEquals(result.getComplete().get("goo"), "boo");
    assertEquals(result.getComplete().get("boo"), "who");
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 3 with PollResult

use of com.netflix.config.PollResult in project archaius by Netflix.

the class BlobStoreBackedConfigurationTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    BlobStoreConfigurationSource testConfigSource = new BlobStoreConfigurationSource(ctx);
    PollResult result = testConfigSource.poll(true, null);
    assertEquals(3, result.getComplete().size());
    assertEquals("val1", result.getComplete().get("test1"));
    assertEquals("val2", result.getComplete().get("test2"));
    assertEquals("val3", result.getComplete().get("test3"));
    update();
    result = testConfigSource.poll(true, null);
    assertEquals(3, result.getComplete().size());
    assertEquals("vala", result.getComplete().get("test1"));
    assertEquals("valb", result.getComplete().get("test2"));
    assertEquals("valc", result.getComplete().get("test3"));
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 4 with PollResult

use of com.netflix.config.PollResult in project archaius by Netflix.

the class BlobStoreBackedConfigurationTest method testPoll.

@Test
public void testPoll() throws Exception {
    BlobStoreConfigurationSource testConfigSource = new BlobStoreConfigurationSource(ctx);
    PollResult result = testConfigSource.poll(true, null);
    assertEquals(3, result.getComplete().size());
    assertEquals("val1", result.getComplete().get("test1"));
    assertEquals("val2", result.getComplete().get("test2"));
    assertEquals("val3", result.getComplete().get("test3"));
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 5 with PollResult

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

the class TestYAMLConfigurationSource method testPullFromClassPath.

@Test
public void testPullFromClassPath() throws Exception {
    YAMLConfigurationSource configSource = new YAMLConfigurationSource();
    PollResult result = configSource.poll(true, null);
    Map<String, Object> configMap = result.getComplete();
    assertNotNull(configMap);
    assertEquals(19, configMap.size());
    assertNotNull(configMap.get("trace.handler.sampler.percent"));
    assertEquals(0.5, configMap.get("trace.handler.sampler.percent"));
    assertEquals("http://10.120.169.202:9980/", configMap.get("registry.client.serviceUrl.defaultZone"));
    assertNull(configMap.get("eureka.client.serviceUrl.defaultZone"));
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Aggregations

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