X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fremote%2Frpc%2FRpcBrokerTest.java;h=d588736f61b0f0aa2e5436abccd23f3e5da3968e;hb=refs%2Fchanges%2F22%2F65622%2F11;hp=6ecd7dac3adc48630540c64e7f14effa6adc915b;hpb=168591eb3dfc298b631e8dc51e25b0331c105cfc;p=controller.git diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java index 6ecd7dac3a..d588736f61 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,18 +8,16 @@ package org.opendaylight.controller.remote.rpc; - import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.when; import akka.actor.Status.Failure; -import akka.testkit.JavaTestKit; +import akka.testkit.javadsl.TestKit; import com.google.common.util.concurrent.Futures; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer; import org.opendaylight.controller.md.sal.dom.api.DOMRpcException; import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException; import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult; @@ -33,7 +31,7 @@ public class RpcBrokerTest extends AbstractRpcTest { @Test public void testExecuteRpc() { - new JavaTestKit(node1) { + new TestKit(node1) { { final ContainerNode invokeRpcResult = makeRPCOutput("bar"); @@ -43,37 +41,31 @@ public class RpcBrokerTest extends AbstractRpcTest { final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null); - rpcBroker1.tell(executeMsg, getRef()); + rpcInvoker1.tell(executeMsg, getRef()); final RpcResponse rpcResponse = expectMsgClass(duration("5 seconds"), RpcResponse.class); - assertEquals(rpcResult.getResult(), - NormalizedNodeSerializer.deSerialize(rpcResponse.getResultNormalizedNode())); + assertEquals(rpcResult.getResult(), rpcResponse.getResultNormalizedNode()); } }; } @Test public void testExecuteRpcFailureWithException() { - - new JavaTestKit(node1) { + new TestKit(node1) { { - when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.>any())) - .thenReturn( - Futures.immediateFailedCheckedFuture(new DOMRpcImplementationNotAvailableException( - "NOT FOUND"))); + .thenReturn(Futures.immediateFailedCheckedFuture( + new DOMRpcImplementationNotAvailableException("NOT FOUND"))); final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null); - rpcBroker1.tell(executeMsg, getRef()); + rpcInvoker1.tell(executeMsg, getRef()); final Failure rpcResponse = expectMsgClass(duration("5 seconds"), akka.actor.Status.Failure.class); Assert.assertTrue(rpcResponse.cause() instanceof DOMRpcException); } }; - } - }