add unit tests for serviceHandlerProvider class
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerProviderTest.java
1 /*
2  * Copyright © 2019 Orange, 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 org.opendaylight.transportpce.servicehandler.impl;
9
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.times;
12 import static org.mockito.Mockito.verify;
13
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.Mock;
17 import org.mockito.MockitoAnnotations;
18 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
19 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
20 import org.opendaylight.transportpce.pce.service.PathComputationService;
21 import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
22 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
23 import org.opendaylight.transportpce.test.AbstractTest;
24
25
26 public class ServicehandlerProviderTest  extends AbstractTest {
27
28     @Mock
29     private PathComputationService pathComputationService;
30
31     @Mock
32     private RendererServiceOperations rendererServiceOperations;
33
34     @Mock
35     private NotificationPublishService notificationPublishService;
36
37     @Mock
38     RpcProviderRegistry rpcProviderRegistry;
39
40     @Mock
41     NetworkModelWavelengthService networkModelWavelengthService;
42
43     @Before
44     public void init() {
45         MockitoAnnotations.initMocks(this);
46
47     }
48
49     @Test
50     public void testInitRegisterServiceHandlerToRpcRegistry() {
51         ServicehandlerProvider provider =  new ServicehandlerProvider(
52                 getDataBroker(), rpcProviderRegistry,
53                 getNotificationService() , pathComputationService,
54                 rendererServiceOperations, networkModelWavelengthService,
55                 notificationPublishService);
56
57         provider.init();
58
59         verify(rpcProviderRegistry, times(1))
60                 .addRpcImplementation(any(), any(ServicehandlerImpl.class));
61     }
62
63
64
65
66
67 }