2 * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
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
9 package org.opendaylight.transportpce.pce.impl;
11 import static org.junit.Assert.assertNotNull;
13 import java.util.concurrent.ExecutionException;
14 import org.junit.Before;
15 import org.junit.Test;
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.pce.utils.PceTestData;
23 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
24 import org.opendaylight.transportpce.pce.utils.TransactionUtils;
25 import org.opendaylight.transportpce.test.AbstractTest;
26 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInputBuilder;
29 public class PceServiceRPCImplTest extends AbstractTest {
31 private PathComputationService pathComputationService;
32 private NotificationPublishService notificationPublishService;
33 private NetworkTransactionImpl networkTransaction;
34 private PceServiceRPCImpl pceServiceRPC;
37 public void setUp() throws ExecutionException, InterruptedException {
38 PceTestUtils.writeNetworkIntoDataStore(this.getDataBroker(), this.getDataStoreContextUtil(),
39 TransactionUtils.getNetworkForSpanLoss());
40 notificationPublishService = new NotificationPublishServiceMock();
41 networkTransaction = new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker()));
42 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
44 pceServiceRPC = new PceServiceRPCImpl(pathComputationService);
49 public void testCancelResourceReserve() {
50 CancelResourceReserveInputBuilder cancelResourceReserveInput = new CancelResourceReserveInputBuilder();
51 assertNotNull(pceServiceRPC.cancelResourceReserve(cancelResourceReserveInput.build()));
55 public void testPathComputationRequest() {
56 assertNotNull(pceServiceRPC.pathComputationRequest(PceTestData.getPCERequest()));
60 public void testPathComputationRequestCoRoutingOrGeneral2() {
61 assertNotNull(pceServiceRPC.pathComputationRequest(
62 PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral2()));