List of usage examples for org.apache.commons.configuration BaseConfiguration containsKey
public boolean containsKey(String key)
From source file:com.netflix.config.PollingSourceTest.java
@Test public void testIncrementalPollingSource() throws Exception { BaseConfiguration config = new BaseConfiguration(); DynamicPropertyFactory.initWithConfigurationSource(config); DynamicStringProperty prop1 = new DynamicStringProperty("prop1", null); DynamicStringProperty prop2 = new DynamicStringProperty("prop2", null); config.addProperty("prop1", "original"); DummyPollingSource source = new DummyPollingSource(true); FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 10, true); scheduler.setIgnoreDeletesFromSource(false); // ConfigurationWithPollingSource pollingConfig = new ConfigurationWithPollingSource(config, source,scheduler); scheduler.startPolling(source, config); assertEquals("original", config.getProperty("prop1")); assertEquals("original", prop1.get()); source.setAdded("prop2=new"); Thread.sleep(200);/* www.j av a2 s.co m*/ assertEquals("original", config.getProperty("prop1")); assertEquals("new", config.getProperty("prop2")); assertEquals("new", prop2.get()); source.setDeleted("prop1=DoesNotMatter"); source.setChanged("prop2=changed"); source.setAdded(""); Thread.sleep(200); assertFalse(config.containsKey("prop1")); assertNull(prop1.get()); assertEquals("changed", config.getProperty("prop2")); assertEquals("changed", prop2.get()); }