use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class GraphDatabaseConfigurationInstanceExecutorServiceTest method shouldCreateCustomBackendExecutorServiceWithExecutorServiceConfigurationConstructor.
@Test
public void shouldCreateCustomBackendExecutorServiceWithExecutorServiceConfigurationConstructor() {
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(), CustomExecutorServiceImplementation.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();
});
}
use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class GraphDatabaseConfigurationInstanceExecutorServiceTest method checkExceptionIsThrownDuringInit.
private <T extends Exception> void checkExceptionIsThrownDuringInit(Class<T> exceptionType, Map<String, Object> configMap, String message) {
final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(configMap);
T exception = assertThrows(exceptionType, () -> {
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
graph.traversal().V().hasNext();
graph.close();
});
assertEquals(message, exception.getMessage());
}
use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class EnsureCacheTest method NopTest.
@Test
public void NopTest() {
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
graph.traversal().addV().iterate();
}
use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class CQLConfiguredGraphFactoryTest method dropGraphShouldRemoveGraphKeyspace.
@Test
public void dropGraphShouldRemoveGraphKeyspace() throws Exception {
final MapConfiguration graphConfig = getGraphConfig();
final String graphName = graphConfig.getString(GRAPH_NAME.toStringWithoutRoot());
try {
ConfiguredGraphFactory.createConfiguration(graphConfig);
final StandardJanusGraph graph = (StandardJanusGraph) ConfiguredGraphFactory.open(graphName);
assertNotNull(graph);
ConfiguredGraphFactory.drop(graphName);
Session cql = cqlContainer.getCluster().connect();
Object graph_keyspace = cql.execute("SELECT * FROM system_schema.keyspaces WHERE keyspace_name = ?", graphName).one();
cql.close();
assertNull(graph_keyspace);
} finally {
ConfiguredGraphFactory.removeConfiguration(graphName);
ConfiguredGraphFactory.close(graphName);
}
}
use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class ManagementLoggerGraphCacheEvictionTest method graphShouldBeRemovedFromCache.
@Test
public void graphShouldBeRemovedFromCache() throws InterruptedException {
final JanusGraphManager jgm = new JanusGraphManager(new Settings());
assertNotNull(jgm);
assertNotNull(JanusGraphManager.getInstance());
assertNull(jgm.getGraph("graph1"));
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
map.put(GRAPH_NAME.toStringWithoutRoot(), "graph1");
final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
jgm.putGraph("graph1", graph);
assertEquals("graph1", ((StandardJanusGraph) JanusGraphManager.getInstance().getGraph("graph1")).getGraphName());
final ManagementSystem mgmt = (ManagementSystem) graph.openManagement();
mgmt.evictGraphFromCache();
mgmt.commit();
// wait for log to be asynchronously pulled
Thread.sleep(10000);
assertNull(jgm.getGraph("graph1"));
}
Aggregations