a51b3741f2f28f643bfc1927b01e883220e0fb95
[openflowplugin.git] / applications / forwardingrules-manager / src / test / java / test / mock / util / RpcProviderRegistryMock.java
1 /*
2  * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package test.mock.util;
9
10 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
12 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
13 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
20 import org.opendaylight.yangtools.concepts.ListenerRegistration;
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
22 import org.opendaylight.yangtools.yang.binding.RpcService;
23
24 public class RpcProviderRegistryMock implements RpcProviderRegistry {
25     @Override
26     public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface,
27             T implementation) throws IllegalStateException {
28         return null;
29     }
30
31     @Override
32     public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(
33             Class<T> serviceInterface, T implementation) throws IllegalStateException {
34         return null;
35     }
36
37     @Override
38     public <L extends RouteChangeListener<RpcContextIdentifier,
39         InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
40             L listener) {
41         return null;
42     }
43
44     @Override
45     public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
46         if (serviceInterface.equals(SalFlowService.class)) {
47             return (T) new SalFlowServiceMock();
48         } else if (serviceInterface.equals(SalGroupService.class)) {
49             return (T) new SalGroupServiceMock();
50         } else if (serviceInterface.equals(SalMeterService.class)) {
51             return (T) new SalMeterServiceMock();
52         } else if (serviceInterface.equals(SalTableService.class)) {
53             return (T) new SalTableServiceMock();
54         } else if (serviceInterface.equals(SalBundleService.class)) {
55             return (T) new SalBundleServiceMock();
56         } else if (serviceInterface.equals(ArbitratorReconcileService.class)) {
57             return (T) new ArbitratorReconcileServiceMock();
58         } else {
59             return null;
60         }
61     }
62 }