List of usage examples for org.apache.commons.configuration Configuration addProperty
void addProperty(String key, Object value);
From source file:org.lable.oss.dynamicconfig.core.commonsconfiguration.ConcurrentConfigurationTest.java
@Test(expected = UnsupportedOperationException.class) public void addPropertyTest() { CombinedConfiguration mockConfiguration = mock(CombinedConfiguration.class); Configuration concurrentConfiguration = new ConcurrentConfiguration(mockConfiguration, null); concurrentConfiguration.addProperty("test", "test"); }
From source file:org.neo4j.server.configuration.validation.WebadminConfigurationRule.java
@Override public void validate(Configuration configuration) throws RuleFailedException { String managementApi = validateConfigurationContainsKey(configuration, Configurator.MANAGEMENT_PATH_PROPERTY_KEY); String restApi = validateConfigurationContainsKey(configuration, Configurator.REST_API_PATH_PROPERTY_KEY); // Check URIs are ok URI managementUri = validateAndNormalizeUri(managementApi, Configurator.MANAGEMENT_PATH_PROPERTY_KEY); URI restUri = validateAndNormalizeUri(restApi, Configurator.REST_API_PATH_PROPERTY_KEY); // Overwrite the properties with the new normalised URIs configuration.clearProperty(Configurator.MANAGEMENT_PATH_PROPERTY_KEY); configuration.addProperty(Configurator.MANAGEMENT_PATH_PROPERTY_KEY, managementUri.toString()); configuration.clearProperty(Configurator.REST_API_PATH_PROPERTY_KEY); configuration.addProperty(Configurator.REST_API_PATH_PROPERTY_KEY, restUri.toString()); }
From source file:org.neo4j.server.database.TestCommunityDatabase.java
@Before public void setup() throws Exception { databaseDirectory = createTempDir(); Configuration conf = new MapConfiguration(new HashMap<String, String>()); conf.addProperty(Configurator.DATABASE_LOCATION_PROPERTY_KEY, databaseDirectory.getAbsolutePath()); theDatabase = new CommunityDatabase(conf); }
From source file:org.neo4j.server.database.TestCommunityDatabase.java
@Test(expected = IllegalStateException.class) public void shouldComplainIfDatabaseLocationIsAlreadyInUse() throws Throwable { deletionFailureOk = true;/*from w w w . j av a 2 s . co m*/ theDatabase.start(); Configuration conf = new MapConfiguration(new HashMap<String, String>()); conf.addProperty(Configurator.DATABASE_LOCATION_PROPERTY_KEY, databaseDirectory.getAbsolutePath()); CommunityDatabase db = new CommunityDatabase(conf); db.start(); }
From source file:org.neo4j.server.database.TestCommunityDatabase.java
@Test public void shouldBeAbleToOverrideShellConfig() throws Throwable { int customPort = findFreeShellPortToUse(8881); File tempDir = createTempDir(); File tuningProperties = new File(tempDir, "neo4j.properties"); tuningProperties.createNewFile();/*w ww . j a v a 2 s . co m*/ ServerTestUtils.writePropertiesToFile(stringMap(ShellSettings.remote_shell_enabled.name(), GraphDatabaseSetting.TRUE, ShellSettings.remote_shell_port.name(), "" + customPort), tuningProperties); Configuration conf = new MapConfiguration(new HashMap<String, String>()); conf.addProperty(Configurator.DATABASE_LOCATION_PROPERTY_KEY, tempDir.getAbsolutePath()); conf.addProperty(Configurator.DB_TUNING_PROPERTY_FILE_KEY, tuningProperties.getAbsolutePath()); Database otherDb = new CommunityDatabase(conf); otherDb.start(); // Try to connect with a shell client to that custom port. // Throws exception if unable to connect ShellLobby.newClient(customPort).shutdown(); otherDb.stop(); FileUtils.forceDelete(tempDir); }
From source file:org.neo4j.server.modules.ManagementApiModuleTest.java
@Test public void shouldRegisterASingleUri() throws Exception { WebServer webServer = mock(WebServer.class); NeoServerWithEmbeddedWebServer neoServer = mock(NeoServerWithEmbeddedWebServer.class); when(neoServer.baseUri()).thenReturn(new URI("http://localhost:7575")); when(neoServer.getWebServer()).thenReturn(webServer); Configuration config = new PropertiesConfiguration(); String managementPath = "/db/manage"; config.addProperty(Configurator.MANAGEMENT_PATH_PROPERTY_KEY, managementPath); when(neoServer.getConfiguration()).thenReturn(config); ManagementApiModule module = new ManagementApiModule(); module.start(neoServer, null);//from w ww . ja v a2 s .com verify(webServer).addJAXRSPackages(any(List.class), anyString()); }
From source file:org.neo4j.server.modules.RESTApiModuleTest.java
@Test public void shouldRegisterASingleUri() throws Exception { WebServer webServer = mock(WebServer.class); NeoServerWithEmbeddedWebServer neoServer = mock(NeoServerWithEmbeddedWebServer.class); when(neoServer.baseUri()).thenReturn(new URI("http://localhost:7575")); when(neoServer.getWebServer()).thenReturn(webServer); Configuration config = new PropertiesConfiguration(); String path = "/db/data"; config.addProperty(Configurator.REST_API_PATH_PROPERTY_KEY, path); when(neoServer.getConfiguration()).thenReturn(config); RESTApiModule module = new RESTApiModule(); module.start(neoServer, null);/*from www . j a v a 2 s.c om*/ verify(webServer).addJAXRSPackages(any(List.class), anyString()); }
From source file:org.pentaho.metaverse.graph.SynchronizedGraphFactoryTest.java
@Test public void testOpen_Configuration() throws Exception { Configuration config = new PropertiesConfiguration(); config.addProperty("blueprints.graph", "com.tinkerpop.blueprints.impls.tg.TinkerGraph"); Graph g = SynchronizedGraphFactory.open(config); assertTrue(g instanceof BaseSynchronizedGraph); }
From source file:org.rzo.yajsw.config.YajswConfigurationImpl.java
/** * Gets the configuration./*from w w w . jav a2 s . c om*/ * * @param map * the map * * @return the configuration */ private Configuration getConfiguration(Map map) { Configuration result = new BaseConfiguration(); if (map != null) for (Iterator it = map.entrySet().iterator(); it.hasNext();) { Entry entry = (Entry) it.next(); result.addProperty((String) entry.getKey(), entry.getValue()); } return result; }
From source file:org.seedstack.seed.security.internal.authorization.ConfigurationRoleMappingUnitTest.java
@Test public void readConfiguration_should_fill_map() { Configuration conf = new PropertiesConfiguration(); conf.addProperty("roles.foo", "bar.foo, foo.bar"); underTest.readConfiguration(conf);/* www. j a v a 2 s .c om*/ Map<String, Set<String>> roleMap = Whitebox.getInternalState(underTest, "map"); Set<String> roles = roleMap.get("bar.foo"); assertTrue(roles.contains("foo")); Set<String> roles2 = roleMap.get("foo.bar"); assertTrue(roles2.contains("foo")); }