import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-/***
+/**
* Unit tests for RemoteRpcImplementation.
*
* @author Thomas Pantelis
/**
- * This test method invokes and executes the remote rpc
+ * This test method invokes and executes the remote rpc.
*/
@Test
public void testInvokeRpc() throws Exception {
}
/**
- * This test method invokes and executes the remote rpc
+ * This test method invokes and executes the remote rpc.
*/
@Test
public void testInvokeRpcWithNullInput() throws Exception {
/**
- * This test method invokes and executes the remote rpc
+ * This test method invokes and executes the remote rpc.
*/
@Test
public void testInvokeRpcWithNoOutput() throws Exception {
/**
- * This test method invokes and executes the remote rpc
+ * This test method invokes and executes the remote rpc.
*/
@Test(expected = DOMRpcException.class)
public void testInvokeRpcWithRemoteFailedFuture() throws Exception {
- final ContainerNode rpcOutput = null;
- final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
-
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
- Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(new DOMRpcException(
- "Test Exception") {}));
+ Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(new RemoteDOMRpcException(
+ "Test Exception", null)));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
/**
* This test method invokes and tests exceptions when akka timeout occured
- *
- * Currently ignored since this test with current config takes around 15 seconds
- * to complete.
- *
+ * Currently ignored since this test with current config takes around 15 seconds to complete.
*/
@Ignore
@Test(expected = RemoteDOMRpcException.class)
public void testInvokeRpcWithAkkaTimeoutException() throws Exception {
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
- @SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
- (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
@Test(expected = DOMRpcException.class)
public void testInvokeRpcWithLookupException() throws Exception {
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
- @SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
- (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
}
/**
- * This test method invokes and executes the remote rpc
+ * This test method invokes and executes the remote rpc.
*/
@Test(expected = DOMRpcImplementationNotAvailableException.class)
public void testInvokeRpcWithLoopException() throws Exception {
final NormalizedNode<?, ?> invokeRpcInput = RemoteRpcInput.from(makeRPCInput("foo"));
- final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+ final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
+ remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
}
-
-
- private RemoteRpcProviderConfig getConfig() {
- return new RemoteRpcProviderConfig.Builder("unit-test").build();
- }
}