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
8 package org.opendaylight.transportpce.pce;
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;
29 @RunWith(MockitoJUnitRunner.class)
30 public class PceSendingPceRPCsTest extends AbstractTest {
32 private PceSendingPceRPCs pceSendingPceRPCs;
33 private NetworkTransactionImpl networkTransaction;
35 private YangParserFactory yangParserFactory;
37 private BindingDOMCodecServices bindingDOMCodecServices;
38 private JerseyServer jerseyServer = new JerseyServer();
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);
50 public void cancelResourceReserve() {
51 pceSendingPceRPCs.cancelResourceReserve();
52 Assert.assertTrue("Success should equal to true", pceSendingPceRPCs.getSuccess());
56 public void pathComputationTest() throws Exception {
59 new PceSendingPceRPCs(PceTestData.getGnpyPCERequest("XPONDER-1", "XPONDER-2"),
60 networkTransaction, null);
62 pceSendingPceRPCs.pathComputation();
63 ConnectToGnpyServer connectToGnpy = new ConnectToGnpyServer();
64 Assert.assertTrue(connectToGnpy.isGnpyURLExist());
65 jerseyServer.tearDown();
70 public void checkMessage() {
71 Assert.assertNull(pceSendingPceRPCs.getMessage());
75 public void responseCodeTest() {
76 Assert.assertNull(pceSendingPceRPCs.getResponseCode());
80 public void gnpyAtoZ() {
81 Assert.assertNull(pceSendingPceRPCs.getGnpyAtoZ());
85 public void getGnpyZtoA() {
86 Assert.assertNull(pceSendingPceRPCs.getGnpyZtoA());