Fix CS warnings in sal-remoterpc-connector and enable enforcement
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / test / java / org / opendaylight / controller / remote / rpc / RemoteRpcImplementationTest.java
index 8d6e8e598d201fc859e6cf90cdf3d8f272cf603d..05ee9f50963b01d8812a305ad8a9eafea8e771d3 100644 (file)
@@ -36,7 +36,7 @@ import org.opendaylight.controller.sal.connector.api.RpcRouter.RouteIdentifier;
 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
@@ -57,7 +57,7 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
 
 
     /**
-     * This test method invokes and executes the remote rpc
+     * This test method invokes and executes the remote rpc.
      */
     @Test
     public void testInvokeRpc() throws Exception {
@@ -88,7 +88,7 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
     }
 
     /**
-     * This test method invokes and executes the remote rpc
+     * This test method invokes and executes the remote rpc.
      */
     @Test
     public void testInvokeRpcWithNullInput() throws Exception {
@@ -119,7 +119,7 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
 
 
     /**
-     * This test method invokes and executes the remote rpc
+     * This test method invokes and executes the remote rpc.
      */
     @Test
     public void testInvokeRpcWithNoOutput() throws Exception {
@@ -151,21 +151,18 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
 
 
     /**
-     * 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);
@@ -182,18 +179,12 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
 
     /**
      * 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);
@@ -212,9 +203,6 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
     @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);
@@ -227,18 +215,14 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
     }
 
     /**
-     * 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();
-    }
 }