示例#1
0
 /** Executes a block of code in a running server, with a test browser. */
 public static void running(
     TestServer server, WebDriver webDriver, final Callback<TestBrowser> block) {
   synchronized (PlayRunners$.MODULE$.mutex()) {
     TestBrowser browser = null;
     TestServer startedServer = null;
     try {
       start(server);
       startedServer = server;
       browser = testBrowser(webDriver);
       block.invoke(browser);
     } catch (Error e) {
       throw e;
     } catch (RuntimeException re) {
       throw re;
     } catch (Throwable t) {
       throw new RuntimeException(t);
     } finally {
       if (browser != null) {
         browser.quit();
       }
       if (startedServer != null) {
         stop(startedServer);
       }
     }
   }
 }
示例#2
0
 /** Executes a block of code in a running server. */
 public static void running(TestServer server, final Runnable block) {
   synchronized (PlayRunners$.MODULE$.mutex()) {
     try {
       start(server);
       block.run();
     } finally {
       stop(server);
     }
   }
 }
示例#3
0
 /** Executes a block of code in a running application. */
 public static void running(FakeApplication fakeApplication, final Runnable block) {
   synchronized (PlayRunners$.MODULE$.mutex()) {
     try {
       start(fakeApplication);
       block.run();
     } finally {
       stop(fakeApplication);
     }
   }
 }
示例#4
0
 /** Executes a block of code in a running server, with a test browser. */
 public static void running(
     TestServer server, WebDriver webDriver, final Consumer<TestBrowser> block) {
   synchronized (PlayRunners$.MODULE$.mutex()) {
     TestBrowser browser = null;
     TestServer startedServer = null;
     try {
       start(server);
       startedServer = server;
       browser = testBrowser(webDriver, server.port());
       block.accept(browser);
     } finally {
       if (browser != null) {
         browser.quit();
       }
       if (startedServer != null) {
         stop(startedServer);
       }
     }
   }
 }
 @After
 public void stopApp() {
   Helpers.stop(app);
 }
示例#6
0
 @AfterClass
 public static void stopApp() {
   Helpers.stop(app);
 }