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.Ignore;
16 import org.junit.Test;
17 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
18 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
19 import org.opendaylight.transportpce.common.network.RequestProcessor;
20 import org.opendaylight.transportpce.pce.service.PathComputationService;
21 import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
22 import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
23 import org.opendaylight.transportpce.pce.utils.PceTestData;
24 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
25 import org.opendaylight.transportpce.pce.utils.TransactionUtils;
26 import org.opendaylight.transportpce.test.AbstractTest;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInputBuilder;
32 public class PceServiceRPCImplTest extends AbstractTest {
34 private PathComputationService pathComputationService;
35 private NotificationPublishService notificationPublishService;
36 private NetworkTransactionImpl networkTransaction;
37 private PceServiceRPCImpl pceServiceRPC;
40 public void setUp() throws ExecutionException, InterruptedException {
41 PceTestUtils.writeNetworkIntoDataStore(this.getDataBroker(), this.getDataStoreContextUtil(),
42 TransactionUtils.getNetworkForSpanLoss());
43 notificationPublishService = new NotificationPublishServiceMock();
44 networkTransaction = new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker()));
45 pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService);
46 pceServiceRPC = new PceServiceRPCImpl(pathComputationService);
51 public void testCancelResourceReserve() {
52 CancelResourceReserveInputBuilder cancelResourceReserveInput = new CancelResourceReserveInputBuilder();
53 assertNotNull(pceServiceRPC.cancelResourceReserve(cancelResourceReserveInput.build()));
57 public void testPathComputationRequest() {
58 assertNotNull(pceServiceRPC.pathComputationRequest(PceTestData.getPCERequest()));
62 public void testPathComputationRequestCoRoutingOrGeneral2() {
63 assertNotNull(pceServiceRPC.pathComputationRequest(
64 PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral2()));