本文整理汇总了Java中org.apache.hadoop.yarn.webapp.WebApp.stop方法的典型用法代码示例。如果您正苦于以下问题:Java WebApp.stop方法的具体用法?Java WebApp.stop怎么用?Java WebApp.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.webapp.WebApp
的用法示例。
在下文中一共展示了WebApp.stop方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCustomRoutes
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@Test public void testCustomRoutes() throws Exception {
WebApp app = WebApps.$for("test", this).start(new WebApp() {
@Override public void setup() {
route("/:foo", FooController.class);
route("/bar/foo", FooController.class, "bar");
route("/foo/:foo", DefaultController.class);
route("/foo/bar/:foo", DefaultController.class, "index");
}
});
String baseUrl = baseUrl(app);
try {
assertEquals("foo", getContent(baseUrl).trim());
assertEquals("foo", getContent(baseUrl +"test").trim());
assertEquals("foo1", getContent(baseUrl +"test/1").trim());
assertEquals("bar", getContent(baseUrl +"test/bar/foo").trim());
assertEquals("default", getContent(baseUrl +"test/foo/bar").trim());
assertEquals("default1", getContent(baseUrl +"test/foo/1").trim());
assertEquals("default2", getContent(baseUrl +"test/foo/bar/2").trim());
assertEquals(404, getResponseCode(baseUrl +"test/goo"));
} finally {
app.stop();
}
}
示例2: testCreateWithPort
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@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();
}
示例3: testCreateWithBindAddressNonZeroPort
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@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();
}
示例4: testCreateWithNonZeroPort
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@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();
}
示例5: testServePaths
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@Test public void testServePaths() {
WebApp app = WebApps.$for("test", this).start();
assertEquals("/test", app.getRedirectPath());
String[] expectedPaths = { "/test", "/test/*" };
String[] pathSpecs = app.getServePathSpecs();
assertEquals(2, pathSpecs.length);
for(int i = 0; i < expectedPaths.length; i++) {
assertTrue(ArrayUtils.contains(pathSpecs, expectedPaths[i]));
}
app.stop();
}
示例6: testServePathsNoName
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@Test public void testServePathsNoName() {
WebApp app = WebApps.$for("", this).start();
assertEquals("/", app.getRedirectPath());
String[] expectedPaths = { "/*" };
String[] pathSpecs = app.getServePathSpecs();
assertEquals(1, pathSpecs.length);
for(int i = 0; i < expectedPaths.length; i++) {
assertTrue(ArrayUtils.contains(pathSpecs, expectedPaths[i]));
}
app.stop();
}
示例7: testDefaultRoutes
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@Test public void testDefaultRoutes() throws Exception {
WebApp app = WebApps.$for("test", this).start();
String baseUrl = baseUrl(app);
try {
assertEquals("foo", getContent(baseUrl +"test/foo").trim());
assertEquals("foo", getContent(baseUrl +"test/foo/index").trim());
assertEquals("bar", getContent(baseUrl +"test/foo/bar").trim());
assertEquals("default", getContent(baseUrl +"test").trim());
assertEquals("default", getContent(baseUrl +"test/").trim());
assertEquals("default", getContent(baseUrl).trim());
} finally {
app.stop();
}
}
示例8: testCreate
import org.apache.hadoop.yarn.webapp.WebApp; //导入方法依赖的package包/类
@Test public void testCreate() {
WebApp app = WebApps.$for(this).start();
app.stop();
}