Search in sources :

Example 36 with WriteConfiguration

use of org.janusgraph.diskstorage.configuration.WriteConfiguration in project janusgraph by JanusGraph.

the class CQLConfigTest method testRequestLoggerConfigurationSet.

@Test
public void testRequestLoggerConfigurationSet() {
    WriteConfiguration wc = getConfiguration();
    assertNull(wc.get(ConfigElement.getPath(REQUEST_TRACKER_CLASS), REQUEST_TRACKER_CLASS.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_SUCCESS_ENABLED), REQUEST_LOGGER_SUCCESS_ENABLED.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_SLOW_THRESHOLD), REQUEST_LOGGER_SLOW_THRESHOLD.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_SLOW_ENABLED), REQUEST_LOGGER_SLOW_ENABLED.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_ERROR_ENABLED), REQUEST_LOGGER_ERROR_ENABLED.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_MAX_QUERY_LENGTH), REQUEST_LOGGER_MAX_QUERY_LENGTH.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_SHOW_VALUES), REQUEST_LOGGER_SHOW_VALUES.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_MAX_VALUE_LENGTH), REQUEST_LOGGER_MAX_VALUE_LENGTH.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_MAX_VALUES), REQUEST_LOGGER_MAX_VALUES.getDatatype()));
    assertNull(wc.get(ConfigElement.getPath(REQUEST_LOGGER_SHOW_STACK_TRACES), REQUEST_LOGGER_SHOW_STACK_TRACES.getDatatype()));
    wc.set(ConfigElement.getPath(REQUEST_TRACKER_CLASS), RequestLogger.class.getSimpleName());
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_SUCCESS_ENABLED), true);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_SLOW_THRESHOLD), 1L);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_SLOW_ENABLED), true);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_ERROR_ENABLED), true);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_MAX_QUERY_LENGTH), 100000);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_SHOW_VALUES), true);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_MAX_VALUE_LENGTH), 100000);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_MAX_VALUES), 100000);
    wc.set(ConfigElement.getPath(REQUEST_LOGGER_SHOW_STACK_TRACES), true);
    graph = (StandardJanusGraph) JanusGraphFactory.open(wc);
    assertDoesNotThrow(() -> {
        graph.traversal().V().hasNext();
        graph.tx().rollback();
    });
}
Also used : RequestLogger(com.datastax.oss.driver.internal.core.tracker.RequestLogger) WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 37 with WriteConfiguration

use of org.janusgraph.diskstorage.configuration.WriteConfiguration in project janusgraph by JanusGraph.

the class CQLConfigTest method shouldCreateCachedThreadPool.

@Test
public void shouldCreateCachedThreadPool() {
    WriteConfiguration wc = getConfiguration();
    wc.set(ConfigElement.getPath(EXECUTOR_SERVICE_CLASS), ExecutorServiceBuilder.CACHED_THREAD_POOL_CLASS);
    graph = (StandardJanusGraph) JanusGraphFactory.open(wc);
    assertDoesNotThrow(() -> {
        graph.traversal().V().hasNext();
        graph.tx().rollback();
    });
}
Also used : WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 38 with WriteConfiguration

use of org.janusgraph.diskstorage.configuration.WriteConfiguration in project janusgraph by JanusGraph.

the class CQLConfigTest method shouldFailDueToSmallTimeout.

@Test
public void shouldFailDueToSmallTimeout() {
    try {
        WriteConfiguration wc = getConfiguration();
        wc.set(ConfigElement.getPath(REQUEST_TIMEOUT), 1);
        wc.set(ConfigElement.getPath(NETTY_TIMER_TICK_DURATION), 1);
        try (StandardJanusGraph graph = (StandardJanusGraph) JanusGraphFactory.open(wc)) {
            GraphTraversalSource graphTraversalSource = graph.traversal();
            for (int i = 0; i < 200; i++) {
                graphTraversalSource.addV().property("name", "world").property("age", 123).property("id", i);
            }
            graphTraversalSource.tx().commit();
            graphTraversalSource.V().has("id", P.lte(195)).valueMap().with(WithOptions.tokens, WithOptions.ids).toList();
            graphTraversalSource.tx().rollback();
        }
    // This test should fail, but it is very flaky, thus, we don't fail it even if we reached this point.
    // fail()
    } catch (Throwable throwable) {
    // the throwable is expected
    }
}
Also used : GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 39 with WriteConfiguration

use of org.janusgraph.diskstorage.configuration.WriteConfiguration in project janusgraph by JanusGraph.

the class CQLConfigTest method shouldCreateCQLSessionWithUrlConfigurationOnly.

@Test
public void shouldCreateCQLSessionWithUrlConfigurationOnly() throws IOException {
    WriteConfiguration wc = getConfiguration();
    String dataStaxConfiguration = prepareDataStaxConfiguration(wc);
    File tempFile = File.createTempFile("datastaxTempExample", ".conf");
    try {
        tempFile.deleteOnExit();
        FileUtils.writeStringToFile(tempFile, dataStaxConfiguration, Charset.defaultCharset(), false);
        wc.set(ConfigElement.getPath(BASE_PROGRAMMATIC_CONFIGURATION_ENABLED), false);
        wc.set(ConfigElement.getPath(URL_CONFIGURATION), new URL("file", "", tempFile.getAbsolutePath()).toString());
        graph = (StandardJanusGraph) JanusGraphFactory.open(wc);
        assertDoesNotThrow(() -> {
            graph.traversal().V().hasNext();
            graph.tx().rollback();
        });
    } finally {
        tempFile.delete();
    }
}
Also used : WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) File(java.io.File) URL(java.net.URL) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 40 with WriteConfiguration

use of org.janusgraph.diskstorage.configuration.WriteConfiguration in project janusgraph by JanusGraph.

the class JanusGraphPartitionGraphTest method getConfiguration.

@Override
public WriteConfiguration getConfiguration() {
    WriteConfiguration config = getBaseConfiguration();
    ModifiableConfiguration modifiableConfiguration = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE);
    // Let GraphDatabaseConfiguration's config freezer set CLUSTER_PARTITION
    // modifiableConfiguration.set(GraphDatabaseConfiguration.CLUSTER_PARTITION,true);
    modifiableConfiguration.set(GraphDatabaseConfiguration.CLUSTER_MAX_PARTITIONS, numPartitions);
    // uses SimpleBulkPlacementStrategy by default
    modifiableConfiguration.set(SimpleBulkPlacementStrategy.CONCURRENT_PARTITIONS, 3 * numPartitions);
    return config;
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration)

Aggregations

WriteConfiguration (org.janusgraph.diskstorage.configuration.WriteConfiguration)40 Test (org.junit.jupiter.api.Test)26 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)21 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)7 StandardJanusGraphTx (org.janusgraph.graphdb.transaction.StandardJanusGraphTx)7 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)6 File (java.io.File)5 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)5 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)5 Test (org.junit.Test)5 GraphTraversalSource (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource)4 URL (java.net.URL)3 JanusGraphManagement (org.janusgraph.core.schema.JanusGraphManagement)3 Configuration (org.janusgraph.diskstorage.configuration.Configuration)3 RequestLogger (com.datastax.oss.driver.internal.core.tracker.RequestLogger)2 IOException (java.io.IOException)2 StringWriter (java.io.StringWriter)2 Duration (java.time.Duration)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2