List of usage examples for org.apache.commons.configuration BaseConfiguration BaseConfiguration
BaseConfiguration
From source file:org.lable.oss.dynamicconfig.provider.zookeeper.ZookeepersAsConfigSourceIT.java
@Test(expected = ConfigurationException.class) public void testLoadNoNode() throws ConfigurationException { ConfigChangeListener mockListener = mock(ConfigChangeListener.class); HierarchicalConfigurationDeserializer mockLoader = mock(HierarchicalConfigurationDeserializer.class); // Assert that load() fails when a nonexistent node is passed as argument. ZookeepersAsConfigSource source = new ZookeepersAsConfigSource(); Configuration config = new BaseConfiguration(); config.setProperty("quorum", zookeeperHost); config.setProperty("znode", "/nope/nope"); config.setProperty(APPNAME_PROPERTY, "nope"); source.configure(config);//w ww . j av a 2 s . c o m source.load(mockLoader, mockListener); }
From source file:org.lable.oss.dynamicconfig.provider.zookeeper.ZookeepersAsConfigSourceTest.java
@Test public void testConstructorSlashPath() throws ConfigurationException { ZookeepersAsConfigSource source = new ZookeepersAsConfigSource(); Configuration config = new BaseConfiguration(); config.setProperty("quorum", "QUORUM"); config.setProperty("znode", "/path/node"); config.setProperty(ConfigurationInitializer.APPNAME_PROPERTY, "my-app"); source.configure(config);/*from ww w .j a v a2 s. com*/ assertThat(source.znode, is("/path/node/my-app")); assertThat(source.quorum.length, is(1)); assertThat(source.quorum[0], is("QUORUM")); }
From source file:org.lable.oss.dynamicconfig.provider.zookeeper.ZookeepersAsConfigSourceTest.java
@Test public void testConstructorWithAppNameAndQuorumList() throws ConfigurationException { ZookeepersAsConfigSource source = new ZookeepersAsConfigSource(); Configuration config = new BaseConfiguration(); config.setProperty("quorum", "zk1,zk2"); config.setProperty("znode", "/path"); config.setProperty(ConfigurationInitializer.APPNAME_PROPERTY, "node"); source.configure(config);//from ww w . j a va2 s. com assertThat(source.znode, is("/path/node")); assertThat(source.quorum.length, is(2)); assertThat(source.quorum[0], is("zk1")); assertThat(source.quorum[1], is("zk2")); }
From source file:org.lable.oss.dynamicconfig.provider.zookeeper.ZookeepersAsConfigSourceTest.java
@Test(expected = ConfigurationException.class) public void testConstructorNoAppName() throws ConfigurationException { ZookeepersAsConfigSource source = new ZookeepersAsConfigSource(); Configuration config = new BaseConfiguration(); config.setProperty("quorum", "QUORUM"); config.setProperty("znode", "/path/node"); source.configure(config);//from w ww .j a v a2 s. com }
From source file:org.lrodero.blueprintstests.TestDistributed.java
protected static Graph createRemoteTitanCassandraGraph(String cassandraHostName, int cassandraPort) { logger.info("Creating remote Titan database configuration (using Cassandra for storage)"); Configuration conf = new BaseConfiguration(); conf.setProperty("storage.backend", "cassandra"); conf.setProperty("storage.hostname", cassandraHostName); conf.setProperty("storage.port", cassandraPort); logger.info("Creating remote Titan database instance (using Cassandra for storage)"); return TitanFactory.open(conf); }
From source file:org.lrodero.blueprintstests.TestDistributed.java
protected static Graph createRemoteOrientDBGraph(String orientdbHostName, int orientdbPort, String dbName, String userName, String password) { logger.info("Creating remote OrientDB database configuration"); Configuration conf = new BaseConfiguration(); conf.setProperty("blueprints.graph", "com.tinkerpop.blueprints.impls.orient.OrientGraph"); conf.setProperty("blueprints.orientdb.url", "remote:" + orientdbHostName + ":" + orientdbPort + "/" + dbName); conf.setProperty("blueprints.orientdb.username", userName); // In fact we should use the 'guest' user for security, but anyway conf.setProperty("blueprints.orientdb.password", password); // Extracted from <users> tag in config/orientdb-server-config.xml) logger.info("Creating remote OrientDB database instance"); return GraphFactory.open(conf); }
From source file:org.lrodero.blueprintstests.TestLocal.java
protected static Graph createLocalTitanGraph(File storageDir) { logger.info("Creating local Titan database configuration"); Configuration conf = new BaseConfiguration(); conf.setProperty("storage.directory", storageDir.getAbsolutePath()); conf.setProperty("storage.backend", "berkeleyje"); logger.info("Creating local Titan database instance"); return TitanFactory.open(conf); }
From source file:org.lrodero.blueprintstests.TestLocal.java
protected static Graph createLocalNeo4jGraph(File storageDir) { logger.info("Creating local Neo4J database configuration"); Configuration conf = new BaseConfiguration(); conf.setProperty("blueprints.graph", "com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph"); conf.setProperty("blueprints.neo4j.directory", storageDir.getAbsolutePath()); logger.info("Creating local Neo4J database instance"); return GraphFactory.open(conf); }
From source file:org.lrodero.blueprintstests.TestLocal.java
protected static Graph createLocalOrientDBGraph(File storageDir) { logger.info("Creating local OrientDB database configuration"); Configuration conf = new BaseConfiguration(); conf.setProperty("blueprints.graph", "com.tinkerpop.blueprints.impls.orient.OrientGraph"); conf.setProperty("blueprints.orientdb.url", "local:" + storageDir.getAbsolutePath()); logger.info("Creating local OrientDB database instance"); return GraphFactory.open(conf); }
From source file:org.neo4j.jdbc.TestWebServer.java
protected NeoServer createNeoServer(final GraphDatabaseAPI gdb, final URI baseUri) { this.gdb = gdb; return new NeoServer() { @Override//ww w .java 2 s . c om public void init() { } @Override public void start() { } @Override public Configuration getConfiguration() { return new BaseConfiguration(); } @Override public void stop() { } @Override public Database getDatabase() { return new Database((AbstractGraphDatabase) gdb); } @Override public Configurator getConfigurator() { return null; } @Override public PluginManager getExtensionManager() { return null; } @SuppressWarnings("unchecked") @Override public Collection<Injectable<?>> getInjectables(List<String> packageNames) { return Arrays.<Injectable<?>>asList(new Injectable<WebServer>() { public WebServer getValue() { return TestWebServer.this; } public Class<WebServer> getType() { return WebServer.class; } }); } @Override public URI baseUri() { return baseUri; } }; }