use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_10.
@Test
public void trans_readBlock_10() {
// READ(start)-WRITE(start)-WRITE(finish)-WRITE(start)-READ(finish)-WRITE(finish)-check
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
DatasetGraphTxn dsgW1 = sConn.begin(ReadWrite.WRITE);
dsgW1.add(q1);
dsgW1.commit();
dsgW1.end();
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgR1.end();
dsgW2.commit();
dsgW2.end();
sConn.forceRecoverFromJournal();
DatasetGraphTDB 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_22.
@Test(expected = JenaTransactionException.class)
public void trans_22() {
// WRITE-close causes implicit abort
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsg = sConn.begin(ReadWrite.WRITE);
dsg.add(q);
dsg.end();
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_11.
@Test
public void trans_readBlock_11() {
// JENA-91
// READ(start)-WRITE-WRITE-WRITE-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();
DatasetGraphTxn dsgW2 = sConn.begin(ReadWrite.WRITE);
dsgW2.add(q2);
dsgW2.commit();
dsgW2.end();
DatasetGraphTxn dsgW3 = sConn.begin(ReadWrite.WRITE);
dsgW3.add(q3);
dsgW3.commit();
dsgW3.end();
dsgR1.end();
sConn.flush();
DatasetGraphTDB dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q1));
assertTrue(dsg.contains(q2));
assertTrue(dsg.contains(q3));
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class TestTDBInternal method basics_1.
@Test
public void basics_1() {
DatasetGraph dsg = TDBFactory.createDatasetGraph();
StoreConnection sConn = TDBInternal.getStoreConnection(dsg);
Assert.assertNotNull(sConn);
}
use of org.apache.jena.tdb.StoreConnection in project jena by apache.
the class AbstractTestTransSeq method trans_readBlock_08.
@Test
public void trans_readBlock_08() {
// WRITE(start)-add-READ(start)-WRITE(commit)-READ sees old DSG.
StoreConnection sConn = getStoreConnection();
DatasetGraphTxn dsgW = sConn.begin(ReadWrite.WRITE);
dsgW.add(q);
DatasetGraphTxn dsgR1 = sConn.begin(ReadWrite.READ);
assertFalse(dsgR1.contains(q));
dsgW.commit();
dsgW.end();
DatasetGraphTxn dsgR2 = sConn.begin(ReadWrite.READ);
// Before view
assertFalse(dsgR1.contains(q));
// After view
assertTrue(dsgR2.contains(q));
dsgR1.end();
dsgR2.end();
sConn.flush();
DatasetGraph dsg = sConn.getBaseDataset();
assertTrue(dsg.contains(q));
}
Aggregations