use of org.apache.commons.configuration.BaseConfiguration in project archaius by Netflix.
the class PollingSourceTest method testDeletingPollingSource.
@Test
public void testDeletingPollingSource() throws Exception {
BaseConfiguration config = new BaseConfiguration();
config.addProperty("prop1", "original");
DummyPollingSource source = new DummyPollingSource(false);
source.setFull("prop1=changed");
FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 10, false);
ConfigurationWithPollingSource pollingConfig = new ConfigurationWithPollingSource(config, source, scheduler);
Thread.sleep(200);
assertEquals("changed", pollingConfig.getProperty("prop1"));
source.setFull("");
Thread.sleep(250);
assertFalse(pollingConfig.containsKey("prop1"));
source.setFull("prop1=changedagain,prop2=new");
Thread.sleep(200);
assertEquals("changedagain", pollingConfig.getProperty("prop1"));
assertEquals("new", pollingConfig.getProperty("prop2"));
source.setFull("prop3=new");
Thread.sleep(200);
assertFalse(pollingConfig.containsKey("prop1"));
assertFalse(pollingConfig.containsKey("prop2"));
assertEquals("new", pollingConfig.getProperty("prop3"));
}
use of org.apache.commons.configuration.BaseConfiguration in project archaius by Netflix.
the class PollingSourceTest method testIncrementalPollingSource.
@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);
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());
}
use of org.apache.commons.configuration.BaseConfiguration in project janusgraph by JanusGraph.
the class ElasticSearchIndexTest method getESTestConfig.
public Configuration getESTestConfig() {
final String index = "es";
final CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
if (esr.getEsMajorVersion().value > 2) {
cc.set("index." + index + ".elasticsearch.ingest-pipeline.ingestvertex", "pipeline_1");
}
return esr.setElasticsearchConfiguration(new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE), index).set(GraphDatabaseConfiguration.INDEX_MAX_RESULT_SET_SIZE, 3, index).restrictTo(index);
}
use of org.apache.commons.configuration.BaseConfiguration in project incubator-servicecomb-java-chassis by apache.
the class TestSimpleTransactionControlFilter method beforeCls.
@BeforeClass
public static void beforeCls() {
AbstractConfiguration configuration = new BaseConfiguration();
configuration.addProperty("cse.loadbalance.test.flowsplitFilter.policy", "org.apache.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
configuration.addProperty("cse.loadbalance.test.flowsplitFilter.options.tag0", "value0");
}
use of org.apache.commons.configuration.BaseConfiguration in project cypher-for-gremlin by opencypher.
the class CypherGremlinServerClient method translating.
@Test
public void translating() {
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("port", gremlinServer.getPort());
configuration.setProperty("hosts", Arrays.asList("localhost"));
Cluster cluster = Cluster.open(configuration);
Client gremlinClient = cluster.connect();
// freshReadmeSnippet: translating
CypherGremlinClient cypherGremlinClient = CypherGremlinClient.translating(gremlinClient);
// freshReadmeSnippet: translating
List<Map<String, Object>> results = cypherGremlinClient.submit("MATCH (p:person) WHERE p.age > 25 RETURN p.name").all();
assertThat(results).extracting("p.name").containsExactly("marko", "vadas", "josh", "peter");
}
Aggregations