/** * 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); }
/** Starts a new application. */ public static void start(FakeApplication fakeApplication) { play.api.Play.start(fakeApplication.getWrappedApplication()); }
/** Starts a new application. */ public static void start(Application application) { play.api.Play.start(application.getWrappedApplication()); }