summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-06-06 16:02:00 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-06 16:02:10 -0400
commit65ca9cb2cc392dcd9793f7758d9d1fd0dd592fb7 (patch)
treeef7f0fff315a4c9d4b1209a45f2e6da783da6636 /mso-api-handlers/mso-api-handler-infra/src/test
parentc4b90365d5c117bc6fd64af421a1468539a8aec3 (diff)
resume request support
copy request body rewrite requestorid added missing curly brace case to regex Updated how we are updating requestorId in requestBody Removed unused imports from RequestHandlerUtils Replaced requestorId in requestBody string Began updating requestorId in requestBody Change-Id: I54bd8097b196899b271956f03395bb98d295e1e0 Issue-ID: SO-1990 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
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