use of com.tinkerpop.blueprints.TransactionalGraph in project blueprints by tinkerpop.
the class GraphSailConnection method commitInternal.
public void commitInternal() throws SailException {
if (store.isTransactional) {
((TransactionalGraph) store.graph).commit();
}
if (statementsAdded || statementsRemoved) {
DefaultSailChangedEvent e = new DefaultSailChangedEvent(store.sail);
e.setStatementsAdded(statementsAdded);
e.setStatementsRemoved(statementsRemoved);
store.sail.notifySailChanged(e);
}
}
use of com.tinkerpop.blueprints.TransactionalGraph in project frames by tinkerpop.
the class FramedTransactionalGraphTest method testTransactions.
@Test
public void testTransactions() {
TransactionalGraph t = Mockito.mock(TransactionalGraph.class);
FramedTransactionalGraph<TransactionalGraph> g = new FramedTransactionalGraph<TransactionalGraph>(t, new FramedGraphConfiguration());
g.commit();
Mockito.verify(t).commit();
Mockito.reset(t);
g.rollback();
Mockito.verify(t).rollback();
}
use of com.tinkerpop.blueprints.TransactionalGraph in project frames by tinkerpop.
the class AbstractModuleTest method testWrapping.
@Test
public void testWrapping() {
Graph baseGraph = Mockito.mock(Graph.class);
TransactionalGraph baseTransactionalGraph = Mockito.mock(TransactionalGraph.class);
Graph wrappedGraph = Mockito.mock(Graph.class);
TransactionalGraph wrappedTransactionalGraph = Mockito.mock(TransactionalGraph.class);
FramedGraphConfiguration config = new FramedGraphConfiguration();
AbstractModule module = Mockito.mock(AbstractModule.class);
Mockito.when(module.doConfigure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).thenReturn(wrappedGraph);
Graph configuredGraph = module.configure(baseGraph, config);
Assert.assertEquals(wrappedGraph, configuredGraph);
Mockito.reset(module);
Mockito.when(module.doConfigure(Mockito.any(TransactionalGraph.class), Mockito.any(FramedGraphConfiguration.class))).thenReturn(wrappedTransactionalGraph);
Graph configuredTransactionalGraph = module.configure(baseTransactionalGraph, config);
Assert.assertEquals(wrappedTransactionalGraph, configuredTransactionalGraph);
}
use of com.tinkerpop.blueprints.TransactionalGraph in project frames by tinkerpop.
the class AbstractModuleTest method testNoWrapping.
@Test
public void testNoWrapping() {
Graph baseGraph = Mockito.mock(Graph.class);
TransactionalGraph baseTransactionalGraph = Mockito.mock(TransactionalGraph.class);
FramedGraphConfiguration config = new FramedGraphConfiguration();
AbstractModule module = Mockito.mock(AbstractModule.class);
Mockito.when(module.doConfigure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).thenCallRealMethod();
Graph configuredGraph = module.configure(baseGraph, config);
Assert.assertEquals(baseGraph, configuredGraph);
Mockito.verify(module).doConfigure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class));
Mockito.verify(module).doConfigure(Mockito.any(FramedGraphConfiguration.class));
Mockito.reset(module);
Mockito.when(module.doConfigure(Mockito.any(TransactionalGraph.class), Mockito.any(FramedGraphConfiguration.class))).thenCallRealMethod();
Graph configuredTransactionalGraph = module.configure(baseTransactionalGraph, config);
Assert.assertEquals(baseTransactionalGraph, configuredTransactionalGraph);
Mockito.verify(module).doConfigure(Mockito.any(TransactionalGraph.class), Mockito.any(FramedGraphConfiguration.class));
Mockito.verify(module).doConfigure(Mockito.any(FramedGraphConfiguration.class));
}
use of com.tinkerpop.blueprints.TransactionalGraph in project frames by tinkerpop.
the class FramedGraphFactoryTest method testWrappingError.
@Test(expected = UnsupportedOperationException.class)
public void testWrappingError() {
Graph wrapper = Mockito.mock(Graph.class);
Mockito.when(mockModule.configure(Mockito.any(Graph.class), Mockito.any(FramedGraphConfiguration.class))).thenReturn(wrapper);
FramedGraphFactory graphFactory = new FramedGraphFactory(mockModule);
TransactionalGraph baseTransactional = Mockito.mock(TransactionalGraph.class);
graphFactory.create(baseTransactional);
}
Aggregations