Migrate to Al and reactivate some Junit tests
[transportpce.git] / pce / src / test / java / org / opendaylight / transportpce / pce / PceSendingPceRPCsTest.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 package org.opendaylight.transportpce.pce;
9
10
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Ignore;
14 import org.junit.Test;
15 import org.junit.runner.RunWith;
16 import org.mockito.Mock;
17 import org.mockito.junit.MockitoJUnitRunner;
18 import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
19 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
20 import org.opendaylight.transportpce.common.network.RequestProcessor;
21 import org.opendaylight.transportpce.pce.gnpy.ConnectToGnpyServer;
22 import org.opendaylight.transportpce.pce.gnpy.JerseyServer;
23 import org.opendaylight.transportpce.pce.utils.PceTestData;
24 import org.opendaylight.transportpce.pce.utils.PceTestUtils;
25 import org.opendaylight.transportpce.test.AbstractTest;
26 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
27
28 @Ignore
29 @RunWith(MockitoJUnitRunner.class)
30 public class PceSendingPceRPCsTest extends AbstractTest {
31
32     private PceSendingPceRPCs pceSendingPceRPCs;
33     private NetworkTransactionImpl networkTransaction;
34     @Mock
35     private YangParserFactory yangParserFactory;
36     @Mock
37     private BindingDOMCodecServices bindingDOMCodecServices;
38     private JerseyServer jerseyServer = new JerseyServer();
39
40
41     @Before
42     public void setUp() {
43         networkTransaction = new NetworkTransactionImpl(new RequestProcessor(this.getDataBroker()));
44         PceTestUtils.writeNetworkInDataStore(this.getDataBroker());
45         pceSendingPceRPCs = new PceSendingPceRPCs(PceTestData.getPCE_test1_request_54(),
46                         networkTransaction, bindingDOMCodecServices);
47     }
48
49     @Test
50     public void cancelResourceReserve() {
51         pceSendingPceRPCs.cancelResourceReserve();
52         Assert.assertTrue("Success should equal to true", pceSendingPceRPCs.getSuccess());
53     }
54
55     @Test
56     public void pathComputationTest() throws Exception {
57         jerseyServer.setUp();
58         pceSendingPceRPCs =
59                 new PceSendingPceRPCs(PceTestData.getGnpyPCERequest("XPONDER-1", "XPONDER-2"),
60                         networkTransaction, null);
61
62         pceSendingPceRPCs.pathComputation();
63         ConnectToGnpyServer connectToGnpy = new ConnectToGnpyServer();
64         Assert.assertTrue(connectToGnpy.isGnpyURLExist());
65         jerseyServer.tearDown();
66
67     }
68
69     @Test
70     public void checkMessage() {
71         Assert.assertNull(pceSendingPceRPCs.getMessage());
72     }
73
74     @Test
75     public void responseCodeTest() {
76         Assert.assertNull(pceSendingPceRPCs.getResponseCode());
77     }
78
79     @Test
80     public void gnpyAtoZ() {
81         Assert.assertNull(pceSendingPceRPCs.getGnpyAtoZ());
82     }
83
84     @Test
85     public void getGnpyZtoA() {
86         Assert.assertNull(pceSendingPceRPCs.getGnpyZtoA());
87     }
88
89
90 }