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.network.NetworkTransactionImpl;
15 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
16 import org.opendaylight.transportpce.common.network.RequestProcessor;
17 import org.opendaylight.transportpce.pce.utils.PceTestData;
18 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
19 import org.opendaylight.transportpce.pce.utils.TransactionUtils;
20 import org.opendaylight.transportpce.test.AbstractTest;
22 public class PceConstraintsCalcTest extends AbstractTest {
23 private static NetworkTransactionService networkTransactionService = null;
24 private DataBroker dataBroker = getDataBroker();
26 //TODO: review this test class. May be miss few assert.
28 public void setup() throws Exception {
29 // networkTransactionService = Mockito.mock(NetworkTransactionService.class);
30 PceTestUtils.writeNetworkIntoDataStore(dataBroker, getDataStoreContextUtil(),
31 TransactionUtils.getNetworkForSpanLoss());
32 networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(dataBroker));
36 public void testNoHardOrSoftConstrainsExists() {
37 PceTestData.getPCE_test2_request_54().getSoftConstraints();
38 new PceConstraintsCalc(PceTestData.getEmptyPCERequest(), networkTransactionService);
42 public void testHardConstrainsExists() {
43 new PceConstraintsCalc(
44 PceTestData.getPCE_simpletopology_test1_requestSetHardAndSoftConstrains(),
45 networkTransactionService);
49 public void testHardConstrainsExists1() {
50 new PceConstraintsCalc(
51 PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral(),
52 networkTransactionService);
56 public void testSoftConstrainsExists() {
57 new PceConstraintsCalc(PceTestData.getPCERequest(), networkTransactionService);
60 @Test(expected = Exception.class)
61 public void testHardConstrainsExists2() {
62 new PceConstraintsCalc(
63 PceTestData.build_diversity_from_request(PceTestData.getPCERequest()),
64 networkTransactionService);
68 public void testHardConstrainsExists3() {
69 new PceConstraintsCalc(PceTestData.getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
72 @Test(expected = Exception.class)
73 public void testHardConstrainsExists4() {
74 new PceConstraintsCalc(PceTestData.getPCE_test2_request_54(), networkTransactionService);