217218219220221222223224225226227
ds.commit() ; try { ds.commit() ; fail("Expected transaction exception - commit-commit("+mode+")") ; } catch (JenaTransactionException ex) { ds.end() ; } } private void testCommitAbort(ReadWrite mode) { Dataset ds = create() ;
229230231232233234235236237238239
ds.commit() ; try { ds.abort() ; fail("Expected transaction exception - commit-commit("+mode+")") ; } catch (JenaTransactionException ex) { ds.end() ; } } private void testAbortAbort(ReadWrite mode) { Dataset ds = create() ;
241242243244245246247248249250251
ds.abort() ; try { ds.abort() ; fail("Expected transaction exception - commit-commit("+mode+")") ; } catch (JenaTransactionException ex) { ds.end() ; } } private void testAbortCommit(ReadWrite mode) {
254255256257258259260261262263264
ds.abort() ; try { ds.commit() ; fail("Expected transaction exception - commit-commit("+mode+")") ; } catch (JenaTransactionException ex) { ds.end() ; } } }
142143144145146147148149150151152
totalExecTime += writeOperationDuration; System.out.println("Write operation " + i + " took " + writeOperationDuration + "ms"); } } if ( bracketWithReader ) dataset1.end() ; System.out.println("All " + TOTAL + " write operations wrote " + size + " triples and took " + totalExecTime + "ms"); } }
4849505152535455565758
@Test public void transaction_01() { Dataset ds = create() ; ds.begin(ReadWrite.READ) ; assertTrue(ds.isInTransaction()) ; ds.end() ; assertFalse(ds.isInTransaction()) ; } @Test public void transaction_02() {
7778798081828384858687
Dataset ds = create() ; ds.begin(ReadWrite.WRITE) ; assertTrue(ds.isInTransaction()) ; ds.commit() ; assertFalse(ds.isInTransaction()) ; ds.end() ; assertFalse(ds.isInTransaction()) ; } @Test public void transaction_05() {
8889909192939495969798
Dataset ds = create() ; ds.begin(ReadWrite.WRITE) ; assertTrue(ds.isInTransaction()) ; ds.abort() ; assertFalse(ds.isInTransaction()) ; ds.end() ; assertFalse(ds.isInTransaction()) ; } @Test public void transaction_06() {
// Check API methods work. Dataset ds = TDBFactory.createDataset(loc) ; ds.begin(ReadWrite.READ) ; Model m = (q.isDefaultGraph() ? ds.getDefaultModel() : ds.getNamedModel("g")) ; assertEquals( nonTxnData ? 2 : 1 , m.size()) ; ds.end() ; } }
213214215216217218219220221222223
ds.begin(mode1) ; try { ds.begin(mode2) ; fail("Expected transaction exception - begin-begin ("+mode1+", "+mode2+")") ; } catch (JenaTransactionException ex) { ds.end() ; } } private void testCommitCommit(ReadWrite mode) { Dataset ds = create() ;