Search in sources :

Example 1 with RpcConsumerRegistry

use of org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry in project controller by opendaylight.

the class DOMRpcServiceTestBugfix560 method test.

@Test
public void test() throws ExecutionException, InterruptedException {
    // FIXME: This is made to only make sure instance identifier codec for path is instantiated.
    domMountPointService.createMountPoint(BI_MOUNT_ID).addService(DOMRpcService.class, new DOMRpcService() {

        @Override
        public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(final T arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final SchemaPath arg0, final NormalizedNode<?, ?> arg1) {
            final DOMRpcResult result = new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
            return Futures.immediateCheckedFuture(result);
        }
    }).register();
    final Optional<MountPoint> mountInstance = bindingMountPointService.getMountPoint(BA_MOUNT_ID);
    assertTrue(mountInstance.isPresent());
    final Optional<RpcConsumerRegistry> rpcRegistry = mountInstance.get().getService(RpcConsumerRegistry.class);
    assertTrue(rpcRegistry.isPresent());
    final OpendaylightTestRpcServiceService rpcService = rpcRegistry.get().getRpcService(OpendaylightTestRpcServiceService.class);
    assertNotNull(rpcService);
    try {
        final Future<RpcResult<Void>> result = rpcService.rockTheHouse(new RockTheHouseInputBuilder().build());
        assertTrue(result.get().isSuccessful());
    } catch (final IllegalStateException ex) {
        fail("OpendaylightTestRpcServiceService class doesn't contain rockTheHouse method!");
    }
}
Also used : DefaultDOMRpcResult(org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult) DOMRpcService(org.opendaylight.controller.md.sal.dom.api.DOMRpcService) DOMRpcResult(org.opendaylight.controller.md.sal.dom.api.DOMRpcResult) DefaultDOMRpcResult(org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult) RockTheHouseInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseInputBuilder) DOMRpcResult(org.opendaylight.controller.md.sal.dom.api.DOMRpcResult) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DefaultDOMRpcResult(org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult) DOMRpcException(org.opendaylight.controller.md.sal.dom.api.DOMRpcException) MountPoint(org.opendaylight.controller.md.sal.binding.api.MountPoint) DOMRpcAvailabilityListener(org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener) RpcConsumerRegistry(org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry) OpendaylightTestRpcServiceService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MountPoint (org.opendaylight.controller.md.sal.binding.api.MountPoint)1 DOMRpcAvailabilityListener (org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener)1 DOMRpcException (org.opendaylight.controller.md.sal.dom.api.DOMRpcException)1 DOMRpcResult (org.opendaylight.controller.md.sal.dom.api.DOMRpcResult)1 DOMRpcService (org.opendaylight.controller.md.sal.dom.api.DOMRpcService)1 DefaultDOMRpcResult (org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult)1 RpcConsumerRegistry (org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry)1 OpendaylightTestRpcServiceService (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService)1 RockTheHouseInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseInputBuilder)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)1 SchemaPath (org.opendaylight.yangtools.yang.model.api.SchemaPath)1