use of com.sun.jersey.api.client.WebResource in project hadoop by apache.
the class TestRMWebServices method testClusterSlash.
@Test
public void testClusterSlash() throws JSONException, Exception {
WebResource r = resource();
// test with trailing "/" to make sure acts same as without slash
ClientResponse response = r.path("ws").path("v1").path("cluster/").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.WebResource in project hadoop by apache.
the class TestRMWebServices method testInfoXML.
@Test
public void testInfoXML() throws JSONException, Exception {
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster").path("info").accept("application/xml").get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8, response.getType().toString());
String xml = response.getEntity(String.class);
verifyClusterInfoXML(xml);
}
use of com.sun.jersey.api.client.WebResource 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.WebResource 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.WebResource 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);
}
Aggregations