use of org.apache.hadoop.yarn.client.api.impl.TimelineWriter in project hadoop by apache.
the class TestDistributedShell method testDSTimelineClientWithConnectionRefuse.
@Test
public void testDSTimelineClientWithConnectionRefuse() throws Exception {
ApplicationMaster am = new ApplicationMaster();
TimelineClientImpl client = new TimelineClientImpl() {
@Override
protected TimelineWriter createTimelineWriter(Configuration conf, UserGroupInformation authUgi, com.sun.jersey.api.client.Client client, URI resURI) throws IOException {
TimelineWriter timelineWriter = new DirectTimelineWriter(authUgi, client, resURI);
spyTimelineWriter = spy(timelineWriter);
return spyTimelineWriter;
}
};
client.init(conf);
client.start();
TestTimelineClient.mockEntityClientResponse(spyTimelineWriter, null, false, true);
try {
UserGroupInformation ugi = mock(UserGroupInformation.class);
when(ugi.getShortUserName()).thenReturn("user1");
// verify no ClientHandlerException get thrown out.
am.publishContainerEndEvent(client, ContainerStatus.newInstance(BuilderUtils.newContainerId(1, 1, 1, 1), ContainerState.COMPLETE, "", 1), "domainId", ugi);
} finally {
client.stop();
}
}
Aggregations