Browse Source

Merge branch 'master' of https://github.com/PerfectCarl/FrameworkBenchmarks into PerfectCarl-master

Patrick Falls 12 years ago
parent
commit
f9113a15cc
45 changed files with 1050 additions and 0 deletions
  1. 2 0
      play1/README.md
  2. 0 0
      play1/__init__.py
  3. 88 0
      play1/app/controllers/Application.java
  4. 30 0
      play1/app/models/World.java
  5. 8 0
      play1/app/views/Application/index.html
  6. 19 0
      play1/app/views/errors/404.html
  7. 21 0
      play1/app/views/errors/500.html
  8. 16 0
      play1/app/views/main.html
  9. 13 0
      play1/benchmark_config
  10. 228 0
      play1/conf/application.conf
  11. 4 0
      play1/conf/dependencies.yml
  12. 3 0
      play1/conf/messages
  13. 12 0
      play1/conf/routes
  14. 3 0
      play1/notes.txt
  15. BIN
      play1/public/images/favicon.png
  16. 1 0
      play1/public/javascripts/jquery-1.6.4.min.js
  17. 0 0
      play1/public/stylesheets/main.css
  18. 32 0
      play1/setup.py
  19. 7 0
      play1/test/Application.test.html
  20. 17 0
      play1/test/ApplicationTest.java
  21. 13 0
      play1/test/BasicTest.java
  22. 7 0
      play1/test/data.yml
  23. 2 0
      play1siena/README.md
  24. 0 0
      play1siena/__init__.py
  25. 92 0
      play1siena/app/controllers/Application.java
  26. 27 0
      play1siena/app/models/World.java
  27. 8 0
      play1siena/app/views/Application/index.html
  28. 19 0
      play1siena/app/views/errors/404.html
  29. 21 0
      play1siena/app/views/errors/500.html
  30. 16 0
      play1siena/app/views/main.html
  31. 13 0
      play1siena/benchmark_config
  32. 229 0
      play1siena/conf/application.conf
  33. 5 0
      play1siena/conf/dependencies.yml
  34. 3 0
      play1siena/conf/messages
  35. 12 0
      play1siena/conf/routes
  36. 1 0
      play1siena/modules/siena-2.0.7
  37. 3 0
      play1siena/notes.txt
  38. BIN
      play1siena/public/images/favicon.png
  39. 1 0
      play1siena/public/javascripts/jquery-1.6.4.min.js
  40. 0 0
      play1siena/public/stylesheets/main.css
  41. 30 0
      play1siena/setup.py
  42. 7 0
      play1siena/test/Application.test.html
  43. 17 0
      play1siena/test/ApplicationTest.java
  44. 13 0
      play1siena/test/BasicTest.java
  45. 7 0
      play1siena/test/data.yml

+ 2 - 0
play1/README.md

@@ -0,0 +1,2 @@
+FrameworkBenchmarks-play1.2.5
+=============================

+ 0 - 0
play1/__init__.py


+ 88 - 0
play1/app/controllers/Application.java

@@ -0,0 +1,88 @@
+package controllers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+
+import models.World;
+import play.db.jpa.JPAPlugin;
+import play.jobs.Job;
+import play.mvc.Controller;
+
+public class Application extends Controller {
+
+	private static final int TEST_DATABASE_ROWS = 10000;
+
+	// FIXME: should this test be consistent - ie set seed or not?
+	private static Random random = new Random();
+
+	public static void index() {
+		render();
+	}
+
+	public static void json() {
+		Map<String, String> result = new HashMap<String, String>();
+		result.put("message", "Hello World!");
+		renderJSON(result);
+	}
+
+	@play.db.jpa.NoTransaction
+	public static void setup() {
+		JPAPlugin plugin = play.Play.plugin(JPAPlugin.class);
+		plugin.startTx(true);
+		
+		// clean out the old
+		World.deleteAll();
+		System.out.println("DELETED");
+		// in with the new
+		for (long i = 0; i <= TEST_DATABASE_ROWS; i++) {
+			int randomNumber = random.nextInt(TEST_DATABASE_ROWS) + 1;
+			new World(i, randomNumber).save();
+			if (i % 100 == 0) {
+				
+				World.em().flush();
+				World.em().clear();
+				System.out.println("FLUSHED : " + i + "/" + TEST_DATABASE_ROWS);
+				
+			}
+		}
+		System.out.println("ADDED");
+		plugin.closeTx(false);
+	}
+
+	public static void db(int queries) throws InterruptedException,
+			ExecutionException {
+		if (queries == 0)
+			queries = 1;
+		final int queryCount = queries;
+		final List<World> worlds = new ArrayList<World>();
+		Job<List<World>> job = new Job<List<World>>() {
+			public java.util.List<World> doJobWithResult() throws Exception {
+				for (int i = 0; i < queryCount; ++i) {
+					Long id = Long
+							.valueOf(random.nextInt(TEST_DATABASE_ROWS) + 1);
+					World result = World.findById(id);
+					worlds.add(result);
+				}
+				return worlds;
+			};
+		};
+		List<World> result = job.now().get();
+		renderJSON(result);
+	}
+
+	public static void dbSync(int queries) {
+		if (queries == 0)
+			queries = 1;
+		final List<World> worlds = new ArrayList<World>();
+		for (int i = 0; i < queries; ++i) {
+			Long id = Long.valueOf(random.nextInt(TEST_DATABASE_ROWS) + 1);
+			World result = World.findById(id);
+			worlds.add(result);
+		}
+		renderJSON(worlds);
+	}
+}

+ 30 - 0
play1/app/models/World.java

@@ -0,0 +1,30 @@
+package models;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+import play.db.jpa.GenericModel;
+import play.db.jpa.Model;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * use a generic model as we want to explicitly define the id
+ * 
+ * @author tom
+ * 
+ */
+@Entity
+public class World extends GenericModel {
+
+	public World(long i, long number) {
+		id = i;
+		randomNumber = number ;
+	}
+
+	@Id
+	public Long id;
+
+	public Long randomNumber;
+}

+ 8 - 0
play1/app/views/Application/index.html

@@ -0,0 +1,8 @@
+
+<ul>
+<li><a href="@{Application.db(queries:100)}">DB</a></li>
+<li><a href="@{Application.dbSync(queries:100)}">DB sync</a></li>
+<li><a href="@{Application.json}">JSON test</a></li>
+<li><a href="@{Application.setup}">populate db</a></li>
+</ul>
+

+ 19 - 0
play1/app/views/errors/404.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>Not found</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=${_response_encoding}"/>    
+    </head>
+    <body>
+        #{if play.mode.name() == 'DEV'}
+            #{404 result /}
+        #{/if}
+        #{else}
+            <h1>Not found</h1>
+            <p>
+                ${result.message}
+            </p>
+        #{/else}
+    </body>
+</html>

+ 21 - 0
play1/app/views/errors/500.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>Application error</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=${_response_encoding}"/>	
+    </head>
+    <body>
+        #{if play.mode.name() == 'DEV'}
+            #{500 exception /}
+        #{/if}
+        #{else}
+            <h1>Oops, an error occured</h1>
+            #{if exception instanceof play.exceptions.PlayException}
+                <p>
+                    This exception has been logged with id <strong>${exception.id}</strong>.
+                </p>
+            #{/if}
+        #{/else}
+    </body>
+</html>

+ 16 - 0
play1/app/views/main.html

@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>#{get 'title' /}</title>
+        <meta charset="${_response_encoding}">
+        <link rel="stylesheet" media="screen" href="@{'/public/stylesheets/main.css'}">
+        #{get 'moreStyles' /}
+        <link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}">
+        <script src="@{'/public/javascripts/jquery-1.6.4.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
+        #{get 'moreScripts' /}
+    </head>
+    <body>
+        #{doLayout /}
+    </body>
+</html>

+ 13 - 0
play1/benchmark_config

@@ -0,0 +1,13 @@
+{
+  "framework": "play1",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "port": 8080,
+      "sort": 13
+    }
+  }]
+}

+ 228 - 0
play1/conf/application.conf

@@ -0,0 +1,228 @@
+# This is the main configuration file for the application.
+# ~~~~~
+application.name=play-1.2.5
+
+# Application mode
+# ~~~~~
+# Set to dev to enable instant reloading and other development help.
+# Otherwise set to prod.
+application.mode=dev
+%prod.application.mode=prod
+
+# Secret key
+# ~~~~~
+# The secret key is used to secure cryptographics functions
+# If you deploy your application to several instances be sure to use the same key !
+application.secret=p7Abj8rpexZmmC8iPsY2PlXSo1xtHFhLKHRCHpE1ZqEgRU5TIHPcEbaryoj16vi8
+
+# i18n
+# ~~~~~
+# Define locales used by your application.
+# You can then place localized messages in conf/messages.{locale} files
+# application.langs=fr,en,ja
+
+# Date format
+# ~~~~~
+date.format=yyyy-MM-dd
+# date.format.fr=dd/MM/yyyy
+
+# Server configuration
+# ~~~~~
+# If you need to change the HTTP port, uncomment this (default is set to 9000)
+# http.port=9000
+#
+# By default the server listen for HTTP on the wilcard address.
+# You can restrict this.
+# http.address=127.0.0.1
+#
+# Use this if you don't host your Play application at the root of the domain
+# you're serving it from. This parameter has no effect when deployed as a
+# war, because the path will be handled by the application server.
+# http.path=/
+
+# Session configuration
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default, session will be written to the transient PLAY_SESSION cookie.
+# The cookies are not secured by default, only set it to true
+# if you're serving your pages through https.
+# application.session.cookie=PLAY
+# application.session.maxAge=1h
+# application.session.secure=false
+
+# Session/Cookie sharing between subdomain
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default a cookie is only valid for a specific domain. By setting
+# application.defaultCookieDomain to '.example.com', the cookies
+# will be valid for all domains ending with '.example.com', ie:
+# foo.example.com and bar.example.com
+# application.defaultCookieDomain=.example.com
+
+# JVM configuration
+# ~~~~~
+# Define which port is used by JPDA when application is in debug mode (default is set to 8000)
+# jpda.port=8000
+#
+# Java source level => 1.5, 1.6 or 1.7 (experimental)
+# java.source=1.5
+
+# Log level
+# ~~~~~
+# Specify log level for your application.
+# If you want a very customized log, create a log4j.properties file in the conf directory
+# application.log=INFO
+#
+# More logging configuration
+# application.log.path=/log4j.properties
+# application.log.system.out=off
+
+# Database configuration
+# ~~~~~ 
+# Enable a database engine if needed.
+#
+# To quickly set up a development database, use either:
+#   - mem : for a transient in memory database (H2 in memory)
+#   - fs  : for a simple file written database (H2 file stored)
+# db=mem
+#
+# To connect to a local MySQL5 database, use:
+# db=mysql://user:pwd@host/database
+#
+# To connect to a local PostgreSQL9 database, use:
+# db=postgres://user:pwd@host/database
+#
+# If you need a full JDBC configuration use the following :
+# db.url=jdbc:postgresql:database_name
+# db.driver=org.postgresql.Driver
+# db.user=root
+# db.pass=secret
+#
+# Connections pool configuration :
+db.pool.timeout=1000
+db.pool.maxSize=30
+db.pool.minSize=10
+#
+# If you want to reuse an existing Datasource from your application server, use:
+# db=java:/comp/env/jdbc/myDatasource
+#
+# When using an existing Datasource, it's sometimes needed to destroy it when
+# the application is stopped. Depending on the datasource, you can define a
+# generic "destroy" method :
+# db.destroyMethod=close
+db.driver= com.mysql.jdbc.Driver
+db.url=jdbc:mysql://localhost:3306/hello_world
+db.user=benchmarkdbuser
+db.pass=benchmarkdbpass
+db.jndiName=DefaultDS
+
+db.default.driver= com.mysql.jdbc.Driver
+db.default.url=jdbc:mysql://localhost:3306/hello_world
+db.default.user=benchmarkdbuser
+db.default.pass=benchmarkdbpass
+db.default.jndiName=DefaultDS
+
+
+# JPA Configuration (Hibernate)
+# ~~~~~
+#
+# Specify the custom JPA dialect to use here (default to guess):
+# jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
+#
+# Specify the ddl generation pattern to use. Set to none to disable it 
+# (default to update in DEV mode, and none in PROD mode):
+# jpa.ddl=update
+#
+# Debug SQL statements (logged using DEBUG level):
+# jpa.debugSQL=true
+#
+# You can even specify additional hibernate properties here:
+# hibernate.use_sql_comments=true
+# ...
+#
+# Store path for Blob content
+attachments.path=data/attachments
+
+# Memcached configuration
+# ~~~~~ 
+# Enable memcached if needed. Otherwise a local cache is used.
+# memcached=enabled
+#
+# Specify memcached host (default to 127.0.0.1:11211)
+# memcached.host=127.0.0.1:11211
+#
+# Or you can specify multiple host to build a distributed cache
+# memcached.1.host=127.0.0.1:11211
+# memcached.2.host=127.0.0.1:11212
+#
+# Use plain SASL to authenticate for memcached
+# memcached.user=
+# memcached.password=
+
+# HTTP Response headers control for static files
+# ~~~~~
+# Set the default max-age, telling the user's browser how long it should cache the page.
+# Default is 3600 (one hour). Set it to 0 to send no-cache.
+# This is only read in prod mode, in dev mode the cache is disabled.
+# http.cacheControl=3600
+
+# If enabled, Play will generate entity tags automatically and send a 304 when needed.
+# Default is true, set it to false to deactivate use of entity tags.
+# http.useETag=true
+
+# Custom mime types
+# mimetype.xpi=application/x-xpinstall
+
+# WS configuration
+# ~~~~~
+# Default engine is Async Http Client, uncomment to use
+# the JDK's internal implementation
+# webservice = urlfetch
+# If you need to set proxy params for WS requests
+# http.proxyHost = localhost
+# http.proxyPort = 3128
+# http.proxyUser = jojo
+# http.proxyPassword = jojo
+
+# Mail configuration
+# ~~~~~ 
+# Default is to use a mock Mailer
+mail.smtp=mock
+
+# Or, specify mail host configuration
+# mail.smtp.host=127.0.0.1
+# mail.smtp.user=admin
+# mail.smtp.pass=
+# mail.smtp.channel=ssl
+
+# Url-resolving in Jobs
+# ~~~~~~
+# When rendering templates with reverse-url-resoling (@@{..}) in Jobs (which do not have an inbound Http.Request),
+# ie if sending a HtmlMail, Play need to know which url your users use when accessing your app.
+# %test.application.baseUrl=http://localhost:9000/
+# %prod.application.baseUrl=http://www.yourdomain.com/
+
+# Jobs executor
+# ~~~~~~
+# Size of the Jobs pool
+# play.jobs.pool=10
+
+# Execution pool
+# ~~~~~
+# Default to 1 thread in DEV mode or (nb processors + 1) threads in PROD mode.
+# Try to keep a low as possible. 1 thread will serialize all requests (very useful for debugging purpose)
+# play.pool=3
+
+# Open file from errors pages
+# ~~~~~
+# If your text editor supports opening files by URL, Play! will
+# dynamically link error pages to files 
+#
+# Example, for textmate:
+# play.editor=txmt://open?url=file://%s&line=%s
+
+# Testing. Set up a custom configuration for test mode
+# ~~~~~
+#%test.module.cobertura=${play.path}/modules/cobertura
+%test.application.mode=dev
+%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0
+%test.jpa.ddl=create
+%test.mail.smtp=mock

+ 4 - 0
play1/conf/dependencies.yml

@@ -0,0 +1,4 @@
+# Application dependencies
+
+require:
+    - play

+ 3 - 0
play1/conf/messages

@@ -0,0 +1,3 @@
+# You can specialize this file for each language.
+# For example, for French create a messages.fr file
+#

+ 12 - 0
play1/conf/routes

@@ -0,0 +1,12 @@
+# Routes
+# This file defines all application routes (Higher priority routes first)
+# ~~~~
+
+
+# Home page
+GET     /json                           Application.json
+GET     /db                             Application.db
+GET     /db_sync                        Application.dbSync
+GET     /setup                          Application.setup
+GET     /                               Application.index
+

+ 3 - 0
play1/notes.txt

@@ -0,0 +1,3 @@
+json.tosjon jackson ?
+
+jackson version ?

BIN
play1/public/images/favicon.png


File diff suppressed because it is too large
+ 1 - 0
play1/public/javascripts/jquery-1.6.4.min.js


+ 0 - 0
play1/public/stylesheets/main.css


+ 32 - 0
play1/setup.py

@@ -0,0 +1,32 @@
+import subprocess
+import sys
+import setup_util
+import os
+
+def start(args):
+   setup_util.replace_text("play1/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
+  
+  subprocess.check_call("play war -o ../play1 --zip", shell=True, cwd="play1")
+  # TODO deploy to resin
+ 
+ # subprocess.check_call("play dist", shell=True, cwd="play-java")
+ # subprocess.check_call("unzip play-java-1.0-SNAPSHOT.zip", shell=True, cwd="play-java/dist")
+ # subprocess.check_call("chmod +x start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
+  # TODO start resin
+  
+  # subprocess.Popen("./start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
+
+  return 0
+def stop():
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if './start' in line or ('play' in line and 'java' in line):   
+      pid = int(line.split(None, 2)[1])
+      os.kill(pid, 9)
+  try:
+    os.remove("play-java/RUNNING_PID")
+  except OSError:
+    pass
+    
+  return 0

+ 7 - 0
play1/test/Application.test.html

@@ -0,0 +1,7 @@
+*{ You can use plain selenium command using the selenium tag }*
+
+#{selenium}
+    // Open the home page, and check that no error occured
+    open('/')
+    assertNotTitle('Application error')
+#{/selenium}

+ 17 - 0
play1/test/ApplicationTest.java

@@ -0,0 +1,17 @@
+import org.junit.*;
+import play.test.*;
+import play.mvc.*;
+import play.mvc.Http.*;
+import models.*;
+
+public class ApplicationTest extends FunctionalTest {
+
+    @Test
+    public void testThatIndexPageWorks() {
+        Response response = GET("/");
+        assertIsOk(response);
+        assertContentType("text/html", response);
+        assertCharset(play.Play.defaultWebEncoding, response);
+    }
+    
+}

+ 13 - 0
play1/test/BasicTest.java

@@ -0,0 +1,13 @@
+import org.junit.*;
+import java.util.*;
+import play.test.*;
+import models.*;
+
+public class BasicTest extends UnitTest {
+
+    @Test
+    public void aVeryImportantThingToTest() {
+        assertEquals(2, 1 + 1);
+    }
+
+}

+ 7 - 0
play1/test/data.yml

@@ -0,0 +1,7 @@
+# you describe your data using the YAML notation here
+# and then load them using Fixtures.load("data.yml")
+
+# User(bob):
+#   email: [email protected]
+#   password: secret
+#   fullname: Bob

+ 2 - 0
play1siena/README.md

@@ -0,0 +1,2 @@
+FrameworkBenchmarks-play1.2.5
+=============================

+ 0 - 0
play1siena/__init__.py


+ 92 - 0
play1siena/app/controllers/Application.java

@@ -0,0 +1,92 @@
+package controllers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+
+import models.World;
+import play.jobs.Job;
+import play.mvc.Controller;
+
+public class Application extends Controller {
+
+	private static final int TEST_DATABASE_ROWS = 10000;
+
+	// FIXME: should this test be consistent - ie set seed or not?
+	private static Random random = new Random();
+
+	public static void index() {
+		render();
+	}
+
+	public static void json() {
+		Map<String, String> result = new HashMap<String, String>();
+		result.put("message", "Hello World!");
+		renderJSON(result);
+	}
+
+	public static void setup() {
+		
+		//JPAPlugin plugin = play.Play.plugin(JPAPlugin.class);
+		//plugin.startTx(true);
+		World w = new World() ; 
+		w.getPersistenceManager().beginTransaction();
+
+		// clean out the old
+		World.deleteAll();
+		System.out.println("DELETED");
+		// in with the new
+		List<World> worlds = new ArrayList<World>() ;
+		for (long i = 0; i <= TEST_DATABASE_ROWS; i++) {
+			int randomNumber = random.nextInt(TEST_DATABASE_ROWS) + 1;
+			worlds.add(new World(i, randomNumber));
+			if (i % 100 == 0) {
+				
+
+				World.batch().insert(worlds) ;
+				System.out.println("FLUSHED : " + i + "/" + TEST_DATABASE_ROWS);
+				worlds.clear() ;
+			}
+		}
+		System.out.println("ADDED");
+		//plugin.closeTx(false);
+		w.getPersistenceManager().commitTransaction();
+
+	}
+
+	public static void db(int queries) throws InterruptedException,
+			ExecutionException {
+		if (queries == 0)
+			queries = 1;
+		final int queryCount = queries;
+		final List<World> worlds = new ArrayList<World>();
+		Job<List<World>> job = new Job<List<World>>() {
+			public java.util.List<World> doJobWithResult() throws Exception {
+				for (int i = 0; i < queryCount; ++i) {
+					Long id = Long
+							.valueOf(random.nextInt(TEST_DATABASE_ROWS) + 1);
+					World result = World.findById(id);
+					worlds.add(result);
+				}
+				return worlds;
+			};
+		};
+		List<World> result = job.now().get();
+		renderJSON(result);
+	}
+
+	public static void dbSync(int queries) {
+		if (queries == 0)
+			queries = 1;
+		final List<World> worlds = new ArrayList<World>();
+		for (int i = 0; i < queries; ++i) {
+			Long id = Long.valueOf(random.nextInt(TEST_DATABASE_ROWS) + 1);
+			World result = World.findById(id);
+			worlds.add(result);
+		}
+		renderJSON(worlds);
+	}
+}

+ 27 - 0
play1siena/app/models/World.java

@@ -0,0 +1,27 @@
+package models;
+
+import play.modules.siena.EnhancedModel;
+import siena.Column;
+import siena.Generator;
+import siena.Id;
+
+import play.modules.siena.EnhancedModel;
+import siena.Generator;
+
+public class World extends EnhancedModel  {
+
+	public World(long i, long number) {
+		id = i;
+		randomNumber = new Long(number);
+	}
+	
+	public World() {
+	}
+
+	@Id(Generator.NONE)
+	public Long id ;
+	
+	@Column("randomNumber")
+	public Long randomNumber;
+
+}

+ 8 - 0
play1siena/app/views/Application/index.html

@@ -0,0 +1,8 @@
+
+<ul>
+<li><a href="@{Application.db(queries:100)}">DB</a></li>
+<li><a href="@{Application.dbSync(queries:100)}">DB sync</a></li>
+<li><a href="@{Application.json}">JSON test</a></li>
+<li><a href="@{Application.setup}">populate db</a></li>
+</ul>
+

+ 19 - 0
play1siena/app/views/errors/404.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>Not found</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=${_response_encoding}"/>    
+    </head>
+    <body>
+        #{if play.mode.name() == 'DEV'}
+            #{404 result /}
+        #{/if}
+        #{else}
+            <h1>Not found</h1>
+            <p>
+                ${result.message}
+            </p>
+        #{/else}
+    </body>
+</html>

+ 21 - 0
play1siena/app/views/errors/500.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>Application error</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=${_response_encoding}"/>	
+    </head>
+    <body>
+        #{if play.mode.name() == 'DEV'}
+            #{500 exception /}
+        #{/if}
+        #{else}
+            <h1>Oops, an error occured</h1>
+            #{if exception instanceof play.exceptions.PlayException}
+                <p>
+                    This exception has been logged with id <strong>${exception.id}</strong>.
+                </p>
+            #{/if}
+        #{/else}
+    </body>
+</html>

+ 16 - 0
play1siena/app/views/main.html

@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <title>#{get 'title' /}</title>
+        <meta charset="${_response_encoding}">
+        <link rel="stylesheet" media="screen" href="@{'/public/stylesheets/main.css'}">
+        #{get 'moreStyles' /}
+        <link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}">
+        <script src="@{'/public/javascripts/jquery-1.6.4.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
+        #{get 'moreScripts' /}
+    </head>
+    <body>
+        #{doLayout /}
+    </body>
+</html>

+ 13 - 0
play1siena/benchmark_config

@@ -0,0 +1,13 @@
+{
+  "framework": "play1siena",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "port": 8080,
+      "sort": 13
+    }
+  }]
+}

+ 229 - 0
play1siena/conf/application.conf

@@ -0,0 +1,229 @@
+# This is the main configuration file for the application.
+# ~~~~~
+application.name=play-1.2.5
+
+# Application mode
+# ~~~~~
+# Set to dev to enable instant reloading and other development help.
+# Otherwise set to prod.
+application.mode=dev
+%prod.application.mode=prod
+
+# Secret key
+# ~~~~~
+# The secret key is used to secure cryptographics functions
+# If you deploy your application to several instances be sure to use the same key !
+application.secret=p7Abj8rpexZmmC8iPsY2PlXSo1xtHFhLKHRCHpE1ZqEgRU5TIHPcEbaryoj16vi8
+
+# i18n
+# ~~~~~
+# Define locales used by your application.
+# You can then place localized messages in conf/messages.{locale} files
+# application.langs=fr,en,ja
+
+# Date format
+# ~~~~~
+date.format=yyyy-MM-dd
+# date.format.fr=dd/MM/yyyy
+
+# Server configuration
+# ~~~~~
+# If you need to change the HTTP port, uncomment this (default is set to 9000)
+# http.port=9000
+#
+# By default the server listen for HTTP on the wilcard address.
+# You can restrict this.
+# http.address=127.0.0.1
+#
+# Use this if you don't host your Play application at the root of the domain
+# you're serving it from. This parameter has no effect when deployed as a
+# war, because the path will be handled by the application server.
+# http.path=/
+
+# Session configuration
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default, session will be written to the transient PLAY_SESSION cookie.
+# The cookies are not secured by default, only set it to true
+# if you're serving your pages through https.
+# application.session.cookie=PLAY
+# application.session.maxAge=1h
+# application.session.secure=false
+
+# Session/Cookie sharing between subdomain
+# ~~~~~~~~~~~~~~~~~~~~~~
+# By default a cookie is only valid for a specific domain. By setting
+# application.defaultCookieDomain to '.example.com', the cookies
+# will be valid for all domains ending with '.example.com', ie:
+# foo.example.com and bar.example.com
+# application.defaultCookieDomain=.example.com
+
+# JVM configuration
+# ~~~~~
+# Define which port is used by JPDA when application is in debug mode (default is set to 8000)
+# jpda.port=8000
+#
+# Java source level => 1.5, 1.6 or 1.7 (experimental)
+# java.source=1.5
+
+# Log level
+# ~~~~~
+# Specify log level for your application.
+# If you want a very customized log, create a log4j.properties file in the conf directory
+# application.log=INFO
+#
+# More logging configuration
+# application.log.path=/log4j.properties
+# application.log.system.out=off
+
+# Database configuration
+# ~~~~~ 
+# Enable a database engine if needed.
+#
+# To quickly set up a development database, use either:
+#   - mem : for a transient in memory database (H2 in memory)
+#   - fs  : for a simple file written database (H2 file stored)
+# db=mem
+#
+# To connect to a local MySQL5 database, use:
+# db=mysql://user:pwd@host/database
+#
+# To connect to a local PostgreSQL9 database, use:
+# db=postgres://user:pwd@host/database
+#
+# If you need a full JDBC configuration use the following :
+# db.url=jdbc:postgresql:database_name
+# db.driver=org.postgresql.Driver
+# db.user=root
+# db.pass=secret
+#
+# Connections pool configuration :
+db.pool.timeout=1000
+db.pool.maxSize=30
+db.pool.minSize=10
+#
+# If you want to reuse an existing Datasource from your application server, use:
+# db=java:/comp/env/jdbc/myDatasource
+#
+# When using an existing Datasource, it's sometimes needed to destroy it when
+# the application is stopped. Depending on the datasource, you can define a
+# generic "destroy" method :
+# db.destroyMethod=close
+db.driver= com.mysql.jdbc.Driver
+db.url=jdbc:mysql://localhost:3306/hello_world
+db.user=benchmarkdbuser
+db.pass=benchmarkdbpass
+db.jndiName=DefaultDS
+
+db.default.driver= com.mysql.jdbc.Driver
+db.default.url=jdbc:mysql://localhost:3306/hello_world
+db.default.user=benchmarkdbuser
+db.default.pass=benchmarkdbpass
+db.default.jndiName=DefaultDS
+
+
+# JPA Configuration (Hibernate)
+# ~~~~~
+#
+# Specify the custom JPA dialect to use here (default to guess):
+# jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
+#
+# Specify the ddl generation pattern to use. Set to none to disable it 
+# (default to update in DEV mode, and none in PROD mode):
+# jpa.ddl=update
+#
+# Debug SQL statements (logged using DEBUG level):
+# jpa.debugSQL=true
+#
+# You can even specify additional hibernate properties here:
+# hibernate.use_sql_comments=true
+# ...
+#
+# Store path for Blob content
+attachments.path=data/attachments
+
+# Memcached configuration
+# ~~~~~ 
+# Enable memcached if needed. Otherwise a local cache is used.
+# memcached=enabled
+#
+# Specify memcached host (default to 127.0.0.1:11211)
+# memcached.host=127.0.0.1:11211
+#
+# Or you can specify multiple host to build a distributed cache
+# memcached.1.host=127.0.0.1:11211
+# memcached.2.host=127.0.0.1:11212
+#
+# Use plain SASL to authenticate for memcached
+# memcached.user=
+# memcached.password=
+
+# HTTP Response headers control for static files
+# ~~~~~
+# Set the default max-age, telling the user's browser how long it should cache the page.
+# Default is 3600 (one hour). Set it to 0 to send no-cache.
+# This is only read in prod mode, in dev mode the cache is disabled.
+# http.cacheControl=3600
+
+# If enabled, Play will generate entity tags automatically and send a 304 when needed.
+# Default is true, set it to false to deactivate use of entity tags.
+# http.useETag=true
+
+# Custom mime types
+# mimetype.xpi=application/x-xpinstall
+
+# WS configuration
+# ~~~~~
+# Default engine is Async Http Client, uncomment to use
+# the JDK's internal implementation
+# webservice = urlfetch
+# If you need to set proxy params for WS requests
+# http.proxyHost = localhost
+# http.proxyPort = 3128
+# http.proxyUser = jojo
+# http.proxyPassword = jojo
+
+# Mail configuration
+# ~~~~~ 
+# Default is to use a mock Mailer
+mail.smtp=mock
+
+# Or, specify mail host configuration
+# mail.smtp.host=127.0.0.1
+# mail.smtp.user=admin
+# mail.smtp.pass=
+# mail.smtp.channel=ssl
+
+# Url-resolving in Jobs
+# ~~~~~~
+# When rendering templates with reverse-url-resoling (@@{..}) in Jobs (which do not have an inbound Http.Request),
+# ie if sending a HtmlMail, Play need to know which url your users use when accessing your app.
+# %test.application.baseUrl=http://localhost:9000/
+# %prod.application.baseUrl=http://www.yourdomain.com/
+
+# Jobs executor
+# ~~~~~~
+# Size of the Jobs pool
+# play.jobs.pool=10
+
+# Execution pool
+# ~~~~~
+# Default to 1 thread in DEV mode or (nb processors + 1) threads in PROD mode.
+# Try to keep a low as possible. 1 thread will serialize all requests (very useful for debugging purpose)
+# play.pool=3
+
+# Open file from errors pages
+# ~~~~~
+# If your text editor supports opening files by URL, Play! will
+# dynamically link error pages to files 
+#
+# Example, for textmate:
+# play.editor=txmt://open?url=file://%s&line=%s
+
+# Testing. Set up a custom configuration for test mode
+# ~~~~~
+#%test.module.cobertura=${play.path}/modules/cobertura
+%test.application.mode=dev
+%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0
+%test.jpa.ddl=create
+%test.mail.smtp=mock
+

+ 5 - 0
play1siena/conf/dependencies.yml

@@ -0,0 +1,5 @@
+# Application dependencies
+
+require:
+    - play
+    - play -> siena 2.0.7

+ 3 - 0
play1siena/conf/messages

@@ -0,0 +1,3 @@
+# You can specialize this file for each language.
+# For example, for French create a messages.fr file
+#

+ 12 - 0
play1siena/conf/routes

@@ -0,0 +1,12 @@
+# Routes
+# This file defines all application routes (Higher priority routes first)
+# ~~~~
+
+
+# Home page
+GET     /json                           Application.json
+GET     /db                             Application.db
+GET     /db_sync                        Application.dbSync
+GET     /setup                          Application.setup
+GET     /                               Application.index
+

+ 1 - 0
play1siena/modules/siena-2.0.7

@@ -0,0 +1 @@
+C:\Users\Evasion\Apps\play-1.2.5\modules\siena-2.0.7

+ 3 - 0
play1siena/notes.txt

@@ -0,0 +1,3 @@
+json.tosjon jackson ?
+
+jackson version ?

BIN
play1siena/public/images/favicon.png


File diff suppressed because it is too large
+ 1 - 0
play1siena/public/javascripts/jquery-1.6.4.min.js


+ 0 - 0
play1siena/public/stylesheets/main.css


+ 30 - 0
play1siena/setup.py

@@ -0,0 +1,30 @@
+
+import subprocess
+import sys
+import setup_util
+import os
+
+def start(args):
+  setup_util.replace_text("play1siena/conf/application.conf", "jdbc:mysql:\/\/.*:3306", "jdbc:mysql://" + args.database_host + ":3306")
+  
+  subprocess.check_call("play war -o ../play1siena --zip", shell=True, cwd="play1siena")
+  # TODO deploy to resin
+  #subprocess.check_call("unzip play-java-1.0-SNAPSHOT.zip", shell=True, cwd="play-java/dist")
+  #subprocess.check_call("chmod +x start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
+  # TODO start resin
+  # subprocess.Popen("./start", shell=True, cwd="play-java/dist/play-java-1.0-SNAPSHOT")
+
+  return 0
+def stop():
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if './start' in line or ('play' in line and 'java' in line):   
+      pid = int(line.split(None, 2)[1])
+      os.kill(pid, 9)
+  try:
+    os.remove("play-java/RUNNING_PID")
+  except OSError:
+    pass
+    
+  return 0

+ 7 - 0
play1siena/test/Application.test.html

@@ -0,0 +1,7 @@
+*{ You can use plain selenium command using the selenium tag }*
+
+#{selenium}
+    // Open the home page, and check that no error occured
+    open('/')
+    assertNotTitle('Application error')
+#{/selenium}

+ 17 - 0
play1siena/test/ApplicationTest.java

@@ -0,0 +1,17 @@
+import org.junit.*;
+import play.test.*;
+import play.mvc.*;
+import play.mvc.Http.*;
+import models.*;
+
+public class ApplicationTest extends FunctionalTest {
+
+    @Test
+    public void testThatIndexPageWorks() {
+        Response response = GET("/");
+        assertIsOk(response);
+        assertContentType("text/html", response);
+        assertCharset(play.Play.defaultWebEncoding, response);
+    }
+    
+}

+ 13 - 0
play1siena/test/BasicTest.java

@@ -0,0 +1,13 @@
+import org.junit.*;
+import java.util.*;
+import play.test.*;
+import models.*;
+
+public class BasicTest extends UnitTest {
+
+    @Test
+    public void aVeryImportantThingToTest() {
+        assertEquals(2, 1 + 1);
+    }
+
+}

+ 7 - 0
play1siena/test/data.yml

@@ -0,0 +1,7 @@
+# you describe your data using the YAML notation here
+# and then load them using Fixtures.load("data.yml")
+
+# User(bob):
+#   email: [email protected]
+#   password: secret
+#   fullname: Bob

Some files were not shown because too many files changed in this diff