InmemoryDOMDataTreeShardWriteTransaction implements DOMDataTreeShardWriteTransaction, Identifiable<String> { @Override public void ready() { checkState(!finished, "Attempting to ready an already finished transaction."); checkState(cursor == null, "Attempting to ready a transaction that has an open cursor."); requireNonNull(modification, "Attempting to ready an empty transaction."); LOG.debug("Readying open transaction on shard {}", modification.getPrefix()); rootModification = modification.seal(); producer.transactionReady(this, rootModification); cohorts.add(new InMemoryDOMDataTreeShardThreePhaseCommitCohort( rootShardDataTree, rootModification, changePublisher)); for (final Entry<DOMDataTreeIdentifier, ForeignShardModificationContext> entry : modification.getChildShards().entrySet()) { cohorts.add(new ForeignShardThreePhaseCommitCohort(entry.getKey(), entry.getValue())); } finished = true; } InmemoryDOMDataTreeShardWriteTransaction(final InMemoryDOMDataTreeShardProducer producer,
                                             final ShardDataModification root,
                                             final DataTree rootShardDataTree,
                                             final InMemoryDOMDataTreeShardChangePublisher changePublisher,
                                             final ListeningExecutorService executor); @Override String getIdentifier(); @Override void close(); boolean isFinished(); @Override void ready(); @Override ListenableFuture<Void> submit(); @Override ListenableFuture<Boolean> validate(); @Override ListenableFuture<Void> prepare(); @Override ListenableFuture<Void> commit(); @Override DOMDataTreeWriteCursor createCursor(final DOMDataTreeIdentifier prefix);  }
@Test public void ready() throws Exception { final Field childShardsField = ShardDataModification.class.getDeclaredField("childShards"); childShardsField.setAccessible(true); childShardsField.set(shardDataModification, ImmutableMap.of(DOM_DATA_TREE_IDENTIFIER, FOREIGN_SHARD_MODIFICATION_CONTEXT)); inmemoryDOMDataTreeShardWriteTransaction.ready(); verify(SHARD_ROOT_MODIFICATION_CONTEXT).ready(); }