Search in sources :

Example 1 with TrackingUriPlugin

use of org.apache.hadoop.yarn.util.TrackingUriPlugin in project hadoop by apache.

the class TestProxyUriUtils method testGetProxyUriFromPluginsReturnsNullIfNoPlugins.

@Test
public void testGetProxyUriFromPluginsReturnsNullIfNoPlugins() throws URISyntaxException {
    ApplicationId id = BuilderUtils.newApplicationId(6384623l, 5);
    List<TrackingUriPlugin> list = Lists.newArrayListWithExpectedSize(0);
    assertNull(ProxyUriUtils.getUriFromTrackingPlugins(id, list));
}
Also used : ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) TrackingUriPlugin(org.apache.hadoop.yarn.util.TrackingUriPlugin) Test(org.junit.Test)

Example 2 with TrackingUriPlugin

use of org.apache.hadoop.yarn.util.TrackingUriPlugin in project hadoop by apache.

the class TestProxyUriUtils method testGetProxyUriFromPluginsReturnsValidUriWhenAble.

@Test
public void testGetProxyUriFromPluginsReturnsValidUriWhenAble() throws URISyntaxException {
    ApplicationId id = BuilderUtils.newApplicationId(6384623l, 5);
    List<TrackingUriPlugin> list = Lists.newArrayListWithExpectedSize(2);
    // Insert a plugin that returns null.
    list.add(new TrackingUriPlugin() {

        public URI getTrackingUri(ApplicationId id) throws URISyntaxException {
            return null;
        }
    });
    // Insert a plugin that returns a valid URI.
    list.add(new TrackingUriPlugin() {

        public URI getTrackingUri(ApplicationId id) throws URISyntaxException {
            return new URI("http://history.server.net/");
        }
    });
    URI result = ProxyUriUtils.getUriFromTrackingPlugins(id, list);
    assertNotNull(result);
}
Also used : URISyntaxException(java.net.URISyntaxException) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) TrackingUriPlugin(org.apache.hadoop.yarn.util.TrackingUriPlugin) URI(java.net.URI) Test(org.junit.Test)

Aggregations

ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 TrackingUriPlugin (org.apache.hadoop.yarn.util.TrackingUriPlugin)2 Test (org.junit.Test)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1