Anandkumar Chandran

Initiate VE.AGARAM

  1 +This is your new Play 2.1 application
  2 +=====================================
  3 +
  4 +This file will be packaged with your application, when using `play dist`.
  5 +
  6 +Lets test
  1 +package controllers;
  2 +
  3 +import play.*;
  4 +import play.mvc.*;
  5 +
  6 +import views.html.*;
  7 +
  8 +public class Application extends Controller {
  9 +
  10 + public static Result index() {
  11 + return ok(index.render("Your new application is ready."));
  12 + }
  13 +
  14 +}
  1 +@(message: String)
  2 +
  3 +@main("Welcome to Play 2.1") {
  4 +
  5 + @play20.welcome(message, style = "Java")
  6 +
  7 +}
  1 +@(title: String)(content: Html)
  2 +
  3 +<!DOCTYPE html>
  4 +
  5 +<html>
  6 + <head>
  7 + <title>@title</title>
  8 + <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
  9 + <link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
  10 + <script src="@routes.Assets.at("javascripts/jquery-1.9.0.min.js")" type="text/javascript"></script>
  11 + </head>
  12 + <body>
  13 + @content
  14 + </body>
  15 +</html>
  1 +# This is the main configuration file for the application.
  2 +# ~~~~~
  3 +
  4 +# Secret key
  5 +# ~~~~~
  6 +# The secret key is used to secure cryptographics functions.
  7 +# If you deploy your application to several instances be sure to use the same key!
  8 +application.secret="pCmp2>9@_aSvs4Ol1DH]JEak`<rA6aQAK/KJeDOS]E[mh@2`HFZcT:v9SpId@xOr"
  9 +
  10 +# The application languages
  11 +# ~~~~~
  12 +application.langs="en"
  13 +
  14 +# Global object class
  15 +# ~~~~~
  16 +# Define the Global object class for this application.
  17 +# Default to Global in the root package.
  18 +# application.global=Global
  19 +
  20 +# Router
  21 +# ~~~~~
  22 +# Define the Router object to use for this application.
  23 +# This router will be looked up first when the application is starting up,
  24 +# so make sure this is the entry point.
  25 +# Furthermore, it's assumed your route file is named properly.
  26 +# So for an application router like `conf/my.application.Router`,
  27 +# you may need to define a router file `my.application.routes`.
  28 +# Default to Routes in the root package (and `conf/routes`)
  29 +# application.router=my.application.Routes
  30 +
  31 +# Database configuration
  32 +# ~~~~~
  33 +# You can declare as many datasources as you want.
  34 +# By convention, the default datasource is named `default`
  35 +#
  36 +# db.default.driver=org.h2.Driver
  37 +# db.default.url="jdbc:h2:mem:play"
  38 +# db.default.user=sa
  39 +# db.default.password=""
  40 +#
  41 +# You can expose this datasource via JNDI if needed (Useful for JPA)
  42 +# db.default.jndiName=DefaultDS
  43 +
  44 +# Evolutions
  45 +# ~~~~~
  46 +# You can disable evolutions if needed
  47 +# evolutionplugin=disabled
  48 +
  49 +# Ebean configuration
  50 +# ~~~~~
  51 +# You can declare as many Ebean servers as you want.
  52 +# By convention, the default server is named `default`
  53 +#
  54 +# ebean.default="models.*"
  55 +
  56 +# Logger
  57 +# ~~~~~
  58 +# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
  59 +
  60 +# Root logger:
  61 +logger.root=ERROR
  62 +
  63 +# Logger used by the framework:
  64 +logger.play=INFO
  65 +
  66 +# Logger provided to your application:
  67 +logger.application=DEBUG
  68 +
  1 +# Routes
  2 +# This file defines all application routes (Higher priority routes first)
  3 +# ~~~~
  4 +
  5 +# Home page
  6 +GET / controllers.Application.index()
  7 +
  8 +# Map static resources from the /public folder to the /assets URL path
  9 +GET /assets/*file controllers.Assets.at(path="/public", file)
  1 +import sbt._
  2 +import Keys._
  3 +import play.Project._
  4 +
  5 +object ApplicationBuild extends Build {
  6 +
  7 + val appName = "ve-agaram"
  8 + val appVersion = "1.0-SNAPSHOT"
  9 +
  10 + val appDependencies = Seq(
  11 + // Add your project dependencies here,
  12 + javaCore,
  13 + javaJdbc,
  14 + javaEbean
  15 + )
  16 +
  17 + val main = play.Project(appName, appVersion, appDependencies).settings(
  18 + // Add your own project settings here
  19 + )
  20 +
  21 +}
  1 +sbt.version=0.12.2
  1 +// Comment to get more information during initialization
  2 +logLevel := Level.Warn
  3 +
  4 +// The Typesafe repository
  5 +resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
  6 +
  7 +// Use the Play sbt plugin for Play projects
  8 +addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
This diff is collapsed. Click to expand it.
  1 +import java.util.ArrayList;
  2 +import java.util.HashMap;
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.codehaus.jackson.JsonNode;
  7 +import org.junit.*;
  8 +
  9 +import play.mvc.*;
  10 +import play.test.*;
  11 +import play.data.DynamicForm;
  12 +import play.data.validation.ValidationError;
  13 +import play.data.validation.Constraints.RequiredValidator;
  14 +import play.i18n.Lang;
  15 +import play.libs.F;
  16 +import play.libs.F.*;
  17 +
  18 +import static play.test.Helpers.*;
  19 +import static org.fest.assertions.Assertions.*;
  20 +
  21 +
  22 +/**
  23 +*
  24 +* Simple (JUnit) tests that can call all parts of a play app.
  25 +* If you are interested in mocking a whole application, see the wiki for more details.
  26 +*
  27 +*/
  28 +public class ApplicationTest {
  29 +
  30 + @Test
  31 + public void simpleCheck() {
  32 + int a = 1 + 1;
  33 + assertThat(a).isEqualTo(2);
  34 + }
  35 +
  36 + @Test
  37 + public void renderTemplate() {
  38 + Content html = views.html.index.render("Your new application is ready.");
  39 + assertThat(contentType(html)).isEqualTo("text/html");
  40 + assertThat(contentAsString(html)).contains("Your new application is ready.");
  41 + }
  42 +
  43 +
  44 +}
  1 +import org.junit.*;
  2 +
  3 +import play.mvc.*;
  4 +import play.test.*;
  5 +import play.libs.F.*;
  6 +
  7 +import static play.test.Helpers.*;
  8 +import static org.fest.assertions.Assertions.*;
  9 +
  10 +import static org.fluentlenium.core.filter.FilterConstructor.*;
  11 +
  12 +public class IntegrationTest {
  13 +
  14 + /**
  15 + * add your integration test here
  16 + * in this example we just check if the welcome page is being shown
  17 + */
  18 + @Test
  19 + public void test() {
  20 + running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
  21 + public void invoke(TestBrowser browser) {
  22 + browser.goTo("http://localhost:3333");
  23 + assertThat(browser.pageSource()).contains("Your new application is ready.");
  24 + }
  25 + });
  26 + }
  27 +
  28 +}