/** * Silent checkstyle. * * @param args not used */ public static void main(final String[] args) { // Initialize Play Application to use the play environment functions... Application play = new DefaultApplication( new File("."), WaypointDemo.class.getClassLoader(), null, Mode.Dev()); Play.start(play); try { // Set up Google Guice Dependency Injector Injector injector = Guice.createInjector(); /* Build up the application, resolving dependencies * automatically by Guice */ WaypointTUI tui = injector.getInstance(WaypointTUI.class); tui.printTUI(); /* continue to read user input on the tui until the user * decides to quit*/ boolean continu = true; Scanner scanner = new Scanner(System.in); while (continu) { continu = tui.processInputLine(scanner.nextLine()); } scanner.close(); } finally { Play.stop(); } }
@Test public void testSession() { Application app = new GuiceApplicationBuilder().build(); Play.start(app); Context ctx = new Context(new RequestBuilder().session("a", "1").session("b", "1").session("b", "2")); assertEquals("1", ctx.session().get("a")); assertEquals("2", ctx.session().get("b")); Play.stop(app); }
/** Stops an application. */ public static void stop(FakeApplication fakeApplication) { play.api.Play.stop(); }
/** Stops an application. */ public static void stop(Application application) { play.api.Play.stop(application.getWrappedApplication()); }