Code Review
/
transportpce.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Do not use RpcService in TPCE pce module
[transportpce.git]
/
pce
/
src
/
test
/
java
/
org
/
opendaylight
/
transportpce
/
pce
/
impl
/
PceServiceRPCImplTest.java
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 7cb93031d35c809dbcd39b431a349c7510b497e3..36afe64203ccead2f1b350f89e2fea1409914cd9 100644
(file)
--- a/
pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java
+++ b/
pce/src/test/java/org/opendaylight/transportpce/pce/impl/PceServiceRPCImplTest.java
@@
-8,16
+8,22
@@
package org.opendaylight.transportpce.pce.impl;
package org.opendaylight.transportpce.pce.impl;
-import static org.junit.Assert.assertNotNull;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutionException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
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.service.PathComputationService;
import org.opendaylight.transportpce.pce.service.PathComputationServiceImpl;
import org.opendaylight.transportpce.pce.utils.NotificationPublishServiceMock;
@@
-27,7
+33,7
@@
import org.opendaylight.transportpce.pce.utils.TransactionUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.CancelResourceReserveInputBuilder;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.CancelResourceReserveInputBuilder;
-
+@ExtendWith(MockitoExtension.class)
public class PceServiceRPCImplTest extends AbstractTest {
private PathComputationService pathComputationService;
public class PceServiceRPCImplTest extends AbstractTest {
private PathComputationService pathComputationService;
@@
-36,38
+42,45
@@
public class PceServiceRPCImplTest extends AbstractTest {
private PceServiceRPCImpl pceServiceRPC;
@Mock
private PortMapping portMapping;
private PceServiceRPCImpl pceServiceRPC;
@Mock
private PortMapping portMapping;
+ @Mock
+ private RpcProviderService rpcProviderService;
- @Before
- public void setUp() throws ExecutionException, InterruptedException {
+
+ @BeforeEach
+ void setUp() throws ExecutionException, InterruptedException {
PceTestUtils.writeNetworkIntoDataStore(getDataBroker(), getDataStoreContextUtil(),
TransactionUtils.getNetworkForSpanLoss());
notificationPublishService = new NotificationPublishServiceMock();
PceTestUtils.writeNetworkIntoDataStore(getDataBroker(), getDataStoreContextUtil(),
TransactionUtils.getNetworkForSpanLoss());
notificationPublishService = new NotificationPublishServiceMock();
- networkTransaction = new NetworkTransactionImpl(
new RequestProcessor(getDataBroker()
));
+ networkTransaction = new NetworkTransactionImpl(
getDataBroker(
));
pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
null, portMapping);
pathComputationService = new PathComputationServiceImpl(networkTransaction, notificationPublishService,
null, portMapping);
- pceServiceRPC = new PceServiceRPCImpl(pathComputationService);
+ pceServiceRPC = new PceServiceRPCImpl(rpcProviderService, pathComputationService);
+ }
+ @Test
+ void testRpcRegistration() {
+ verify(rpcProviderService, times(1)).registerRpcImplementations(any());
}
@Test
}
@Test
-
public
void testCancelResourceReserve() {
+ void testCancelResourceReserve() {
CancelResourceReserveInputBuilder cancelResourceReserveInput = new CancelResourceReserveInputBuilder();
assertNotNull(pceServiceRPC.cancelResourceReserve(cancelResourceReserveInput.build()));
}
@Test
CancelResourceReserveInputBuilder cancelResourceReserveInput = new CancelResourceReserveInputBuilder();
assertNotNull(pceServiceRPC.cancelResourceReserve(cancelResourceReserveInput.build()));
}
@Test
-
public
void testPathComputationRequest() {
+ void testPathComputationRequest() {
assertNotNull(pceServiceRPC.pathComputationRequest(PceTestData.getPCERequest()));
}
@Test
assertNotNull(pceServiceRPC.pathComputationRequest(PceTestData.getPCERequest()));
}
@Test
-
public
void testPathComputationRerouteRequest() {
+ void testPathComputationRerouteRequest() {
assertNotNull(pceServiceRPC.pathComputationRerouteRequest(PceTestData.getPCERerouteRequest()));
}
@Test
assertNotNull(pceServiceRPC.pathComputationRerouteRequest(PceTestData.getPCERerouteRequest()));
}
@Test
-
public
void testPathComputationRequestCoRoutingOrGeneral2() {
- assertNotNull(
pceServiceRPC.pathComputationRequest(
-
PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral2()));
+ void testPathComputationRequestCoRoutingOrGeneral2() {
+ assertNotNull(
+
pceServiceRPC.pathComputationRequest(
PceTestData.getPathComputationRequestInputWithCoRoutingOrGeneral2()));
}
}
}
}