Search in sources :

Example 1 with WebAppProxyServer

use of org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer in project hadoop by apache.

the class TestWebAppProxyServer method setUp.

@Before
public void setUp() throws Exception {
    YarnConfiguration conf = new YarnConfiguration();
    conf.set(YarnConfiguration.PROXY_ADDRESS, proxyAddress);
    webAppProxy = new WebAppProxyServer();
    webAppProxy.init(conf);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) WebAppProxyServer(org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer) Before(org.junit.Before)

Example 2 with WebAppProxyServer

use of org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer in project hadoop by apache.

the class TestRMFailover method testWebAppProxyInStandAloneMode.

@Test
public void testWebAppProxyInStandAloneMode() throws YarnException, InterruptedException, IOException {
    conf.setBoolean(YarnConfiguration.AUTO_FAILOVER_ENABLED, false);
    WebAppProxyServer webAppProxyServer = new WebAppProxyServer();
    try {
        conf.set(YarnConfiguration.PROXY_ADDRESS, "0.0.0.0:9099");
        cluster.init(conf);
        cluster.start();
        getAdminService(0).transitionToActive(req);
        assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex());
        verifyConnections();
        webAppProxyServer.init(conf);
        // Start webAppProxyServer
        Assert.assertEquals(STATE.INITED, webAppProxyServer.getServiceState());
        webAppProxyServer.start();
        Assert.assertEquals(STATE.STARTED, webAppProxyServer.getServiceState());
        // send httpRequest with fakeApplicationId
        // expect to get "Not Found" response and 404 response code
        URL wrongUrl = new URL("http://0.0.0.0:9099/proxy/" + fakeAppId);
        HttpURLConnection proxyConn = (HttpURLConnection) wrongUrl.openConnection();
        proxyConn.connect();
        verifyResponse(proxyConn);
        explicitFailover();
        verifyConnections();
        proxyConn.connect();
        verifyResponse(proxyConn);
    } finally {
        webAppProxyServer.stop();
    }
}
Also used : HttpURLConnection(java.net.HttpURLConnection) WebAppProxyServer(org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer) URL(java.net.URL) Test(org.junit.Test)

Aggregations

WebAppProxyServer (org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer)2 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 Before (org.junit.Before)1 Test (org.junit.Test)1