Teach sal-remoterpc-connector to route actions
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / test / java / org / opendaylight / controller / remote / rpc / RemoteOpsProviderFactoryTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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 org.opendaylight.controller.remote.rpc;
9
10 import static org.mockito.MockitoAnnotations.initMocks;
11
12 import akka.actor.ActorSystem;
13 import org.junit.Assert;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.Mock;
17 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
18 import org.opendaylight.mdsal.dom.api.DOMActionService;
19 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
20 import org.opendaylight.mdsal.dom.api.DOMRpcService;
21
22 public class RemoteOpsProviderFactoryTest {
23
24     @Mock
25     private DOMRpcProviderService providerService;
26     @Mock
27     private DOMRpcService rpcService;
28     @Mock
29     private ActorSystem actorSystem;
30     @Mock
31     private RemoteOpsProviderConfig providerConfig;
32     @Mock
33     private DOMActionProviderService actionProviderService;
34     @Mock
35     private DOMActionService actionService;
36
37     @Before
38     public void setUp() {
39         initMocks(this);
40     }
41
42     @Test
43     public void testCreateInstance() {
44         Assert.assertNotNull(RemoteOpsProviderFactory
45                 .createInstance(providerService, rpcService, actorSystem, providerConfig,
46                         actionProviderService, actionService));
47     }
48
49     @Test(expected = NullPointerException.class)
50     public void testCreateInstanceMissingProvideService() {
51         RemoteOpsProviderFactory.createInstance(null, rpcService, actorSystem, providerConfig,
52                 actionProviderService, actionService);
53     }
54
55     @Test(expected = NullPointerException.class)
56     public void testCreateInstanceMissingRpcService() {
57         RemoteOpsProviderFactory.createInstance(providerService, null, actorSystem, providerConfig,
58                 actionProviderService, actionService);
59     }
60
61     @Test(expected = NullPointerException.class)
62     public void testCreateInstanceMissingActorSystem() {
63         RemoteOpsProviderFactory.createInstance(providerService, rpcService, null, providerConfig,
64                 actionProviderService, actionService);
65     }
66
67     @Test(expected = NullPointerException.class)
68     public void testCreateInstanceMissingProviderConfig() {
69         RemoteOpsProviderFactory.createInstance(providerService, rpcService, actorSystem, null,
70                 actionProviderService, actionService);
71     }
72
73     @Test(expected = NullPointerException.class)
74     public void testCreateInstanceMissingActionProvider() {
75         RemoteOpsProviderFactory.createInstance(providerService, rpcService, actorSystem, providerConfig,
76                 null, actionService);
77     }
78
79     @Test(expected = NullPointerException.class)
80     public void testCreateInstanceMissingActionService() {
81         RemoteOpsProviderFactory.createInstance(providerService, rpcService, actorSystem, providerConfig,
82                 actionProviderService, null);
83     }
84 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.