X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-dom-adapter%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fdom%2Fadapter%2Finvoke%2FAbstractMappedRpcInvokerTest.java;h=4a6201af831b88d890bbf6e5c239aa5734631bc3;hb=f202949bd20ac080e386814418c018e24771559d;hp=bcd495c24a80a0d511ce5e394a3a42783c5b2eb5;hpb=61fdc5953d6041f6be61663b941d926b1fbd3221;p=mdsal.git diff --git a/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/invoke/AbstractMappedRpcInvokerTest.java b/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/invoke/AbstractMappedRpcInvokerTest.java index bcd495c24a..4a6201af83 100644 --- a/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/invoke/AbstractMappedRpcInvokerTest.java +++ b/binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/invoke/AbstractMappedRpcInvokerTest.java @@ -8,7 +8,6 @@ package org.opendaylight.mdsal.binding.dom.adapter.invoke; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; @@ -26,32 +25,20 @@ import org.opendaylight.yangtools.yang.binding.RpcService; import org.opendaylight.yangtools.yang.common.QName; public class AbstractMappedRpcInvokerTest { - @Test public void invokeRpcTest() throws Exception { - final Method methodWithoutInput = - TestRpcService.class.getDeclaredMethod("methodWithoutInput", RpcService.class); final Method methodWithInput = TestRpcService.class.getDeclaredMethod("methodWithInput", RpcService.class, DataObject.class); methodWithInput.setAccessible(true); - methodWithoutInput.setAccessible(true); final RpcService rpcService = new TestRpcService(); final TestRpcInvokerImpl testRpcInvoker = new TestRpcInvokerImpl(ImmutableMap.of( - "(test)tstWithoutInput", methodWithoutInput, "(test)tstWithInput", methodWithInput)); - assertTrue(testRpcInvoker.map.get("(test)tstWithInput") instanceof RpcMethodInvokerWithInput); - assertTrue(testRpcInvoker.map.get("(test)tstWithoutInput") instanceof RpcMethodInvokerWithoutInput); - - final Crate crateWithoutInput = - (Crate) testRpcInvoker.invokeRpc(rpcService, QName.create("test", "tstWithoutInput"), null).get(); - assertEquals(TestRpcService.methodWithoutInput(rpcService).get().getRpcService(), - crateWithoutInput.getRpcService()); - assertFalse(crateWithoutInput.getDataObject().isPresent()); + assertTrue(testRpcInvoker.map.get("(test)tstWithInput") instanceof RpcMethodInvoker); final DataObject dataObject = mock(DataObject.class); final Crate crateWithInput = @@ -62,8 +49,7 @@ public class AbstractMappedRpcInvokerTest { assertEquals(dataObject, crateWithInput.getDataObject().get()); } - private class TestRpcInvokerImpl extends AbstractMappedRpcInvoker { - + private static class TestRpcInvokerImpl extends AbstractMappedRpcInvoker { TestRpcInvokerImpl(final Map map) { super(map); } @@ -85,19 +71,15 @@ public class AbstractMappedRpcInvokerTest { } RpcService getRpcService() { - return this.rpcService; + return rpcService; } Optional getDataObject() { - return this.dataObject.get(); + return dataObject.get(); } } static class TestRpcService implements RpcService { - static ListenableFuture methodWithoutInput(final RpcService testArgument) { - return Futures.immediateFuture(new Crate(testArgument, null)); - } - static ListenableFuture methodWithInput(final RpcService testArgument, final DataObject testArgument2) { return Futures.immediateFuture(new Crate(testArgument, testArgument2)); }