diff options
author | Boslet, Cory <cory.boslet@att.com> | 2019-11-21 20:48:40 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-11-21 20:48:41 -0500 |
commit | f89d9e0887e41de727b4e829916ae60dd6926e0e (patch) | |
tree | df4e980859cb4756abb4ee878ab351fe47cde96d /mso-api-handlers/mso-api-handler-infra | |
parent | df2db9f4a7c3fccc5f617792a057d8dbc6bf9d34 (diff) |
Updated and added to get request processing data
Updated and added to get request processing data by internal data flag
Committing file that I forgot to commit.
Added junit test and change method to not use bowman client.
Added and updated orch request unit test
ran formatter so verify job will pass and not cry
Added an intergration test for new jpa method.
Format unit test class for the verify job build
Update param key in jpa and also changed return type.
Updated method name in request client to avoid confusion
Issue-ID: SO-2534
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I420f1a887835dd0d9d0ad991e5b17dddb1db5376
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
3 files changed, 53 insertions, 3 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 cf4e63529c..12f2a07993 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 @@ -9,9 +9,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. @@ -131,7 +131,7 @@ public class OrchestrationRequests { infraActiveRequest = infraActiveRequestLookup(requestId); try { - requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId); + requestProcessingData = requestsDbClient.getExternalRequestProcessingDataBySoRequestId(requestId); } catch (Exception e) { logger.error("Exception occurred while communicating with RequestDb during requestProcessingData lookup ", e); 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 151785dbeb..a0b9fead4e 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 @@ -107,6 +107,18 @@ public class OrchestrationRequestsTest extends BaseTest { .withBody(new String(Files.readAllBytes(Paths.get( "src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json")))) .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get( + ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-1a18-42e5-965d-8ea592502018&IS_INTERNAL_DATA=false")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(new String(Files.readAllBytes(Paths.get( + "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json")))) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get( + ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-3fb3-42e5-965d-8ea592502017&IS_INTERNAL_DATA=false")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(new String(Files.readAllBytes(Paths.get( + "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json")))) + .withStatus(HttpStatus.SC_OK))); } @Test @@ -117,6 +129,16 @@ public class OrchestrationRequestsTest extends BaseTest { Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest(); testResponse.setRequest(request); + testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>()); + RequestProcessingData e = new RequestProcessingData(); + e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714"); + e.setTag("pincFabricConfigRequest"); + List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>(); + HashMap<String, String> data1 = new HashMap<String, String>(); + data1.put("requestAction", "assign"); + data.add(data1); + e.setDataPairs(data); + testResponse.getRequest().getRequestProcessingData().add(e); String testRequestId = request.getRequestId(); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); @@ -148,6 +170,16 @@ public class OrchestrationRequestsTest extends BaseTest { Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest(); testResponse.setRequest(request); + testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>()); + RequestProcessingData e = new RequestProcessingData(); + e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714"); + e.setTag("pincFabricConfigRequest"); + List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>(); + HashMap<String, String> data1 = new HashMap<String, String>(); + data1.put("requestAction", "assign"); + data.add(data1); + e.setDataPairs(data); + testResponse.getRequest().getRequestProcessingData().add(e); String testRequestId = request.getRequestId(); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); @@ -184,6 +216,16 @@ public class OrchestrationRequestsTest extends BaseTest { request.setCloudRequestData(cloudRequestData); testResponse.setRequest(request); String testRequestId = request.getRequestId(); + testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>()); + RequestProcessingData e = new RequestProcessingData(); + e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714"); + e.setTag("pincFabricConfigRequest"); + List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>(); + HashMap<String, String> data1 = new HashMap<String, String>(); + data1.put("requestAction", "assign"); + data.add(data1); + e.setDataPairs(data); + testResponse.getRequest().getRequestProcessingData().add(e); HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json new file mode 100644 index 0000000000..c746020e7f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json @@ -0,0 +1,8 @@ +[{ + "id": 1, + "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018", + "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714", + "name": "requestAction", + "value": "assign", + "tag": "pincFabricConfigRequest" +}] |