From 4f82c56ca62b266d007f240c7b57d11cadd5f0b3 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Tue, 18 Jun 2019 17:04:18 -0400 Subject: support no payload for alacarte deletes Swap to using HTTP Enumerations rather than ints Add Unit Tests to Service Instances endpoint Add Vnf Tests remove Abstract class Clean up usage of abstract classes Fix volume and module bean wiring issues Add logic to find create request if cloud not in AAI Updated network to take in version pathparam Additonal refactor of the endpoints Add missing license headers to all files Clean up public variable usage, move to protected Change-Id: Icdbdf78aa6c8af7a30fdff8a5805103f8df9364d Issue-ID: SO-2032 Signed-off-by: Benjamin, Max (mb388a) --- .../requestsdb/client/RequestsDbClientTest.java | 46 +++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'adapters') diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index 711606cfa1..49291b6863 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -33,9 +34,7 @@ import java.util.Map; import java.util.UUID; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import org.onap.so.adapters.requestsdb.RequestsAdapterBase; -import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; @@ -43,10 +42,7 @@ import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.onap.so.db.request.beans.RequestProcessingData; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; public class RequestsDbClientTest extends RequestsAdapterBase { @@ -86,6 +82,7 @@ public class RequestsDbClientTest extends RequestsAdapterBase { infraActiveRequests.setRequestStatus("IN_PROGRESS"); infraActiveRequests.setAction("create"); infraActiveRequests.setRequestAction("someaction"); + infraActiveRequests.setStartTime(new Timestamp(System.currentTimeMillis())); infraActiveRequests .setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances"); List cloudApiRequests = new ArrayList<>(); @@ -97,6 +94,34 @@ public class RequestsDbClientTest extends RequestsAdapterBase { cloudApiRequests.add(cloudRequest); infraActiveRequests.setCloudApiRequests(cloudApiRequests); requestsDbClient.save(infraActiveRequests); + + InfraActiveRequests infraActiveRequests2 = new InfraActiveRequests(); + infraActiveRequests2.setRequestId(UUID.randomUUID().toString()); + infraActiveRequests2.setOperationalEnvId(UUID.randomUUID().toString()); + infraActiveRequests2.setServiceInstanceId(UUID.randomUUID().toString()); + infraActiveRequests2.setServiceInstanceName("serviceInstanceNameTest"); + infraActiveRequests2.setVnfId(UUID.randomUUID().toString()); + infraActiveRequests2.setVnfName("vnfInstanceNameTest"); + infraActiveRequests2.setVfModuleId(UUID.randomUUID().toString()); + infraActiveRequests2.setVfModuleName("vfModuleInstanceNameTest"); + infraActiveRequests2.setVolumeGroupId(UUID.randomUUID().toString()); + infraActiveRequests2.setVolumeGroupName("volumeGroupInstanceNameTest"); + infraActiveRequests2.setNetworkId(UUID.randomUUID().toString()); + infraActiveRequests2.setNetworkName("networkInstanceNameTest"); + infraActiveRequests2.setConfigurationId(UUID.randomUUID().toString()); + infraActiveRequests2.setConfigurationName("configurationInstanceNameTest"); + infraActiveRequests2.setAicCloudRegion("1"); + infraActiveRequests2.setTenantId(UUID.randomUUID().toString()); + infraActiveRequests2.setRequestScope("operationalEnvironment"); + infraActiveRequests2.setRequestorId(UUID.randomUUID().toString()); + infraActiveRequests2.setSource("sourceTest"); + infraActiveRequests2.setOperationalEnvName(UUID.randomUUID().toString()); + infraActiveRequests2.setRequestStatus("IN_PROGRESS"); + infraActiveRequests2.setAction("create"); + infraActiveRequests2.setRequestAction("someaction"); + infraActiveRequests2.setStartTime(new Timestamp(System.currentTimeMillis())); + infraActiveRequests + .setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances"); } private void verifyOperationStatus(OperationStatus request, OperationStatus response) { @@ -278,4 +303,15 @@ public class RequestsDbClientTest extends RequestsAdapterBase { assertNotNull(requestProcessingData); } + + @Test + public void getInfraActiveRequestbyRequestId_Filters_Test() { + Map filters = new HashMap<>(); + filters.put("requestStatus", new String[] {"EQ", "IN_PROGRESS"}); + filters.put("action", new String[] {"EQ", "create"}); + filters.put("serviceInstanceId", new String[] {"EQ", infraActiveRequests.getServiceInstanceId()}); + List infraActiveRequestsResponse = requestsDbClient.getRequest(filters); + + verifyInfraActiveRequests(infraActiveRequestsResponse.get(0)); + } } -- cgit 1.2.3-korg