@Test public void apply_partial() throws Exception { indoubt("ex1"); assertThat(count(production1), is(0)); assertThat(count(production2), is(0)); writable(production1, false); try { testee.apply("ex1"); } catch (IOException e) { } assertThat(count(production1), is(0)); assertThat(count(production2), is(1)); writable(production1, true); assertThat(testee.apply("ex1"), is(true)); assertThat(count(production1), is(1)); assertThat(count(production2), is(1)); assertThat(testee.apply("ex1"), is(false)); }
public boolean apply(String executionId) throws IOException, InterruptedException { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); } LOG.info(MessageFormat.format( "Start applying Direct I/O transaction (executionId={0})", executionId)); TxStatus status = doApply(executionId); switch (status) { case APPLIED: LOG.info(MessageFormat.format( "Finish applying Direct I/O transaction (executionId={0})", executionId)); return true; case NOT_COMMITTED: LOG.info(MessageFormat.format( "Direct I/O transaction is not committed (executionId={0})", executionId)); return false; case NOT_FOUND: LOG.info(MessageFormat.format( "Direct I/O transaction is already completed or not found (executionId={0})", executionId)); return false; default: throw new AssertionError(status); } }
DirectIoTransactionEditor extends Configured { public boolean apply(String executionId) throws IOException, InterruptedException { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); } LOG.info(MessageFormat.format( "Start applying Direct I/O transaction (executionId={0})", executionId)); TxStatus status = doApply(executionId); switch (status) { case APPLIED: LOG.info(MessageFormat.format( "Finish applying Direct I/O transaction (executionId={0})", executionId)); return true; case NOT_COMMITTED: LOG.info(MessageFormat.format( "Direct I/O transaction is not committed (executionId={0})", executionId)); return false; case NOT_FOUND: LOG.info(MessageFormat.format( "Direct I/O transaction is already completed or not found (executionId={0})", executionId)); return false; default: throw new AssertionError(status); } } }
DirectIoTransactionEditor extends Configured { public boolean apply(String executionId) throws IOException, InterruptedException { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); } LOG.info(MessageFormat.format( "Start applying Direct I/O transaction (executionId={0})", executionId)); TxStatus status = doApply(executionId); switch (status) { case APPLIED: LOG.info(MessageFormat.format( "Finish applying Direct I/O transaction (executionId={0})", executionId)); return true; case NOT_COMMITTED: LOG.info(MessageFormat.format( "Direct I/O transaction is not committed (executionId={0})", executionId)); return false; case NOT_FOUND: LOG.info(MessageFormat.format( "Direct I/O transaction is already completed or not found (executionId={0})", executionId)); return false; default: throw new AssertionError(status); } } DirectIoTransactionEditor();  DirectIoTransactionEditor(DirectDataSourceRepository repository); }
DirectIoTransactionEditor extends Configured { public boolean apply(String executionId) throws IOException, InterruptedException { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); } LOG.info(MessageFormat.format( "Start applying Direct I/O transaction (executionId={0})", executionId)); TxStatus status = doApply(executionId); switch (status) { case APPLIED: LOG.info(MessageFormat.format( "Finish applying Direct I/O transaction (executionId={0})", executionId)); return true; case NOT_COMMITTED: LOG.info(MessageFormat.format( "Direct I/O transaction is not committed (executionId={0})", executionId)); return false; case NOT_FOUND: LOG.info(MessageFormat.format( "Direct I/O transaction is already completed or not found (executionId={0})", executionId)); return false; default: throw new AssertionError(status); } } DirectIoTransactionEditor();  DirectIoTransactionEditor(DirectDataSourceRepository repository); TransactionInfo get(String executionId); List<TransactionInfo> list(); boolean apply(String executionId); boolean abort(String executionId); }
DirectIoTransactionEditor extends Configured { public boolean apply(String executionId) throws IOException, InterruptedException { if (executionId == null) { throw new IllegalArgumentException("executionId must not be null"); } LOG.info(MessageFormat.format( "Start applying Direct I/O transaction (executionId={0})", executionId)); TxStatus status = doApply(executionId); switch (status) { case APPLIED: LOG.info(MessageFormat.format( "Finish applying Direct I/O transaction (executionId={0})", executionId)); return true; case NOT_COMMITTED: LOG.info(MessageFormat.format( "Direct I/O transaction is not committed (executionId={0})", executionId)); return false; case NOT_FOUND: LOG.info(MessageFormat.format( "Direct I/O transaction is already completed or not found (executionId={0})", executionId)); return false; default: throw new AssertionError(status); } } DirectIoTransactionEditor();  DirectIoTransactionEditor(DirectDataSourceRepository repository); TransactionInfo get(String executionId); List<TransactionInfo> list(); boolean apply(String executionId); boolean abort(String executionId);  }