Search in sources :

Example 6 with GetOrchestrationResponse

use of org.onap.so.serviceinstancebeans.GetOrchestrationResponse in project so by onap.

the class OrchestrationRequestsTest method getOrchestrationRequestSimpleTest.

@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);
    headers.set(ONAPLogConstants.Headers.REQUEST_ID, "e5e3c007-9fe9-4a20-8691-bdd20e14504d");
    HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId)).queryParam("format", "simple");
    ResponseEntity<GetOrchestrationResponse> 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("e5e3c007-9fe9-4a20-8691-bdd20e14504d", response.getHeaders().get("X-TransactionID").get(0));
    assertNotNull(response.getBody().getRequest().getFinishTime());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) Request(org.onap.so.serviceinstancebeans.Request) GetOrchestrationResponse(org.onap.so.serviceinstancebeans.GetOrchestrationResponse) Test(org.junit.Test)

Aggregations

GetOrchestrationResponse (org.onap.so.serviceinstancebeans.GetOrchestrationResponse)6 Request (org.onap.so.serviceinstancebeans.Request)6 Test (org.junit.Test)5 HttpEntity (org.springframework.http.HttpEntity)5 HttpHeaders (org.springframework.http.HttpHeaders)5 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 RequestProcessingData (org.onap.so.serviceinstancebeans.RequestProcessingData)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Operation (io.swagger.v3.oas.annotations.Operation)1 IOException (java.io.IOException)1 Transactional (javax.transaction.Transactional)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ResponseBuilder (org.onap.so.apihandler.common.ResponseBuilder)1 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)1 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)1 ErrorLoggerInfo (org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo)1