aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql1
11 files changed, 160 insertions, 67 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 7bb1bdf71a..6efcdc47e5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -89,7 +88,7 @@ public class ApiExceptionTest extends BaseTest {
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index bb78c822f7..1943b42404 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -29,6 +29,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
import java.io.IOException;
import java.util.Map;
@@ -44,7 +53,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.springframework.http.HttpEntity;
@@ -64,8 +72,6 @@ public class ManualTasksTest extends BaseTest{
private final String basePath = "/tasks/v1/";
-
-
@Test
public void testCreateOpEnvObjectMapperError() throws IOException {
TestAppender.events.clear();
@@ -88,8 +94,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -116,22 +122,22 @@ public class ManualTasksTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
@@ -151,8 +157,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + "55" + "/complete");
@@ -187,8 +193,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -227,8 +233,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index d6c794ef2e..17fa011c93 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -34,6 +34,18 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID;
+
import java.io.File;
import java.io.IOException;
@@ -59,8 +71,7 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -117,11 +128,11 @@ public class ServiceInstancesTest extends BaseTest{
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.CLIENT_ID, "VID");
- headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ headers.set(CLIENT_ID, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
initialPort = initialUrl.getPort();
@@ -263,22 +274,22 @@ public class ServiceInstancesTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
@@ -2387,14 +2398,14 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
- assertEquals(response.getHeaders().get(MsoLogger.TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
for(ILoggingEvent logEvent : TestAppender.events){
if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertEquals("VID",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("VID",mdc.get(PARTNERNAME));
}
}
}
@@ -2451,7 +2462,7 @@ public class ServiceInstancesTest extends BaseTest{
public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{
HttpHeaders noPartnerHeaders = new HttpHeaders();
noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4");
- noPartnerHeaders.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ noPartnerHeaders.set(REQUESTOR_ID, "xxxxxx");
uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c";
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
//then
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
index b799394b7a..78315e9fad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
@@ -92,6 +92,7 @@ public class AAIClientHelperTest extends BaseTest{
Map<String, String> payload = new HashMap<String, String>();
payload.put("tenant-context", "Test");
payload.put("workload-context", "ECOMPL_PSL");
+ payload.put("operational-environment-status", "ACTIVE");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
index 3e06275fca..6fda6afc50 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
@@ -41,6 +41,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class ActivateVnfDBHelperTest extends BaseTest{
String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
String requestId = "TEST_requestId";
String origRequestId = "TEST_requestId";
@@ -81,6 +82,7 @@ public class ActivateVnfDBHelperTest extends BaseTest{
expectedServiceModelStatus.setRecoveryAction(recoveryActionRetry);
expectedServiceModelStatus.setRetryCount(new Integer(retryCountThree));
expectedServiceModelStatus.setWorkloadContext(workloadContext1);
+ expectedServiceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
}
@Test
@@ -122,7 +124,8 @@ public class ActivateVnfDBHelperTest extends BaseTest{
statusOk,
recoveryActionRetry,
retryCountThree,
- workloadContext1);
+ workloadContext1,
+ vnfOperationalEnvironmentId);
assertThat(serviceModelStatus1, sameBeanAs(expectedServiceModelStatus));
// prepare updated expected object
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
index 18af7fbaa0..418ed4270a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
@@ -74,6 +74,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String operationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d";
+ private final String vnfOperationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "PVT";
String recoveryActionRetry = "RETRY";
@@ -86,7 +87,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
@Before
public void init(){
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e66d\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
@@ -130,7 +131,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
requestParameters.setWorkloadContext(workloadContext);
requestDetails.setRequestParameters(requestParameters);
- request.setOperationalEnvironmentId(operationalEnvironmentId);
+ request.setOperationalEnvironmentId(vnfOperationalEnvironmentId);
request.setRequestDetails(requestDetails);
JSONObject jsonObject = new JSONObject();
@@ -139,7 +140,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonObject.put("distributionId", sdcDistributionId);
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
activateVnf.execute(requestId, request);
@@ -165,7 +166,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@Test
@@ -205,7 +206,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
thrown.expect(ValidateException.class);
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index a26848bf21..6722941f95 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
@@ -48,6 +49,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
+import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
@@ -66,6 +68,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String requestIdOrig = "TEST_requestIdOrig";
private final String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ private final String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "TEST_workloadContext";
private final String recoveryActionRetry = "RETRY";
@@ -81,6 +84,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
private final String statusSent = "SENT";
+ String json = "{\"operational-environment-status\" : \"INACTIVE\"}";
private final ObjectMapper mapper = new ObjectMapper();
@@ -96,6 +100,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
serviceModelDb.setRequestId(requestIdOrig);
serviceModelDb.setServiceModelVersionId(serviceModelVersionId1);
@@ -104,6 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
@@ -134,6 +140,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -169,6 +176,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -188,6 +196,8 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusSent);
+ serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -221,7 +231,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -229,7 +239,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
-
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -244,6 +259,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -294,10 +310,15 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -312,6 +333,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -360,6 +382,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -382,6 +409,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -391,8 +419,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
-
-
// prepare distribution obj
Distribution distribution = new Distribution();
distribution.setStatus(Status.DISTRIBUTION_COMPLETE_ERROR);
@@ -428,13 +454,18 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
- .withRequestBody(containing("operationalEnvId\":\"TEST_operationalEnvironmentId\""))
+ .withRequestBody(containing("operationalEnvId\":\"VNF_operationalEnvironmentId\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -455,6 +486,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -490,7 +522,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -499,6 +531,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -514,6 +551,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -558,6 +596,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
index ce1dde835d..65ec5fade6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
@@ -40,8 +40,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.HttpHeaders;
@@ -102,7 +102,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/events/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException expectedException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
new file mode 100644
index 0000000000..974a824467
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
@@ -0,0 +1,27 @@
+{
+ "operational-environment-id": "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d",
+ "operational-environment-name": "Test Managing ECOMP Environment",
+ "operational-environment-type": "ECOMP",
+ "operational-environment-status": "INACTIVE",
+ "tenant-context": "Test",
+ "workload-context": "PVT",
+ "resource-version": "1505228226913",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "operational-environment",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/operational-environments/operational-environment/1dfe7154-eae0-44f2-8e7a-8e5e7882e55d",
+ "relationship-data": [{
+ "relationship-key": "operational-environment.operational-environment-id",
+ "relationship-value": "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "operational-environment.operational-environment-name",
+ "property-value": "myOpEnv_IST_un577h_0119"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
index f99f89653f..765b8cf75e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
@@ -22,9 +22,9 @@ INSERT INTO requestdb.site_status(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06'),
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06', 'vnf_1234'),
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56', 'vnf_1235');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID) VALUES
('TEST_distributionId', 'DISTRIBUTION_COMPLETE_OK', NULL, '2018-02-02 18:44:27', '2018-02-02 18:44:56', '1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74'),
@@ -276,12 +276,12 @@ VALUES
('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status (DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID)
VALUES
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 5873e147bc..fddd7adbf4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -980,6 +980,7 @@ CREATE TABLE `activate_operational_env_service_model_distribution_status` (
`WORKLOAD_CONTEXT` varchar(80) NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `VNF_OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;