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 networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(dataBroker));
33 PceTestUtils.writeNetworkIntoDataStore(dataBroker, dataStoreContext, TransactionUtils.getNetworkForSpanLoss());
38 public void testNoHardOrSoftConstrainsExists() {
39 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
40 .getEmptyPCERequest(), networkTransactionService);
43 @Test(expected = NullPointerException.class)
44 public void testHardConstrainsExists() {
45 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
46 .getPCE_test2_request_54(), networkTransactionService);
50 public void testSoftConstrainsExists() {
51 pceConstraintsCalc = new PceConstraintsCalc(PceTestData
52 .getPCERequest(), networkTransactionService);