b6a01b4e29142047f325ac77c9b058fe361d1875
[openflowplugin.git] / applications / forwardingrules-manager / src / test / java / test / mock / util / RpcProviderRegistryMock.java
1 package test.mock.util;
2
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
4
5 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
6 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
7 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
8 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
14 import org.opendaylight.yangtools.yang.binding.RpcService;
15
16 public class RpcProviderRegistryMock implements RpcProviderRegistry {
17     @Override
18     public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
19         return null;
20     }
21
22     @Override
23     public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
24         return null;
25     }
26
27     @Override
28     public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(L listener) {
29         return null;
30     }
31
32     @Override
33     public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
34         if (serviceInterface.equals(SalFlowService.class)) {
35             return (T) new SalFlowServiceMock();
36         } else if (serviceInterface.equals(SalGroupService.class)) {
37             return (T) new SalGroupServiceMock();
38         } else if (serviceInterface.equals(SalMeterService.class)) {
39             return (T) new SalMeterServiceMock();
40         } else if (serviceInterface.equals(SalTableService.class)) {
41             return (T) new SalTableServiceMock();
42         } else {
43             return null;
44         }
45     }
46 }