@Test public void basicTest() throws Exception { final ShardSubmitCoordinationTask shardSubmitCoordinationTask = new ShardSubmitCoordinationTask(DOM_DATA_TREE_IDENTIFIER, Collections.emptySet(), tx); final ShardCanCommitCoordinationTask canCommitCoordinationTask = mock(ShardCanCommitCoordinationTask.class); doNothing().when(canCommitCoordinationTask).canCommitBlocking(); final ShardPreCommitCoordinationTask preCommitCoordinationTask = mock(ShardPreCommitCoordinationTask.class); doNothing().when(preCommitCoordinationTask).preCommitBlocking(); final ShardCommitCoordinationTask commitCoordinationTask = mock(ShardCommitCoordinationTask.class); doNothing().when(commitCoordinationTask).commitBlocking(); Field canCommitCoordinationTaskField = ShardSubmitCoordinationTask.class.getDeclaredField("canCommitCoordinationTask"); Field preCommitCoordinationTaskField = ShardSubmitCoordinationTask.class.getDeclaredField("preCommitCoordinationTask"); Field commitCoordinationTaskField = ShardSubmitCoordinationTask.class.getDeclaredField("commitCoordinationTask"); canCommitCoordinationTaskField.setAccessible(true); preCommitCoordinationTaskField.setAccessible(true); commitCoordinationTaskField.setAccessible(true); canCommitCoordinationTaskField.set(shardSubmitCoordinationTask, canCommitCoordinationTask); preCommitCoordinationTaskField.set(shardSubmitCoordinationTask, preCommitCoordinationTask); commitCoordinationTaskField.set(shardSubmitCoordinationTask, commitCoordinationTask); shardSubmitCoordinationTask.call(); verify(canCommitCoordinationTask).canCommitBlocking(); verify(preCommitCoordinationTask).preCommitBlocking(); verify(commitCoordinationTask).commitBlocking(); }
@Override public Void call() throws TransactionCommitFailedException { LOG.debug("Shard {}, tx{} CanCommit started", transaction.getIdentifier(), rootShardPrefix); canCommitCoordinationTask.canCommitBlocking(); LOG.debug("Shard {}, tx{} PreCommit started", transaction.getIdentifier(), rootShardPrefix); preCommitCoordinationTask.preCommitBlocking(); LOG.debug("Shard {}, tx{} commit started", transaction.getIdentifier(), rootShardPrefix); commitCoordinationTask.commitBlocking(); transaction.transactionCommited(transaction); return null; }
ShardSubmitCoordinationTask implements Callable<Void> { @Override public Void call() throws TransactionCommitFailedException { LOG.debug("Shard {}, tx{} CanCommit started", transaction.getIdentifier(), rootShardPrefix); canCommitCoordinationTask.canCommitBlocking(); LOG.debug("Shard {}, tx{} PreCommit started", transaction.getIdentifier(), rootShardPrefix); preCommitCoordinationTask.preCommitBlocking(); LOG.debug("Shard {}, tx{} commit started", transaction.getIdentifier(), rootShardPrefix); commitCoordinationTask.commitBlocking(); transaction.transactionCommited(transaction); return null; } }
ShardSubmitCoordinationTask implements Callable<Void> { @Override public Void call() throws TransactionCommitFailedException { LOG.debug("Shard {}, tx{} CanCommit started", transaction.getIdentifier(), rootShardPrefix); canCommitCoordinationTask.canCommitBlocking(); LOG.debug("Shard {}, tx{} PreCommit started", transaction.getIdentifier(), rootShardPrefix); preCommitCoordinationTask.preCommitBlocking(); LOG.debug("Shard {}, tx{} commit started", transaction.getIdentifier(), rootShardPrefix); commitCoordinationTask.commitBlocking(); transaction.transactionCommited(transaction); return null; } ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
                                       final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
                                       final InmemoryDOMDataTreeShardWriteTransaction transaction); }
ShardSubmitCoordinationTask implements Callable<Void> { @Override public Void call() throws TransactionCommitFailedException { LOG.debug("Shard {}, tx{} CanCommit started", transaction.getIdentifier(), rootShardPrefix); canCommitCoordinationTask.canCommitBlocking(); LOG.debug("Shard {}, tx{} PreCommit started", transaction.getIdentifier(), rootShardPrefix); preCommitCoordinationTask.preCommitBlocking(); LOG.debug("Shard {}, tx{} commit started", transaction.getIdentifier(), rootShardPrefix); commitCoordinationTask.commitBlocking(); transaction.transactionCommited(transaction); return null; } ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
                                       final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
                                       final InmemoryDOMDataTreeShardWriteTransaction transaction); @Override Void call(); }
ShardSubmitCoordinationTask implements Callable<Void> { @Override public Void call() throws TransactionCommitFailedException { LOG.debug("Shard {}, tx{} CanCommit started", transaction.getIdentifier(), rootShardPrefix); canCommitCoordinationTask.canCommitBlocking(); LOG.debug("Shard {}, tx{} PreCommit started", transaction.getIdentifier(), rootShardPrefix); preCommitCoordinationTask.preCommitBlocking(); LOG.debug("Shard {}, tx{} commit started", transaction.getIdentifier(), rootShardPrefix); commitCoordinationTask.commitBlocking(); transaction.transactionCommited(transaction); return null; } ShardSubmitCoordinationTask(final DOMDataTreeIdentifier rootShardPrefix,
                                       final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
                                       final InmemoryDOMDataTreeShardWriteTransaction transaction); @Override Void call();  }