本文整理汇总了Java中play.test.Helpers.testServer方法的典型用法代码示例。如果您正苦于以下问题:Java Helpers.testServer方法的具体用法?Java Helpers.testServer怎么用?Java Helpers.testServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.test.Helpers
的用法示例。
在下文中一共展示了Helpers.testServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navAdminFirefox17
import play.test.Helpers; //导入方法依赖的package包/类
/**
* @author andre.tschirch
*
* Example test method for using specific Firefox version e.g. v17.
*
* Test method for running a successful login and the right presentation of
* the activity state of the admin navigation link, which must be active,
* for browser Firefox.
*/
// @Test
public void navAdminFirefox17() {
ProfilesIni profile = new ProfilesIni();
FirefoxProfile firefoxProfile = profile.getProfile("firefox17");
WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("D:/schatzsuche/firefox17/firefox.exe")), firefoxProfile);
TestBrowser browser = Helpers.testBrowser(driver, 3333);
TestServer server = Helpers.testServer(3333, Helpers.fakeApplication());
TestServer startedServer = null;
try {
server.start();
startedServer = server;
new NavAdminCallbackComposite().invoke(browser);
} catch(Throwable t) {
throw new RuntimeException(t);
} finally {
if(browser != null) {
browser.quit();
}
if(startedServer != null) {
startedServer.stop();
}
}
}
示例2: testServer
import play.test.Helpers; //导入方法依赖的package包/类
private TestServer testServer(final boolean isAuthEnabled) {
final Router router = new RoutingDsl()
.GET(URI).routeTo(() -> ok())
.build();
final Application app = new GuiceApplicationBuilder()
.configure("play.http.filters", "com.commercetools.sunrise.httpauth.basic.BasicHttpAuthenticationFilters")
.overrides(
bind(HttpAuthentication.class).toInstance(httpAuthentication(isAuthEnabled)),
bind(play.api.routing.Router.class).toInstance(router.asScala()))
.build();
return Helpers.testServer(app);
}