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();
});
}
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();
});
}
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
}
}
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();
}
}
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;
}
Aggregations