From 87c6dd0ae5477e1c20ebbef1c0d1036af313ea4e Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Thu, 12 Dec 2019 15:39:21 -0500 Subject: Add simple query format, to limit response content Add simple query format, to limit response content Add simple query format, to limit response content Add simple query format, to limit response content Issue-ID: SO-2570 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I7570828d7c47e0635239dba50d0f7f76bd17f4a8 --- .../apihandlerinfra/OrchestrationRequestsTest.java | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java') 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 e64f689624..23c2892c78 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 @@ -64,7 +64,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -162,6 +161,39 @@ public class OrchestrationRequestsTest extends BaseTest { assertNotNull(response.getBody().getRequest().getFinishTime()); } + @Test + public void getOrchestrationRequestSimpleTest() throws Exception { + setupTestGetOrchestrationRequest(); + // TEST VALID REQUEST + GetOrchestrationResponse testResponse = new GetOrchestrationResponse(); + + Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest(); + request.setRequestProcessingData(null); + testResponse.setRequest(request); + + String testRequestId = request.getRequestId(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + HttpEntity entity = new HttpEntity(null, headers); + UriComponentsBuilder builder = UriComponentsBuilder + .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId)) + .queryParam("format", "simple"); + + ResponseEntity response = + restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime") + .ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp")); + 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)); + assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0)); + assertEquals("00032ab7-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0)); + assertNotNull(response.getBody().getRequest().getFinishTime()); + } + @Test public void testGetOrchestrationRequestInstanceGroup() throws Exception { setupTestGetOrchestrationRequestInstanceGroup(); @@ -448,6 +480,7 @@ public class OrchestrationRequestsTest extends BaseTest { assertThat(actualProcessingData, sameBeanAs(expectedDataList)); } + public void setupTestGetOrchestrationRequest() throws Exception { // For testGetOrchestrationRequest wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018")) -- cgit 1.2.3-korg