use of org.apache.commons.configuration.BaseConfiguration in project titan by thinkaurelius.
the class CommonsConfiguration method copy.
@Override
public WriteConfiguration copy() {
BaseConfiguration copy = new BaseConfiguration();
copy.copy(config);
return new CommonsConfiguration(copy);
}
use of org.apache.commons.configuration.BaseConfiguration in project titan by thinkaurelius.
the class ElasticSearchConfigTest method testLocalNodeUsingExt.
@Test
public void testLocalNodeUsingExt() throws BackendException, InterruptedException {
String baseDir = Joiner.on(File.separator).join("target", "es", "jvmlocal_ext");
assertFalse(new File(baseDir + File.separator + "data").exists());
CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.data", "true");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.client", "false");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.local", "true");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.path.data", baseDir + File.separator + "data");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.path.work", baseDir + File.separator + "work");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.path.logs", baseDir + File.separator + "logs");
ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = new ElasticSearchIndex(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
assertTrue(new File(baseDir + File.separator + "data").exists());
}
use of org.apache.commons.configuration.BaseConfiguration in project titan by thinkaurelius.
the class ElasticSearchConfigTest method testNetworkNodeUsingExt.
@Test
public void testNetworkNodeUsingExt() throws BackendException, InterruptedException {
ElasticsearchRunner esr = new ElasticsearchRunner(".", "networkNodeUsingExt.yml");
esr.start();
CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.data", "false");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.client", "true");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.cluster.name", "networkNodeUsingExt");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.discovery.zen.ping.multicast.enabled", "false");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.discovery.zen.ping.unicast.hosts", "localhost,127.0.0.1:9300");
ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = new ElasticSearchIndex(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.discovery.zen.ping.unicast.hosts", "10.11.12.13");
config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME);
config.set(HEALTH_REQUEST_TIMEOUT, "5s", INDEX_NAME);
indexConfig = config.restrictTo(INDEX_NAME);
Throwable failure = null;
try {
idx = new ElasticSearchIndex(indexConfig);
} catch (Throwable t) {
failure = t;
}
// idx.close();
Assert.assertNotNull("ES client failed to throw exception on connection failure", failure);
esr.stop();
}
use of org.apache.commons.configuration.BaseConfiguration in project titan by thinkaurelius.
the class ElasticSearchConfigTest method testLocalNodeUsingExtAndIndexDirectory.
@Test
public void testLocalNodeUsingExtAndIndexDirectory() throws BackendException, InterruptedException {
String baseDir = Joiner.on(File.separator).join("target", "es", "jvmlocal_ext2");
assertFalse(new File(baseDir + File.separator + "data").exists());
CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.data", "true");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.client", "false");
cc.set("index." + INDEX_NAME + ".elasticsearch.ext.node.local", "true");
ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME);
config.set(INDEX_DIRECTORY, baseDir, INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = new ElasticSearchIndex(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
assertTrue(new File(baseDir + File.separator + "data").exists());
}
use of org.apache.commons.configuration.BaseConfiguration in project archaius by Netflix.
the class TestConfigurationFactory method testConfigurationFactory.
@Test
public void testConfigurationFactory() {
Object configSource = DynamicPropertyFactory.getInstance().getBackingConfigurationSource();
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
assertTrue(ConfigurationManager.isConfigurationInstalled());
assertTrue(configSource == config);
assertTrue(config == TestConfigurationFactory.getInstance());
try {
DynamicPropertyFactory.initWithConfigurationSource(new BaseConfiguration());
fail("IllegalStateException expected");
} catch (IllegalStateException e) {
assertNotNull(e);
}
}
Aggregations