connectHost + ":" + webApp.getListenerAddress().getPort());
.with(conf) .start(this.tezAMWebApp); InetSocketAddress address = webApp.getListenerAddress(); if (address != null) { InetSocketAddress bindAddress = NetUtils.createSocketAddrForHost(
@VisibleForTesting protected void initializeWebApp(Configuration conf) { webApp = new HsWebApp(history); InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf); // NOTE: there should be a .at(InetSocketAddress) WebApps .$for("jobhistory", HistoryClientService.class, this, "ws") .with(conf) .withHttpSpnegoKeytabKey( JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY) .withHttpSpnegoPrincipalKey( JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY) .at(NetUtils.getHostPortString(bindAddress)).start(webApp); String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0]; MRWebAppUtil.setJHSWebappURLWithoutScheme(conf, connectHost + ":" + webApp.getListenerAddress().getPort()); }
@VisibleForTesting protected void initializeWebApp(Configuration conf) { webApp = new HsWebApp(history); InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf); // NOTE: there should be a .at(InetSocketAddress) WebApps .$for("jobhistory", HistoryClientService.class, this, "ws") .with(conf) .withHttpSpnegoKeytabKey( JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY) .withHttpSpnegoPrincipalKey( JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY) .at(NetUtils.getHostPortString(bindAddress)).start(webApp); String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0]; MRWebAppUtil.setJHSWebappURLWithoutScheme(conf, connectHost + ":" + webApp.getListenerAddress().getPort()); }
@VisibleForTesting protected void initializeWebApp(Configuration conf) { webApp = new HsWebApp(history); InetSocketAddress bindAddress = MRWebAppUtil.getJHSWebBindAddress(conf); // NOTE: there should be a .at(InetSocketAddress) WebApps .$for("jobhistory", HistoryClientService.class, this, "ws") .with(conf) .withHttpSpnegoKeytabKey( JHAdminConfig.MR_WEBAPP_SPNEGO_KEYTAB_FILE_KEY) .withHttpSpnegoPrincipalKey( JHAdminConfig.MR_WEBAPP_SPNEGO_USER_NAME_KEY) .at(NetUtils.getHostPortString(bindAddress)).start(webApp); String connectHost = MRWebAppUtil.getJHSWebappURLWithoutScheme(conf).split(":")[0]; MRWebAppUtil.setJHSWebappURLWithoutScheme(conf, connectHost + ":" + webApp.getListenerAddress().getPort()); }
connectAddress = NetUtils.getConnectAddress(webApp.getListenerAddress()); String hostname = connectAddress.getAddress().getCanonicalHostName(); if (hostname.equals(connectAddress.getAddress().getHostAddress())) {
@Test public void testCreateWithPort() { // see if the ephemeral port is updated WebApp app = WebApps.$for(this).at(0).start(); int port = app.getListenerAddress().getPort(); assertTrue(port > 0); app.stop(); // try to reuse the port app = WebApps.$for(this).at(port).start(); assertEquals(port, app.getListenerAddress().getPort()); app.stop(); }
@Test public void testCreateWithPort() { // see if the ephemeral port is updated WebApp app = WebApps.$for(this).at(0).start(); int port = app.getListenerAddress().getPort(); assertTrue(port > 0); app.stop(); // try to reuse the port app = WebApps.$for(this).at(port).start(); assertEquals(port, app.getListenerAddress().getPort()); app.stop(); }
@Test public void testCreateWithPort() { // see if the ephemeral port is updated WebApp app = WebApps.$for(this).at(0).start(); int port = app.getListenerAddress().getPort(); assertTrue(port > 0); app.stop(); // try to reuse the port app = WebApps.$for(this).at(port).start(); assertEquals(port, app.getListenerAddress().getPort()); app.stop(); }
String hostPort = NetUtils.getHostPortString(((MRClientService) app.getClientService()) .getWebApp().getListenerAddress()); URL httpUrl = new URL("http://" + hostPort + "/mapreduce");
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithNonZeroPort() { WebApp app = WebApps.$for(this).at(50000).start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at(50000).start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithBindAddressNonZeroPort() { WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithBindAddressNonZeroPort() { WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithNonZeroPort() { WebApp app = WebApps.$for(this).at(50000).start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at(50000).start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithBindAddressNonZeroPort() { WebApp app = WebApps.$for(this).at("0.0.0.0:50000").start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at("0.0.0.0:50000").start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
@Test(expected=org.apache.hadoop.yarn.webapp.WebAppException.class) public void testCreateWithNonZeroPort() { WebApp app = WebApps.$for(this).at(50000).start(); int port = app.getListenerAddress().getPort(); assertEquals(50000, port); // start another WebApp with same NonZero port WebApp app2 = WebApps.$for(this).at(50000).start(); // An exception occurs (findPort disabled) app.stop(); app2.stop(); }
assertEquals("foo", getContent(baseUrl +"test/foo").trim()); app1 = WebApps.$for("test", this).at(port).start(); assertEquals(port, app1.getListenerAddress().getPort()); app2 = WebApps.$for("test", this).at("0.0.0.0", port, true).start(); assertTrue(app2.getListenerAddress().getPort() > port); Configuration conf = new Configuration(); port = ServerSocketUtil.waitForPort(47000, 60); app3 = WebApps.$for("test", this).at(port).withPortRange(conf, "abc"). start(); assertEquals(port, app3.getListenerAddress().getPort()); ServerSocketUtil.waitForPort(46000, 60); conf.set("abc", "46000-46500"); app4 = WebApps.$for("test", this).at(port).withPortRange(conf, "abc"). start(); assertEquals(46000, app4.getListenerAddress().getPort()); app5 = WebApps.$for("test", this).withPortRange(conf, "abc").start(); assertTrue(app5.getListenerAddress().getPort() > 46000); } finally { stopWebApp(app);
private void checkActiveRMWebServices() throws JSONException { // Validate web-service Client webServiceClient = Client.create(new DefaultClientConfig()); InetSocketAddress rmWebappAddr = NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress()); String webappURL = "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort(); WebResource webResource = webServiceClient.resource(webappURL); String path = app.getApplicationId().toString(); ClientResponse response = webResource.path("ws").path("v1").path("cluster").path("apps") .path(path).accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE + "; " + JettyUtils.UTF_8, response.getType().toString()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject appJson = json.getJSONObject("app"); assertEquals("ACCEPTED", appJson.getString("state")); // Other stuff is verified in the regular web-services related tests }
private void checkActiveRMWebServices() throws JSONException { // Validate web-service Client webServiceClient = Client.create(new DefaultClientConfig()); InetSocketAddress rmWebappAddr = NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress()); String webappURL = "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort(); WebResource webResource = webServiceClient.resource(webappURL); String path = app.getApplicationId().toString(); ClientResponse response = webResource.path("ws").path("v1").path("cluster").path("apps") .path(path).accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); JSONObject json = response.getEntity(JSONObject.class); assertEquals("incorrect number of elements", 1, json.length()); JSONObject appJson = json.getJSONObject("app"); assertEquals("ACCEPTED", appJson.getString("state")); // Other stuff is verified in the regular web-services related tests }