/** * Executes a block of code in a running server. * @param server the server to start. * @param block the block of code to run after the server starts. */ public static void running(TestServer server, final Runnable block) { Helpers$.MODULE$.running(server, asScala(() -> { block.run(); return null; })); }
/** * Executes a block of code in a running server. * @param server the server to start. * @param block the block of code to run after the server starts. */ public static void running(TestServer server, final Runnable block) { Helpers$.MODULE$.running(server, asScala(() -> { block.run(); return null; })); }
/** * Executes a block of code in a running application. * * @param application the application context. * @param block the block to run after the Play app is started. */ public static void running(Application application, final Runnable block) { Helpers$.MODULE$.running(application.asScala(), asScala(() -> { block.run(); return null; })); }
/** * Executes a block of code in a running application. * * @param application the application context. * @param block the block to run after the Play app is started. */ public static void running(Application application, final Runnable block) { Helpers$.MODULE$.running(application.asScala(), asScala(() -> { block.run(); return null; })); }
/** * Constructs a in-memory (h2) database configuration to add to a fake application. * * @param name the database name. * @param options the database options. * @return a map of String containing database config info. */ public static Map<String, String> inMemoryDatabase(String name, Map<String, String> options) { return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options))); }
/** * Constructs a in-memory (h2) database configuration to add to a FakeApplication. */ public static Map<String,String> inMemoryDatabase(String name, Map<String, String> options) { return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options))); }
/** * Constructs a in-memory (h2) database configuration to add to a fake application. * * @param name the database name. * @param options the database options. * @return a map of String containing database config info. */ public static Map<String, String> inMemoryDatabase(String name, Map<String, String> options) { return Scala.asJava(play.api.test.Helpers.inMemoryDatabase(name, Scala.asScala(options))); }
/** * Executes a block of code in a running server, with a test browser. * * @param server the test server. * @param webDriver the web driver instance. * @param block the block of code to execute. */ public static void running(TestServer server, WebDriver webDriver, final Consumer<TestBrowser> block) { Helpers$.MODULE$.runSynchronized(server.application(), asScala(() -> { TestBrowser browser = null; TestServer startedServer = null; try { start(server); startedServer = server; browser = testBrowser(webDriver, (Integer) OptionConverters.toJava(server.config().port()).get()); block.accept(browser); } finally { if (browser != null) { browser.quit(); } if (startedServer != null) { stop(startedServer); } } return null; })); }
/** * Executes a block of code in a running server, with a test browser. * * @param server the test server. * @param webDriver the web driver instance. * @param block the block of code to execute. */ public static void running(TestServer server, WebDriver webDriver, final Consumer<TestBrowser> block) { Helpers$.MODULE$.runSynchronized(server.application(), asScala(() -> { TestBrowser browser = null; TestServer startedServer = null; try { start(server); startedServer = server; browser = testBrowser(webDriver, (Integer) OptionConverters.toJava(server.config().port()).get()); block.accept(browser); } finally { if (browser != null) { browser.quit(); } if (startedServer != null) { stop(startedServer); } } return null; })); }
Scala.toSeq(additionalPlugins), Scala.toSeq(withoutPlugins), Scala.asScala((Map<String, Object>) additionalConfiguration), scala.Option.apply(scalaGlobal), scala.PartialFunction$.MODULE$.<scala.Tuple2<String, String>, Handler>empty()
/** * Convert this session to a Scala session. * * @return the Scala session. */ public play.api.mvc.Session asScala() { return new play.api.mvc.Session(Scala.asScala(this)); }
/** * Set a Form url encoded body to this request. */ public RequestBuilder bodyForm(Map<String,String> data) { Map<String,Seq<String>> seqs = new HashMap<>(); for (Entry<String,String> entry: data.entrySet()) { seqs.put(entry.getKey(), JavaConversions.asScalaBuffer(Arrays.asList(entry.getValue()))); } scala.collection.immutable.Map<String,Seq<String>> map = asScala(seqs); return body(new AnyContentAsFormUrlEncoded(map), "application/x-www-form-urlencoded"); }
@Override public void configure(Environment env, Config configuration, Map<String, String> optionalProperties) { delegate.configure( env.asScala(), new play.api.Configuration(configuration), Scala.asScala(optionalProperties) ); }
/** * Returns a new flash with the given keys removed. */ public Flash removing(String... keys) { return new play.api.mvc.Flash(Scala.asScala(this)).$minus$minus(Scala.toSeq(keys)).asJava(); }
/** * Returns a new session with the given keys removed. */ public Session removing(String... keys) { return new play.api.mvc.Session(Scala.asScala(this)).$minus$minus(Scala.toSeq(keys)).asJava(); }
/** * Returns a new flash with the given key-value pair added. */ public Flash adding(String key, String value) { return new play.api.mvc.Flash(Scala.asScala(this)).$plus(Scala.Tuple(key, value)).asJava(); }
/** * Sets all parameters for the session. * @param data a key value mapping of the session data * @return the builder instance */ public RequestBuilder session(Map<String,String> data) { play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data)); attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session)); return this; }
/** * Sets all parameters for the session. * @param data a key value mapping of the session data * @return the builder instance */ public RequestBuilder session(Map<String,String> data) { play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data)); attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session)); return this; }
/** * Sets all parameters for the session. * @param data a key value mapping of the session data * @return the builder instance */ public RequestBuilder session(Map<String,String> data) { play.api.mvc.Session session = new play.api.mvc.Session(Scala.asScala(data)); attr(new TypedKey<>(RequestAttrKey.Session()), new AssignedCell<>(session)); return this; }