use of ai.grakn.kb.internal.GraknTxTinker in project grakn by graknlabs.
the class GraknTxTinkerFactoryTest method whenGettingGraphFromFactoryClosingItAndGettingItAgain_ReturnGraph.
@Test
public void whenGettingGraphFromFactoryClosingItAndGettingItAgain_ReturnGraph() {
TxFactoryTinker factory = new TxFactoryTinker(session);
GraknTx graph1 = factory.open(GraknTxType.WRITE);
graph1.close();
GraknTxTinker graph2 = factory.open(GraknTxType.WRITE);
assertEquals(graph1, graph2);
}
use of ai.grakn.kb.internal.GraknTxTinker in project grakn by graknlabs.
the class GraknTxTinkerFactoryTest method whenBuildingTxFromTheSameFactory_ReturnSingletonGraphs.
@Test
public void whenBuildingTxFromTheSameFactory_ReturnSingletonGraphs() {
GraknTx tx1 = tinkerGraphFactory.open(GraknTxType.WRITE);
TinkerGraph tinkerGraph1 = ((GraknTxTinker) tx1).getTinkerPopGraph();
tx1.close();
GraknTx tx1_copy = tinkerGraphFactory.open(GraknTxType.WRITE);
tx1_copy.close();
GraknTx tx2 = tinkerGraphFactory.open(GraknTxType.BATCH);
TinkerGraph tinkerGraph2 = ((GraknTxTinker) tx2).getTinkerPopGraph();
tx2.close();
GraknTx tx2_copy = tinkerGraphFactory.open(GraknTxType.BATCH);
assertEquals(tx1, tx1_copy);
assertEquals(tx2, tx2_copy);
assertNotEquals(tx1, tx2);
assertEquals(tinkerGraph1, tinkerGraph2);
}
Aggregations