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