Browse Source

Merge branch 'master' of https://github.com/TechEmpower/FrameworkBenchmarks

jamming 10 years ago
parent
commit
a44570220c
52 changed files with 640 additions and 410 deletions
  1. 3 1
      deployment/vagrant-common/core.rb
  2. 6 6
      deployment/vagrant-production/Vagrantfile
  3. 74 4
      frameworks/C/lwan/README.md
  4. 18 14
      frameworks/Java/activeweb/benchmark_config
  5. 48 11
      frameworks/Java/activeweb/pom.xml
  6. 14 14
      frameworks/Java/activeweb/source_code
  7. 2 4
      frameworks/Java/activeweb/src/main/java/app/config/AppBootstrap.java
  8. 2 2
      frameworks/Java/activeweb/src/main/java/app/config/AppControllerConfig.java
  9. 0 30
      frameworks/Java/activeweb/src/main/java/app/config/FreeMarkerConfig.java
  10. 1 4
      frameworks/Java/activeweb/src/main/java/app/config/RouteConfig.java
  11. 0 39
      frameworks/Java/activeweb/src/main/java/app/controllers/DatabaseController.java
  12. 40 0
      frameworks/Java/activeweb/src/main/java/app/controllers/DbController.java
  13. 16 19
      frameworks/Java/activeweb/src/main/java/app/controllers/FortunesController.java
  14. 24 33
      frameworks/Java/activeweb/src/main/java/app/controllers/JsonController.java
  15. 15 22
      frameworks/Java/activeweb/src/main/java/app/controllers/PlaintextController.java
  16. 26 32
      frameworks/Java/activeweb/src/main/java/app/controllers/QueriesController.java
  17. 18 21
      frameworks/Java/activeweb/src/main/java/app/controllers/UpdatesController.java
  18. 1 1
      frameworks/Java/activeweb/src/main/java/app/models/Fortune.java
  19. 38 0
      frameworks/Java/activeweb/src/main/java/app/models/Message.java
  20. 19 17
      frameworks/Java/activeweb/src/main/java/app/models/World.java
  21. 1 0
      frameworks/Java/activeweb/src/main/resources/activeweb.properties
  22. 0 20
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.ftl
  23. 1 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.html
  24. 0 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.html
  25. 1 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/json/index.html
  26. 10 5
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.html
  27. 0 3
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/footer.ftl
  28. 0 4
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/header.ftl
  29. 0 7
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.ftl
  30. 1 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.html
  31. 0 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.html
  32. 0 0
      frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.html
  33. 0 46
      frameworks/Java/activeweb/src/test/java/app/controllers/DatabaseControllerSpec.java
  34. 66 0
      frameworks/Java/activeweb/src/test/java/app/controllers/DbControllerSpec.java
  35. 48 0
      frameworks/Java/activeweb/src/test/java/app/controllers/FortunesControllerSpec.java
  36. 33 26
      frameworks/Java/activeweb/src/test/java/app/controllers/JsonControllerSpec.java
  37. 42 0
      frameworks/Java/activeweb/src/test/java/app/controllers/PlaintextControllerSpec.java
  38. 3 3
      frameworks/Java/curacao/build.sbt
  39. 2 2
      frameworks/Java/curacao/src/main/java/benchmark/Benchmarks.java
  40. 3 3
      frameworks/Java/gemini/benchmark_config
  41. 3 3
      frameworks/Java/netty/pom.xml
  42. 8 1
      frameworks/Java/netty/src/main/java/hello/HelloWebServer.java
  43. 1 1
      frameworks/Java/servlet/pom.xml
  44. 2 1
      frameworks/Java/servlet3-cass/bash_profile.sh
  45. 1 1
      frameworks/Java/servlet3-cass/install.sh
  46. 5 5
      frameworks/Java/servlet3-cass/pom.xml
  47. 0 2
      frameworks/Java/servlet3-cass/source_code
  48. 1 1
      frameworks/Java/undertow-edge/pom.xml
  49. 1 1
      frameworks/Java/undertow/pom.xml
  50. 1 1
      frameworks/Perl/mojolicious/benchmark_config
  51. 10 0
      toolset/benchmark/benchmarker.py
  52. 31 0
      toolset/benchmark/utils.py

+ 3 - 1
deployment/vagrant-common/core.rb

@@ -77,7 +77,9 @@ def provider_aws(config, role, ip_address='172.16.0.16')
   end
 end
 
-def provider_virtualbox(config, role)
+def provider_virtualbox(config, role, ip_address='172.16.0.16')
+  config.vm.network "private_network", ip: ip_address
+  
   config.vm.provider :virtualbox do |vb, override|
     override.vm.hostname = "TFB-#{role}"
 

+ 6 - 6
deployment/vagrant-production/Vagrantfile

@@ -8,9 +8,9 @@ check_provider_needs(provider)
 
 Vagrant.configure("2") do |config|
 
-  server_ip = ENV.fetch('TFB_AWS_LOAD_IP', '172.16.0.16')
-  client_ip = ENV.fetch('TFB_AWS_DB_IP', '172.16.0.17')
-  databa_ip = ENV.fetch('TFB_AWS_APP_IP', '172.16.0.18')
+  server_ip = ENV.fetch('TFB_AWS_APP_IP', '172.16.0.16')
+  client_ip = ENV.fetch('TFB_AWS_LOAD_IP', '172.16.0.17')
+  databa_ip = ENV.fetch('TFB_AWS_DB_IP', '172.16.0.18')
   
   # Put the keys inside each box
   Dir['keys/*'].each do |fname|
@@ -28,20 +28,20 @@ Vagrant.configure("2") do |config|
   config.vm.define "client" do |client|
     provision_bootstrap(client, "client")
     provider_aws(client, "loadgen", client_ip)
-    provider_virtualbox(client, "client")
+    provider_virtualbox(client, "client", client_ip)
   end
 
   config.vm.define "db" do |db|
     provision_bootstrap(db, "database")
     provider_aws(db, "database", databa_ip)
-    provider_virtualbox(db, "database")
+    provider_virtualbox(db, "database", databa_ip)
   end
 
   # Define the app server as the primary VM
   config.vm.define "app", primary: true do |app|
     provision_bootstrap(app, "server")
     provider_aws(app, "appserver", server_ip)
-    provider_virtualbox(app, "server")
+    provider_virtualbox(app, "server", server_ip)
   end
 
 end

+ 74 - 4
frameworks/C/lwan/README.md

@@ -1,11 +1,82 @@
 # Lwan
 
-This is the configuration files to benchmark the [Lwan](http://lwan.ws)
+This is the configuration files to benchmark the [Lwan](http://lwan.ws/?src=twfb)
 web server/framework.
 
+## FAQ
+
+### Where's the source code for the benchmark?
+
+Source code for the benchmark itself is currently living in [in Lwan's
+repository](https://github.com/lpereira/lwan/tree/master/techempower) for
+practical reasons, but will move to [this repository right after Round 10 is
+complete](https://github.com/TechEmpower/FrameworkBenchmarks/issues/1372).
+
+In any case, the script to install the framework in the test machines [pulls
+a specific snapshot of the Lwan source
+code](https://github.com/lpereira/lwan/tree/49607addb31879e2aa2b701317773674662315aa),
+including the benchmark code; and, due to the nature of Git, it's not
+possible to alter that code without changing which commit hash to checkout
+in this repository.
+
+### The JSON test RPS value seems ridiculous; is Lwan cheating?
+
+Come on. There's no optimization without cheating. There's a somewhat
+[detailed blog post about
+this](http://tia.mat.br/blog/html/2014/10/06/life_of_a_http_request.html?src=twfb).
+However, that level of cheating is considered by Lwan's author to be fair
+game, since it's not related to the benchmark code itself.
+
+In fact, the serialization library has been picked solely because it was
+available in the [CCAN](http://ccodearchive.net/).  It's written by [Joseph
+A.  Adams](http://ccodearchive.net/info/json.html), and has been slightly
+tweaked to fix some compiler warnings and a few other minor changes.  No
+major optimization or trickery has been made there: it's essentially the
+same code.  Props to him for a clean code that performs well.
+
+It's all open source anyway, feel free to go ahead and inspect the code.
+
+### The database results aren't that good. Why?
+
+The database tests are included for completeness sake. The database
+abstraction layer (which works with SQLite and MySQL) was written
+specifically for this benchmark, and is completely synchronous: while
+one query is being performed, all other clients wait.
+
+So the uninspiring results are expected. Database connectivity is
+important and will eventually be revisited.
+
+### I've seen the preliminary results and Lwan didn't fare well in the plaintext benchmark. Is there a reason why?
+
+These benchmarks are performed using pipelined requests. For practical
+reasons (almost no client supports them, at least by default), this was not
+implemented in Lwan: the server was dropping the request buffer and waiting
+for the next request to come in, while `wrk` was waiting for responses to
+come out, eventually timeouting and sending more pipelined requests, only to
+repeat, until the test actually ended.
+
+Pipelining has been implemented in a hurry to get included in Round 10.
+
+### The results are pretty good, can I use this in my next web app?
+
+Writing web apps in C? Only if you're Crazy. (The uppercase C is not a typo.)
+
+Seriously, Lwan is just a toy.  It's an experiment.  Most things you'll need
+from real frameworks won't be available.  You'll have a hard time trying to do
+the simplest things.  There are far more important things to look for while
+picking a framework, and performance, while important, is not the most
+important factor.  However, if you're feeling adventurous, know that Lwan is
+free software, and is very open to pull requests.
+
+### I have other questions, is there a FAQ somewhere else?
+
+Sure there is. [See Lwan's web page](http://lwan.ws/?src=twfb) or contact the author
+directly.
+
 ## Requirements
 
-GCC, SQLite 3.7, Linux 3.0, optionally jemalloc or tcmalloc.
+GCC, SQLite 3.7, MySQL/MariaDB client libraries, Lua 5.1/LuaJit 2.0, Linux 3.0,
+optionally jemalloc or tcmalloc.
 
 ## Tests available
 
@@ -29,7 +100,6 @@ URL: /fortunes
 
 URL: /plaintext
 
-
 ## Contact
 
-Leandro Pereira <[email protected]>
+[Leandro Pereira](http://tia.mat.br/?src=twfb) <[[email protected]](mailto:[email protected])>

+ 18 - 14
frameworks/Java/activeweb/benchmark_config

@@ -4,15 +4,19 @@
     "default": {
       "setup_file": "setup",
       "json_url": "/activeweb/json",
+      "db_url": "/activeweb/db",
+      "query_url": "/activeweb/queries?queries=",
+      "fortune_url": "/activeweb/fortunes",
+      "update_url": "/activeweb/updates?queries=",
       "plaintext_url": "/activeweb/plaintext",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
+      "classification": "Fullstack",
+      "database": "MySQL",
       "framework": "activeweb",
       "language": "Java",
-      "orm": "Raw",
-      "platform": "ActiveWeb",
+      "orm": "Micro",
+      "platform": "Servlet",
       "webserver": "Resin",
       "os": "Linux",
       "database_os": "Linux",
@@ -20,24 +24,24 @@
       "notes": "",
       "versus": "servlet"
     },
-    "raw": {
+    "jackson": {
       "setup_file": "setup",
-      "db_url": "/activeweb/db",
-      "query_url": "/activeweb/queries?queries=",
-      "fortune_url": "/activeweb/fortunes",
-      "update_url": "/activeweb/updates?queries=",
+      "json_url": "/activeweb/json/jackson",
+      "db_url": "/activeweb/db/jackson",
+      "query_url": "/activeweb/queries/jackson?queries=",
+      "update_url": "/activeweb/updates/jackson?queries=",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Platform",
+      "classification": "Fullstack",
       "database": "MySQL",
-      "framework": "ActiveWeb",
+      "framework": "activeweb",
       "language": "Java",
-      "orm": "Raw",
-      "platform": "ActiveWeb",
+      "orm": "Micro",
+      "platform": "Servlet",
       "webserver": "Resin",
       "os": "Linux",
       "database_os": "Linux",
-      "display_name": "activeweb",
+      "display_name": "ActiveWeb",
       "notes": "",
       "versus": "servlet"
     }

+ 48 - 11
frameworks/Java/activeweb/pom.xml

@@ -9,7 +9,8 @@
     <name>ActiveWeb Benchmark App</name>
 
     <properties>
-        <activeweb.version>1.9</activeweb.version>
+        <activeweb.version>1.11</activeweb.version>
+        <activejdbc.version>1.4.10</activejdbc.version>
     </properties>
 
     <build>
@@ -18,7 +19,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.14.1</version>
+                <version>2.18.1</version>
                 <configuration>
                     <reportFormat>brief</reportFormat>
                     <trimStackTrace>true</trimStackTrace>
@@ -51,12 +52,18 @@
                             <maxIdleTime>1000</maxIdleTime>
                         </connector>
                     </connectors>
+                    <!--<systemProperties>-->
+                        <!--<systemProperty>-->
+                            <!--<name>active_reload</name>-->
+                            <!--<value>true</value>-->
+                        <!--</systemProperty>-->
+                    <!--</systemProperties>-->
                 </configuration>
             </plugin>
             <plugin>
                 <groupId>org.javalite</groupId>
                 <artifactId>activejdbc-instrumentation</artifactId>
-                <version>1.4.9</version>
+                <version>${activejdbc.version}</version>
                 <executions>
                     <execution>
                         <phase>process-classes</phase>
@@ -73,7 +80,7 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.8.1</version>
+            <version>4.12</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -81,6 +88,11 @@
             <artifactId>activeweb</artifactId>
             <version>${activeweb.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.javalite</groupId>
+            <artifactId>activejdbc</artifactId>
+            <version>${activejdbc.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.javalite</groupId>
             <artifactId>activeweb-testing</artifactId>
@@ -98,18 +110,43 @@
             <artifactId>slf4j-simple</artifactId>
             <version>1.7.5</version>
         </dependency>
-
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
-            <version>2.3.1</version>
+            <version>2.4.4</version>
         </dependency>
-
         <dependency>
-          <groupId>com.fasterxml.jackson.core</groupId>
-          <artifactId>jackson-databind</artifactId>
-          <version>2.3.1</version>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.4.4</version>
         </dependency>
-
     </dependencies>
+
+    <repositories>
+        <repository>
+            <id>javaLite-snapshots</id>
+            <name>JavaLite Snapshots</name>
+            <url>http://repo.javalite.io/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>javaLite-plugin-snapshots</id>
+            <name>JavaLite Plugin Snapshots</name>
+            <url>http://repo.javalite.io/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
 </project>

+ 14 - 14
frameworks/Java/activeweb/source_code

@@ -1,14 +1,14 @@
-./src/main/java/app/config/AppControllerConfig.java
-./src/main/java/app/config/RouteConfig.java
-./src/main/java/app/config/FreeMarkerConfig.java
-./src/main/java/app/config/DbConfig.java
-./src/main/java/app/config/AppBootstrap.java
-./src/main/java/app/models/World.java
-./src/main/java/app/models/Fortune.java
-./src/main/java/app/controllers/PlaintextController.java
-./src/main/java/app/controllers/JsonController.java
-./src/main/java/app/controllers/DatabaseController.java
-./src/main/java/app/controllers/FortunesController.java
-./src/main/java/app/controllers/QueriesController.java
-./src/main/java/app/controllers/HomeController.java
-./src/main/java/app/controllers/UpdatesController.java
+./activeweb/src/main/java/app/config/AppBootstrap.java
+./activeweb/src/main/java/app/config/AppControllerConfig.java
+./activeweb/src/main/java/app/config/DbConfig.java
+./activeweb/src/main/java/app/config/RouteConfig.java
+./activeweb/src/main/java/app/controllers/DbController.java
+./activeweb/src/main/java/app/controllers/FortunesController.java
+./activeweb/src/main/java/app/controllers/HomeController.java
+./activeweb/src/main/java/app/controllers/JsonController.java
+./activeweb/src/main/java/app/controllers/PlaintextController.java
+./activeweb/src/main/java/app/controllers/QueriesController.java
+./activeweb/src/main/java/app/controllers/UpdatesController.java
+./activeweb/src/main/java/app/models/Fortune.java
+./activeweb/src/main/java/app/models/Message.java
+./activeweb/src/main/java/app/models/World.java

+ 2 - 4
frameworks/Java/activeweb/src/main/java/app/config/AppBootstrap.java

@@ -17,15 +17,13 @@ package app.config;
 
 import org.javalite.activeweb.AppContext;
 import org.javalite.activeweb.Bootstrap;
-
-import com.google.inject.Guice;
-import org.javalite.activeweb.Configuration;
+import org.javalite.templator.TemplatorConfig;
 
 /**
  * @author Igor Polevoy
  */
 public class AppBootstrap extends Bootstrap {
     public void init(AppContext context) {
-        Configuration.setUseDefaultLayoutForErrors(true);
+        TemplatorConfig.instance().cacheTemplates(true);
     }
 }

+ 2 - 2
frameworks/Java/activeweb/src/main/java/app/config/AppControllerConfig.java

@@ -16,7 +16,7 @@ limitations under the License.
 package app.config;
 
 
-import app.controllers.DatabaseController;
+import app.controllers.DbController;
 import app.controllers.FortunesController;
 import app.controllers.QueriesController;
 import app.controllers.UpdatesController;
@@ -33,7 +33,7 @@ public class AppControllerConfig extends AbstractControllerConfig {
     public void init(AppContext context) {
 //        addGlobalFilters(new TimingFilter()); for speed - not sure how logging is configured
 
-        add(new DBConnectionFilter()).to(DatabaseController.class, QueriesController.class,
+        add(new DBConnectionFilter()).to(DbController.class, QueriesController.class,
                 FortunesController.class, UpdatesController.class);
     }
 }

+ 0 - 30
frameworks/Java/activeweb/src/main/java/app/config/FreeMarkerConfig.java

@@ -1,30 +0,0 @@
-/*
-Copyright 2009-2010 Igor Polevoy 
-
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
-
-http://www.apache.org/licenses/LICENSE-2.0 
-
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
-*/
-
-package app.config;
-
-import org.javalite.activeweb.freemarker.AbstractFreeMarkerConfig;
-
-/**
- * @author Igor Polevoy
- */
-public class FreeMarkerConfig extends org.javalite.activeweb.freemarker.AbstractFreeMarkerConfig {
-    @Override
-    public void init() {
-        //this is to override a strange FreeMarker default processing of numbers 
-        getConfiguration().setNumberFormat("0.##");
-    }
-}

+ 1 - 4
frameworks/Java/activeweb/src/main/java/app/config/RouteConfig.java

@@ -20,13 +20,10 @@ limitations under the License.
 
 package app.config;
 
-import app.controllers.DatabaseController;
 import org.javalite.activeweb.AbstractRouteConfig;
 import org.javalite.activeweb.AppContext;
 
 public class RouteConfig extends AbstractRouteConfig {
-    @Override
-    public void init(AppContext appContext) {
-        route("/db").to(DatabaseController.class);
+    @Override public void init(AppContext appContext) {
     }
 }

+ 0 - 39
frameworks/Java/activeweb/src/main/java/app/controllers/DatabaseController.java

@@ -1,39 +0,0 @@
-/*
-Copyright 2009-2010 Igor Polevoy 
-
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
-
-http://www.apache.org/licenses/LICENSE-2.0 
-
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
-*/
-
-/**
- * @author Igor Polevoy: 12/18/13 4:36 PM
- */
-
-package app.controllers;
-
-import app.models.World;
-import org.javalite.activeweb.AppController;
-
-import java.util.Date;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class DatabaseController extends AppController {
-    public void index() {
-
-        String json = World.findById(ThreadLocalRandom.current().nextInt(10000)).toJson(false, "id", "randomNumber");
-
-        respond(json).contentType("application/json")
-                .header("Content-Length", String.valueOf(json.length()))
-                .header("Date", new Date().toString());
-    }
-}

+ 40 - 0
frameworks/Java/activeweb/src/main/java/app/controllers/DbController.java

@@ -0,0 +1,40 @@
+/*
+Copyright 2009-2015 Igor Polevoy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package app.controllers;
+
+import app.models.World;
+import java.io.IOException;
+import org.javalite.activeweb.AppController;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * @author Igor Polevoy: 12/18/13 4:36 PM
+ * @author Eric Nielsen
+ */
+public class DbController extends AppController {
+    public void index() {
+        respond(World.findById(randomNumber()).toJson(false, "id", "randomNumber")).contentType("application/json");
+    }
+
+    public void jackson() throws IOException {
+        JsonController.WRITER.writeValue(outputStream("application/json"), World.findById(randomNumber()));
+    }
+
+    protected int randomNumber(){
+        return ThreadLocalRandom.current().nextInt(10000) + 1;
+    }
+}

+ 16 - 19
frameworks/Java/activeweb/src/main/java/app/controllers/FortunesController.java

@@ -1,23 +1,18 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 9:11 PM
- */
-
 package app.controllers;
 
 import app.models.Fortune;
@@ -25,17 +20,19 @@ import org.javalite.activeweb.AppController;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 
+/**
+ * @author Igor Polevoy: 12/18/13 9:11 PM
+ * @author Eric Nielsen
+ */
 public class FortunesController extends AppController {
-
     public void index() {
         List<Fortune> dbFortunes = Fortune.findAll();
         List<Fortune> fortunes = new ArrayList<Fortune>(dbFortunes);
-        fortunes.add((Fortune) Fortune.create("id", 0, "message", "Additional fortune added at request time."));
+        fortunes.add(Fortune.<Fortune>create("id", 0, "message", "Additional fortune added at request time."));
         Collections.sort(fortunes);
         view("fortunes", fortunes);
-        render().noLayout();
+        render("/fortunes/index").noLayout();
     }
 }

+ 24 - 33
frameworks/Java/activeweb/src/main/java/app/controllers/JsonController.java

@@ -1,49 +1,40 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 3:51 PM
- */
-
 package app.controllers;
 
+import app.models.Message;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import java.io.IOException;
 import org.javalite.activeweb.AppController;
 
-import java.io.IOException;
-import java.util.Date;
 
+/**
+ * @author Igor Polevoy: 12/18/13 3:51 PM
+ * @author Eric Nielsen
+ */
 public class JsonController extends AppController {
-    public void index() throws IOException {
-        String json = new ObjectMapper().writeValueAsString(new Message("Hello, World!"));
-        respond(json)
-                .contentType("application/json")
-                .header("Content-Length", String.valueOf(json.length()))
-                .header("Date", new Date().toString());
-    }
-
-    public static final class Message {
-        private final String message;
+    static final ObjectWriter WRITER = new ObjectMapper().writer();
 
-        private Message(String message) {
-            this.message = message;
-        }
+    public void index() {
+        view("message", new Message("Hello, World!"));
+        render("/json/index").noLayout().contentType("application/json");
+    }
 
-        public String getMessage() {
-            return message;
-        }
+    public void jackson() throws IOException {
+        WRITER.writeValue(outputStream("application/json"), new Message("Hello, World!"));
     }
 }

+ 15 - 22
frameworks/Java/activeweb/src/main/java/app/controllers/PlaintextController.java

@@ -1,35 +1,28 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/19/13 1:23 AM
- */
-
 package app.controllers;
 
 import org.javalite.activeweb.AppController;
 
-import java.util.Date;
-
+/**
+ * @author Igor Polevoy: 12/19/13 1:23 AM
+ * @author Eric Nielsen
+ */
 public class PlaintextController extends AppController {
     public void index() {
-        String message = "Hello, World!";
-        respond(message)
-                .contentType("text/plain")
-                .header("Content-Length", String.valueOf(message.length()))
-                .header("Date", new Date().toString());
+        respond("Hello, World!").contentType("text/plain");
     }
 }

+ 26 - 32
frameworks/Java/activeweb/src/main/java/app/controllers/QueriesController.java

@@ -1,40 +1,42 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 4:36 PM
- */
-
 package app.controllers;
 
 import app.models.World;
-import org.javalite.activeweb.AppController;
+import java.io.IOException;
 
 import java.util.ArrayList;
-import java.util.Date;
-import java.util.LinkedList;
 import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
 
-public class QueriesController extends AppController {
+/**
+ * @author Igor Polevoy: 12/18/13 4:36 PM
+ * @author Eric Nielsen
+ */
+public class QueriesController extends DbController {
+    @Override public void index() {
+        view("worlds", getWorlds());
+        render("/queries/index").contentType("application/json");
+    }
 
-    public void index() {
+    @Override public void jackson() throws IOException {
+        JsonController.WRITER.writeValue(outputStream("application/json"), getWorlds());
+    }
 
-        view("worlds", getWorlds());
-        render().contentType("application/json").header("Date", new Date().toString());
+    @Override protected String getLayout() {
+        return null;
     }
 
     protected List<World> getWorlds() {
@@ -46,7 +48,7 @@ public class QueriesController extends AppController {
         return worlds;
     }
 
-    public int getQueries() {
+    protected int getQueries() {
         int queries;
         try {
             queries = Integer.parseInt(param("queries"));
@@ -60,12 +62,4 @@ public class QueriesController extends AppController {
         }
         return queries;
     }
-    protected int randomNumber(){
-        return ThreadLocalRandom.current().nextInt(10000) + 1;
-    }
-
-    @Override
-    protected String getLayout() {
-        return null;
-    }
 }

+ 18 - 21
frameworks/Java/activeweb/src/main/java/app/controllers/UpdatesController.java

@@ -1,38 +1,35 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 9:51 PM
- */
-
 package app.controllers;
 
 import app.models.World;
-import org.javalite.activeweb.AppController;
 
 import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
 
+/**
+ * @author Igor Polevoy: 12/18/13 9:51 PM
+ * @author Eric Nielsen
+ */
 public class UpdatesController extends QueriesController {
-    public void index() {
-        List<World> worlds = getWorlds();
+
+    @Override protected List<World> getWorlds() {
+        List<World> worlds = super.getWorlds();
         for (World world : worlds) {
             world.set("randomNumber", randomNumber()).saveIt();
         }
-        view("worlds", worlds);
-        render("/queries/index"); //same template
+        return worlds;
     }
 }

+ 1 - 1
frameworks/Java/activeweb/src/main/java/app/models/Fortune.java

@@ -25,7 +25,7 @@ import org.javalite.activejdbc.annotations.Table;
 
 @Table("Fortune")
 public class Fortune extends Model implements Comparable<Fortune> {
-    public int compareTo(Fortune other) {
+    @Override public int compareTo(Fortune other) {
         return getString("message").compareTo(other.getString("message"));
     }
 }

+ 38 - 0
frameworks/Java/activeweb/src/main/java/app/models/Message.java

@@ -0,0 +1,38 @@
+/*
+Copyright 2009-2015 Igor Polevoy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package app.models;
+
+/**
+ * @author Eric Nielsen
+ */
+public class Message {
+    private String message;
+
+    public Message() {
+    }
+
+    public Message(String message) {
+        this.message = message;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}

+ 19 - 17
frameworks/Java/activeweb/src/main/java/app/models/World.java

@@ -1,30 +1,32 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 4:32 PM
- */
-
 package app.models;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import org.javalite.activejdbc.Model;
 import org.javalite.activejdbc.annotations.Table;
 
-
+/**
+ * @author Igor Polevoy: 12/18/13 4:32 PM
+ * @author Eric Nielsen
+ */
 @Table("World")
+@JsonIgnoreProperties({"frozen", "idName", "longId", "new", "valid"})
 public class World extends Model {
-
+    public Object getRandomNumber() {
+        return get("randomNumber");
+    }
 }

+ 1 - 0
frameworks/Java/activeweb/src/main/resources/activeweb.properties

@@ -0,0 +1 @@
+templateManager=org.javalite.activeweb.templator.TemplatorManager

+ 0 - 20
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.ftl

@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><title>Fortunes</title></head>
-<body>
-<table>
-    <tr>
-        <th>id</th>
-        <th>message</th>
-    </tr>
-
-<#list fortunes as fortune>
-    <tr>
-        <td>${fortune.id}</td>
-        <td>${fortune.message?html}</td>
-    </tr>
-</#list>
-
-</table>
-</body>
-</html>

+ 1 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/fortunes/index.html

@@ -0,0 +1 @@
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><#list fortunes as fortune ><tr><td>${fortune.id}</td><td>${fortune.message esc}</td></tr></#list></table></body></html>

+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/home/index.html


+ 1 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/json/index.html

@@ -0,0 +1 @@
+{"message":"${message.message}"}

+ 10 - 5
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/default_layout.html

@@ -1,21 +1,26 @@
-<#setting url_escaping_charset='ISO-8859-1'>
-
 <html>
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <LINK href="${context_path}/css/main.css" rel="stylesheet" type="text/css"/>
     <script src="${context_path}/js/jquery-1.4.2.min.js" type="text/javascript"></script>
     <script src="${context_path}/js/aw.js" type="text/javascript"></script>
-    <title>ActiveWeb - <@yield to="title"/></title>
+    <title>ActiveWeb</title>
 </head>
 <body>
 
 <div class="main">
-<#include "header.ftl" >
+    <div class="header">
+        <h1><a href="${context_path}">ActiveWeb Benchmark Application</a></h1>
+    </div>
+
+
     <div class="content">
     ${page_content}
     </div>
-<#include "footer.ftl" >
+    <div class='footer'>
+        <p>2010 - 2015 Active Web.</p>
+    </div>
+
 </div>
 
 </body>

+ 0 - 3
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/footer.ftl

@@ -1,3 +0,0 @@
-<div class='footer'>
-    <p>2010 - 2013 Active Web. No Rights Reserved.</p>
-</div>

+ 0 - 4
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/layouts/header.ftl

@@ -1,4 +0,0 @@
-<div class="header">
-    <h1><a href="${context_path}">ActiveWeb Benchmark Application</a></h1>
-</div>
-

+ 0 - 7
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.ftl

@@ -1,7 +0,0 @@
-<@compress single_line=true>
-[<#list worlds as w>
-{"id":${w.id},"randomNumber":${w.randomNumber}}
-<#if w_has_next>,</#if>
-</#list>
-]
-</@compress>

+ 1 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/queries/index.html

@@ -0,0 +1 @@
+[<#list worlds as w >{"id":${w.id},"randomNumber":${w.randomNumber}}<#if w_has_next >,</#if></#list>]

+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/404.html


+ 0 - 0
frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.ftl → frameworks/Java/activeweb/src/main/webapp/WEB-INF/views/system/error.html


+ 0 - 46
frameworks/Java/activeweb/src/test/java/app/controllers/DatabaseControllerSpec.java

@@ -1,46 +0,0 @@
-/*
-Copyright 2009-2010 Igor Polevoy 
-
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
-
-http://www.apache.org/licenses/LICENSE-2.0 
-
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
-*/
-
-/**
- * @author Igor Polevoy: 12/18/13 4:42 PM
- */
-
-package app.controllers;
-
-
-import org.javalite.activeweb.DBControllerSpec;
-import org.junit.Test;
-
-import java.util.Map;
-
-public class DatabaseControllerSpec extends DBControllerSpec {
-
-    @Test
-    public void shouldRenderOneRecord(){
-
-        //execute controller
-        request().get("index");
-
-        //process result
-        Map result = JsonHelper.toMap(responseContent());
-
-        //test result
-        a(result.size()).shouldBeEqual(2);
-        a(result.get("id")).shouldNotBeNull();
-        a(result.get("randomNumber")).shouldNotBeNull();
-        a(contentType()).shouldBeEqual("application/json");
-    }
-}

+ 66 - 0
frameworks/Java/activeweb/src/test/java/app/controllers/DbControllerSpec.java

@@ -0,0 +1,66 @@
+/*
+Copyright 2009-2015 Igor Polevoy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package app.controllers;
+
+import org.junit.Test;
+
+import java.util.Map;
+import org.junit.Ignore;
+
+/**
+ * @author Igor Polevoy: 12/18/13 4:42 PM
+ * @author Eric Nielsen
+ */
+public class DbControllerSpec extends org.javalite.activeweb.DBControllerSpec {
+
+    @Test
+    public void shouldRenderOneRecord() {
+        //execute controller
+        request().get("index");
+        //process result
+        System.out.println(responseContent());
+        Map result = JsonHelper.toMap(responseContent());
+        //test result
+        a(result.size()).shouldBeEqual(2);
+        a(result.get("id")).shouldNotBeNull();
+        a(result.get("randomNumber")).shouldNotBeNull();
+        a(contentType()).shouldBeEqual("application/json");
+    }
+
+
+    @Test
+    public void shouldRenderOneRecordWithJackson() {
+        //execute controller
+        request().get("jackson");
+        //process result
+        System.out.println(responseContent());
+        Map result = JsonHelper.toMap(responseContent());
+        //test result
+        a(result.size()).shouldBeEqual(2);
+        a(result.get("id")).shouldNotBeNull();
+        a(result.get("randomNumber")).shouldNotBeNull();
+        a(contentType()).shouldBeEqual("application/json");
+    }
+
+    @Ignore
+    public void shouldRenderResponseOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
+    }
+}

+ 48 - 0
frameworks/Java/activeweb/src/test/java/app/controllers/FortunesControllerSpec.java

@@ -0,0 +1,48 @@
+/*
+Copyright 2009-2015 Igor Polevoy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package app.controllers;
+
+import org.javalite.activeweb.DBControllerSpec;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Eric Nielsen
+ */
+public class FortunesControllerSpec extends DBControllerSpec {
+
+    @Test
+    public void shouldRenderHtml() {
+        request().integrateViews().get("index");
+        System.out.print(responseContent());
+        the(responseContent()).shouldContain(
+                "<tr><td>11</td><td>&lt;script&gt;alert(&quot;This should not be displayed in a browser alert box.&quot;);&lt;/script&gt;</td></tr>"
+                + "<tr><td>4</td><td>A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1</td></tr>"
+                + "<tr><td>5</td><td>A computer program does what you tell it to do, not what you want it to do.</td></tr>"
+                + "<tr><td>2</td><td>A computer scientist is someone who fixes things that aren&apos;t broken.</td></tr>");
+    }
+
+    @Ignore
+    @Test
+    public void shouldRenderHtmlOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().integrateViews().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
+    }
+}

+ 33 - 26
frameworks/Java/activeweb/src/test/java/app/controllers/JsonControllerSpec.java

@@ -1,45 +1,52 @@
 /*
-Copyright 2009-2010 Igor Polevoy 
+Copyright 2009-2015 Igor Polevoy
 
-Licensed under the Apache License, Version 2.0 (the "License"); 
-you may not use this file except in compliance with the License. 
-You may obtain a copy of the License at 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0 
+http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing, software 
-distributed under the License is distributed on an "AS IS" BASIS, 
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-See the License for the specific language governing permissions and 
-limitations under the License. 
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 3:59 PM
- */
-
 package app.controllers;
 
-import org.javalite.activeweb.Configuration;
 import org.javalite.activeweb.ControllerSpec;
+import org.junit.Ignore;
 import org.junit.Test;
 
-import java.util.Map;
 
+/**
+ * @author Igor Polevoy: 12/18/13 3:59 PM
+ * @author Eric Nielsen
+ */
 public class JsonControllerSpec extends ControllerSpec {
 
     @Test
     public void shouldRenderMessage() {
+        request().integrateViews().get("index");
+        the(responseContent()).shouldBeEqual("{\"message\":\"Hello, World!\"}");
+        the(contentType()).shouldBeEqual("application/json");
+    }
 
-        System.out.println("ACTIVE_ENV value ============>>>>" + Configuration.getEnv());
-        //execute controller
-        request().get("index");
-
-        //process result
-        Map result = JsonHelper.toMap(responseContent());
+    @Test
+    public void shouldRenderMessageWithJackson() {
+        request().get("jackson");
+        the(responseContent()).shouldBeEqual("{\"message\":\"Hello, World!\"}");
+        the(contentType()).shouldBeEqual("application/json");
+    }
 
-        //test result
-        a(result.get("message")).shouldBeEqual("Hello, World!");
-        a(contentType()).shouldBeEqual("application/json");
+    @Ignore
+    @Test
+    public void shouldRenderMessageOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().integrateViews().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
     }
 }

+ 42 - 0
frameworks/Java/activeweb/src/test/java/app/controllers/PlaintextControllerSpec.java

@@ -0,0 +1,42 @@
+/*
+Copyright 2009-2015 Igor Polevoy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package app.controllers;
+
+import org.javalite.activeweb.ControllerSpec;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Eric Nielsen
+ */
+public class PlaintextControllerSpec extends ControllerSpec {
+
+    @Test
+    public void shouldRenderResponse() {
+        request().get("index");
+        the(responseContent()).shouldBeEqual("Hello, World!");
+    }
+
+    @Ignore
+    public void shouldRenderHtmlOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
+    }
+}

+ 3 - 3
frameworks/Java/curacao/build.sbt

@@ -13,9 +13,9 @@ resolvers ++= Seq(
 )
 
 libraryDependencies ++= Seq(
-  "com.kolich.curacao" % "curacao" % "2.6.3" % "compile",
-  "com.kolich.curacao" % "curacao-gson" % "2.6.3" % "compile",
-  "org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "compile",
+  "com.kolich.curacao" % "curacao" % "2.9-M1" % "compile",
+  "com.kolich.curacao" % "curacao-gson" % "2.9-M1" % "compile",
+  "org.eclipse.jetty" % "jetty-webapp" % "9.2.9.v20150224" % "compile",
   "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided",
   "org.slf4j" % "slf4j-api" % "1.7.2" % "compile",
   "ch.qos.logback" % "logback-core" % "1.0.7" % "compile",

+ 2 - 2
frameworks/Java/curacao/src/main/java/benchmark/Benchmarks.java

@@ -2,8 +2,8 @@ package benchmark;
 
 import benchmark.entities.HelloWorld;
 import com.kolich.curacao.annotations.Controller;
-import com.kolich.curacao.annotations.methods.RequestMapping;
-import com.kolich.curacao.handlers.requests.matchers.AntPathMatcher;
+import com.kolich.curacao.annotations.RequestMapping;
+import com.kolich.curacao.mappers.request.matchers.AntPathMatcher;
 
 @Controller
 public final class Benchmarks {

+ 3 - 3
frameworks/Java/gemini/benchmark_config

@@ -37,7 +37,7 @@
       "webserver": "Resin",
       "os": "Linux",
       "database_os": "Linux",
-      "display_name": "gemini",
+      "display_name": "gemini-mysql",
       "notes": "",
       "versus": "servlet"
     },
@@ -50,7 +50,7 @@
       "port": 8080,
       "approach": "Realistic",
       "classification": "Fullstack",
-      "database": "MySQL",
+      "database": "Postgres",
       "framework": "gemini",
       "language": "Java",
       "orm": "Micro",
@@ -58,7 +58,7 @@
       "webserver": "Resin",
       "os": "Linux",
       "database_os": "Linux",
-      "display_name": "gemini",
+      "display_name": "gemini-postgres",
       "notes": "",
       "versus": "servlet"
     }   

+ 3 - 3
frameworks/Java/netty/pom.xml

@@ -8,17 +8,17 @@
 	<version>0.1</version>
 
 	<packaging>jar</packaging>
-
+	
 	<dependencies>
 		<dependency>
 			<groupId>io.netty</groupId>
 			<artifactId>netty-codec-http</artifactId>
-			<version>4.0.25.Final</version>
+			<version>4.0.26.Final</version>
 		</dependency>
 		<dependency>
 			<groupId>io.netty</groupId>
 			<artifactId>netty-transport-native-epoll</artifactId>
-			<version>4.0.25.Final</version>
+			<version>4.0.26.Final</version>
 			<classifier>linux-x86_64</classifier>
 		</dependency>
 		<dependency>

+ 8 - 1
frameworks/Java/netty/src/main/java/hello/HelloWebServer.java

@@ -1,5 +1,7 @@
 package hello;
 
+import java.net.InetSocketAddress;
+
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.channel.Channel;
@@ -38,6 +40,8 @@ public class HelloWebServer {
 
     private void doRun(EventLoopGroup loupGroup, Class<? extends ServerChannel> serverChannelClass) throws InterruptedException {
 	try {
+		InetSocketAddress inet = new InetSocketAddress(port);
+		
 	    ServerBootstrap b = new ServerBootstrap();
 	    b.option(ChannelOption.SO_BACKLOG, 1024);
 	    b.option(ChannelOption.SO_REUSEADDR, true);
@@ -47,7 +51,10 @@ public class HelloWebServer {
 	    b.childOption(ChannelOption.SO_REUSEADDR, true);
 	    b.childOption(ChannelOption.MAX_MESSAGES_PER_READ, Integer.MAX_VALUE);
 
-	    Channel ch = b.bind(port).sync().channel();
+	    Channel ch = b.bind(inet).sync().channel();
+	    
+	    System.out.printf("Httpd started. Listening on: %s%n", inet.toString());	    
+	    
 	    ch.closeFuture().sync();
 	} finally {
 	    loupGroup.shutdownGracefully().sync();

+ 1 - 1
frameworks/Java/servlet/pom.xml

@@ -20,7 +20,7 @@
 	<dependency>
 	    <groupId>org.postgresql</groupId>
 	    <artifactId>postgresql</artifactId>
-	    <version>9.3-1102-jdbc41</version>
+	    <version>9.4-1200-jdbc41</version>
 	</dependency>
             
 

+ 2 - 1
frameworks/Java/servlet3-cass/bash_profile.sh

@@ -1,2 +1,3 @@
-export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
+export JAVA_HOME=/opt/java8
+export JAVA_EXE=$JAVA_HOME/bin/java
 export RESIN_HOME=${IROOT}/resin-4.0.41

+ 1 - 1
frameworks/Java/servlet3-cass/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends java resin maven
+fw_depends java8 resin maven

+ 5 - 5
frameworks/Java/servlet3-cass/pom.xml

@@ -10,7 +10,7 @@
         <sourceEncoding>UTF-8</sourceEncoding>
         <java.version>1.7</java.version>
 
-        <slf4j.version>1.7.7</slf4j.version>
+        <slf4j.version>1.7.10</slf4j.version>
         <logback.version>1.1.2</logback.version>
     </properties>
 
@@ -22,7 +22,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.1</version>
+                <version>3.2</version>
                 <configuration>
                     <source>${java.version}</source>
                     <target>${java.version}</target>
@@ -33,7 +33,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>
-                <version>2.4</version>
+                <version>2.6</version>
                 <configuration>
                     <failOnMissingWebXml>false</failOnMissingWebXml>
                 </configuration>
@@ -62,13 +62,13 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.4.1</version>
+            <version>2.5.1</version>
         </dependency>
 
         <dependency>
             <groupId>com.datastax.cassandra</groupId>
             <artifactId>cassandra-driver-core</artifactId>
-            <version>2.0.3</version>
+            <version>2.1.4</version>
             <scope>compile</scope>
         </dependency>
 

+ 0 - 2
frameworks/Java/servlet3-cass/source_code

@@ -4,8 +4,6 @@
 ./servlet3-cass/src/main/java/fi/markoa
 ./servlet3-cass/src/main/java/fi/markoa/tfb
 ./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3
-./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3/AsyncErrorServlet1.java
-./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3/AsyncErrorServlet2.java
 ./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3/DatabaseBaseServlet.java
 ./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3/DatabaseQueriesServlet.java
 ./servlet3-cass/src/main/java/fi/markoa/tfb/servlet3/DatabaseQueryServlet.java

+ 1 - 1
frameworks/Java/undertow-edge/pom.xml

@@ -45,7 +45,7 @@
         <dependency>
             <groupId>org.postgresql</groupId>
 	    <artifactId>postgresql</artifactId>
-            <version>9.3-1102-jdbc41</version>
+            <version>9.4-1200-jdbc41</version>
 	</dependency>
         <dependency>
             <groupId>org.mongodb</groupId>

+ 1 - 1
frameworks/Java/undertow/pom.xml

@@ -36,7 +36,7 @@
         <dependency>
             <groupId>org.postgresql</groupId>
 	    <artifactId>postgresql</artifactId>
-            <version>9.3-1102-jdbc41</version>
+            <version>9.4-1200-jdbc41</version>
 	</dependency>
         <dependency>
             <groupId>org.mongodb</groupId>

+ 1 - 1
frameworks/Perl/mojolicious/benchmark_config

@@ -11,7 +11,7 @@
       "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Full",
+      "classification": "Fullstack",
       "database": "MongoDB",
       "framework": "mojolicious",
       "language": "Perl",

+ 10 - 0
toolset/benchmark/benchmarker.py

@@ -6,6 +6,7 @@ from benchmark.test_types import *
 from utils import header
 from utils import gather_tests
 from utils import gather_frameworks
+from utils import verify_database_connections
 
 import os
 import json
@@ -539,6 +540,15 @@ class Benchmarker:
           """)
           time.sleep(10)
 
+          st = verify_database_connections([
+            ("mysql", self.database_host, 3306),
+            ("mongodb", self.database_host, 27017),
+            ("redis", self.database_host, 6379),
+            ("postgresql", self.database_host, 5432),
+            ("cassandra", self.database_host, 9160)
+          ])
+          print "database connection test results:\n" + "\n".join(st[1])
+
         if self.__is_port_bound(test.port):
           # This can happen sometimes - let's try again
           self.__stop_test(out, err)

+ 31 - 0
toolset/benchmark/utils.py

@@ -2,6 +2,7 @@ import ConfigParser
 import os
 import glob
 import json
+import socket
 
 from ast import literal_eval
 
@@ -138,3 +139,33 @@ def header(message, top='-', bottom='-'):
       else:
         result += "\n%s" % bottomheader
     return result + '\n'
+
+def check_services(services):
+
+  def check_service(address, port):
+    try:
+      s = socket.socket()
+      s.settimeout(20)
+      s.connect((address, port))
+      return (True, "")
+    except Exception as ex:
+      return (False, ex)
+    finally:
+      s.close
+
+  res = []
+  for s in services:
+    r = check_service(s[1], s[2])
+    res.append((s[0], r[0], str(r[1])))
+  return res
+
+def verify_database_connections(services):
+  allGo = True
+  messages = []
+  for r in check_services(services):
+    if r[1]:
+      messages.append(r[0] + ": is GO!")
+    else:
+      messages.append(r[0] + ": is _NO_ GO!: ERROR: " + r[2])
+      allGo = False
+  return (allGo, messages)