Switch to MD-SAL APIs
[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 java.util.Set;
11 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
12 import org.opendaylight.mdsal.binding.api.RpcProviderService;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
19 import org.opendaylight.yangtools.concepts.ObjectRegistration;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
21 import org.opendaylight.yangtools.yang.binding.RpcService;
22
23 public class RpcProviderRegistryMock implements RpcConsumerRegistry, RpcProviderService {
24     @Override
25     public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
26             T implementation) {
27         return null;
28     }
29
30     @Override
31     public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
32             T implementation, Set<InstanceIdentifier<?>> paths) {
33         return null;
34     }
35
36     @Override
37     public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
38         if (serviceInterface.equals(SalFlowService.class)) {
39             return (T) new SalFlowServiceMock();
40         } else if (serviceInterface.equals(SalGroupService.class)) {
41             return (T) new SalGroupServiceMock();
42         } else if (serviceInterface.equals(SalMeterService.class)) {
43             return (T) new SalMeterServiceMock();
44         } else if (serviceInterface.equals(SalTableService.class)) {
45             return (T) new SalTableServiceMock();
46         } else if (serviceInterface.equals(SalBundleService.class)) {
47             return (T) new SalBundleServiceMock();
48         } else if (serviceInterface.equals(ArbitratorReconcileService.class)) {
49             return (T) new ArbitratorReconcileServiceMock();
50         } else {
51             return null;
52         }
53     }
54
55
56 }