diff options
author | Haddox, Anthony (ah0647) <ah0647@att.com> | 2021-01-05 18:00:02 +0000 |
---|---|---|
committer | Haddox, Anthony (ah0647) <ah0647@att.com> | 2021-01-05 18:00:02 +0000 |
commit | 32ce2c60bd58043c18d87f7b14427aa573e700f6 (patch) | |
tree | 43744c11c7003a38a915d9dab41e653e7b9638ee /ms/generic-resource-api/src/test | |
parent | 8b3b64274acaaaf487c2169933aa03d6d610349f (diff) |
[SDNC-1452]VNF Topology Async
Added async method to VNF Topology Operation
Signed-off-by: Haddox, Anthony (ah0647) <ah0647@att.com>
Issue-ID: SDNC-1452
Change-Id: If983153f6400491343c649aea7778011cc540de5
Diffstat (limited to 'ms/generic-resource-api/src/test')
-rw-r--r-- | ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java index 0a5e8a8..60dc811 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import com.fasterxml.jackson.databind.ObjectMapper; @@ -52,6 +53,9 @@ public class OperationsApiControllerTest { @Autowired OperationalServicesRepository operationalServicesRepository; + @Autowired + OperationsApiController operationsApiController; + @BeforeClass public static void setUp() throws Exception { System.out.println("OperationsApiControllerTest: Setting serviceLogicProperties, serviceLogicDirectory and sdnc.config.dir"); @@ -126,7 +130,32 @@ public class OperationsApiControllerTest { assertEquals(200, mvcResult.getResponse().getStatus()); assertEquals(1, configServicesRepository.count()); assertEquals(0, operationalServicesRepository.count()); + } + + @Test + public void serviceTopologyOperationAsync() throws Exception { + configServicesRepository.deleteAll(); + GenericResourceApiVnfOperationInformationBodyparam inputParam = operationsApiController.getObjectMapper().get().readValue(readFileContent("src/test/resources/vnf-assign-rpc.json"), GenericResourceApiVnfOperationInformationBodyparam.class); + operationsApiController.processAsyncVnfTopologyOperation("vnf-topology-operation",inputParam); + loadVnfData("src/test/resources/vnf-data.json"); + inputParam.getInput().getServiceInformation().setServiceInstanceId("98f189dd-2971-46f5-b4f1-1a9a323f39a4"); + operationsApiController.processAsyncVnfTopologyOperation("vnf-topology-operation",inputParam); + configServicesRepository.deleteAll(); + } + + private void loadVnfData(String path) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + String content = readFileContent(path); + GenericResourceApiServicedataServiceData svcData = new GenericResourceApiServicedataServiceData(); + GenericResourceApiServicedataServicedataVnfsVnf vnfData = objectMapper.readValue(content, GenericResourceApiServicedataServicedataVnfsVnf.class); + svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); + svcData.getVnfs().setVnf(new ArrayList<>()); + svcData.getVnfs().addVnfItem(vnfData); + ConfigServices newService = new ConfigServices(); + newService.setSvcData(objectMapper.writeValueAsString(svcData)); + newService.setSvcInstanceId("98f189dd-2971-46f5-b4f1-1a9a323f39a4"); + configServicesRepository.save(newService); } @Test |