use of org.apache.jena.tdb.transaction.Transaction in project jena by apache.
the class AbstractTestNodeTableTrans method nodetrans_03.
@Test
public void nodetrans_03() {
Transaction txn = createTxn(11);
NodeTableTrans ntt = create(txn);
NodeTable nt0 = ntt.getBaseNodeTable();
ntt.begin(txn);
// Add a node
NodeId nodeId = ntt.getAllocateNodeId(node1);
// Check not in the base.
assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node1));
assertNull(nt0.getNodeForNodeId(nodeId));
// Check is in the transaction node table.
assertEquals(node1, ntt.getNodeForNodeId(nodeId));
ntt.abort(txn);
// Check it is not in the base.
assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node1));
assertNull(nt0.getNodeForNodeId(nodeId));
ntt.commitClearup(txn);
}
use of org.apache.jena.tdb.transaction.Transaction in project jena by apache.
the class AbstractTestNodeTableTrans method nodetrans_04.
@Test
public void nodetrans_04() {
Transaction txn = createTxn(11);
NodeTableTrans ntt = create(txn, node1);
NodeTable nt0 = ntt.getBaseNodeTable();
ntt.begin(txn);
// Add a node
NodeId nodeId = ntt.getAllocateNodeId(node2);
// Not here
assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node2));
// Is here
assertEquals(nodeId, ntt.getNodeIdForNode(node2));
ntt.commitPrepare(txn);
ntt.commitEnact(txn);
assertEquals(nodeId, nt0.getNodeIdForNode(node2));
ntt.commitClearup(txn);
}
use of org.apache.jena.tdb.transaction.Transaction in project jena by apache.
the class AbstractTestObjectFileTrans method setup.
@Before
public void setup() {
txn = new Transaction(null, 5, ReadWrite.WRITE, ++count, null, tm);
file1 = createFile("base");
file2 = createFile("log");
}
Aggregations