summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json2
4 files changed, 63 insertions, 9 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 630fda05c7..4e019ca602 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -328,8 +328,6 @@ public class OrchestrationRequests {
ir.setVolumeGroupInstanceId(iar.getVolumeGroupId());
if (iar.getVolumeGroupName() != null)
ir.setVolumeGroupInstanceName(iar.getVolumeGroupName());
- if (iar.getRequestorId() != null)
- ir.setRequestorId(iar.getRequestorId());
if (iar.getInstanceGroupId() != null)
ir.setInstanceGroupId(iar.getInstanceGroupId());
if (iar.getInstanceGroupName() != null)
@@ -439,11 +437,13 @@ public class OrchestrationRequests {
String retryStatusMessage = iar.getRetryStatusMessage();
String taskName = null;
- if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
- && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
- taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
- if (taskName != null) {
- flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ if (format == null || !format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString())) {
+ if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
+ && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
+ taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
+ if (taskName != null) {
+ flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ }
}
}
@@ -544,7 +544,8 @@ public class OrchestrationRequests {
}
protected boolean isRequestProcessingDataRequired(String format) {
- if (StringUtils.isNotEmpty(format) && format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())) {
+ if (StringUtils.isNotEmpty(format) && (format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())
+ || format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString()))) {
return false;
} else {
return true;
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 47aa3cccb5..22c82bf75c 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
@@ -27,6 +27,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
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;
@@ -187,6 +188,50 @@ public class OrchestrationRequestsUnitTest {
}
@Test
+ public void mapRequestStatusNoTaskInfoTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage");
+
+ 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.SIMPLENOTASKINFO.toString());
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
+ public void mapRequestStatusNullFormatTest() throws ApiException {
+ doReturn("TaskName").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage");
+
+ 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, null);
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
@@ -338,4 +383,10 @@ public class OrchestrationRequestsUnitTest {
orchestrationRequests.infraActiveRequestLookup(iar.getRequestId());
}
+ @Test
+ public void isRequestProcessingDataRequiredTest() {
+ boolean required = orchestrationRequests.isRequestProcessingDataRequired("simpleNoTaskInfo");
+ assertFalse(required);
+ }
+
}
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,