SnapshotStorageConnector extends SharedStorageConnector { @Override public void begin() { ensureOpen(); if (transaction.isActive()) { throw new IllegalStateException("Transaction is already active."); } transaction.begin(); snapshotCentralDataset(); this.transactionalUpdates = new ArrayList<>(); this.transactionalChanges = new LocalModel(configuration.is(JenaConfigParam.TREAT_DEFAULT_GRAPH_AS_UNION)); } SnapshotStorageConnector(AbstractStorageConnector centralConnector); @Override void begin(); @Override void commit(); @Override void rollback(); @Override List<Statement> find(Resource subject, Property property, RDFNode value, String context); @Override boolean contains(Resource subject, Property property, RDFNode value, String context); @Override List<String> getContexts(); @Override void add(List<Statement> statements, String context); @Override void remove(List<Statement> statements, String context); @Override void remove(Resource subject, Property property, RDFNode object, String context); @Override AbstractResultSet executeSelectQuery(Query query, StatementOntology target); @Override AbstractResultSet executeAskQuery(Query query, StatementOntology target); @Override void executeUpdate(String query, StatementOntology target);  }
@Test public void beginThrowsIllegalStateWhenTransactionIsAlreadyActive() { connector.begin(); thrown.expect(IllegalStateException.class); thrown.expectMessage(containsString("Transaction is already active")); connector.begin(); }