@Test public void preCommitWithExceptionTest() throws Exception { doThrow(new RuntimeException("testException")).when(DATA_TREE).prepare(any()); try { IN_MEMORY_DOM_DATA_TREE_SHARD_THREE_PHASE_COMMIT_COHORT.preCommit().get(); fail("Expected Exception"); } catch (ExecutionException e) { assertTrue(e.getCause().getMessage().contains("testException")); } }
@SuppressWarnings("checkstyle:IllegalCatch") @Override public ListenableFuture<Void> preCommit() { try { candidate = dataTree.prepare(modification); LOG.debug("DataTreeModification {} prepared", modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in preparation phase", e); return Futures.immediateFailedFuture(e); } }
InMemoryDOMDataTreeShardThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public ListenableFuture<Void> preCommit() { try { candidate = dataTree.prepare(modification); LOG.debug("DataTreeModification {} prepared", modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in preparation phase", e); return Futures.immediateFailedFuture(e); } } }
InMemoryDOMDataTreeShardThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public ListenableFuture<Void> preCommit() { try { candidate = dataTree.prepare(modification); LOG.debug("DataTreeModification {} prepared", modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in preparation phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMDataTreeShardThreePhaseCommitCohort(final DataTree dataTree,
                                                   final DataTreeModification modification,
                                                   final InMemoryDOMDataTreeShardChangePublisher changePublisher); }
InMemoryDOMDataTreeShardThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public ListenableFuture<Void> preCommit() { try { candidate = dataTree.prepare(modification); LOG.debug("DataTreeModification {} prepared", modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in preparation phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMDataTreeShardThreePhaseCommitCohort(final DataTree dataTree,
                                                   final DataTreeModification modification,
                                                   final InMemoryDOMDataTreeShardChangePublisher changePublisher); @SuppressWarnings("checkstyle:IllegalCatch") @Override ListenableFuture<Boolean> canCommit(); @SuppressWarnings("checkstyle:IllegalCatch") @Override ListenableFuture<Void> preCommit(); @Override ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit(); }
InMemoryDOMDataTreeShardThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @SuppressWarnings("checkstyle:IllegalCatch") @Override public ListenableFuture<Void> preCommit() { try { candidate = dataTree.prepare(modification); LOG.debug("DataTreeModification {} prepared", modification); return SUCCESSFUL_FUTURE; } catch (Exception e) { LOG.warn("Unexpected failure in preparation phase", e); return Futures.immediateFailedFuture(e); } } InMemoryDOMDataTreeShardThreePhaseCommitCohort(final DataTree dataTree,
                                                   final DataTreeModification modification,
                                                   final InMemoryDOMDataTreeShardChangePublisher changePublisher); @SuppressWarnings("checkstyle:IllegalCatch") @Override ListenableFuture<Boolean> canCommit(); @SuppressWarnings("checkstyle:IllegalCatch") @Override ListenableFuture<Void> preCommit(); @Override ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit();  }