+ /**
+ * This test method invokes and executes the remote rpc.
+ */
+ @SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
+ @Test(expected = DOMActionException.class)
+ public void testInvokeActionWithRemoteFailedFuture() throws Throwable {
+ final ContainerNode invokeActionInput = makeRPCInput("foo");
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ final ArgumentCaptor<ContainerNode> inputCaptor =
+ ArgumentCaptor.forClass(ContainerNode.class);
+
+ when(domActionService2.invokeAction(eq(TEST_RPC_TYPE), eq(TEST_DATA_TREE_ID),
+ inputCaptor.capture())).thenReturn(FluentFutures.immediateFailedFluentFuture(
+ new RemoteDOMRpcException("Test Exception", null)));
+
+ final ListenableFuture<DOMActionResult> frontEndFuture = remoteActionImpl1.invokeAction(TEST_RPC_TYPE,
+ TEST_DATA_TREE_ID, invokeActionInput);
+ assertTrue(frontEndFuture instanceof RemoteDOMActionFuture);
+
+ try {
+ frontEndFuture.get(5, TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ throw e.getCause();
+ }
+ }
+