|
@@ -100,7 +100,7 @@ public class TestAHSWebServices extends JerseyTestBase {
|
|
|
private static ApplicationHistoryClientService historyClientService;
|
|
|
private static AHSWebServices ahsWebservice;
|
|
|
private static final String[] USERS = new String[] { "foo" , "bar" };
|
|
|
- private static final int MAX_APPS = 5;
|
|
|
+ private static final int MAX_APPS = 6;
|
|
|
private static Configuration conf;
|
|
|
private static FileSystem fs;
|
|
|
private static final String remoteLogRootDir = "target/logs/";
|
|
@@ -364,7 +364,27 @@ public class TestAHSWebServices extends JerseyTestBase {
|
|
|
JSONObject apps = json.getJSONObject("apps");
|
|
|
assertEquals("incorrect number of elements", 1, apps.length());
|
|
|
JSONArray array = apps.getJSONArray("app");
|
|
|
- assertEquals("incorrect number of elements", 5, array.length());
|
|
|
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testQueueQuery() throws Exception {
|
|
|
+ WebResource r = resource();
|
|
|
+ ClientResponse response =
|
|
|
+ r.path("ws").path("v1").path("applicationhistory").path("apps")
|
|
|
+ .queryParam("queue", "test queue")
|
|
|
+ .queryParam("user.name", USERS[round])
|
|
|
+ .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
|
|
+ assertResponseStatusCode(Status.OK, response.getStatusInfo());
|
|
|
+ assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
|
|
|
+ response.getType().toString());
|
|
|
+ JSONObject json = response.getEntity(JSONObject.class);
|
|
|
+ assertEquals("incorrect number of elements", 1, json.length());
|
|
|
+ JSONObject apps = json.getJSONObject("apps");
|
|
|
+ assertEquals("incorrect number of elements", 1, apps.length());
|
|
|
+ JSONArray array = apps.getJSONArray("app");
|
|
|
+ assertEquals("incorrect number of elements", MAX_APPS - 1,
|
|
|
+ array.length());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -414,7 +434,7 @@ public class TestAHSWebServices extends JerseyTestBase {
|
|
|
JSONObject appAttempts = json.getJSONObject("appAttempts");
|
|
|
assertEquals("incorrect number of elements", 1, appAttempts.length());
|
|
|
JSONArray array = appAttempts.getJSONArray("appAttempt");
|
|
|
- assertEquals("incorrect number of elements", 5, array.length());
|
|
|
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -471,7 +491,7 @@ public class TestAHSWebServices extends JerseyTestBase {
|
|
|
JSONObject containers = json.getJSONObject("containers");
|
|
|
assertEquals("incorrect number of elements", 1, containers.length());
|
|
|
JSONArray array = containers.getJSONArray("container");
|
|
|
- assertEquals("incorrect number of elements", 5, array.length());
|
|
|
+ assertEquals("incorrect number of elements", MAX_APPS, array.length());
|
|
|
}
|
|
|
|
|
|
@Test
|