use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class ConfiguredGraphFactoryTest method graphConfigurationShouldBeWhatWeExpect.
@Test
public void graphConfigurationShouldBeWhatWeExpect() throws Exception {
try {
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
map.put(GRAPH_NAME.toStringWithoutRoot(), "graph1");
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));
final StandardJanusGraph graph = (StandardJanusGraph) ConfiguredGraphFactory.open("graph1");
assertNotNull(graph);
assertEquals("graph1", graph.getConfiguration().getConfiguration().get(GRAPH_NAME));
assertEquals("inmemory", graph.getConfiguration().getConfiguration().get(STORAGE_BACKEND));
} finally {
ConfiguredGraphFactory.removeConfiguration("graph1");
ConfiguredGraphFactory.close("graph1");
}
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class ConfiguredGraphFactoryTest method shouldOpenGraphUsingConfiguration.
@Test
public void shouldOpenGraphUsingConfiguration() throws Exception {
try {
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
map.put(GRAPH_NAME.toStringWithoutRoot(), "graph1");
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));
final StandardJanusGraph graph = (StandardJanusGraph) ConfiguredGraphFactory.open("graph1");
assertNotNull(graph);
} finally {
ConfiguredGraphFactory.removeConfiguration("graph1");
ConfiguredGraphFactory.close("graph1");
}
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class GraphDatabaseConfigurationInstanceIdTest method instanceIdShouldEqualHostnamePlusSuffix.
@Test
public void instanceIdShouldEqualHostnamePlusSuffix() throws UnknownHostException {
final Map<String, Object> map = new HashMap<String, Object>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
map.put(UNIQUE_INSTANCE_ID_SUFFIX.toStringWithoutRoot(), 1);
final MapConfiguration config = new MapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfiguration(new CommonsConfiguration(config)));
assertEquals(graph.openManagement().getOpenInstances().size(), 1);
assertEquals(graph.openManagement().getOpenInstances().toArray()[0], Inet4Address.getLocalHost().getHostName() + "1");
graph.close();
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class GraphDatabaseConfigurationInstanceIdTest method instanceIdShouldEqualHostname.
@Test
public void instanceIdShouldEqualHostname() throws UnknownHostException {
final Map<String, Object> map = new HashMap<String, Object>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
map.put(UNIQUE_INSTANCE_ID_HOSTNAME.toStringWithoutRoot(), true);
final MapConfiguration config = new MapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfiguration(new CommonsConfiguration(config)));
assertEquals(graph.openManagement().getOpenInstances().size(), 1);
assertEquals(graph.openManagement().getOpenInstances().toArray()[0], Inet4Address.getLocalHost().getHostName());
graph.close();
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class ManagementLoggerGraphCacheEvictionTest method shouldNotBeAbleToEvictGraphWhenJanusGraphManagerIsNull.
@Test
public void shouldNotBeAbleToEvictGraphWhenJanusGraphManagerIsNull() {
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
final MapConfiguration config = new MapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfiguration(new CommonsConfiguration(config)));
final ManagementSystem mgmt = (ManagementSystem) graph.openManagement();
mgmt.evictGraphFromCache();
mgmt.commit();
assertNull(JanusGraphManager.getInstance());
}
Aggregations