@SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" }) @Test(expected = UnsupportedOperationException.class) public void preCommitTestWithUnknownException() throws Throwable { doThrow(new UnsupportedOperationException("testException")) .when(IN_MEMORY_DOM_DATA_STORE).prepare(any()); try { inMemoryDOMStoreThreePhaseCommitCohort.preCommit().get(); fail("Expected exception"); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof UnsupportedOperationException); throw e.getCause(); } }
@SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Void> preCommit() { try { candidate = store.prepare(modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in pre-commit phase", e); return Futures.immediateFailedFuture(e); } }
InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Void> preCommit() { try { candidate = store.prepare(modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in pre-commit phase", e); return Futures.immediateFailedFuture(e); } } }
InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Void> preCommit() { try { candidate = store.prepare(modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in pre-commit phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
                                           final SnapshotBackedWriteTransaction<String> writeTransaction,
                                           final DataTreeModification modification,
                                           final Exception operationError); }
InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Void> preCommit() { try { candidate = store.prepare(modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in pre-commit phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
                                           final SnapshotBackedWriteTransaction<String> writeTransaction,
                                           final DataTreeModification modification,
                                           final Exception operationError); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Boolean> canCommit(); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Void> preCommit(); @Override final ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit(); }
InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public final ListenableFuture<Void> preCommit() { try { candidate = store.prepare(modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in pre-commit phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
                                           final SnapshotBackedWriteTransaction<String> writeTransaction,
                                           final DataTreeModification modification,
                                           final Exception operationError); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Boolean> canCommit(); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Void> preCommit(); @Override final ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit();  }