@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"); }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); }
DynamoDbDeploymentContextConfigurationSource implements PolledConfigurationSource { @Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); } }
DynamoDbDeploymentContextConfigurationSource implements PolledConfigurationSource { @Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); } DynamoDbDeploymentContextConfigurationSource(DynamoDbDeploymentContextTableCache tableCache, DeploymentContext.ContextKey contextKey); }
DynamoDbDeploymentContextConfigurationSource implements PolledConfigurationSource { @Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); } DynamoDbDeploymentContextConfigurationSource(DynamoDbDeploymentContextTableCache tableCache, DeploymentContext.ContextKey contextKey); @Override PollResult poll(boolean initial, Object checkPoint); }
DynamoDbDeploymentContextConfigurationSource implements PolledConfigurationSource { @Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); } DynamoDbDeploymentContextConfigurationSource(DynamoDbDeploymentContextTableCache tableCache, DeploymentContext.ContextKey contextKey); @Override PollResult poll(boolean initial, Object checkPoint);  }