/** * Creates a new Test server. * * @param port the port to run the server on. * @param sslPort the port to run the server on. * @return the test server. */ public static TestServer testServer(int port, int sslPort) { return new TestServer(port, fakeApplication(), sslPort); }
/** * Route a call using the given application. * * @param app the application * @param call the call to route * @see GuiceApplicationBuilder * @return the result */ public static Result route(Application app, Call call) { return route(app, fakeRequest(call)); }
/** * Creates a Test Browser. */ public static TestBrowser testBrowser() { return testBrowser(HTMLUNIT); }
@Before public void startServer() { if (testServer != null) { testServer.stop(); } app = provideApplication(); port = providePort(); testServer = Helpers.testServer(port, app); testServer.start(); }
/** * Build a new GET / fake request. */ public static RequestBuilder fakeRequest() { return fakeRequest("GET", "/"); }
/** * Constructs a in-memory (h2) database configuration to add to a FakeApplication. */ public static Map<String,String> inMemoryDatabase() { return inMemoryDatabase("default"); }
/** * Stops a Test server. */ public static void stop(TestServer server) { server.stop(); }
/** * Override this method to setup the application to use. * * @return The application to use */ protected Application provideApplication() { return Helpers.fakeApplication(); }
/** * Creates a Test Browser. * * @param of the web driver to run the browser with. * @param port the port to run against http://localhost * @return the test browser. */ public static TestBrowser testBrowser(WebDriver of, int port) { return new TestBrowser(of, "http://localhost:" + port); }
@Before public void startServer() { if (testServer != null) { testServer.stop(); } app = provideApplication(); port = providePort(); testServer = Helpers.testServer(port, app); testServer.start(); }
/** * Creates a new Test server. * * @param port the port to run the server on. * @param sslPort the port to run the server on. * @return the test server. */ public static TestServer testServer(int port, int sslPort) { return new TestServer(port, fakeApplication(), sslPort); }
/** * Route a call using the given application and timeout. * * @param app the application * @param call the call to route * @param timeout the time out * @see GuiceApplicationBuilder * @return the result */ public static Result route(Application app, Call call, long timeout) { return route(app, fakeRequest(call), timeout); }
/** * Creates a Test Browser. */ public static TestBrowser testBrowser(int port) { return testBrowser(HTMLUNIT, port); }
/** * Builds a new "GET /" fake request. * @return the request builder. */ public static RequestBuilder fakeRequest() { return fakeRequest("GET", "/"); }
@Before public void startServer() { if (testServer != null) { testServer.stop(); } app = provideApplication(); port = providePort(); testServer = Helpers.testServer(port, app); testServer.start(); }
/** * Creates a new Test server. */ public static TestServer testServer(int port) { return new TestServer(port, fakeApplication()); }
/** * Override this if you want to use a different browser * * @param port the port to run the browser against. * @return a new test browser */ protected TestBrowser provideBrowser(int port) { return Helpers.testBrowser(port); }
/** * Creates a new Test server. * * @param port the port to run the server on. * @return the test server. */ public static TestServer testServer(int port) { return new TestServer(port, fakeApplication()); }
/** * Creates a Test Browser. * * @return the test browser. */ public static TestBrowser testBrowser() { return testBrowser(HTMLUNIT); }
/** * Creates a new Test server. * * @param port the port to run the server on. * @return the test server. */ public static TestServer testServer(int port) { return new TestServer(port, fakeApplication()); }