Search in sources :

Example 96 with Config

use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.

the class ServerSettingsTest method webServerThreadCountDefaultShouldBeDocumented.

@Test
public void webServerThreadCountDefaultShouldBeDocumented() throws Exception {
    Config config = Config.serverDefaults();
    String documentedDefaultValue = config.getConfigValues().entrySet().stream().filter(c -> c.getKey().equals(ServerSettings.webserver_max_threads.name())).map(Entry::getValue).findAny().orElseThrow(() -> new RuntimeException("Setting not present!")).documentedDefaultValue().orElseThrow(() -> new RuntimeException("Default value not present!"));
    assertEquals("Number of available processors (max 500).", documentedDefaultValue);
}
Also used : Assert.assertThat(org.junit.Assert.assertThat) ConfigValue(org.neo4j.configuration.ConfigValue) List(java.util.List) Config(org.neo4j.kernel.configuration.Config) Collectors.toList(java.util.stream.Collectors.toList) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Entry(java.util.Map.Entry) Optional(java.util.Optional) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) MapUtil.stringMap(org.neo4j.helpers.collection.MapUtil.stringMap) Assert.assertEquals(org.junit.Assert.assertEquals) Entry(java.util.Map.Entry) Config(org.neo4j.kernel.configuration.Config) Test(org.junit.Test)

Example 97 with Config

use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.

the class ServerSettingsTest method connectorSettingHasItsOwnValues.

@Test
public void connectorSettingHasItsOwnValues() throws Exception {
    Config config = Config.serverDefaults(stringMap("dbms.connector.http.address", "localhost:123"));
    ConfigValue address = config.getConfigValues().entrySet().stream().filter(c -> c.getKey().equals("dbms.connector.http.address")).map(Entry::getValue).findAny().orElseThrow(() -> new RuntimeException("Setting not present!"));
    assertTrue(address.deprecated());
    assertEquals(Optional.of("dbms.connector.http.listen_address"), address.replacement());
}
Also used : Assert.assertThat(org.junit.Assert.assertThat) ConfigValue(org.neo4j.configuration.ConfigValue) List(java.util.List) Config(org.neo4j.kernel.configuration.Config) Collectors.toList(java.util.stream.Collectors.toList) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Entry(java.util.Map.Entry) Optional(java.util.Optional) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) MapUtil.stringMap(org.neo4j.helpers.collection.MapUtil.stringMap) Assert.assertEquals(org.junit.Assert.assertEquals) ConfigValue(org.neo4j.configuration.ConfigValue) Entry(java.util.Map.Entry) Config(org.neo4j.kernel.configuration.Config) Test(org.junit.Test)

Example 98 with Config

use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.

the class ConfigAdapterTest method shouldGetPropertyInRightFormat.

@Test
public void shouldGetPropertyInRightFormat() throws Exception {
    // GIVEN
    Config config = Config.defaults();
    ConfigAdapter wrappingConfiguration = new ConfigAdapter(config);
    // WHEN
    wrappingConfiguration.setProperty(ServerSettings.rest_api_path.name(), "http://localhost:7474///db///data///");
    final Object dataPath = wrappingConfiguration.getProperty(ServerSettings.rest_api_path.name());
    // THEN
    assertEquals(new URI(ServerSettings.rest_api_path.getDefaultValue()), dataPath);
}
Also used : Config(org.neo4j.kernel.configuration.Config) URI(java.net.URI) Test(org.junit.Test)

Example 99 with Config

use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.

the class ConfigAdapterTest method shouldGetDefaultPropertyByKey.

@Test
public void shouldGetDefaultPropertyByKey() throws Exception {
    // GIVEN
    Config config = Config.defaults();
    ConfigAdapter wrappingConfiguration = new ConfigAdapter(config);
    // WHEN
    final Object propertyValue = wrappingConfiguration.getProperty(ServerSettings.rest_api_path.name());
    // THEN
    assertEquals(new URI(ServerSettings.rest_api_path.getDefaultValue()), propertyValue);
}
Also used : Config(org.neo4j.kernel.configuration.Config) URI(java.net.URI) Test(org.junit.Test)

Example 100 with Config

use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.

the class ConfigAdapterTest method shouldAbleToAccessRegisteredPropertyByName.

@Test
public void shouldAbleToAccessRegisteredPropertyByName() {
    Config config = Config.defaults();
    ConfigAdapter wrappingConfiguration = new ConfigAdapter(config);
    assertEquals(60000L, wrappingConfiguration.getProperty(ServerSettings.transaction_idle_timeout.name()));
}
Also used : Config(org.neo4j.kernel.configuration.Config) Test(org.junit.Test)

Aggregations

Config (org.neo4j.kernel.configuration.Config)264 Test (org.junit.Test)184 File (java.io.File)54 PageCache (org.neo4j.io.pagecache.PageCache)35 InstanceId (org.neo4j.cluster.InstanceId)26 MultiPaxosContext (org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.context.MultiPaxosContext)25 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)25 LogProvider (org.neo4j.logging.LogProvider)20 Executor (java.util.concurrent.Executor)19 ClusterConfiguration (org.neo4j.cluster.protocol.cluster.ClusterConfiguration)19 Timeouts (org.neo4j.cluster.timeout.Timeouts)19 HashMap (java.util.HashMap)18 URI (java.net.URI)17 ObjectInputStreamFactory (org.neo4j.cluster.protocol.atomicbroadcast.ObjectInputStreamFactory)17 ObjectOutputStreamFactory (org.neo4j.cluster.protocol.atomicbroadcast.ObjectOutputStreamFactory)17 AcceptorInstanceStore (org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.AcceptorInstanceStore)17 IOException (java.io.IOException)16 ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)15 BoltConnector (org.neo4j.kernel.configuration.BoltConnector)15 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)15