use of org.apache.jena.tdb.store.NodeId 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.store.NodeId in project jena by apache.
the class AbstractTestNodeTableTrans method contains.
static void contains(NodeTable nt, Node... nodes) {
for (Node n : nodes) {
NodeId nodeId = nt.getNodeIdForNode(n);
assertFalse(NodeId.isDoesNotExist(nodeId));
}
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordFindNot_1.
@Test
public void TupleIndexRecordFindNot_1() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n4, n5, n6);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertNotNull(iter);
assertFalse(iter.hasNext());
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordPOS_3.
@Test
public void TupleIndexRecordPOS_3() {
TupleIndex index = createIndex("POS");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(null, n2, n3);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertTrue("Can't find tuple", iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordPOS_1.
@Test
public void TupleIndexRecordPOS_1() {
TupleIndex index = createIndex("POS");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n2, n3);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertTrue("Can't find tuple", iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
}
Aggregations