Search in sources :

Example 6 with PollResult

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

the class S3ConfigurationSourceTest method testPoll_fileNotFound.

@Test(expected = AmazonServiceException.class)
public void testPoll_fileNotFound() throws Exception {
    S3ConfigurationSource instance = new S3ConfigurationSource(client, "bucketname", "404.txt");
    PollResult result = instance.poll(INITIAL, CHECK_POINT);
    assertNotNull(result);
    assertEquals("true", result.getComplete().get("loaded"));
    assertEquals(1, result.getComplete().size());
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 7 with PollResult

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

the class S3ConfigurationSourceTest method testPoll_shouldLoadSomeData.

@Test
public void testPoll_shouldLoadSomeData() throws Exception {
    S3ConfigurationSource instance = new S3ConfigurationSource(client, "bucketname", "standard-key.txt");
    PollResult result = instance.poll(INITIAL, CHECK_POINT);
    assertNotNull(result);
    assertEquals("true", result.getComplete().get("loaded"));
    assertEquals(1, result.getComplete().size());
}
Also used : PollResult(com.netflix.config.PollResult) Test(org.junit.Test)

Example 8 with PollResult

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

the class DynamoDbConfigurationSourceIntegrationTest method testPoll.

//@Test
public void testPoll() throws Exception {
    if (dbClient != null) {
        DynamoDbConfigurationSource testConfigSource = new DynamoDbConfigurationSource();
        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)

Example 9 with PollResult

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

the class DynamoDbConfigurationSourceIntegrationTest method testUpdate.

//@Test
public void testUpdate() throws Exception {
    if (dbClient != null) {
        DynamoDbConfigurationSource testConfigSource = new DynamoDbConfigurationSource();
        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"));
        updateValues(dbClient, tableName);
        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)

Example 10 with PollResult

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

the class DynamoDbConfigurationSourceTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    AmazonDynamoDB mockBasicDbClient = mock(AmazonDynamoDB.class);
    when(mockBasicDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.basicScanResult1, DynamoDbMocks.basicScanResult2);
    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"));
    result = testConfigSource.poll(false, null);
    assertEquals(3, result.getComplete().size());
    assertEquals("bar", result.getComplete().get("foo"));
    assertEquals("foo", 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)

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