@Test public void testRead() { YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.empty(); NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class); doReturn(FluentFutures.immediateFluentFuture(Optional.of(normalizedNode))).when(readWriteTransaction) .read(yangInstanceIdentifier); localTransactionContext.executeRead(new ReadData(yangInstanceIdentifier, DataStoreVersions.CURRENT_VERSION), SettableFuture.create(), null); verify(readWriteTransaction).read(yangInstanceIdentifier); }
@Override public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture, final Boolean havePermit) { Futures.addCallback(readCmd.apply(getReadDelegate()), new FutureCallback<T>() { @Override public void onSuccess(final T result) { proxyFuture.set(result); } @Override public void onFailure(final Throwable failure) { proxyFuture.setException(failure instanceof Exception ? ReadFailedException.MAPPER.apply((Exception) failure) : failure); } }, MoreExecutors.directExecutor()); }
LocalTransactionContext extends AbstractTransactionContext { @Override public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture, final Boolean havePermit) { Futures.addCallback(readCmd.apply(getReadDelegate()), new FutureCallback<T>() { @Override public void onSuccess(final T result) { proxyFuture.set(result); } @Override public void onFailure(final Throwable failure) { proxyFuture.setException(failure instanceof Exception ? ReadFailedException.MAPPER.apply((Exception) failure) : failure); } }, MoreExecutors.directExecutor()); } }
LocalTransactionContext extends AbstractTransactionContext { @Override public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture, final Boolean havePermit) { Futures.addCallback(readCmd.apply(getReadDelegate()), new FutureCallback<T>() { @Override public void onSuccess(final T result) { proxyFuture.set(result); } @Override public void onFailure(final Throwable failure) { proxyFuture.setException(failure instanceof Exception ? ReadFailedException.MAPPER.apply((Exception) failure) : failure); } }, MoreExecutors.directExecutor()); } LocalTransactionContext(final DOMStoreTransaction txDelegate, final TransactionIdentifier identifier,
            final LocalTransactionReadySupport readySupport); }
LocalTransactionContext extends AbstractTransactionContext { @Override public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture, final Boolean havePermit) { Futures.addCallback(readCmd.apply(getReadDelegate()), new FutureCallback<T>() { @Override public void onSuccess(final T result) { proxyFuture.set(result); } @Override public void onFailure(final Throwable failure) { proxyFuture.setException(failure instanceof Exception ? ReadFailedException.MAPPER.apply((Exception) failure) : failure); } }, MoreExecutors.directExecutor()); } 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(); }
LocalTransactionContext extends AbstractTransactionContext { @Override public <T> void executeRead(final AbstractRead<T> readCmd, final SettableFuture<T> proxyFuture, final Boolean havePermit) { Futures.addCallback(readCmd.apply(getReadDelegate()), new FutureCallback<T>() { @Override public void onSuccess(final T result) { proxyFuture.set(result); } @Override public void onFailure(final Throwable failure) { proxyFuture.setException(failure instanceof Exception ? ReadFailedException.MAPPER.apply((Exception) failure) : failure); } }, MoreExecutors.directExecutor()); } 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();  }