use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_01.
@Test
public void trans_readBlock_01() {
// READ(start)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
dsgW.add(q);
dsgW.commit();
dsgW.end();
assertFalse(dsgR1.contains(q));
dsgR1.end();
//**** Not hitting the queue ****
// Order of tweaking counters?
// also writer and counters?
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_03.
@Test
public void trans_readBlock_03() {
// READ(start)-WRITE(commit)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
assertFalse(dsgR1.contains(q1));
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
assertFalse(dsgR1.contains(q1));
assertFalse(dsgR1.contains(q2));
dsgR1.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q1));
assertTrue(dsgR2.contains(q2));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_09.
@Test
public void trans_readBlock_09() {
// WRITE(commit)-READ(start)-WRITE(commit)-READ(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR1.contains(q1));
assertFalse(dsgR1.contains(q2));
assertTrue(dsgR2.contains(q1));
assertTrue(dsgR2.contains(q2));
dsgR1.end();
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_04.
@Test
public void trans_04() {
// WRITE-abort-READ-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
dsgW.add(q);
assertTrue(dsgW.contains(q));
dsgW.abort();
dsgW.end();
DatasetGraphTxn dsg2 = sConn.begin(ReadWrite.READ);
assertFalse(dsg2.contains(q));
dsg2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertFalse(dsg.contains(q));
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_06.
@Test
public void trans_readBlock_06() {
// WRITE(start)-READ(start)-WRITE(commit)-READ sees old DSG.
// READ before WRITE remains seeing old view - READ after WRITE starts
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
DatasetGraphTxn dsgR = sConn.begin(ReadWrite.READ);
dsgW.add(q);
dsgW.commit();
dsgW.end();
assertFalse(dsgR.contains(q));
dsgR.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
assertTrue(dsgR2.contains(q));
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
Aggregations