Search in sources :

Example 1 with ReservationSubmissionRequestInfo

use of org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo in project hadoop by apache.

the class TestRMWebServicesReservation method submitAndVerifyReservation.

private ClientResponse submitAndVerifyReservation(String path, String media, String reservationJson) throws Exception {
    JSONJAXBContext jc = new JSONJAXBContext(JSONConfiguration.mapped().build(), ReservationSubmissionRequestInfo.class);
    JSONUnmarshaller unmarshaller = jc.createJSONUnmarshaller();
    ReservationSubmissionRequestInfo rsci = unmarshaller.unmarshalFromJSON(new StringReader(reservationJson), ReservationSubmissionRequestInfo.class);
    Thread.sleep(1000);
    ClientResponse response = constructWebResource(path).entity(rsci, MediaType.APPLICATION_JSON).accept(media).post(ClientResponse.class);
    if (!this.isAuthenticationEnabled()) {
        assertResponseStatusCode(Status.UNAUTHORIZED, response.getStatusInfo());
    }
    return response;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) ReservationSubmissionRequestInfo(org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo) StringReader(java.io.StringReader) JSONUnmarshaller(com.sun.jersey.api.json.JSONUnmarshaller) JSONJAXBContext(com.sun.jersey.api.json.JSONJAXBContext)

Aggregations

ClientResponse (com.sun.jersey.api.client.ClientResponse)1 JSONJAXBContext (com.sun.jersey.api.json.JSONJAXBContext)1 JSONUnmarshaller (com.sun.jersey.api.json.JSONUnmarshaller)1 StringReader (java.io.StringReader)1 ReservationSubmissionRequestInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ReservationSubmissionRequestInfo)1