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.constraints;
11 import org.junit.Before;
12 import org.junit.Ignore;
13 import org.junit.Test;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
16 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
17 import org.opendaylight.transportpce.common.network.RequestProcessor;
18 import org.opendaylight.transportpce.pce.utils.PceTestData;
19 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
20 import org.opendaylight.transportpce.pce.utils.TransactionUtils;
21 import org.opendaylight.transportpce.test.AbstractTest;
22 import org.opendaylight.transportpce.test.DataStoreContext;
25 public class PceConstraintsCalcTest extends AbstractTest {
26 private static PceConstraintsCalc pceConstraintsCalc = null;
27 private static NetworkTransactionService networkTransactionService = null;
28 private DataStoreContext dataStoreContext = this.getDataStoreContextUtil();
29 private DataBroker dataBroker = this.getDataBroker();
32 public void setup() throws Exception {
33 // networkTransactionService = Mockito.mock(NetworkTransactionService.class);
34 PceTestUtils.writeNetworkIntoDataStore(dataBroker, this.getDataStoreContextUtil(),
35 TransactionUtils.getNetworkForSpanLoss());
36 networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(dataBroker));
42 public void testNoHardOrSoftConstrainsExists() {
43 PceTestData.getPCE_test2_request_54().getSoftConstraints();
44 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
45 .getEmptyPCERequest(), networkTransactionService);
49 public void testHardConstrainsExists() {
50 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
51 .getPCE_simpletopology_test1_requestSetHardAndSoftConstrains(), networkTransactionService);
55 public void testHardConstrainsExists1() {
56 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
57 .getPathComputationRequestInputWithCoRoutingOrGeneral(), networkTransactionService);
61 public void testSoftConstrainsExists() {
62 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
63 .getPCERequest(), networkTransactionService);
66 @Test(expected = Exception.class)
67 public void testHardConstrainsExists2() {
68 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
69 .build_diversity_from_request(PceTestData.getPCERequest()), networkTransactionService);
73 public void testHardConstrainsExists3() {
74 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
75 .getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
78 @Test(expected = Exception.class)
79 public void testHardConstrainsExists4() {
80 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
81 .getPCE_test2_request_54(), networkTransactionService);