@Test
public void testSingleContainer() throws Exception {

  ApplicationId appId = ApplicationId.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =
      ApplicationAttemptId.newInstance(appId, 1);
  ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
  WebResource r = resource();
  ClientResponse response =
      r.path("ws").path("v1").path("applicationhistory").path("apps")
        .path(appId.toString()).path("appattempts")
        .path(appAttemptId.toString()).path("containers")
        .path(containerId.toString())
        .queryParam("user.name", USERS[round])
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
  if (round == 1) {
    assertResponseStatusCode(Status.FORBIDDEN, response.getStatusInfo());
    return;
  }
  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 container = json.getJSONObject("container");
  assertEquals(containerId.toString(), container.getString("containerId"));
  assertEquals("test diagnostics info", container.getString("diagnosticsInfo"));
  assertEquals("-1", container.getString("allocatedMB"));
  assertEquals("-1", container.getString("allocatedVCores"));
  assertEquals(NodeId.newInstance("test host", 100).toString(),
    container.getString("assignedNodeId"));
  assertEquals("-1", container.getString("priority"));
  Configuration conf = new YarnConfiguration();
  assertEquals(WebAppUtils.getHttpSchemePrefix(conf) +
      WebAppUtils.getAHSWebAppURLWithoutScheme(conf) +
      "/applicationhistory/logs/test host:100/container_0_0001_01_000001/" +
      "container_0_0001_01_000001/user1", container.getString("logUrl"));
  assertEquals(ContainerState.COMPLETE.toString(),
    container.getString("containerState"));
}