Search in sources :

Example 11 with MapConfiguration

use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.

the class GraphDatabaseConfigurationInstanceIdTest method instanceIdShouldEqualHostname.

@Test
public void instanceIdShouldEqualHostname() throws UnknownHostException {
    final Map<String, Object> map = getStorageConfiguration();
    map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
    final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
    final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
    assertEquals(1, graph.openManagement().getOpenInstances().size());
    assertEquals(toCurrentInstance(Inet4Address.getLocalHost().getHostName()), graph.openManagement().getOpenInstances().iterator().next());
    graph.close();
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test)

Example 12 with MapConfiguration

use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.

the class GraphDatabaseConfigurationInstanceExecutorServiceTest method shouldCreateCustomBackendFixedThreadPoolSize.

@Test
public void shouldCreateCustomBackendFixedThreadPoolSize() {
    final Map<String, Object> map = getStorageConfiguration();
    map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_OPS.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_EXECUTOR_SERVICE_CORE_POOL_SIZE.toStringWithoutRoot(), 15);
    final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
    assertDoesNotThrow(() -> {
        final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
        graph.traversal().V().hasNext();
        graph.close();
    });
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test)

Example 13 with MapConfiguration

use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.

the class GraphDatabaseConfigurationInstanceExecutorServiceTest method shouldCreateCustomBackendExecutorServiceWithoutExecutorServiceConfigurationConstructor.

@Test
public void shouldCreateCustomBackendExecutorServiceWithoutExecutorServiceConfigurationConstructor() {
    final Map<String, Object> map = getStorageConfiguration();
    map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_OPS.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_EXECUTOR_SERVICE_CLASS.toStringWithoutRoot(), CustomParameterlessExecutorServiceImplementation.class.getName());
    final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
    assertDoesNotThrow(() -> {
        final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
        graph.traversal().V().hasNext();
        graph.close();
    });
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test)

Example 14 with MapConfiguration

use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.

the class GraphDatabaseConfigurationInstanceExecutorServiceTest method shouldCreateCustomBackendExecutorServiceWithoutBothExecutorServiceConfigurationConstructors.

@Test
public void shouldCreateCustomBackendExecutorServiceWithoutBothExecutorServiceConfigurationConstructors() {
    final Map<String, Object> map = getStorageConfiguration();
    map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_OPS.toStringWithoutRoot(), true);
    map.put(PARALLEL_BACKEND_EXECUTOR_SERVICE_CORE_POOL_SIZE.toStringWithoutRoot(), 15);
    map.put(PARALLEL_BACKEND_EXECUTOR_SERVICE_CLASS.toStringWithoutRoot(), CustomExecutorServiceWithBothConstructorsImplementation.class.getName());
    final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
    assertDoesNotThrow(() -> {
        final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
        graph.traversal().V().hasNext();
        graph.close();
    });
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test)

Example 15 with MapConfiguration

use of org.apache.commons.configuration2.MapConfiguration in project bitflyer4j by after-the-sunrise.

the class EnvironmentImplTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    conf = new MapConfiguration(new HashMap<>());
    target = new EnvironmentImpl(conf, conf);
}
Also used : HashMap(java.util.HashMap) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MapConfiguration (org.apache.commons.configuration2.MapConfiguration)34 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)25 Test (org.junit.jupiter.api.Test)25 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)16 GraphDatabaseConfigurationBuilder (org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder)16 HashMap (java.util.HashMap)6 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)3 Test (org.testng.annotations.Test)3 Configuration (org.apache.commons.configuration2.Configuration)2 Settings (org.apache.tinkerpop.gremlin.server.Settings)2 AbstractConfiguredGraphFactoryTest (org.janusgraph.core.AbstractConfiguredGraphFactoryTest)2 ManagementSystem (org.janusgraph.graphdb.database.management.ManagementSystem)2 ConfigurationManagementGraph (org.janusgraph.graphdb.management.ConfigurationManagementGraph)2 Session (com.datastax.driver.core.Session)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Bindings (javax.script.Bindings)1 SimpleBindings (javax.script.SimpleBindings)1 CompositeConfiguration (org.apache.commons.configuration2.CompositeConfiguration)1 JanusGraphException (org.janusgraph.core.JanusGraphException)1 PropertyKey (org.janusgraph.core.PropertyKey)1