Esempio n. 1
0
 @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();
 }
Esempio n. 2
0
 @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();
 }