Procházet zdrojové kódy

Merge pull request #1698 from donovanmuller/master

Java: Update Play 2
Hamilton Turner před 10 roky
rodič
revize
ea344fb764
68 změnil soubory, kde provedl 216 přidání a 1445 odebrání
  1. 1 43
      frameworks/Java/play2-java/benchmark_config.json
  2. 0 30
      frameworks/Java/play2-java/play2-java-ebean-bonecp/.gitignore
  3. 0 35
      frameworks/Java/play2-java/play2-java-ebean-bonecp/README.md
  4. 0 144
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/controllers/Application.java
  5. 0 26
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/models/Fortune.java
  6. 0 37
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/models/World.java
  7. 0 21
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Headers.java
  8. 0 8
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Predicate.java
  9. 0 26
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Predicated.java
  10. 0 23
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/PredicatedAction.java
  11. 0 16
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/views/fortunes.scala.html
  12. 0 12
      frameworks/Java/play2-java/play2-java-ebean-bonecp/app/views/main.scala.html
  13. 0 13
      frameworks/Java/play2-java/play2-java-ebean-bonecp/build.sbt
  14. 0 74
      frameworks/Java/play2-java/play2-java-ebean-bonecp/conf/application.conf
  15. 0 13
      frameworks/Java/play2-java/play2-java-ebean-bonecp/conf/routes
  16. 0 1
      frameworks/Java/play2-java/play2-java-ebean-bonecp/project/build.properties
  17. 0 8
      frameworks/Java/play2-java/play2-java-ebean-bonecp/project/plugins.sbt
  18. 0 11
      frameworks/Java/play2-java/play2-java-ebean-bonecp/source_code
  19. 1 1
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/README.md
  20. 34 60
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/controllers/Application.java
  21. 6 4
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/models/Fortune.java
  22. 4 11
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/models/World.java
  23. 3 5
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/build.sbt
  24. 18 58
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/application.conf
  25. 22 0
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/logback.xml
  26. 0 1
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/play.plugins
  27. 1 1
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/routes
  28. 1 1
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/project/build.properties
  29. 2 8
      frameworks/Java/play2-java/play2-java-ebean-hikaricp/project/plugins.sbt
  30. 0 30
      frameworks/Java/play2-java/play2-java-jpa-bonecp/.gitignore
  31. 0 35
      frameworks/Java/play2-java/play2-java-jpa-bonecp/README.md
  32. 0 154
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/controllers/Application.java
  33. 0 34
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/models/Fortune.java
  34. 0 38
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/models/World.java
  35. 0 21
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Headers.java
  36. 0 8
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Predicate.java
  37. 0 26
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Predicated.java
  38. 0 23
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/PredicatedAction.java
  39. 0 16
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/views/fortunes.scala.html
  40. 0 12
      frameworks/Java/play2-java/play2-java-jpa-bonecp/app/views/main.scala.html
  41. 0 16
      frameworks/Java/play2-java/play2-java-jpa-bonecp/build.sbt
  42. 0 14
      frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/META-INF/persistence.xml
  43. 0 74
      frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/application.conf
  44. 0 12
      frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/routes
  45. 0 1
      frameworks/Java/play2-java/play2-java-jpa-bonecp/project/build.properties
  46. 0 8
      frameworks/Java/play2-java/play2-java-jpa-bonecp/project/plugins.sbt
  47. 0 11
      frameworks/Java/play2-java/play2-java-jpa-bonecp/source_code
  48. 1 1
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/README.md
  49. 31 62
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/controllers/Application.java
  50. 5 7
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/models/Fortune.java
  51. 2 10
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/models/World.java
  52. 4 3
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/build.sbt
  53. 4 4
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/META-INF/persistence.xml
  54. 19 68
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/application.conf
  55. 22 0
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/logback.xml
  56. 0 1
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/play.plugins
  57. 2 2
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/routes
  58. 1 1
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/project/build.properties
  59. 1 4
      frameworks/Java/play2-java/play2-java-jpa-hikaricp/project/plugins.sbt
  60. 1 1
      frameworks/Java/play2-java/play2-java/README.md
  61. 2 2
      frameworks/Java/play2-java/play2-java/app/controllers/Application.java
  62. 3 1
      frameworks/Java/play2-java/play2-java/build.sbt
  63. 1 15
      frameworks/Java/play2-java/play2-java/conf/application.conf
  64. 22 0
      frameworks/Java/play2-java/play2-java/conf/logback.xml
  65. 1 1
      frameworks/Java/play2-java/play2-java/project/build.properties
  66. 1 8
      frameworks/Java/play2-java/play2-java/project/plugins.sbt
  67. 0 15
      frameworks/Java/play2-java/setup_java_ebean_bonecp.sh
  68. 0 15
      frameworks/Java/play2-java/setup_java_jpa_bonecp.sh

+ 1 - 43
frameworks/Java/play2-java/benchmark_config.json

@@ -21,27 +21,6 @@
         "json_url": "/json", 
         "plaintext_url": "/plaintext"
       }, 
-      "java-ebean-bonecp": {
-        "display_name": "play2-java-ebean-bonecp", 
-        "setup_file": "setup_java_ebean_bonecp", 
-        "framework": "play2", 
-        "language": "Java", 
-        "orm": "Full", 
-        "os": "Linux", 
-        "database": "MySQL", 
-        "approach": "Realistic", 
-        "classification": "Fullstack", 
-        "platform": "Netty", 
-        "webserver": "None", 
-        "database_os": "Linux", 
-        "notes": "", 
-        "versus": "netty", 
-        "port": "9000", 
-        "db_url": "/db", 
-        "query_url": "/queries?queries=", 
-        "fortune_url": "/fortunes", 
-        "update_url": "/update?queries="
-      }, 
       "java-ebean-hikaricp": {
         "display_name": "play2-java-ebean-hikaricp", 
         "setup_file": "setup_java_ebean_hikaricp", 
@@ -63,27 +42,6 @@
         "fortune_url": "/fortunes", 
         "update_url": "/update?queries="
       }, 
-      "java-jpa-bonecp": {
-        "display_name": "play2-java-jpa-bonecp", 
-        "setup_file": "setup_java_jpa_bonecp", 
-        "framework": "play2", 
-        "language": "Java", 
-        "orm": "Full", 
-        "os": "Linux", 
-        "database": "MySQL", 
-        "approach": "Realistic", 
-        "classification": "Fullstack", 
-        "platform": "Netty", 
-        "webserver": "None", 
-        "database_os": "Linux", 
-        "notes": "", 
-        "versus": "netty", 
-        "port": "9000", 
-        "db_url": "/db", 
-        "query_url": "/queries?queries=", 
-        "fortune_url": "/fortunes", 
-        "update_url": "/update?queries="
-      }, 
       "java-jpa-hikaricp": {
         "display_name": "play2-java-jpa-hikaricp", 
         "setup_file": "setup_java_jpa_hikaricp", 
@@ -107,4 +65,4 @@
       }
     }
   ]
-}
+}

+ 0 - 30
frameworks/Java/play2-java/play2-java-ebean-bonecp/.gitignore

@@ -1,30 +0,0 @@
-logs
-project/project
-project/target
-target
-tmp
-.history
-dist
-
-# Ignore all dotfiles...
-.*
-# except for .gitignore
-!.gitignore
-
-# Ignore Play! working directory #
-db
-eclipse
-lib
-log
-logs
-modules
-precompiled
-project/project
-project/target
-target
-tmp
-test-result
-server.pid
-*.iml
-*.eml
-

+ 0 - 35
frameworks/Java/play2-java/play2-java-ebean-bonecp/README.md

@@ -1,35 +0,0 @@
-#Play Benchmarking Test
-
-This is the Play portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-
-* [JSON test controller](app/controllers/Application.java)
-
-### Data-Store/Database Mapping Test
-
-* [Database test controller](app/controllers/Application.java)
-* [Database World test model](app/models/World.java)
-* [Database Fortune test model](app/models/Fortune.java)
-
-### Plain Text Test
-
-* [Plain text test controller](app/controllers/Application.java)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java OpenJDK 1.7](http://openjdk.java.net/)
-* [Play 2.3.7](http://http://www.playframework.com/)
-
-## Test URLs
-### JSON Encoding Test
-
-* http://localhost/json
-
-### Data-Store/Database Mapping Test
-
-* http://localhost/db
-* http://localhost/queries?queries=10
-* http://localhost/fortunes
-* http://localhost/update?queries=10

+ 0 - 144
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/controllers/Application.java

@@ -1,144 +0,0 @@
-package controllers;
-
-import akka.dispatch.ExecutionContexts;
-import models.Fortune;
-import models.World;
-import play.Play;
-import play.core.NamedThreadFactory;
-import play.libs.F;
-import play.libs.Json;
-import play.mvc.Controller;
-import play.mvc.Result;
-import play.mvc.With;
-import scala.concurrent.ExecutionContext;
-import utils.Headers;
-import utils.Predicate;
-import utils.Predicated;
-
-import java.util.*;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-@With(Headers.class)
-public class Application extends Controller {
-
-    private static final int TEST_DATABASE_ROWS = 10000;
-
-    private static final int partitionCount = Play.application().configuration().getInt("db.default.partitionCount");
-    private static final int maxConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.maxConnectionsPerPartition");
-    private static final int minConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.minConnectionsPerPartition");
-
-    private static final ThreadPoolExecutor tpe = new ThreadPoolExecutor(minConnections, maxConnections,
-            0L, TimeUnit.MILLISECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new NamedThreadFactory("dbEc"));
-    private static final ExecutionContext dbEc = ExecutionContexts.fromExecutorService(tpe);
-
-    // If the thread-pool used by the database grows too large then our server
-    // is probably struggling, and we should start dropping requests. Set
-    // the max size of our queue something above the number of concurrent
-    // connections that we need to handle.
-    public static class IsDbAvailable implements Predicate {
-        @Override
-        public boolean condition() {
-            return tpe.getQueue().size() <= 1024;
-        }
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> db() {
-        return getRandomWorlds(1).map(new F.Function<List<World>, Result>() {
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds.get(0)));
-            }
-        });
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> queries(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds));
-            }
-        });
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> fortunes() {
-        return F.Promise.promise(new F.Function0<Result>() {
-
-            @Override
-            public Result apply() throws Throwable {
-                List<Fortune> fortunes = Fortune.find.all();
-                fortunes.add(new Fortune("Additional fortune added at request time."));
-                Collections.sort(fortunes, new Comparator<Fortune>() {
-
-                    @Override
-                    public int compare(Fortune f1, Fortune f2) {
-                        return f1.message.compareTo(f2.message);
-                    }
-                });
-
-                return ok(views.html.fortunes.render(fortunes));
-            }
-        }, dbEc);
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> update(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                for (World world : worlds) {
-                    world.randomNumber = (long) (random.nextInt(10000) + 1);
-                }
-
-                List<World> updatedWorlds = World.save(worlds);
-                return ok(Json.toJson(updatedWorlds));
-            }
-        }, dbEc);
-    }
-
-    private static int queryCount(String queryCountString) {
-        int queryCount;
-        try {
-            queryCount = Integer.parseInt(queryCountString, 10);
-        } catch (NumberFormatException e) {
-            queryCount = 1;
-        }
-        if (queryCount < 1) {
-            queryCount = 1;
-        } else if (queryCount > 500) {
-            queryCount = 500;
-        }
-
-        return queryCount;
-    }
-
-    private static F.Promise<List<World>> getRandomWorlds(final int n) {
-        return F.Promise.promise(new F.Function0<List<World>>() {
-
-            @Override
-            public List<World> apply() {
-                Random random = ThreadLocalRandom.current();
-                List<World> worlds = new ArrayList<World>(n);
-                for (int i = 0; i < n; ++i) {
-                    long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
-                    World world = World.find.byId(randomId);
-                    worlds.add(world);
-                }
-                return worlds;
-            }
-        }, dbEc);
-    }
-
-}

+ 0 - 26
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/models/Fortune.java

@@ -1,26 +0,0 @@
-package models;
-
-import play.db.ebean.Model;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class Fortune extends Model {
-
-    @Id
-    public Long id = 0L;
-
-    public String message;
-
-    public Fortune() {
-    }
-
-    public Fortune(String message) {
-        this.message = message;
-    }
-
-    public static Finder<Long, Fortune> find = new Finder<Long, Fortune>(
-            Long.class, Fortune.class
-    );
-}

+ 0 - 37
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/models/World.java

@@ -1,37 +0,0 @@
-package models;
-
-import com.avaje.ebean.Ebean;
-import play.db.ebean.Model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-@Entity
-public class World extends Model {
-
-    @Id
-    public Long id;
-
-    @Column(name = "randomNumber")
-    public Long randomNumber;
-
-    public static Finder<Long, World> find = new Finder<Long, World>(
-            Long.class, World.class
-    );
-
-    public static List<World> save(final List<World> worlds) throws Throwable {
-        Set<String> updateProperties = new HashSet<>();
-        updateProperties.add("randomNumber");
-
-        for (World world : worlds) {
-            Ebean.update(world, updateProperties);
-        }
-
-        return worlds;
-    }
-
-}

+ 0 - 21
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Headers.java

@@ -1,21 +0,0 @@
-package utils;
-
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-import play.libs.F;
-import play.mvc.Action;
-import play.mvc.Http;
-import play.mvc.Result;
-
-public class Headers extends Action.Simple {
-
-    private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZoneUTC();
-
-    @Override
-    public F.Promise<Result> call(Http.Context context) throws Throwable {
-        context.response().setHeader("Server", "Play2");
-        context.response().setHeader("Date", RFC_1123_DATE_TIME.print(new DateTime()));
-        return delegate.call(context);
-    }
-}

+ 0 - 8
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Predicate.java

@@ -1,8 +0,0 @@
-package utils;
-
-/**
- * Predicates for PredicatedActions.
- */
-public interface Predicate {
-    boolean condition();
-}

+ 0 - 26
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/Predicated.java

@@ -1,26 +0,0 @@
-package utils;
-
-import play.mvc.With;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Declares a composing action that will check for a condition before deciding on whether to proceed with the request.
- */
-@With(PredicatedAction.class)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Predicated {
-    /**
-     * The condition.
-     */
-    Class<? extends Predicate> predicate();
-
-    /**
-     * The http status code to return if the condition fails.
-     */
-    int failed();
-}

+ 0 - 23
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/utils/PredicatedAction.java

@@ -1,23 +0,0 @@
-package utils;
-
-/**
- * A predicated action is one where a condition must be satisfied in order to proceed with the request. If the
- * condition is not satisfied then a supplied status result is yielded.
- */
-
-import play.libs.F;
-import play.mvc.Action;
-import play.mvc.Http;
-import play.mvc.Result;
-
-public class PredicatedAction extends Action<Predicated> {
-    @Override
-    public F.Promise<Result> call(final Http.Context ctx) throws Throwable {
-        final Predicate p = configuration.predicate().newInstance();
-        if (p.condition()) {
-            return delegate.call(ctx);
-        } else {
-            return F.Promise.<Result>pure(status(configuration.failed()));
-        }
-    }
-}

+ 0 - 16
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/views/fortunes.scala.html

@@ -1,16 +0,0 @@
-@(fortunes: List[Fortune])
-
-@main() {
-    <table>
-        <tr>
-            <th>id</th>
-            <th>message</th>
-        </tr>
-        @for(fortune <- fortunes) {
-        <tr>
-            <td>@fortune.id</td>
-            <td>@fortune.message</td>
-        </tr>
-        }
-    </table>
-}

+ 0 - 12
frameworks/Java/play2-java/play2-java-ebean-bonecp/app/views/main.scala.html

@@ -1,12 +0,0 @@
-@()(content: Html)
-
-<!DOCTYPE html>
-
-<html>
-    <head>
-        <title>Fortunes</title>
-    </head>
-    <body>
-    @content
-    </body>
-</html>

+ 0 - 13
frameworks/Java/play2-java/play2-java-ebean-bonecp/build.sbt

@@ -1,13 +0,0 @@
-name := "play2-java-ebean-bonecp"
-
-version := "1.0-SNAPSHOT"
-
-lazy val root = (project in file(".")).enablePlugins(PlayJava)
-
-scalaVersion := "2.11.6"
-
-libraryDependencies ++= Seq(
-  javaJdbc,
-  javaEbean,
-  "mysql" % "mysql-connector-java" % "5.1.35"
-)

+ 0 - 74
frameworks/Java/play2-java/play2-java-ebean-bonecp/conf/application.conf

@@ -1,74 +0,0 @@
-# This is the main configuration file for the application.
-# ~~~~~
-
-# 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="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
-
-# The application languages
-# ~~~~~
-application.langs="en"
-
-# Global object class
-# ~~~~~
-# Define the Global object class for this application.
-# Default to Global in the root package.
-# global=Global
-
-# Database configuration
-# ~~~~~ 
-# You can declare as many datasources as you want.
-# By convention, the default datasource is named `default`
-#
-# db.default.driver=org.h2.Driver
-# db.default.url="jdbc:h2:mem:play"
-# db.default.user=sa
-# db.default.password=
-#
-# You can expose this datasource via JNDI if needed (Useful for JPA)
-# db.default.jndiName=DefaultDS
-db.default.driver= com.mysql.jdbc.Driver
-db.default.url="jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
-db.default.user=benchmarkdbuser
-db.default.password=benchmarkdbpass
-db.default.jndiName=DefaultDS
-
-db.default.partitionCount=4
-
-# The number of connections to create per partition. Setting this to 
-# 5 with 3 partitions means you will have 15 unique connections to the 
-# database. Note that BoneCP will not create all these connections in 
-# one go but rather start off with minConnectionsPerPartition and 
-# gradually increase connections as required.
-db.default.maxConnectionsPerPartition=64
-
-# The number of initial connections, per partition.
-db.default.minConnectionsPerPartition=64
-
-# Evolutions
-# ~~~~~
-# You can disable evolutions if needed
-evolutionplugin=disabled
-
-# Ebean configuration
-# ~~~~~
-# You can declare as many Ebean servers as you want.
-# By convention, the default server is named `default`
-#
-ebean.default="models.*"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=INFO
-
-# Logger used by the framework:
-logger.play=INFO
-
-# Logger provided to your application:
-logger.application=ERROR
-

+ 0 - 13
frameworks/Java/play2-java/play2-java-ebean-bonecp/conf/routes

@@ -1,13 +0,0 @@
-# Routes
-# This file defines all application routes (Higher priority routes first)
-# ~~~~
-
-# Home page
-GET        /db                  controllers.Application.db()
-GET        /queries             controllers.Application.queries(queries ?= "1")
-GET        /fortunes            controllers.Application.fortunes
-GET        /update              controllers.Application.update(queries ?= "1")
-
-
-# Map static resources from the /public folder to the /assets URL path
-GET        /assets/*file        controllers.Assets.at(path="/public", file)

+ 0 - 1
frameworks/Java/play2-java/play2-java-ebean-bonecp/project/build.properties

@@ -1 +0,0 @@
-sbt.version=0.13.5

+ 0 - 8
frameworks/Java/play2-java/play2-java-ebean-bonecp/project/plugins.sbt

@@ -1,8 +0,0 @@
-// Comment to get more information during initialization
-logLevel := Level.Warn
-
-// The Typesafe repository 
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.9")

+ 0 - 11
frameworks/Java/play2-java/play2-java-ebean-bonecp/source_code

@@ -1,11 +0,0 @@
-./play-java-jpa/app/
-./play-java-jpa/app/controllers
-./play-java-jpa/app/controllers/Application.java
-./play-java-jpa/app/utils
-./play-java-jpa/app/utils/Headers.java
-./play-java-jpa/app/utils/Predicate.java
-./play-java-jpa/app/utils/PredicatedAction.java
-./play-java-jpa/app/utils/Predicated.java
-./play-java-jpa/app/models
-./play-java-jpa/app/models/World.java
-./play-java-jpa/app/models/Fortune.java

+ 1 - 1
frameworks/Java/play2-java/play2-java-ebean-hikaricp/README.md

@@ -20,7 +20,7 @@ This is the Play portion of a [benchmarking test suite](../) comparing a variety
 The tests were run with:
 
 * [Java OpenJDK 1.7](http://openjdk.java.net/)
-* [Play 2.3.7](http://http://www.playframework.com/)
+* [Play 2.4.2](http://http://www.playframework.com/)
 
 ## Test URLs
 ### JSON Encoding Test

+ 34 - 60
frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/controllers/Application.java

@@ -15,7 +15,10 @@ import utils.Headers;
 import utils.Predicate;
 import utils.Predicated;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -34,7 +37,7 @@ public class Application extends Controller {
 
     private static final ThreadPoolExecutor tpe = new ThreadPoolExecutor(minConnections, maxConnections,
             0L, TimeUnit.MILLISECONDS,
-            new LinkedBlockingQueue<Runnable>(),
+            new LinkedBlockingQueue<>(),
             new NamedThreadFactory("dbEc"));
     private static final ExecutionContext dbEc = ExecutionContexts.fromExecutorService(tpe);
 
@@ -50,65 +53,40 @@ public class Application extends Controller {
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> db() {
-        return getRandomWorlds(1).map(new F.Function<List<World>, Result>() {
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds.get(0)));
-            }
-        });
+    public F.Promise<Result> db() {
+        return getRandomWorlds(1).map(worlds -> ok(Json.toJson(worlds.get(0))));
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> queries(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds));
-            }
-        });
+    public F.Promise<Result> queries(final String queryCountString) {
+        return getRandomWorlds(queryCount(queryCountString)).map(worlds -> ok(Json.toJson(worlds)));
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> fortunes() {
-        return F.Promise.promise(new F.Function0<Result>() {
-
-            @Override
-            public Result apply() throws Throwable {
-                List<Fortune> fortunes = Fortune.find.all();
-                fortunes.add(new Fortune("Additional fortune added at request time."));
-                Collections.sort(fortunes, new Comparator<Fortune>() {
-
-                    @Override
-                    public int compare(Fortune f1, Fortune f2) {
-                        return f1.message.compareTo(f2.message);
-                    }
-                });
-
-                return ok(views.html.fortunes.render(fortunes));
-            }
+    public F.Promise<Result> fortunes() {
+        return F.Promise.promise(() -> {
+            List<Fortune> fortunes = Fortune.findAll();
+            fortunes.add(new Fortune("Additional fortune added at request time."));
+            Collections.sort(fortunes, (f1, f2) -> f1.message.compareTo(f2.message));
+
+            return ok(views.html.fortunes.render(fortunes));
         }, dbEc);
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> update(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                for (World world : worlds) {
-                    world.randomNumber = (long) (random.nextInt(10000) + 1);
-                }
-
-                List<World> updatedWorlds = World.save(worlds);
-                return ok(Json.toJson(updatedWorlds));
+    public F.Promise<Result> update(final String queryCountString) {
+        return getRandomWorlds(queryCount(queryCountString)).map(worlds -> {
+            Random random = ThreadLocalRandom.current();
+            for (World world : worlds) {
+                world.randomNumber = (long) (random.nextInt(10000) + 1);
             }
+
+            List<World> updatedWorlds = World.save(worlds);
+            return ok(Json.toJson(updatedWorlds));
         }, dbEc);
     }
 
-    private static int queryCount(String queryCountString) {
+    private int queryCount(String queryCountString) {
         int queryCount;
         try {
             queryCount = Integer.parseInt(queryCountString, 10);
@@ -124,20 +102,16 @@ public class Application extends Controller {
         return queryCount;
     }
 
-    private static F.Promise<List<World>> getRandomWorlds(final int n) {
-        return F.Promise.promise(new F.Function0<List<World>>() {
-
-            @Override
-            public List<World> apply() {
-                Random random = ThreadLocalRandom.current();
-                List<World> worlds = new ArrayList<World>(n);
-                for (int i = 0; i < n; ++i) {
-                    long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
-                    World world = World.find.byId(randomId);
-                    worlds.add(world);
-                }
-                return worlds;
+    private F.Promise<List<World>> getRandomWorlds(final int n) {
+        return F.Promise.promise(() -> {
+            Random random = ThreadLocalRandom.current();
+            List<World> worlds = new ArrayList<>(n);
+            for (int i = 0; i < n; ++i) {
+                long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
+                World world = World.find(randomId);
+                worlds.add(world);
             }
+            return worlds;
         }, dbEc);
     }
 

+ 6 - 4
frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/models/Fortune.java

@@ -1,9 +1,11 @@
 package models;
 
-import play.db.ebean.Model;
+import com.avaje.ebean.Ebean;
+import com.avaje.ebean.Model;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import java.util.List;
 
 @Entity
 public class Fortune extends Model {
@@ -20,7 +22,7 @@ public class Fortune extends Model {
         this.message = message;
     }
 
-    public static Finder<Long, Fortune> find = new Finder<Long, Fortune>(
-            Long.class, Fortune.class
-    );
+    public static List<Fortune> findAll() {
+        return Ebean.find(Fortune.class).findList();
+    }
 }

+ 4 - 11
frameworks/Java/play2-java/play2-java-ebean-hikaricp/app/models/World.java

@@ -6,9 +6,7 @@ import play.db.ebean.Model;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 @Entity
 public class World extends Model {
@@ -19,17 +17,12 @@ public class World extends Model {
     @Column(name = "randomNumber")
     public Long randomNumber;
 
-    public static Finder<Long, World> find = new Finder<Long, World>(
-            Long.class, World.class
-    );
+    public static World find(Long id) {
+        return Ebean.find(World.class, id);
+    }
 
     public static List<World> save(final List<World> worlds) throws Throwable {
-        Set<String> updateProperties = new HashSet<>();
-        updateProperties.add("randomNumber");
-
-        for (World world : worlds) {
-            Ebean.update(world, updateProperties);
-        }
+        worlds.forEach(Ebean::update);
 
         return worlds;
     }

+ 3 - 5
frameworks/Java/play2-java/play2-java-ebean-hikaricp/build.sbt

@@ -2,15 +2,13 @@ name := "play2-java-ebean-hikaricp"
 
 version := "1.0-SNAPSHOT"
 
-lazy val root = (project in file(".")).enablePlugins(PlayJava)
+lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
 
 scalaVersion := "2.11.6"
 
 libraryDependencies ++= Seq(
   javaJdbc,
-  javaEbean,
-  "mysql" % "mysql-connector-java" % "5.1.35",
-  "com.edulify" %% "play-hikaricp" % "2.0.4"
+  "mysql" % "mysql-connector-java" % "5.1.35"
 )
 
-resolvers += Resolver.url("Edulify Repository", url("http://edulify.github.io/modules/releases/"))(Resolver.ivyStylePatterns)
+routesGenerator := InjectedRoutesGenerator

+ 18 - 58
frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/application.conf

@@ -5,7 +5,7 @@
 # ~~~~~
 # 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="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
+play.crypto.secret="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
 
 # The application languages
 # ~~~~~
@@ -30,52 +30,26 @@ application.langs="en"
 # You can expose this datasource via JNDI if needed (Useful for JPA)
 # db.default.jndiName=DefaultDS
 
-db {
-  default {
+db.default.driver= com.mysql.jdbc.Driver
+db.default.url="jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
+db.default.username=benchmarkdbuser
+db.default.password=benchmarkdbpass
+db.default.jndiName=DefaultDS
+jpa.default=defaultPersistenceUnit
 
-    jndiName="DefaultDS"
+db.default.partitionCount=4
 
-    dataSourceClassName=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
-    dataSource {
-      user=benchmarkdbuser
-      password=benchmarkdbpass
-      databaseName=hello_world
-      serverName=127.0.0.1
-      port=3306
-
-      jdbcCompliantTruncation=false
-      elideSetAutoCommits=true
-      useLocalSessionState=true
-      cachePrepStmts=true
-      cacheCallableStmts=true
-      cacheServerConfiguration=true
-      cacheResultSetMetadata=true
-      alwaysSendSetIsolation=false
-      prepStmtCacheSize=4096
-      prepStmtCacheSqlLimit=2048
-      zeroDateTimeBehavior=convertToNull
-      traceProtocol=false
-      useUnbufferedInput=false
-      useReadAheadInput=false
-      maintainTimeStats=false
-      useServerPrepStmts=true
-    }
-
-    partitionCount=4
-
-    # The number of connections to create per partition. Setting this to
-    # 5 with 3 partitions means you will have 15 unique connections to the
-    # database.
-
-    # This value maps to the maximumPoolSize for HickariCP (db.default.partitionCount * db.default.maxConnectionsPerPartition)
-    maxConnectionsPerPartition=64
+# The number of connections to create per partition. Setting this to
+# 5 with 3 partitions means you will have 15 unique connections to the
+# database..
+#
+# This value maps to the maximumPoolSize for HickariCP (db.default.partitionCount * db.default.maxConnectionsPerPartition)
+db.default.maxConnectionsPerPartition=64
 
-    # The number of initial connections, per partition.
-    #
-    # This maps to the minimumIdle connections for HikariCP (db.default.partitionCount * db.default.minConnectionsPerPartition)
-    minConnectionsPerPartition=64
-  }
-}
+# The number of initial connections, per partition.
+#
+# This maps to the minimumIdle connections for HikariCP (db.default.partitionCount * db.default.minConnectionsPerPartition)
+db.default.minConnectionsPerPartition=64
 
 dbplugin=disabled
 
@@ -90,17 +64,3 @@ evolutionplugin=disabled
 # By convention, the default server is named `default`
 #
 ebean.default="models.*"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=INFO
-
-# Logger used by the framework:
-logger.play=ERROR
-
-# Logger provided to your application:
-logger.application=ERROR
-

+ 22 - 0
frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/logback.xml

@@ -0,0 +1,22 @@
+<configuration>
+    
+  <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%coloredLevel - %logger - %message%n%xException</pattern>
+    </encoder>
+  </appender>
+
+  <!--
+    The logger name is typically the Java/Scala package name.
+    This configures the log level to log at for a package and its children packages.
+  -->
+  <logger name="play" level="INFO" />
+  <logger name="application" level="INFO" />
+
+  <root level="ERROR">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>

+ 0 - 1
frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/play.plugins

@@ -1 +0,0 @@
-200:com.edulify.play.hikaricp.HikariCPPlugin

+ 1 - 1
frameworks/Java/play2-java/play2-java-ebean-hikaricp/conf/routes

@@ -5,7 +5,7 @@
 # Home page
 GET        /db                  controllers.Application.db()
 GET        /queries             controllers.Application.queries(queries ?= "1")
-GET        /fortunes            controllers.Application.fortunes
+GET        /fortunes            controllers.Application.fortunes()
 GET        /update              controllers.Application.update(queries ?= "1")
 
 

+ 1 - 1
frameworks/Java/play2-java/play2-java-ebean-hikaricp/project/build.properties

@@ -1 +1 @@
-sbt.version=0.13.5
+sbt.version=0.13.8

+ 2 - 8
frameworks/Java/play2-java/play2-java-ebean-hikaricp/project/plugins.sbt

@@ -1,8 +1,2 @@
-// Comment to get more information during initialization
-logLevel := Level.Warn
-
-// The Typesafe repository 
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.9")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")
+addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

+ 0 - 30
frameworks/Java/play2-java/play2-java-jpa-bonecp/.gitignore

@@ -1,30 +0,0 @@
-logs
-project/project
-project/target
-target
-tmp
-.history
-dist
-
-# Ignore all dotfiles...
-.*
-# except for .gitignore
-!.gitignore
-
-# Ignore Play! working directory #
-db
-eclipse
-lib
-log
-logs
-modules
-precompiled
-project/project
-project/target
-target
-tmp
-test-result
-server.pid
-*.iml
-*.eml
-

+ 0 - 35
frameworks/Java/play2-java/play2-java-jpa-bonecp/README.md

@@ -1,35 +0,0 @@
-#Play Benchmarking Test
-
-This is the Play portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-
-* [JSON test controller](app/controllers/Application.java)
-
-### Data-Store/Database Mapping Test
-
-* [Database test controller](app/controllers/Application.java)
-* [Database World test model](app/models/World.java)
-* [Database Fortune test model](app/models/Fortune.java)
-
-### Plain Text Test
-
-* [Plain text test controller](app/controllers/Application.java)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java OpenJDK 1.7](http://openjdk.java.net/)
-* [Play 2.3.7](http://http://www.playframework.com/)
-
-## Test URLs
-### JSON Encoding Test
-
-* http://localhost/json
-
-### Data-Store/Database Mapping Test
-
-* http://localhost/db
-* http://localhost/queries?queries=10
-* http://localhost/fortunes
-* http://localhost/update?queries=10

+ 0 - 154
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/controllers/Application.java

@@ -1,154 +0,0 @@
-package controllers;
-
-import akka.dispatch.ExecutionContexts;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import models.Fortune;
-import models.World;
-import play.Play;
-import play.core.NamedThreadFactory;
-import play.libs.F;
-import play.libs.Json;
-import play.mvc.Controller;
-import play.mvc.Result;
-import play.mvc.With;
-import scala.concurrent.ExecutionContext;
-import utils.Headers;
-import utils.Predicate;
-import utils.Predicated;
-
-import java.util.*;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-@With(Headers.class)
-public class Application extends Controller {
-
-    private static final int TEST_DATABASE_ROWS = 10000;
-    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
-    private static final int partitionCount = Play.application().configuration().getInt("db.default.partitionCount");
-    private static final int maxConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.maxConnectionsPerPartition");
-    private static final int minConnections =
-            partitionCount * Play.application().configuration().getInt("db.default.minConnectionsPerPartition");
-
-    private static final ThreadPoolExecutor tpe = new ThreadPoolExecutor(minConnections, maxConnections,
-            0L, TimeUnit.MILLISECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new NamedThreadFactory("dbEc"));
-    private static final ExecutionContext dbEc = ExecutionContexts.fromExecutorService(tpe);
-
-    public static Result json() {
-        final ObjectNode result = OBJECT_MAPPER.createObjectNode();
-        result.put("message", "Hello World!");
-        return ok(result);
-    }
-
-    // If the thread-pool used by the database grows too large then our server
-    // is probably struggling, and we should start dropping requests. Set
-    // the max size of our queue something above the number of concurrent
-    // connections that we need to handle.
-    public static class IsDbAvailable implements Predicate {
-        @Override
-        public boolean condition() {
-            return tpe.getQueue().size() <= 1024;
-        }
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> db() {
-        return getRandomWorlds(1).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds.get(0)));
-            }
-        });
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> queries(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds));
-            }
-        });
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> fortunes() {
-        return F.Promise.promise(new F.Function0<Result>() {
-
-            @Override
-            public Result apply() throws Throwable {
-                List<Fortune> fortunes = Fortune.findAll();
-                fortunes.add(new Fortune("Additional fortune added at request time."));
-                Collections.sort(fortunes, new Comparator<Fortune>() {
-
-                    @Override
-                    public int compare(Fortune f1, Fortune f2) {
-                        return f1.message.compareTo(f2.message);
-                    }
-                });
-
-                return ok(views.html.fortunes.render(fortunes));
-            }
-        }, dbEc);
-    }
-
-    @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> update(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                for (World world : worlds) {
-                    world.randomNumber = (long) (random.nextInt(10000) + 1);
-                }
-
-                List<World> updatedWorlds = World.save(worlds);
-                return ok(Json.toJson(updatedWorlds));
-            }
-        }, dbEc);
-    }
-
-    private static int queryCount(String queryCountString) {
-        int queryCount;
-        try {
-            queryCount = Integer.parseInt(queryCountString, 10);
-        } catch (NumberFormatException e) {
-            queryCount = 1;
-        }
-        if (queryCount < 1) {
-            queryCount = 1;
-        } else if (queryCount > 500) {
-            queryCount = 500;
-        }
-
-        return queryCount;
-    }
-
-    private static F.Promise<List<World>> getRandomWorlds(final int n) {
-        return F.Promise.promise(new F.Function0<List<World>>() {
-
-            @Override
-            public List<World> apply() throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                List<World> worlds = new ArrayList<World>(n);
-                for (int i = 0; i < n; ++i) {
-                    long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
-                    World world = World.findById(randomId);
-                    worlds.add(world);
-                }
-                return worlds;
-            }
-        }, dbEc);
-    }
-
-}

+ 0 - 34
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/models/Fortune.java

@@ -1,34 +0,0 @@
-package models;
-
-import play.db.jpa.JPA;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.criteria.CriteriaQuery;
-import java.util.List;
-
-@Entity
-public class Fortune {
-
-    @Id
-    public Long id = 0L;
-
-    public String message;
-
-    public Fortune() {
-    }
-
-    public Fortune(String message) {
-        this.message = message;
-    }
-
-    public static List<Fortune> findAll() throws Throwable {
-        return JPA.withTransaction("default", true, new play.libs.F.Function0<List<Fortune>>() {
-            public List<Fortune> apply() {
-                CriteriaQuery<Fortune> criteria = JPA.em().getCriteriaBuilder().createQuery(Fortune.class);
-                criteria.select(criteria.from(Fortune.class));
-                return JPA.em().createQuery(criteria).getResultList();
-            }
-        });
-    }
-}

+ 0 - 38
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/models/World.java

@@ -1,38 +0,0 @@
-package models;
-
-import play.db.jpa.JPA;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import java.util.List;
-
-@Entity
-public class World {
-
-    @Id
-    public Long id;
-
-    @Column(name = "randomNumber")
-    public Long randomNumber;
-
-    public static World findById(final Long id) throws Throwable {
-        return JPA.withTransaction("default", true, new play.libs.F.Function0<World>() {
-            public World apply() {
-                return JPA.em().find(World.class, id);
-            }
-        });
-    }
-
-    public static List<World> save(final List<World> worlds) throws Throwable {
-        for (final World world : worlds) {
-            JPA.withTransaction("default", false, new play.libs.F.Function0<World>() {
-                public World apply() {
-                    return JPA.em().merge(world);
-                }
-            });
-        }
-
-        return worlds;
-    }
-}

+ 0 - 21
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Headers.java

@@ -1,21 +0,0 @@
-package utils;
-
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-import play.libs.F;
-import play.mvc.Action;
-import play.mvc.Http;
-import play.mvc.Result;
-
-public class Headers extends Action.Simple {
-
-    private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZoneUTC();
-
-    @Override
-    public F.Promise<Result> call(Http.Context context) throws Throwable {
-        context.response().setHeader("Server", "Play2");
-        context.response().setHeader("Date", RFC_1123_DATE_TIME.print(new DateTime()));
-        return delegate.call(context);
-    }
-}

+ 0 - 8
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Predicate.java

@@ -1,8 +0,0 @@
-package utils;
-
-/**
- * Predicates for PredicatedActions.
- */
-public interface Predicate {
-    boolean condition();
-}

+ 0 - 26
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/Predicated.java

@@ -1,26 +0,0 @@
-package utils;
-
-import play.mvc.With;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Declares a composing action that will check for a condition before deciding on whether to proceed with the request.
- */
-@With(PredicatedAction.class)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Predicated {
-    /**
-     * The condition.
-     */
-    Class<? extends Predicate> predicate();
-
-    /**
-     * The http status code to return if the condition fails.
-     */
-    int failed();
-}

+ 0 - 23
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/utils/PredicatedAction.java

@@ -1,23 +0,0 @@
-package utils;
-
-/**
- * A predicated action is one where a condition must be satisfied in order to proceed with the request. If the
- * condition is not satisfied then a supplied status result is yielded.
- */
-
-import play.libs.F;
-import play.mvc.Action;
-import play.mvc.Http;
-import play.mvc.Result;
-
-public class PredicatedAction extends Action<Predicated> {
-    @Override
-    public F.Promise<Result> call(final Http.Context ctx) throws Throwable {
-        final Predicate p = configuration.predicate().newInstance();
-        if (p.condition()) {
-            return delegate.call(ctx);
-        } else {
-            return F.Promise.<Result>pure(status(configuration.failed()));
-        }
-    }
-}

+ 0 - 16
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/views/fortunes.scala.html

@@ -1,16 +0,0 @@
-@(fortunes: List[Fortune])
-
-@main() {
-    <table>
-        <tr>
-            <th>id</th>
-            <th>message</th>
-        </tr>
-        @for(fortune <- fortunes) {
-        <tr>
-            <td>@fortune.id</td>
-            <td>@fortune.message</td>
-        </tr>
-        }
-    </table>
-}

+ 0 - 12
frameworks/Java/play2-java/play2-java-jpa-bonecp/app/views/main.scala.html

@@ -1,12 +0,0 @@
-@()(content: Html)
-
-<!DOCTYPE html>
-
-<html>
-    <head>
-        <title>Fortunes</title>
-    </head>
-    <body>
-    @content
-    </body>
-</html>

+ 0 - 16
frameworks/Java/play2-java/play2-java-jpa-bonecp/build.sbt

@@ -1,16 +0,0 @@
-name := "play2-java-jpa-bonecp"
-
-version := "1.0-SNAPSHOT"
-
-scalaVersion := "2.11.6"
-
-lazy val root = (project in file(".")).enablePlugins(PlayJava)
-
-libraryDependencies ++= Seq(
-  javaJdbc,
-  javaJpa,
-  "mysql" % "mysql-connector-java" % "5.1.35",
-  "org.hibernate" % "hibernate-entitymanager" % "4.3.9.Final"
-  )
-
-dependencyOverrides += "com.jolbox" % "bonecp" % "0.8.0.RELEASE"

+ 0 - 14
frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/META-INF/persistence.xml

@@ -1,14 +0,0 @@
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
-             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
-             version="2.0">
-             
-    <persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
-        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
-        <non-jta-data-source>DefaultDS</non-jta-data-source>
-        <properties>
-            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
-        </properties>
-    </persistence-unit>
-    
-</persistence>

+ 0 - 74
frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/application.conf

@@ -1,74 +0,0 @@
-# This is the main configuration file for the application.
-# ~~~~~
-
-# 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="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
-
-# The application languages
-# ~~~~~
-application.langs="en"
-
-# Global object class
-# ~~~~~
-# Define the Global object class for this application.
-# Default to Global in the root package.
-# global=Global
-
-# Database configuration
-# ~~~~~ 
-# You can declare as many datasources as you want.
-# By convention, the default datasource is named `default`
-#
-#db.default.driver=org.h2.Driver
-#db.default.url="jdbc:h2:mem:play"
-#db.default.user=sa
-#db.default.password=
-#
-# You can expose this datasource via JNDI if needed (Useful for JPA)
-# db.default.jndiName=DefaultDS
-db.default.driver= com.mysql.jdbc.Driver
-db.default.url="jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
-db.default.user=benchmarkdbuser
-db.default.password=benchmarkdbpass
-db.default.jndiName=DefaultDS
-jpa.default=defaultPersistenceUnit
-
-db.default.partitionCount=4
-
-# The number of connections to create per partition. Setting this to 
-# 5 with 3 partitions means you will have 15 unique connections to the 
-# database. Note that BoneCP will not create all these connections in 
-# one go but rather start off with minConnectionsPerPartition and 
-# gradually increase connections as required.
-db.default.maxConnectionsPerPartition=64
-
-# The number of initial connections, per partition.
-db.default.minConnectionsPerPartition=64
-
-# Evolutions
-# ~~~~~
-# You can disable evolutions if needed
-# evolutionplugin=disabled
-
-# Ebean configuration
-# ~~~~~
-# You can declare as many Ebean servers as you want.
-# By convention, the default server is named `default`
-#
-#ebean.default="models.*"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=INFO
-
-# Logger used by the framework:
-logger.play=ERROR
-
-# Logger provided to your application:
-logger.application=ERROR

+ 0 - 12
frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/routes

@@ -1,12 +0,0 @@
-# Routes
-# This file defines all application routes (Higher priority routes first)
-# ~~~~
-
-GET        /json                controllers.Application.json
-GET        /db                  controllers.Application.db()
-GET        /queries             controllers.Application.queries(queries ?= "1")
-GET        /fortunes            controllers.Application.fortunes
-GET        /update              controllers.Application.update(queries ?= "1")
-
-# Map static resources from the /public folder to the /assets URL path
-GET        /assets/*file        controllers.Assets.at(path="/public", file)

+ 0 - 1
frameworks/Java/play2-java/play2-java-jpa-bonecp/project/build.properties

@@ -1 +0,0 @@
-sbt.version=0.13.5

+ 0 - 8
frameworks/Java/play2-java/play2-java-jpa-bonecp/project/plugins.sbt

@@ -1,8 +0,0 @@
-// Comment to get more information during initialization
-logLevel := Level.Warn
-
-// The Typesafe repository 
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.9")

+ 0 - 11
frameworks/Java/play2-java/play2-java-jpa-bonecp/source_code

@@ -1,11 +0,0 @@
-./play-java-jpa/app/
-./play-java-jpa/app/controllers
-./play-java-jpa/app/controllers/Application.java
-./play-java-jpa/app/utils
-./play-java-jpa/app/utils/Headers.java
-./play-java-jpa/app/utils/Predicate.java
-./play-java-jpa/app/utils/PredicatedAction.java
-./play-java-jpa/app/utils/Predicated.java
-./play-java-jpa/app/models
-./play-java-jpa/app/models/World.java
-./play-java-jpa/app/models/Fortune.java

+ 1 - 1
frameworks/Java/play2-java/play2-java-jpa-hikaricp/README.md

@@ -20,7 +20,7 @@ This is the Play portion of a [benchmarking test suite](../) comparing a variety
 The tests were run with:
 
 * [Java OpenJDK 1.7](http://openjdk.java.net/)
-* [Play 2.3.7](http://http://www.playframework.com/)
+* [Play 2.4.2](http://http://www.playframework.com/)
 
 ## Test URLs
 ### JSON Encoding Test

+ 31 - 62
frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/controllers/Application.java

@@ -37,11 +37,11 @@ public class Application extends Controller {
 
     private static final ThreadPoolExecutor tpe = new ThreadPoolExecutor(minConnections, maxConnections,
             0L, TimeUnit.MILLISECONDS,
-            new LinkedBlockingQueue<Runnable>(),
+            new LinkedBlockingQueue<>(),
             new NamedThreadFactory("dbEc"));
     private static final ExecutionContext dbEc = ExecutionContexts.fromExecutorService(tpe);
 
-    public static Result json() {
+    public Result json() {
         final ObjectNode result = OBJECT_MAPPER.createObjectNode();
         result.put("message", "Hello World!");
         return ok(result);
@@ -52,7 +52,6 @@ public class Application extends Controller {
     // the max size of our queue something above the number of concurrent
     // connections that we need to handle.
     public static class IsDbAvailable implements Predicate {
-
         @Override
         public boolean condition() {
             return tpe.getQueue().size() <= 1024;
@@ -60,66 +59,40 @@ public class Application extends Controller {
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> db() {
-        return getRandomWorlds(1).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds.get(0)));
-            }
-        });
+    public F.Promise<Result> db() {
+        return getRandomWorlds(1).map(worlds -> ok(Json.toJson(worlds.get(0))));
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> queries(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) {
-                return ok(Json.toJson(worlds));
-            }
-        });
+    public F.Promise<Result> queries(final String queryCountString) {
+        return getRandomWorlds(queryCount(queryCountString)).map(worlds -> ok(Json.toJson(worlds)));
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> fortunes() {
-        return F.Promise.promise(new F.Function0<Result>() {
-
-            @Override
-            public Result apply() throws Throwable {
-                List<Fortune> fortunes = Fortune.findAll();
-                fortunes.add(new Fortune("Additional fortune added at request time."));
-                Collections.sort(fortunes, new Comparator<Fortune>() {
-
-                    @Override
-                    public int compare(Fortune f1, Fortune f2) {
-                        return f1.message.compareTo(f2.message);
-                    }
-                });
-
-                return ok(views.html.fortunes.render(fortunes));
-            }
+    public F.Promise<Result> fortunes() {
+        return F.Promise.promise(() -> {
+            List<Fortune> fortunes = Fortune.findAll();
+            fortunes.add(new Fortune("Additional fortune added at request time."));
+            Collections.sort(fortunes, (f1, f2) -> f1.message.compareTo(f2.message));
+
+            return ok(views.html.fortunes.render(fortunes));
         }, dbEc);
     }
 
     @Predicated(predicate = IsDbAvailable.class, failed = SERVICE_UNAVAILABLE)
-    public static F.Promise<Result> update(final String queryCountString) {
-        return getRandomWorlds(queryCount(queryCountString)).map(new F.Function<List<World>, Result>() {
-
-            @Override
-            public Result apply(List<World> worlds) throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                for (World world : worlds) {
-                    world.randomNumber = (long) (random.nextInt(10000) + 1);
-                }
-
-                List<World> updatedWorlds = World.save(worlds);
-                return ok(Json.toJson(updatedWorlds));
+    public F.Promise<Result> update(final String queryCountString) {
+        return getRandomWorlds(queryCount(queryCountString)).map(worlds -> {
+            Random random = ThreadLocalRandom.current();
+            for (World world : worlds) {
+                world.randomNumber = (long) (random.nextInt(10000) + 1);
             }
+
+            List<World> updatedWorlds = World.save(worlds);
+            return ok(Json.toJson(updatedWorlds));
         }, dbEc);
     }
 
-    private static int queryCount(String queryCountString) {
+    private int queryCount(String queryCountString) {
         int queryCount;
         try {
             queryCount = Integer.parseInt(queryCountString, 10);
@@ -135,20 +108,16 @@ public class Application extends Controller {
         return queryCount;
     }
 
-    private static F.Promise<List<World>> getRandomWorlds(final int n) {
-        return F.Promise.promise(new F.Function0<List<World>>() {
-
-            @Override
-            public List<World> apply() throws Throwable {
-                Random random = ThreadLocalRandom.current();
-                List<World> worlds = new ArrayList<World>(n);
-                for (int i = 0; i < n; ++i) {
-                    long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
-                    World world = World.findById(randomId);
-                    worlds.add(world);
-                }
-                return worlds;
+    private F.Promise<List<World>> getRandomWorlds(final int n) {
+        return F.Promise.promise(() -> {
+            Random random = ThreadLocalRandom.current();
+            List<World> worlds = new ArrayList<>(n);
+            for (int i = 0; i < n; ++i) {
+                long randomId = random.nextInt(TEST_DATABASE_ROWS) + 1;
+                World world = World.findById(randomId);
+                worlds.add(world);
             }
+            return worlds;
         }, dbEc);
     }
 

+ 5 - 7
frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/models/Fortune.java

@@ -23,12 +23,10 @@ public class Fortune {
     }
 
     public static List<Fortune> findAll() throws Throwable {
-        return JPA.withTransaction("default", true, new play.libs.F.Function0<List<Fortune>>() {
-            public List<Fortune> apply() {
-                CriteriaQuery<Fortune> criteria = JPA.em().getCriteriaBuilder().createQuery(Fortune.class);
-                criteria.select(criteria.from(Fortune.class));
-                return JPA.em().createQuery(criteria).getResultList();
-            }
+        return JPA.withTransaction("default", true, () -> {
+            CriteriaQuery<Fortune> criteria = JPA.em().getCriteriaBuilder().createQuery(Fortune.class);
+            criteria.select(criteria.from(Fortune.class));
+            return JPA.em().createQuery(criteria).getResultList();
         });
     }
-}
+}

+ 2 - 10
frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/models/World.java

@@ -17,20 +17,12 @@ public class World {
     public Long randomNumber;
 
     public static World findById(final Long id) throws Throwable {
-        return JPA.withTransaction("default", true, new play.libs.F.Function0<World>() {
-            public World apply() {
-                return JPA.em().find(World.class, id);
-            }
-        });
+        return JPA.withTransaction("default", true, () -> JPA.em().find(World.class, id));
     }
 
     public static List<World> save(final List<World> worlds) throws Throwable {
         for (final World world : worlds) {
-            JPA.withTransaction("default", false, new play.libs.F.Function0<World>() {
-                public World apply() {
-                    return JPA.em().merge(world);
-                }
-            });
+            JPA.withTransaction("default", false, () -> JPA.em().merge(world));
         }
 
         return worlds;

+ 4 - 3
frameworks/Java/play2-java/play2-java-jpa-hikaricp/build.sbt

@@ -10,8 +10,9 @@ libraryDependencies ++= Seq(
   javaJdbc,
   javaJpa,
   "mysql" % "mysql-connector-java" % "5.1.35",
-  "org.hibernate" % "hibernate-entitymanager" % "4.3.9.Final",
-  "com.edulify" %% "play-hikaricp" % "2.0.4"
+  "org.hibernate" % "hibernate-entitymanager" % "4.3.10.Final"
 )
 
-resolvers += Resolver.url("Edulify Repository", url("http://edulify.github.io/modules/releases/"))(Resolver.ivyStylePatterns)
+routesGenerator := InjectedRoutesGenerator
+
+PlayKeys.externalizeResources := false

+ 4 - 4
frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/META-INF/persistence.xml

@@ -1,8 +1,8 @@
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
-             version="2.0">
-             
+             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
+             version="2.1">
+
     <persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
         <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
         <non-jta-data-source>DefaultDS</non-jta-data-source>

+ 19 - 68
frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/application.conf

@@ -7,8 +7,8 @@
 #
 # This must be changed for production, but we recommend not changing it in this file.
 #
-# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details.
-application.secret="`o0VB@vXStsF:ffwM5ZZ_r:GYkm96QM[nRUJLpEbI8hwLUdV;N<:UyUWI;lf/XP`"
+# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details
+play.crypto.secret="`o0VB@vXStsF:ffwM5ZZ_r:GYkm96QM[nRUJLpEbI8hwLUdV;N<:UyUWI;lf/XP`"
 
 # The application languages
 # ~~~~~
@@ -44,54 +44,26 @@ application.langs="en"
 # You can expose this datasource via JNDI if needed (Useful for JPA)
 # db.default.jndiName=DefaultDS
 
-db {
-  default {
-
-    jndiName="DefaultDS"
-
-    dataSourceClassName=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
-    dataSource {
-      user=benchmarkdbuser
-      password=benchmarkdbpass
-      databaseName=hello_world
-      serverName=127.0.0.1
-      port=3306
-
-      jdbcCompliantTruncation=false
-      elideSetAutoCommits=true
-      useLocalSessionState=true
-      cachePrepStmts=true
-      cacheCallableStmts=true
-      cacheServerConfiguration=true
-      cacheResultSetMetadata=true
-      alwaysSendSetIsolation=false
-      prepStmtCacheSize=4096
-      prepStmtCacheSqlLimit=2048
-      zeroDateTimeBehavior=convertToNull
-      traceProtocol=false
-      useUnbufferedInput=false
-      useReadAheadInput=false
-      maintainTimeStats=false
-      useServerPrepStmts=true
-    }
-
-    partitionCount=4
-
-    # The number of connections to create per partition. Setting this to
-    # 5 with 3 partitions means you will have 15 unique connections to the
-    # database.
+db.default.driver= com.mysql.jdbc.Driver
+db.default.url="jdbc:mysql://127.0.0.1:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
+db.default.username=benchmarkdbuser
+db.default.password=benchmarkdbpass
+db.default.jndiName=DefaultDS
+jpa.default=defaultPersistenceUnit
 
-    # This value maps to the maximumPoolSize for HickariCP (db.default.partitionCount * db.default.maxConnectionsPerPartition)
-    maxConnectionsPerPartition=64
+db.default.partitionCount=4
 
-    # The number of initial connections, per partition.
-    #
-    # This maps to the minimumIdle connections for HikariCP (db.default.partitionCount * db.default.minConnectionsPerPartition)
-    minConnectionsPerPartition=64
-  }
-}
+# The number of connections to create per partition. Setting this to
+# 5 with 3 partitions means you will have 15 unique connections to the
+# database..
+#
+# This value maps to the maximumPoolSize for HickariCP (db.default.partitionCount * db.default.maxConnectionsPerPartition)
+db.default.maxConnectionsPerPartition=64
 
-jpa.default=defaultPersistenceUnit
+# The number of initial connections, per partition.
+#
+# This maps to the minimumIdle connections for HikariCP (db.default.partitionCount * db.default.minConnectionsPerPartition)
+db.default.minConnectionsPerPartition=64
 
 dbplugin=disabled
 
@@ -100,24 +72,3 @@ dbplugin=disabled
 # You can disable evolutions if needed
 evolutionplugin=disabled
 
-# Ebean configuration
-# ~~~~~
-# You can declare as many Ebean servers as you want.
-# By convention, the default server is named `default`
-#
-# ebean.default="models.*"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/),
-# by providing an application-logger.xml file in the conf directory.
-
-# Root logger:
-logger.root=INFO
-
-# Logger used by the framework:
-logger.play=ERROR
-
-# Logger provided to your application:
-logger.application=ERROR
-

+ 22 - 0
frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/logback.xml

@@ -0,0 +1,22 @@
+<configuration>
+    
+  <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%coloredLevel - %logger - %message%n%xException</pattern>
+    </encoder>
+  </appender>
+
+  <!--
+    The logger name is typically the Java/Scala package name.
+    This configures the log level to log at for a package and its children packages.
+  -->
+  <logger name="play" level="INFO" />
+  <logger name="application" level="INFO" />
+
+  <root level="ERROR">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>

+ 0 - 1
frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/play.plugins

@@ -1 +0,0 @@
-200:com.edulify.play.hikaricp.HikariCPPlugin

+ 2 - 2
frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/routes

@@ -2,10 +2,10 @@
 # This file defines all application routes (Higher priority routes first)
 # ~~~~
 
-GET        /json                controllers.Application.json
+GET        /json                controllers.Application.json()
 GET        /db                  controllers.Application.db()
 GET        /queries             controllers.Application.queries(queries ?= "1")
-GET        /fortunes            controllers.Application.fortunes
+GET        /fortunes            controllers.Application.fortunes()
 GET        /update              controllers.Application.update(queries ?= "1")
 
 # Map static resources from the /public folder to the /assets URL path

+ 1 - 1
frameworks/Java/play2-java/play2-java-jpa-hikaricp/project/build.properties

@@ -1 +1 @@
-sbt.version=0.13.5
+sbt.version=0.13.8

+ 1 - 4
frameworks/Java/play2-java/play2-java-jpa-hikaricp/project/plugins.sbt

@@ -1,4 +1 @@
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// The Play plugin
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.9")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")

+ 1 - 1
frameworks/Java/play2-java/play2-java/README.md

@@ -10,7 +10,7 @@ This is the Play portion of a [benchmarking test suite](../) comparing a variety
 The tests were run with:
 
 * [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
-* [Play 2.3.7](http://http://www.playframework.com/)
+* [Play 2.4.2](http://http://www.playframework.com/)
 
 ## Test URLs
 ### JSON Encoding Test

+ 2 - 2
frameworks/Java/play2-java/play2-java/app/controllers/Application.java

@@ -13,13 +13,13 @@ public class Application extends Controller {
     //http://stackoverflow.com/questions/3907929/should-i-make-jacksons-objectmapper-as-static-final
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
-    public static Result json() {
+    public Result json() {
         final ObjectNode result = OBJECT_MAPPER.createObjectNode();
         result.put("message", "Hello, World!");
         return ok(result);
     }
 
-    public static Result plainText() {
+    public Result plainText() {
         return ok("Hello, World!");
     }
 

+ 3 - 1
frameworks/Java/play2-java/play2-java/build.sbt

@@ -4,4 +4,6 @@ version := "1.0-SNAPSHOT"
 
 lazy val root = (project in file(".")).enablePlugins(PlayJava)
 
-scalaVersion := "2.11.6"
+scalaVersion := "2.11.6"
+
+routesGenerator := InjectedRoutesGenerator

+ 1 - 15
frameworks/Java/play2-java/play2-java/conf/application.conf

@@ -5,22 +5,8 @@
 # ~~~~~
 # 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="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
+play.crypto.secret="RItx1I:80?W@]8GAtPDuF8Ydd3mXM85p/<7og]Q;uBOdijQAauRDgu73B6`wQP59"
 
 # The application languages
 # ~~~~~
 application.langs="en"
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=ERROR
-
-# Logger used by the framework:
-logger.play=ERROR
-
-# Logger provided to your application:
-logger.application=ERROR
-

+ 22 - 0
frameworks/Java/play2-java/play2-java/conf/logback.xml

@@ -0,0 +1,22 @@
+<configuration>
+    
+  <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%coloredLevel - %logger - %message%n%xException</pattern>
+    </encoder>
+  </appender>
+
+  <!--
+    The logger name is typically the Java/Scala package name.
+    This configures the log level to log at for a package and its children packages.
+  -->
+  <logger name="play" level="INFO" />
+  <logger name="application" level="INFO" />
+
+  <root level="ERROR">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>

+ 1 - 1
frameworks/Java/play2-java/play2-java/project/build.properties

@@ -1 +1 @@
-sbt.version=0.13.5
+sbt.version=0.13.8

+ 1 - 8
frameworks/Java/play2-java/play2-java/project/plugins.sbt

@@ -1,8 +1 @@
-// Comment to get more information during initialization
-logLevel := Level.Warn
-
-// The Typesafe repository 
-resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
-
-// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.9")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")

+ 0 - 15
frameworks/Java/play2-java/setup_java_ebean_bonecp.sh

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# load java environment variables
-source $IROOT/java8.installed
-
-cd play2-java-ebean-bonecp
-
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-ebean-bonecp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-ebean-bonecp/target/universal/stage/RUNNING_PID
-fi
-
-${IROOT}/sbt/bin/sbt stage
-target/universal/stage/bin/play2-java-ebean-bonecp &

+ 0 - 15
frameworks/Java/play2-java/setup_java_jpa_bonecp.sh

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# load java environment variables
-source $IROOT/java8.installed
-
-cd play2-java-jpa-bonecp
-
-# If application is running, clear old running app.
-if [ -f ${TROOT}/play2-java-jpa-bonecp/target/universal/stage/RUNNING_PID ]
-then
-  rm -f -r ${TROOT}/play2-java-jpa-bonecp/target/universal/stage/RUNNING_PID
-fi
-
-${IROOT}/sbt/bin/sbt stage
-target/universal/stage/bin/play2-java-jpa-bonecp &