Search in sources :

Example 6 with GraphDatabaseConfigurationBuilder

use of org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder 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 7 with GraphDatabaseConfigurationBuilder

use of org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder 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 8 with GraphDatabaseConfigurationBuilder

use of org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder 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 9 with GraphDatabaseConfigurationBuilder

use of org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder in project janusgraph by JanusGraph.

the class HBaseStoreManagerConfigTest method testHBaseTimestampProvider.

@Test
public // Test HBase preferred timestamp provider MILLI is set by default
void testHBaseTimestampProvider() {
    // Get an empty configuration
    // GraphDatabaseConfiguration.buildGraphConfiguration() only build an empty one.
    ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
    // Set backend to hbase
    config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "hbase");
    // Instantiate a GraphDatabaseConfiguration based on the above
    GraphDatabaseConfiguration graphConfig = new GraphDatabaseConfigurationBuilder().build(config.getConfiguration());
    // Check the TIMESTAMP_PROVIDER has been set to the hbase preferred MILLI
    TimestampProviders provider = graphConfig.getConfiguration().get(GraphDatabaseConfiguration.TIMESTAMP_PROVIDER);
    assertEquals(HBaseStoreManager.PREFERRED_TIMESTAMPS, provider);
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) TimestampProviders(org.janusgraph.diskstorage.util.time.TimestampProviders) Test(org.junit.jupiter.api.Test)

Example 10 with GraphDatabaseConfigurationBuilder

use of org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder in project janusgraph by JanusGraph.

the class AbstractConfiguredGraphFactoryTest method setup.

@BeforeEach
public void setup() {
    if (gm != null)
        return;
    gm = new JanusGraphManager(new Settings());
    final MapConfiguration config = getManagementConfig();
    final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
    // Instantiate the ConfigurationManagementGraph Singleton
    new ConfigurationManagementGraph(graph);
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) JanusGraphManager(org.janusgraph.graphdb.management.JanusGraphManager) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) Settings(org.apache.tinkerpop.gremlin.server.Settings) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

GraphDatabaseConfigurationBuilder (org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder)19 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)18 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)18 MapConfiguration (org.apache.commons.configuration2.MapConfiguration)16 Test (org.junit.jupiter.api.Test)14 HashMap (java.util.HashMap)4 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)4 Settings (org.apache.tinkerpop.gremlin.server.Settings)2 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)2 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)2 ConfigurationManagementGraph (org.janusgraph.graphdb.management.ConfigurationManagementGraph)2 Preconditions (com.google.common.base.Preconditions)1 File (java.io.File)1 Instant (java.time.Instant)1 List (java.util.List)1 Set (java.util.Set)1 Spliterators (java.util.Spliterators)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 StreamSupport (java.util.stream.StreamSupport)1