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.Test;
13 import org.opendaylight.mdsal.binding.api.DataBroker;
14 import org.opendaylight.transportpce.common.DataStoreContext;
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;
23 public class PceConstraintsCalcTest extends AbstractTest {
24 private static PceConstraintsCalc pceConstraintsCalc = null;
25 private static NetworkTransactionService networkTransactionService = null;
26 private DataStoreContext dataStoreContext = this.getDataStoreContextUtil();
27 private DataBroker dataBroker = this.getDataBroker();
30 public void setup() throws Exception {
31 // networkTransactionService = Mockito.mock(NetworkTransactionService.class);
32 PceTestUtils.writeNetworkIntoDataStore(dataBroker, this.getDataStoreContextUtil(),
33 TransactionUtils.getNetworkForSpanLoss());
34 networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(dataBroker));
40 public void testNoHardOrSoftConstrainsExists() {
41 PceTestData.getPCE_test2_request_54().getSoftConstraints();
42 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
43 .getEmptyPCERequest(), networkTransactionService);
47 public void testHardConstrainsExists() {
48 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
49 .getPCE_simpletopology_test1_requestSetHardAndSoftConstrains(), networkTransactionService);
53 public void testHardConstrainsExists1() {
54 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
55 .getPathComputationRequestInputWithCoRoutingOrGeneral(), networkTransactionService);
59 public void testSoftConstrainsExists() {
60 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
61 .getPCERequest(), networkTransactionService);
64 @Test(expected = Exception.class)
65 public void testHardConstrainsExists2() {
66 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
67 .build_diversity_from_request(PceTestData.getPCERequest()), networkTransactionService);
71 public void testHardConstrainsExists3() {
72 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
73 .getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
76 @Test(expected = Exception.class)
77 public void testHardConstrainsExists4() {
78 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
79 .getPCE_test2_request_54(), networkTransactionService);