X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-dom-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Ftest%2Fconnect%2Fdom%2FDOMRpcServiceTestBugfix560.java;h=c7399e89f0503fcaa1ceaa630c1a406a9f82d9e8;hp=791c540c59685890b919c424f80673499f44f248;hb=ad5299f05589b508b89f40c97b62016ed1806ae8;hpb=f781598707f0810491cb571f835ee49772e00e83 diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java index 791c540c59..c7399e89f0 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java @@ -11,6 +11,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; @@ -22,14 +23,15 @@ import java.util.concurrent.Future; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.opendaylight.controller.md.sal.binding.api.MountPoint; +import org.opendaylight.controller.md.sal.binding.api.MountPointService; import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener; import org.opendaylight.controller.md.sal.dom.api.DOMRpcException; import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult; import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderService; +import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory; import org.opendaylight.controller.sal.binding.test.util.BindingTestContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService; @@ -45,8 +47,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaPath; -import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor; -import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline; +import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; /** * Test case for reported bug 560 @@ -70,7 +71,7 @@ public class DOMRpcServiceTestBugfix560 { private BindingTestContext testContext; private DOMMountPointService domMountPointService; - private MountProviderService bindingMountPointService; + private MountPointService bindingMountPointService; private SchemaContext schemaContext; /** @@ -79,13 +80,13 @@ public class DOMRpcServiceTestBugfix560 { @Before public void setUp() throws Exception { final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory(); - testFactory.setExecutor(MoreExecutors.sameThreadExecutor()); + testFactory.setExecutor(MoreExecutors.newDirectExecutorService()); testFactory.setStartWithParsedSchema(true); testContext = testFactory.getTestContext(); testContext.start(); domMountPointService = testContext.getDomMountProviderService(); - bindingMountPointService = testContext.getBindingMountProviderService(); + bindingMountPointService = testContext.getBindingMountPointService(); assertNotNull(domMountPointService); final InputStream moduleStream = BindingReflections.getModuleInfo( @@ -94,8 +95,7 @@ public class DOMRpcServiceTestBugfix560 { assertNotNull(moduleStream); final List rpcModels = Collections.singletonList(moduleStream); - final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(); - schemaContext = reactor.buildEffective(rpcModels); + schemaContext = YangParserTestUtils.parseYangStreams(rpcModels); } private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBITllIdentifier( @@ -110,7 +110,7 @@ public class DOMRpcServiceTestBugfix560 { private static InstanceIdentifier createBATllIdentifier( final String mount) { return InstanceIdentifier.builder(Top.class) - .child(TopLevelList.class, new TopLevelListKey(mount)).toInstance(); + .child(TopLevelList.class, new TopLevelListKey(mount)).build(); } @Test @@ -131,10 +131,13 @@ public class DOMRpcServiceTestBugfix560 { return Futures.immediateCheckedFuture(result); } }).register(); - final MountProviderInstance mountInstance = bindingMountPointService - .getMountPoint(BA_MOUNT_ID); - assertNotNull(mountInstance); - final OpendaylightTestRpcServiceService rpcService = mountInstance + + final Optional mountInstance = bindingMountPointService.getMountPoint(BA_MOUNT_ID); + assertTrue(mountInstance.isPresent()); + + final Optional rpcRegistry = mountInstance.get().getService(RpcConsumerRegistry.class); + assertTrue(rpcRegistry.isPresent()); + final OpendaylightTestRpcServiceService rpcService = rpcRegistry.get() .getRpcService(OpendaylightTestRpcServiceService.class); assertNotNull(rpcService);