AHSv2ClientImpl extends AHSClient { @Override public ContainerReport getContainerReport(ContainerId containerId) throws YarnException, IOException { ApplicationReport appReport = getApplicationReport( containerId.getApplicationAttemptId().getApplicationId()); TimelineEntity entity = readerClient.getContainerEntity(containerId, "ALL", null); return TimelineEntityV2Converter.convertToContainerReport( entity, logServerUrl, appReport.getUser()); } AHSv2ClientImpl(); @Override void serviceInit(Configuration conf); @Override void serviceStart(); @Override void serviceStop(); @Override ApplicationReport getApplicationReport(ApplicationId appId); @Override List<ApplicationReport> getApplications(); @Override ApplicationAttemptReport getApplicationAttemptReport(
      ApplicationAttemptId applicationAttemptId); @Override List<ApplicationAttemptReport> getApplicationAttempts(
      ApplicationId applicationId); @Override ContainerReport getContainerReport(ContainerId containerId); @Override List<ContainerReport> getContainers(ApplicationAttemptId
      applicationAttemptId);  }
@Test public void testGetContainerReport() throws IOException, YarnException { final ApplicationId appId = ApplicationId.newInstance(0, 1); final ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, 1); final ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1); when(spyTimelineReaderClient.getContainerEntity(containerId, "ALL", null)) .thenReturn(createContainerEntity(containerId)); when(spyTimelineReaderClient.getApplicationEntity(appId, "ALL", null)) .thenReturn(createApplicationTimelineEntity(appId, true, false)); ContainerReport report = client.getContainerReport(containerId); assertThat(report.getContainerId()).isEqualTo(containerId); assertThat(report.getAssignedNode().getHost()).isEqualTo("test host"); assertThat(report.getAssignedNode().getPort()).isEqualTo(100); assertThat(report.getAllocatedResource().getVirtualCores()).isEqualTo(8); assertThat(report.getCreationTime()).isEqualTo(123456); assertThat(report.getLogUrl()).isEqualTo("https: + "test host:100/container_0_0001_01_000001/" + "container_0_0001_01_000001/user1"); }