DefaultGraphManager implements GraphManager { public final Graph openGraph(final String graphName, final Function<String, Graph> supplier) { final Graph graph = graphs.get(graphName); if (null != graph) { return graph; } final Graph newGraph = supplier.apply(graphName); putGraph(graphName, newGraph); return newGraph; } DefaultGraphManager(final Settings settings); final Set<String> getGraphNames(); final Graph getGraph(final String graphName); final void putGraph(final String graphName, final Graph g); final Set<String> getTraversalSourceNames(); final TraversalSource getTraversalSource(final String traversalSourceName); final void putTraversalSource(final String tsName, final TraversalSource ts); final TraversalSource removeTraversalSource(final String tsName); final Bindings getAsBindings(); final void rollbackAll(); final void rollback(final Set<String> graphSourceNamesToCloseTxOn); final void commitAll(); final void commit(final Set<String> graphSourceNamesToCloseTxOn); final Graph openGraph(final String graphName, final Function<String, Graph> supplier); final Graph removeGraph(final String graphName);  }
@Test public void openGraphShouldReturnExistingGraph() { final Settings settings = Settings.read(DefaultGraphManagerTest.class.getResourceAsStream("../gremlin-server-integration.yaml")); final GraphManager graphManager = new DefaultGraphManager(settings); final Graph graph = graphManager.openGraph("graph", null); assertNotNull(graph); assertThat(graph, instanceOf(TinkerGraph.class)); }