use of com.netflix.config.PropertyWithDeploymentContext in project archaius by Netflix.
the class DynamoDbDeploymentContextConfigurationSourceTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
propCollection1 = new LinkedList<PropertyWithDeploymentContext>();
propCollection1.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "foo", "bar"));
propCollection1.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "goo", "goo"));
propCollection1.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "boo", "who"));
propCollection2 = new LinkedList<PropertyWithDeploymentContext>();
propCollection2.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "foo", "bar"));
propCollection2.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "goo", "boo"));
propCollection2.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "prod", "goo", "foo"));
propCollection2.add(new PropertyWithDeploymentContext(DeploymentContext.ContextKey.environment, "test", "boo", "who"));
ConfigurationManager.getConfigInstance().setProperty(ConfigurationBasedDeploymentContext.DEPLOYMENT_ENVIRONMENT_PROPERTY, "test");
}
use of com.netflix.config.PropertyWithDeploymentContext in project archaius by Netflix.
the class DynamoDbDeploymentContextTableCacheTest method testPoll.
@Test
public void testPoll() throws Exception {
AmazonDynamoDB mockContextDbClient = mock(AmazonDynamoDB.class);
when(mockContextDbClient.scan(any(ScanRequest.class))).thenReturn(DynamoDbMocks.contextScanResult1, DynamoDbMocks.contextScanResult2);
DynamoDbDeploymentContextTableCache cache = new DynamoDbDeploymentContextTableCache(mockContextDbClient, 100, 100);
Collection<PropertyWithDeploymentContext> props = cache.getProperties();
assertEquals(4, props.size());
assertTrue(props.contains(test1));
assertTrue(props.contains(test2));
assertTrue(props.contains(test5));
assertTrue(props.contains(test6));
Thread.sleep(150);
props = cache.getProperties();
assertEquals(5, props.size());
assertTrue(props.contains(test1));
assertTrue(props.contains(test3));
assertTrue(props.contains(test4));
assertTrue(props.contains(test5));
assertTrue(props.contains(test6));
}
Aggregations