TransactionProxy extends AbstractDOMStoreTransaction<TransactionIdentifier> implements DOMStoreReadWriteTransaction { @Override public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { checkModificationState("merge", path); if (path.isEmpty()) { mergeAllData(checkRootData(data)); } else { executeModification(new MergeOperation(path, data)); } } @VisibleForTesting  TransactionProxy(final AbstractTransactionContextFactory<?> txContextFactory, final TransactionType type); @Override FluentFuture<Boolean> exists(final YangInstanceIdentifier path); @Override FluentFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path); @Override void delete(final YangInstanceIdentifier path); @Override void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data); @Override void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data); @Override final void close(); @Override final AbstractThreePhaseCommitCohort<?> ready();  }
@Test public void testMerge() { dataStoreContextBuilder.shardBatchedModificationCount(1); ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), WRITE_ONLY); NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); expectBatchedModifications(actorRef, 1); TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY); transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite); verifyOneBatchedModification(actorRef, new MergeModification(TestModel.TEST_PATH, nodeToWrite), false); }
@Test public void testMergeThrottlingWhenShardFound() { throttleOperation(transactionProxy -> { NormalizedNode<?, ?> nodeToMerge = ImmutableNodes.containerNode(TestModel.TEST_QNAME); expectIncompleteBatchedModifications(); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); }); }
@Test public void testMergeThrottlingWhenShardNotFound() { completeOperation(transactionProxy -> { NormalizedNode<?, ?> nodeToMerge = ImmutableNodes.containerNode(TestModel.TEST_QNAME); expectBatchedModifications(2); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); }, false); }
@Test public void testMergeCompletion() { completeOperation(transactionProxy -> { NormalizedNode<?, ?> nodeToMerge = ImmutableNodes.containerNode(TestModel.TEST_QNAME); expectBatchedModifications(2); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); transactionProxy.merge(TestModel.TEST_PATH, nodeToMerge); }); }
@Test public void testMergeCompletionForLocalShard() { completeOperationLocal(transactionProxy -> { NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME); transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite); transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite); }, createDataTree()); }