add tests for impl layer pce module
[transportpce.git] / pce / src / test / java / org / opendaylight / transportpce / pce / impl / PceServiceRPCImplTest.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.junit.Assert.assertNotNull;
12
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.mockito.Mockito;
16 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
17 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
18 import org.opendaylight.transportpce.common.network.RequestProcessor;
19 import org.opendaylight.transportpce.pce.service.PathComputationService;
20 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
21 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
22 import org.opendaylight.transportpce.test.AbstractTest;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInputBuilder;
24 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInputBuilder;
26
27
28
29
30 public class PceServiceRPCImplTest extends AbstractTest {
31
32     private PathComputationService pathComputationService;
33     private NotificationPublishService notificationPublishService;
34     private NetworkTransactionImpl networkTransaction;
35     private RequestProcessor requestProcessor;
36     private PceServiceRPCImpl pceServiceRPC;
37
38     @Before
39     public void setUp() {
40         notificationPublishService = new NotificationPublishServiceMock();
41         requestProcessor = Mockito.mock(RequestProcessor.class);
42         networkTransaction = new NetworkTransactionImpl(requestProcessor);
43         pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService);
44         pceServiceRPC = new PceServiceRPCImpl(pathComputationService);
45     }
46
47     @Test
48     public void testCancelResourceReserve() {
49         CancelResourceReserveInputBuilder cancelResourceReserveInput = new CancelResourceReserveInputBuilder();
50         assertNotNull(pceServiceRPC.cancelResourceReserve(cancelResourceReserveInput.build()));
51     }
52
53     @Test
54     public void testPathComputationRequest() {
55         PathComputationRequestInput pathComputationRequestInput =
56                 new PathComputationRequestInputBuilder().build();
57         assertNotNull(pceServiceRPC.pathComputationRequest(pathComputationRequestInput));
58     }
59
60 }