9b46f6c0c751cf2c811b2e7446406a0a1bc0c4a9
[transportpce.git] / pce / src / test / java / org / opendaylight / transportpce / pce / impl / PceProviderTest.java
1 /*
2  * Copyright © 2020 Orange Labs, 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
9 package org.opendaylight.transportpce.pce.impl;
10
11 import static org.mockito.ArgumentMatchers.anyObject;
12 import static org.mockito.ArgumentMatchers.eq;
13
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.junit.Before;
16 import org.junit.Ignore;
17 import org.junit.Test;
18 import org.mockito.Mockito;
19 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
20 import org.opendaylight.mdsal.binding.api.RpcProviderService;
21 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
22 import org.opendaylight.transportpce.common.network.RequestProcessor;
23 import org.opendaylight.transportpce.pce.service.PathComputationService;
24 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
25 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
26 import org.opendaylight.transportpce.test.AbstractTest;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceService;
28 import org.opendaylight.yangtools.concepts.ObjectRegistration;
29
30 @Ignore
31 public class PceProviderTest extends AbstractTest {
32
33     private RpcProviderService rpcService;
34     private PathComputationService pathComputationService;
35     private NotificationPublishService notificationPublishService;
36     private NetworkTransactionImpl networkTransaction;
37     private RequestProcessor requestProcessor;
38     private ObjectRegistration<TransportpcePceService> rpcRegistration;
39     private PceProvider pceProvider;
40
41     @Before
42     public void setUp() {
43         rpcService = Mockito.mock(RpcProviderService.class);
44         notificationPublishService = new NotificationPublishServiceMock();
45         requestProcessor = Mockito.mock(RequestProcessor.class);
46         networkTransaction = new NetworkTransactionImpl(requestProcessor);
47         pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
48                 null);
49         pceProvider = new PceProvider(rpcService, pathComputationService);
50     }
51
52     @Test
53     public void testInit() {
54         this.rpcRegistration = new ObjectRegistration<TransportpcePceService>() {
55             @NonNull
56             @Override
57             public TransportpcePceService getInstance() {
58                 return new PceServiceRPCImpl(pathComputationService);
59             }
60
61             @Override
62             public void close() {
63
64             }
65         };
66
67
68         Mockito
69                 .when(rpcService
70                         .registerRpcImplementation(eq(TransportpcePceService.class), anyObject()))
71                 .thenReturn(rpcRegistration);
72         pceProvider.init();
73         pceProvider.close();
74     }
75
76 }