DynamoDbDeploymentContextTableCache extends AbstractDynamoDbConfigurationSource<PropertyWithDeploymentContext> { public Collection<PropertyWithDeploymentContext> getProperties() { return cachedTable.values(); } DynamoDbDeploymentContextTableCache();  DynamoDbDeploymentContextTableCache(int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(ClientConfiguration clientConfiguration);  DynamoDbDeploymentContextTableCache(ClientConfiguration clientConfiguration, int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(AWSCredentials credentials);  DynamoDbDeploymentContextTableCache(AWSCredentials credentials, int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(AWSCredentials credentials, ClientConfiguration clientConfiguration);  DynamoDbDeploymentContextTableCache(AWSCredentials credentials, ClientConfiguration clientConfiguration, int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(AWSCredentialsProvider credentialsProvider);  DynamoDbDeploymentContextTableCache(AWSCredentialsProvider credentialsProvider, int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration);  DynamoDbDeploymentContextTableCache(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration, int initialDelayMillis, int delayMillis);  DynamoDbDeploymentContextTableCache(AmazonDynamoDB dbClient);  DynamoDbDeploymentContextTableCache(AmazonDynamoDB dbClient, int initialDelayMillis, int delayMillis); void stop(); Collection<PropertyWithDeploymentContext> getProperties();  }
@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)); }