X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fimpl%2FPceServiceRPCImplTest.java;h=7cb93031d35c809dbcd39b431a349c7510b497e3;hb=2aa755154013d88a4aa99b1d84f38304a29fbc5e;hp=116551f65e4d7064da6c2e2e41d4b50de0e42b7e;hpb=de9c823434160ba713e598018cd1cfc09d8cbb08;p=transportpce.git diff --git a/pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java b/pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java index 116551f65..7cb93031d 100644 --- a/pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java +++ b/pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java @@ -10,21 +10,22 @@ package org.opendaylight.transportpce.pce.impl; import static org.junit.Assert.assertNotNull; +import java.util.concurrent.ExecutionException; import org.junit.Before; import org.junit.Test; -import org.mockito.Mockito; +import org.mockito.Mock; import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.transportpce.common.mapping.PortMapping; import org.opendaylight.transportpce.common.network.NetworkTransactionImpl; import org.opendaylight.transportpce.common.network.RequestProcessor; import org.opendaylight.transportpce.pce.service.PathComputationService; import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl; import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock; +import org.opendaylight.transportpce.pce.utils.PceTestData; +import org.opendaylight.transportpce.pce.utils.PceTestUtils; +import org.opendaylight.transportpce.pce.utils.TransactionUtils; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.CancelResourceReserveInputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInputBuilder; - - +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.CancelResourceReserveInputBuilder; public class PceServiceRPCImplTest extends AbstractTest { @@ -32,16 +33,20 @@ public class PceServiceRPCImplTest extends AbstractTest { private PathComputationService pathComputationService; private NotificationPublishService notificationPublishService; private NetworkTransactionImpl networkTransaction; - private RequestProcessor requestProcessor; private PceServiceRPCImpl pceServiceRPC; + @Mock + private PortMapping portMapping; @Before - public void setUp() { + public void setUp() throws ExecutionException, InterruptedException { + PceTestUtils.writeNetworkIntoDataStore(getDataBroker(), getDataStoreContextUtil(), + TransactionUtils.getNetworkForSpanLoss()); notificationPublishService = new NotificationPublishServiceMock(); - requestProcessor = Mockito.mock(RequestProcessor.class); - networkTransaction = new NetworkTransactionImpl(requestProcessor); - pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService); + networkTransaction = new NetworkTransactionImpl(new RequestProcessor(getDataBroker())); + pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService, + null, portMapping); pceServiceRPC = new PceServiceRPCImpl(pathComputationService); + } @Test @@ -52,9 +57,17 @@ public class PceServiceRPCImplTest extends AbstractTest { @Test public void testPathComputationRequest() { - PathComputationRequestInput pathComputationRequestInput = - new PathComputationRequestInputBuilder().build(); - assertNotNull(pceServiceRPC.pathComputationRequest(pathComputationRequestInput)); + assertNotNull(pceServiceRPC.pathComputationRequest(PceTestData.getPCERequest())); + } + + @Test + public void testPathComputationRerouteRequest() { + assertNotNull(pceServiceRPC.pathComputationRerouteRequest(PceTestData.getPCERerouteRequest())); } + @Test + public void testPathComputationRequestCoRoutingOrGeneral2() { + assertNotNull(pceServiceRPC.pathComputationRequest( + PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral2())); + } }