use of com.tinkerpop.blueprints.TransactionalGraph in project frames by tinkerpop.
the class FramedGraphFactoryTest method testFactory.
@Test
public void testFactory() {
Mockito.when(mockModule.configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).then(new ReturnsArgumentAt(0));
FramedGraphFactory graphFactory = new FramedGraphFactory(mockModule);
FramedGraph<Graph> framed = graphFactory.create(base);
Assert.assertEquals(base, framed.getBaseGraph());
Mockito.verify(mockModule, Mockito.times(1)).configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class));
TransactionalGraph baseTransactional = Mockito.mock(TransactionalGraph.class);
FramedTransactionalGraph<TransactionalGraph> framedTransactional = graphFactory.create(baseTransactional);
Assert.assertEquals(baseTransactional, framedTransactional.getBaseGraph());
Mockito.verify(mockModule, Mockito.times(2)).configure(Mockito.any(TransactionalGraph.class), Mockito.any(FramedGraphConfiguration.class));
}
use of com.tinkerpop.blueprints.TransactionalGraph in project blueprints by tinkerpop.
the class SparkseeGraphSpecificTestSuite method testMultipleSessions.
public void testMultipleSessions() throws InterruptedException, IOException {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
((SparkseeGraph) graph).typeScope.set(true);
this.stopWatch();
// This test requires a multiple sessions license,
// so just executed if a license has been given,
// see SparkseeGraphTest#generateGraph(...) -> blueprints-sparksee.cfg
com.sparsity.sparksee.gdb.SparkseeConfig cfg = new com.sparsity.sparksee.gdb.SparkseeConfig();
if (cfg.getLicense() == null || cfg.getLicense().length() == 0) {
printPerformance(graph.toString(), null, "skip because no license", this.stopWatch());
graph.shutdown();
return;
}
new GraphMLReader(graph).inputGraph(GraphMLReader.class.getResourceAsStream("graph-example-2.xml"));
printPerformance(graph.toString(), null, "load", this.stopWatch());
List<SessionThread> threads = new ArrayList<SessionThread>();
for (int i = 0; i < 10; i++) threads.add(new SessionThread(graph));
this.stopWatch();
for (SessionThread th : threads) th.start();
Thread.sleep(5000);
for (SessionThread th : threads) th.stop = true;
int acum = 0;
for (SessionThread th : threads) {
while (!th.finished) ;
acum += th.counter;
}
printPerformance(graph.toString(), acum, "tx (sessions)", this.stopWatch());
graph.shutdown();
}
Aggregations