Search in sources :

Example 1 with TimelineWriter

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();
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HdfsConfiguration(org.apache.hadoop.hdfs.HdfsConfiguration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) DirectTimelineWriter(org.apache.hadoop.yarn.client.api.impl.DirectTimelineWriter) TimelineWriter(org.apache.hadoop.yarn.client.api.impl.TimelineWriter) TimelineClientImpl(org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl) TestTimelineClient(org.apache.hadoop.yarn.client.api.impl.TestTimelineClient) YarnClient(org.apache.hadoop.yarn.client.api.YarnClient) URI(java.net.URI) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) DirectTimelineWriter(org.apache.hadoop.yarn.client.api.impl.DirectTimelineWriter) Test(org.junit.Test)

Aggregations

URI (java.net.URI)1 Configuration (org.apache.hadoop.conf.Configuration)1 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 YarnClient (org.apache.hadoop.yarn.client.api.YarnClient)1 DirectTimelineWriter (org.apache.hadoop.yarn.client.api.impl.DirectTimelineWriter)1 TestTimelineClient (org.apache.hadoop.yarn.client.api.impl.TestTimelineClient)1 TimelineClientImpl (org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl)1 TimelineWriter (org.apache.hadoop.yarn.client.api.impl.TimelineWriter)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 Test (org.junit.Test)1