WebAppProxyServer extends CompositeService { public static InetSocketAddress getBindAddress(Configuration conf) { return conf.getSocketAddr( YarnConfiguration.PROXY_BIND_HOST, YarnConfiguration.PROXY_ADDRESS, YarnConfiguration.DEFAULT_PROXY_ADDRESS, YarnConfiguration.DEFAULT_PROXY_PORT); } WebAppProxyServer(); static InetSocketAddress getBindAddress(Configuration conf); static void main(String[] args); static final int SHUTDOWN_HOOK_PRIORITY; }
@Test public void testStart() { webAppProxy.init(conf); assertEquals(STATE.INITED, webAppProxy.getServiceState()); webAppProxy.start(); for (Service service : webAppProxy.getServices()) { if (service instanceof WebAppProxy) { assertEquals(proxyAddress, ((WebAppProxy) service).getBindAddress()); } } assertEquals(STATE.STARTED, webAppProxy.getServiceState()); }
@Test public void testStartWithBindHost() { String bindHost = "0.0.0.0"; conf.set(YarnConfiguration.PROXY_BIND_HOST, bindHost); webAppProxy.init(conf); assertEquals(STATE.INITED, webAppProxy.getServiceState()); webAppProxy.start(); for (Service service : webAppProxy.getServices()) { if (service instanceof WebAppProxy) { assertEquals(bindHost + ":" + port, ((WebAppProxy) service).getBindAddress()); } } assertEquals(STATE.STARTED, webAppProxy.getServiceState()); }
@Test public void testBindAddress() { conf = new YarnConfiguration(); InetSocketAddress defaultBindAddress = WebAppProxyServer.getBindAddress(conf); Assert.assertEquals("Web Proxy default bind address port is incorrect", YarnConfiguration.DEFAULT_PROXY_PORT, defaultBindAddress.getPort()); }