LocalTransactionContext extends AbstractTransactionContext { @Override public void executeMerge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data, final Boolean havePermit) { executeModification(transaction -> transaction.merge(path, data)); } LocalTransactionContext(final DOMStoreTransaction txDelegate, final TransactionIdentifier identifier,
            final LocalTransactionReadySupport readySupport); @Override void executeDelete(final YangInstanceIdentifier path, final Boolean havePermit); @Override void executeMerge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
            final Boolean havePermit); @Override void executeWrite(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data,
            final Boolean havePermit); @Override void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture,
            final Boolean havePermit); @Override Future<ActorSelection> readyTransaction(final Boolean havePermit,
            final Optional<SortedSet<String>> participatingShardNames); @Override Future<Object> directCommit(final Boolean havePermit); @Override void closeTransaction();  }
@Test public void testMerge() { YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.empty(); NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class); localTransactionContext.executeMerge(yangInstanceIdentifier, normalizedNode, null); verify(readWriteTransaction).merge(yangInstanceIdentifier, normalizedNode); }
@Test public void testReadyWithMergeError() { YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.empty(); NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class); RuntimeException error = new RuntimeException("mock"); doThrow(error).when(readWriteTransaction).merge(yangInstanceIdentifier, normalizedNode); localTransactionContext.executeMerge(yangInstanceIdentifier, normalizedNode, null); localTransactionContext.executeMerge(yangInstanceIdentifier, normalizedNode, null); verify(readWriteTransaction).merge(yangInstanceIdentifier, normalizedNode); doReadyWithExpectedError(error); }