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/RequestHandlerUtilsUnitTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json19
3 files changed, 40 insertions, 11 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
index e92417728c..3cb4e0c9c2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
@@ -114,14 +114,14 @@ public class RequestHandlerUtilsUnitTest {
currentActiveRequest.setSource("VID");
currentActiveRequest.setStartTime(startTimeStamp);
currentActiveRequest.setTenantId("tenant-id");
- currentActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
+ currentActiveRequest.setRequestBody(getRequestBody("/RequestBodyNewRequestorId.json"));
currentActiveRequest.setAicCloudRegion("cloudRegion");
currentActiveRequest.setRequestScope("service");
currentActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
currentActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
currentActiveRequest.setRequestAction(Action.createInstance.toString());
currentActiveRequest.setRequestUrl(requestUri);
- currentActiveRequest.setRequestorId("xxxxxx");
+ currentActiveRequest.setRequestorId("yyyyyy");
currentActiveRequest.setProgress(new Long(5));
currentActiveRequest.setOriginalRequestId(RESUMED_REQUEST_ID);
}
@@ -140,10 +140,12 @@ public class RequestHandlerUtilsUnitTest {
@Test
- public void createNewRecordCopyFromInfraActiveRequestTest() {
+ public void createNewRecordCopyFromInfraActiveRequestTest() throws IOException {
doNothing().when(requestHandler).setInstanceIdAndName(infraActiveRequest, currentActiveRequest);
+ doReturn(getRequestBody("/RequestBodyNewRequestorId.json")).when(requestHandler)
+ .updateRequestorIdInRequestBody(infraActiveRequest, "yyyyyy");
InfraActiveRequests result = requestHandler.createNewRecordCopyFromInfraActiveRequest(infraActiveRequest,
- CURRENT_REQUEST_ID, startTimeStamp, "VID", requestUri, "xxxxxx", RESUMED_REQUEST_ID);
+ CURRENT_REQUEST_ID, startTimeStamp, "VID", requestUri, "yyyyyy", RESUMED_REQUEST_ID);
assertThat(currentActiveRequest, sameBeanAs(result));
}
@@ -396,4 +398,12 @@ public class RequestHandlerUtilsUnitTest {
assertEquals(modelTypeResult, modelTypeExpected);
}
+ @Test
+ public void updateRequestorIdInRequestBodyTest() throws IOException {
+ String newRequestorId = "yyyyyy";
+ String expected = getRequestBody("/RequestBodyNewRequestorId.json");
+ String result = requestHandler.updateRequestorIdInRequestBody(infraActiveRequest, newRequestorId);
+ assertEquals(expected, result);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json
index 7e8ed4dee1..d6406338a0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json
@@ -1,5 +1,11 @@
{
"requestDetails":{
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion": "1.0",
+ "modelType":"service",
+ "modelName":"serviceModel"
+ },
"requestInfo":{
"source":"VID",
"requestorId":"xxxxxx",
@@ -8,12 +14,6 @@
},
"requestParameters":{
"aLaCarte":"false"
- },
- "modelInfo":{
- "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
- "modelVersion": "1.0",
- "modelType":"service",
- "modelName":"serviceModel"
- }
+ }
}
} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json
new file mode 100644
index 0000000000..740d4e2ec2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json
@@ -0,0 +1,19 @@
+{
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion": "1.0",
+ "modelType":"service",
+ "modelName":"serviceModel"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "requestorId":"yyyyyy",
+ "instanceName":"testService",
+ "productFamilyId":"test"
+ },
+ "requestParameters":{
+ "aLaCarte":"false"
+ }
+ }
+} \ No newline at end of file