use of org.apache.jena.sparql.core.DatasetGraph 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.sparql.core.DatasetGraph 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));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class TestTDBInternal method exclusive_5.
@Test
public void exclusive_5() {
DatasetGraph dsg = TDBFactory.createDatasetGraph();
TransactionManager txnmgr = TDBInternal.getTransactionManager(dsg);
ReentrantReadWriteLock rwx = (ReentrantReadWriteLock) txnmgr.getExclusivityLock$();
dsg.begin(ReadWrite.READ);
boolean b = txnmgr.tryExclusiveMode();
Assert.assertFalse(b);
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class TestTDBInternal method exclusive_4.
@Test
public void exclusive_4() {
DatasetGraph dsg = TDBFactory.createDatasetGraph();
TransactionManager txnmgr = TDBInternal.getTransactionManager(dsg);
ReentrantReadWriteLock rwx = (ReentrantReadWriteLock) txnmgr.getExclusivityLock$();
checkLock(rwx, 0, 0);
boolean b = txnmgr.tryExclusiveMode();
Assert.assertTrue("Exclusive 1", b);
checkLock(rwx, 0, 1);
txnmgr.finishExclusiveMode();
checkLock(rwx, 0, 0);
b = txnmgr.tryExclusiveMode();
Assert.assertTrue("Exclusive 2", b);
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class TestTDBInternal method basics_2.
@Test
public void basics_2() {
DatasetGraph dsg = TDBFactory.createDatasetGraph();
TransactionManager txnmgr = TDBInternal.getTransactionManager(dsg);
Assert.assertNotNull(txnmgr);
}
Aggregations