public void cleanUpAfterRollback() { localTxn = null; readonlyTnx = false; close(); }
@Override public void rollback() { try { for (RDFBeanTransaction tx : transactions) { tx.rollback(); } } finally { connection.cleanUpAfterCommit(); } }
@Test public void test() throws IOException { MultiConnection connection = new MultiConnection(repository.openConnection(), repository.openConnection()); // find CloseableIterator<STMT> stmts = connection.findStatements(null, null, null, null, false); assertFalse(stmts.hasNext()); stmts.close(); // update connection.update( Collections.<STMT> emptySet(), Collections.<STMT> singleton(dialect.createStatement(RDFS.label, RDF.type, RDF.Property))); // find again stmts = connection.findStatements(RDFS.label, RDF.type, null, null, false); assertTrue(stmts.hasNext()); stmts.close(); // close connection.close(); }
@Before public void setUp() { MiniRepository repository = new MiniRepository(); MultiConnection connection = new MultiConnection(repository.openConnection(), repository.openConnection()); RDFBeanTransaction innerTx = EasyMock.createNiceMock(RDFBeanTransaction.class); tx = new MultiTransaction(connection, new RDFBeanTransaction[] { innerTx }); }
@Override public void commit() { if (rollbackOnly) { throw new RepositoryException("Transaction is rollBackOnly"); } try { prepare(); } catch (RuntimeException e) { rollback(); throw new RepositoryException(e); } try { for (RDFBeanTransaction tx : transactions) { tx.commit(); } } finally { connection.cleanUpAfterCommit(); } }