summaryrefslogtreecommitdiffstats
path: root/adapters/mso-requests-db-adapter/src/test
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2019-06-18 17:04:18 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-18 17:18:16 -0400
commit4f82c56ca62b266d007f240c7b57d11cadd5f0b3 (patch)
tree6452b1e22db9e70a7e8636689af5fe4b7ff4e7ee /adapters/mso-requests-db-adapter/src/test
parent7c69f07593a8c7474bd7a69a65979dc0635f1526 (diff)
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) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-requests-db-adapter/src/test')
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java46
1 files changed, 41 insertions, 5 deletions
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> 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<String, String[]> 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<InfraActiveRequests> infraActiveRequestsResponse = requestsDbClient.getRequest(filters);
+
+ verifyInfraActiveRequests(infraActiveRequestsResponse.get(0));
+ }
}