1 package test.mock.util;
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
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;
16 public class RpcProviderRegistryMock implements RpcProviderRegistry {
18 public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
23 public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
28 public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(L listener) {
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();