use of com.sun.jersey.api.client.ClientResponse in project hadoop by apache.
the class TestRMWebServices method testInfoSlash.
@Test
public void testInfoSlash() throws JSONException, Exception {
// test with trailing "/" to make sure acts same as without slash
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster").path("info/").accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, response.getType().toString());
JSONObject json = response.getEntity(JSONObject.class);
verifyClusterInfo(json);
}
use of com.sun.jersey.api.client.ClientResponse in project hadoop by apache.
the class TestRMWebServices method testClusterSchedulerFifoXML.
@Test
public void testClusterSchedulerFifoXML() throws JSONException, Exception {
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster").path("scheduler").accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8, response.getType().toString());
String xml = response.getEntity(String.class);
verifySchedulerFifoXML(xml);
}
use of com.sun.jersey.api.client.ClientResponse in project hadoop by apache.
the class TestRMWebServices method testClusterMetricsDefault.
@Test
public void testClusterMetricsDefault() throws JSONException, Exception {
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster").path("metrics").get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, response.getType().toString());
JSONObject json = response.getEntity(JSONObject.class);
verifyClusterMetricsJSON(json);
}
use of com.sun.jersey.api.client.ClientResponse in project hadoop by apache.
the class TestRMWebServicesAppsModification method testGetAppQueue.
@Test
public void testGetAppQueue() throws Exception {
client().addFilter(new LoggingFilter(System.out));
boolean isCapacityScheduler = rm.getResourceScheduler() instanceof CapacityScheduler;
rm.start();
MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
String[] contentTypes = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML };
for (String contentType : contentTypes) {
RMApp app = rm.submitApp(CONTAINER_MB, "", webserviceUserName);
amNodeManager.nodeHeartbeat(true);
ClientResponse response = this.constructWebResource("apps", app.getApplicationId().toString(), "queue").accept(contentType).get(ClientResponse.class);
assertResponseStatusCode(Status.OK, response.getStatusInfo());
String expectedQueue = "default";
if (!isCapacityScheduler) {
expectedQueue = "root." + webserviceUserName;
}
if (contentType.contains(MediaType.APPLICATION_JSON)) {
verifyAppQueueJson(response, expectedQueue);
} else {
verifyAppQueueXML(response, expectedQueue);
}
}
rm.stop();
}
use of com.sun.jersey.api.client.ClientResponse in project hadoop by apache.
the class TestRMWebServicesAppsModification method testGetNewApplication.
protected String testGetNewApplication(String mediaType) throws JSONException, ParserConfigurationException, IOException, SAXException {
ClientResponse response = this.constructWebResource("apps", "new-application").accept(mediaType).post(ClientResponse.class);
validateResponseStatus(response, Status.OK);
if (!isAuthenticationEnabled()) {
return "";
}
return validateGetNewApplicationResponse(response);
}
Aggregations