diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
6 files changed, 77 insertions, 31 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 bc867503f2..3d80ec230e 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 @@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException; 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import java.io.IOException; import java.util.LinkedList; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 46fd2f9025..9b892af869 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -32,6 +32,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -155,6 +156,7 @@ public class OrchestrationRequestsTest extends BaseTest { assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime") .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp")); + assertNull(response.getBody().getRequest().getInstanceReferences().getRequestorId()); 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)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java index 22c82bf75c..4631b53bc0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,9 +25,9 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; import static org.mockito.Mockito.doReturn; import javax.ws.rs.core.Response; import org.apache.commons.lang.StringUtils; @@ -92,6 +92,7 @@ public class OrchestrationRequestsUnitTest { iar.setFlowStatus(FLOW_STATUS); iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE); iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE); + iar.setResourceStatusMessage("The vf module already exist"); } @Test @@ -101,8 +102,10 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -114,7 +117,7 @@ public class OrchestrationRequestsUnitTest { iar.setOriginalRequestId(ORIGINAL_REQUEST_ID); Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(result, sameBeanAs(expected)); } @@ -125,8 +128,11 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); + Request expected = new Request(); expected.setRequestId(REQUEST_ID); expected.setInstanceReferences(instanceReferences); @@ -134,7 +140,7 @@ public class OrchestrationRequestsUnitTest { expected.setRequestScope(SERVICE); Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(result, sameBeanAs(expected)); } @@ -145,8 +151,10 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -157,7 +165,7 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(actual, sameBeanAs(expected)); } @@ -183,7 +191,34 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.STATUSDETAIL.toString()); + OrchestrationRequestFormat.STATUSDETAIL.toString(), "v7"); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void mapRequestStatusAndExtSysErrSrcToRequestStatusDetailV8Test() throws ApiException { + doReturn(null).when(camundaRequestHandler).getTaskName(REQUEST_ID); + InstanceReferences instanceReferences = new InstanceReferences(); + instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); + RequestStatus requestStatus = new RequestStatus(); + requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE); + requestStatus.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE); + requestStatus.setRequestState(iar.getRequestStatus()); + requestStatus.setFlowStatus(FLOW_STATUS); + requestStatus.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE); + requestStatus.setRetryStatusMessage(RETRY_STATUS_MESSAGE); + requestStatus.setResourceStatusMessage("The vf module already exist"); + + Request expected = new Request(); + expected.setRequestId(REQUEST_ID); + expected.setInstanceReferences(instanceReferences); + expected.setRequestStatus(requestStatus); + expected.setRequestScope(SERVICE); + + includeCloudRequest = false; + + Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, + OrchestrationRequestFormat.STATUSDETAIL.toString(), "v8"); assertThat(actual, sameBeanAs(expected)); } @@ -194,7 +229,7 @@ public class OrchestrationRequestsUnitTest { RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); requestStatus.setStatusMessage( - "FLOW STATUS: FlowStatus RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage"); + "FLOW STATUS: FlowStatus RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage RESOURCE STATUS: The vf module already exist"); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -205,7 +240,7 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.SIMPLENOTASKINFO.toString()); + OrchestrationRequestFormat.SIMPLENOTASKINFO.toString(), "v7"); assertThat(expected, sameBeanAs(actual)); } @@ -217,7 +252,7 @@ public class OrchestrationRequestsUnitTest { RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); requestStatus.setStatusMessage( - "FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage"); + "FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage RESOURCE STATUS: The vf module already exist"); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -227,7 +262,7 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; - Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, null); + Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, null, "v7"); assertThat(expected, sameBeanAs(actual)); } @@ -238,8 +273,10 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -250,7 +287,7 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(actual, sameBeanAs(expected)); } @@ -272,9 +309,10 @@ public class OrchestrationRequestsUnitTest { includeCloudRequest = false; iar.setFlowStatus(null); + iar.setResourceStatusMessage(null); Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(actual, sameBeanAs(expected)); } @@ -288,7 +326,7 @@ public class OrchestrationRequestsUnitTest { iar.setStatusMessage("Error retrieving cloud region from AAI"); Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertTrue(actual.getRequestStatus().getStatusMessage() .contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE)); @@ -300,8 +338,10 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - "Successfully completed all Building Blocks", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + "Successfully completed all Building Blocks", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -313,7 +353,7 @@ public class OrchestrationRequestsUnitTest { iar.setFlowStatus("Successfully completed all Building Blocks"); Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(actual, sameBeanAs(expected)); } @@ -324,8 +364,10 @@ public class OrchestrationRequestsUnitTest { instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID); RequestStatus requestStatus = new RequestStatus(); requestStatus.setRequestState(iar.getRequestStatus()); - requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s", - "All Rollback flows have completed successfully", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE)); + requestStatus.setStatusMessage( + String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", + "All Rollback flows have completed successfully", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, + "The vf module already exist")); Request expected = new Request(); expected.setRequestId(REQUEST_ID); @@ -337,7 +379,7 @@ public class OrchestrationRequestsUnitTest { iar.setFlowStatus("All Rollback flows have completed successfully"); Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, - OrchestrationRequestFormat.DETAIL.toString()); + OrchestrationRequestFormat.DETAIL.toString(), "v7"); assertThat(actual, sameBeanAs(expected)); } 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 8d8f4969d7..0f096ee374 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 @@ -46,7 +46,7 @@ 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.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json index 8953dfdfe0..e50aed7a33 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json @@ -37,7 +37,7 @@ "networkId": null, "networkName": null, "networkType": null, - "requestorId": null, + "requestorId": "xxxxxx", "configurationId": null, "configurationName": null, "operationalEnvId": null, 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 85a17dd369..19855bc85e 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 @@ -1299,6 +1299,7 @@ CREATE TABLE `infra_active_requests` ( `ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL, `TENANT_NAME` varchar(200) DEFAULT NULL, `PRODUCT_FAMILY_NAME` varchar(200) DEFAULT NULL, + `RESOURCE_STATUS_MESSAGE` longtext, PRIMARY KEY (`REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; @@ -1342,6 +1343,7 @@ CREATE TABLE `archived_infra_requests` ( `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, `REQUEST_URL` varchar(500) DEFAULT NULL, + `RESOURCE_STATUS_MESSAGE` longtext, PRIMARY KEY (`REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |