From c0e81367ca4b30a1ce92aeeaaf62ecb9c8ec7a29 Mon Sep 17 00:00:00 2001 From: MD IRSHAD SHEIKH Date: Fri, 6 May 2022 16:17:27 +0530 Subject: Add Junit coverage Issue-ID: SO-3707 Signed-off-by: MD IRSHAD SHEIKH Change-Id: If5ca92abc74d5d46a8e4269d4962edb6b9a940e8 --- .../service/impl/NssmfManagerServiceImplTest.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/so-nssmf-adapter-application/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java b/so-nssmf-adapter-application/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java index df49953..76d2a05 100644 --- a/so-nssmf-adapter-application/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java +++ b/so-nssmf-adapter-application/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java @@ -519,6 +519,67 @@ public class NssmfManagerServiceImplTest { assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067"); } + @Test + public void modifyAnNssi() throws Exception { + modifyNssi(ACCESS); + } + + + @Test + public void modifyCnNssi() throws Exception { + modifyNssi(CORE); + } + + public void modifyNssi(NetworkType domainType) throws Exception { + NssmfInfo nssmf = new NssmfInfo(); + nssmf.setUserName("nssmf-user"); + nssmf.setPassword("nssmf-pass"); + nssmf.setPort("8080"); + nssmf.setIpAddress("127.0.0.1"); + nssmf.setUrl("http://127.0.0.1:8080"); + + NssiResponse nssiRes = new NssiResponse(); + nssiRes.setJobId("4b45d919816ccaa2b762df5120f72067"); + nssiRes.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX"); + + TokenResponse token = new TokenResponse(); + token.setAccessToken("7512eb3feb5249eca5ddd742fedddd39"); + token.setExpires(1800); + + postStream = new ByteArrayInputStream(marshal(nssiRes).getBytes(UTF_8)); + tokenStream = new ByteArrayInputStream(marshal(token).getBytes(UTF_8)); + + NssmfAdapterNBIRequest nbiRequest = createNbiRequest(domainType); + + ServiceInfo serviceInfo = new ServiceInfo(); + serviceInfo.setServiceUuid("8ee5926d-720b-4bb2-86f9-d20e921c143b"); + serviceInfo.setServiceInvariantUuid("e75698d9-925a-4cdd-a6c0-edacbe6a0b51"); + serviceInfo.setGlobalSubscriberId("5GCustomer"); + serviceInfo.setServiceType("5G"); + serviceInfo.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX"); + serviceInfo.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX"); + + AllocateCnNssi cnNssi = new AllocateCnNssi(); + cnNssi.setNssiId("NSST-C-001-HDBNJ-NSSMF-01-A-ZX"); + + AllocateAnNssi anNssi = new AllocateAnNssi(); + anNssi.setNssiId("NSST-C-001-HDBNJ-NSSMF-01-A-ZX"); + + nbiRequest.setServiceInfo(serviceInfo); + nbiRequest.setAllocateCnNssi(cnNssi); + nbiRequest.setAllocateAnNssi(anNssi); + + createCommonMock(200, nssmf); + ResponseEntity res = nssiManagerService.allocateNssi(nbiRequest); + assertNotNull(res); + assertNotNull(res.getBody()); + NssiResponse allRes = unMarshal(res.getBody().toString(), NssiResponse.class); + if (!domainType.equals(ACCESS)) { + assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067"); + } + assertNotNull(allRes); + } + @Test public void testNssmfRequest() throws ApplicationException { NssmfRequest nssmfRequest = new NssmfRequest(); -- cgit 1.2.3-korg