PoolingStorageConnector extends AbstractConnector { @Override public void commit() throws SesameDriverException { transaction.commit(); WRITE.lock(); try { centralConnector.begin(); centralConnector.removeStatements(localModel.getRemovedStatements()); centralConnector.addStatements(localModel.getAddedStatements()); centralConnector.commit(); transaction.afterCommit(); } catch (SesameDriverException e) { transaction.rollback(); centralConnector.rollback(); transaction.afterRollback(); throw e; } finally { WRITE.unlock(); centralConnector.releaseConnection(connection); this.localModel = null; } } PoolingStorageConnector(StorageConnector centralConnector); @Override TupleQueryResult executeSelectQuery(String query); @Override boolean executeBooleanQuery(String query); @Override void executeUpdate(String query); @Override List<Resource> getContexts(); @Override ValueFactory getValueFactory(); @Override void begin(); @Override void commit(); @Override void rollback(); @Override void close(); @Override void addStatements(Collection<Statement> statements); @Override void removeStatements(Collection<Statement> statements); @Override Collection<Statement> findStatements(Resource subject, IRI property, Value value, boolean includeInferred); @Override Collection<Statement> findStatements(Resource subject, IRI property, Value value,
                                                boolean includeInferred, IRI context); @Override boolean containsStatement(Resource subject, IRI property, Value value, boolean includeInferred); @Override boolean containsStatement(Resource subject, IRI property, Value value, boolean includeInferred, IRI context); @Override T unwrap(Class<T> cls);  }
@Test public void testCommit() throws Exception { connector.begin(); connector.commit(); verify(writeLock).lock(); verify(centralMock).begin(); verify(centralMock).addStatements(anyCollection()); verify(centralMock).removeStatements(anyCollection()); verify(centralMock).commit(); verify(writeLock).unlock(); assertFalse(transaction.isActive()); }