update PceLink test object and NetworkService
[transportpce.git] / pce / src / test / java / org / opendaylight / transportpce / pce / constraints / PceConstraintsCalcTest.java
1 /*
2  * Copyright © 2020 Orange Labs, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.transportpce.pce.constraints;
10
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;
22
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();
28
29     @Before
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());
34
35     }
36
37     @Test
38     public void testNoHardOrSoftConstrainsExists() {
39         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
40                 .getEmptyPCERequest(), networkTransactionService);
41     }
42
43     @Test(expected = NullPointerException.class)
44     public void testHardConstrainsExists() {
45         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
46                 .getPCE_test2_request_54(), networkTransactionService);
47     }
48
49     @Test
50     public void testSoftConstrainsExists() {
51         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
52                 .getPCERequest(), networkTransactionService);
53     }
54
55 }