Merge "Move common DataStoreContext and co to test-common"
[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.Ignore;
13 import org.junit.Test;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
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 import org.opendaylight.transportpce.test.DataStoreContext;
23
24 @Ignore
25 public class PceConstraintsCalcTest extends AbstractTest {
26     private static PceConstraintsCalc pceConstraintsCalc = null;
27     private static NetworkTransactionService networkTransactionService = null;
28     private DataStoreContext dataStoreContext = this.getDataStoreContextUtil();
29     private DataBroker dataBroker = this.getDataBroker();
30
31     @Before
32     public void setup() throws Exception {
33         // networkTransactionService = Mockito.mock(NetworkTransactionService.class);
34         PceTestUtils.writeNetworkIntoDataStore(dataBroker, this.getDataStoreContextUtil(),
35                 TransactionUtils.getNetworkForSpanLoss());
36         networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(dataBroker));
37
38
39     }
40
41     @Test
42     public void testNoHardOrSoftConstrainsExists() {
43         PceTestData.getPCE_test2_request_54().getSoftConstraints();
44         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
45                 .getEmptyPCERequest(), networkTransactionService);
46     }
47
48     @Test()
49     public void testHardConstrainsExists() {
50         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
51                 .getPCE_simpletopology_test1_requestSetHardAndSoftConstrains(), networkTransactionService);
52     }
53
54     @Test()
55     public void testHardConstrainsExists1() {
56         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
57                 .getPathComputationRequestInputWithCoRoutingOrGeneral(), networkTransactionService);
58     }
59
60     @Test
61     public void testSoftConstrainsExists() {
62         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
63                 .getPCERequest(), networkTransactionService);
64     }
65
66     @Test(expected = Exception.class)
67     public void testHardConstrainsExists2() {
68         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
69                 .build_diversity_from_request(PceTestData.getPCERequest()), networkTransactionService);
70     }
71
72     @Test()
73     public void testHardConstrainsExists3() {
74         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
75                 .getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
76     }
77
78     @Test(expected = Exception.class)
79     public void testHardConstrainsExists4() {
80         pceConstraintsCalc = new PceConstraintsCalc(PceTestData
81                 .getPCE_test2_request_54(), networkTransactionService);
82     }
83
84 }