Browse Source

Using latest release versions of activeweb and activejdbc
Respectively, 1.11 and 1.4.10

ericbn 10 years ago
parent
commit
0c5bb35508

+ 19 - 1
frameworks/Java/activeweb/benchmark_config

@@ -11,7 +11,25 @@
       "plaintext_url": "/activeweb/plaintext",
       "plaintext_url": "/activeweb/plaintext",
       "port": 8080,
       "port": 8080,
       "approach": "Realistic",
       "approach": "Realistic",
-      "classification": "Full-stack",
+      "classification": "Fullstack",
+      "database": "MySQL",
+      "framework": "activeweb",
+      "language": "Java",
+      "orm": "Micro",
+      "platform": "Servlet",
+      "webserver": "Resin",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ActiveWeb",
+      "notes": "",
+      "versus": "servlet"
+    },
+    "jackson": {
+      "setup_file": "setup",
+      "json_url": "/activeweb/json/jackson",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
       "database": "MySQL",
       "database": "MySQL",
       "framework": "activeweb",
       "framework": "activeweb",
       "language": "Java",
       "language": "Java",

+ 20 - 33
frameworks/Java/activeweb/pom.xml

@@ -9,7 +9,8 @@
     <name>ActiveWeb Benchmark App</name>
     <name>ActiveWeb Benchmark App</name>
 
 
     <properties>
     <properties>
-        <activeweb.version>1.11-SNAPSHOT</activeweb.version>
+        <activeweb.version>1.11</activeweb.version>
+        <activejdbc.version>1.4.10</activejdbc.version>
     </properties>
     </properties>
 
 
     <build>
     <build>
@@ -18,7 +19,7 @@
             <plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.14.1</version>
+                <version>2.18.1</version>
                 <configuration>
                 <configuration>
                     <reportFormat>brief</reportFormat>
                     <reportFormat>brief</reportFormat>
                     <trimStackTrace>true</trimStackTrace>
                     <trimStackTrace>true</trimStackTrace>
@@ -51,20 +52,18 @@
                             <maxIdleTime>1000</maxIdleTime>
                             <maxIdleTime>1000</maxIdleTime>
                         </connector>
                         </connector>
                     </connectors>
                     </connectors>
-
                     <!--<systemProperties>-->
                     <!--<systemProperties>-->
                         <!--<systemProperty>-->
                         <!--<systemProperty>-->
                             <!--<name>active_reload</name>-->
                             <!--<name>active_reload</name>-->
                             <!--<value>true</value>-->
                             <!--<value>true</value>-->
                         <!--</systemProperty>-->
                         <!--</systemProperty>-->
                     <!--</systemProperties>-->
                     <!--</systemProperties>-->
-
                 </configuration>
                 </configuration>
             </plugin>
             </plugin>
             <plugin>
             <plugin>
                 <groupId>org.javalite</groupId>
                 <groupId>org.javalite</groupId>
                 <artifactId>activejdbc-instrumentation</artifactId>
                 <artifactId>activejdbc-instrumentation</artifactId>
-                <version>1.4.10-SNAPSHOT</version>
+                <version>${activejdbc.version}</version>
                 <executions>
                 <executions>
                     <execution>
                     <execution>
                         <phase>process-classes</phase>
                         <phase>process-classes</phase>
@@ -81,7 +80,7 @@
         <dependency>
         <dependency>
             <groupId>junit</groupId>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <artifactId>junit</artifactId>
-            <version>4.8.1</version>
+            <version>4.12</version>
             <scope>test</scope>
             <scope>test</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
@@ -92,7 +91,7 @@
         <dependency>
         <dependency>
             <groupId>org.javalite</groupId>
             <groupId>org.javalite</groupId>
             <artifactId>activejdbc</artifactId>
             <artifactId>activejdbc</artifactId>
-            <version>1.4.10-SNAPSHOT</version>
+            <version>${activejdbc.version}</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>org.javalite</groupId>
             <groupId>org.javalite</groupId>
@@ -111,53 +110,41 @@
             <artifactId>slf4j-simple</artifactId>
             <artifactId>slf4j-simple</artifactId>
             <version>1.7.5</version>
             <version>1.7.5</version>
         </dependency>
         </dependency>
-
-        <!--<dependency>-->
-            <!--<groupId>com.sun</groupId>-->
-            <!--<artifactId>tools</artifactId>-->
-            <!--<version>1.7.0</version>-->
-            <!--<scope>system</scope>-->
-            <!--<systemPath>${java.home}/../lib/tools.jar</systemPath>-->
-        <!--</dependency>-->
-
         <dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>
             <artifactId>jackson-core</artifactId>
-            <version>2.3.1</version>
-            <scope>test</scope>
+            <version>2.4.4</version>
         </dependency>
         </dependency>
-
         <dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.3.1</version>
-            <scope>test</scope>
+            <version>2.4.4</version>
         </dependency>
         </dependency>
-
-
     </dependencies>
     </dependencies>
 
 
     <repositories>
     <repositories>
         <repository>
         <repository>
-            <id>snapshots1</id>
-            <name>Sonatype Snapshots</name>
-            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+            <id>javaLite-snapshots</id>
+            <name>JavaLite Snapshots</name>
+            <url>http://repo.javalite.io/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
             <snapshots>
             <snapshots>
                 <enabled>true</enabled>
                 <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-                <checksumPolicy>warn</checksumPolicy>
             </snapshots>
             </snapshots>
         </repository>
         </repository>
     </repositories>
     </repositories>
     <pluginRepositories>
     <pluginRepositories>
         <pluginRepository>
         <pluginRepository>
-            <id>snapshots2</id>
-            <name>Sonatype Snapshots</name>
-            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+            <id>javaLite-plugin-snapshots</id>
+            <name>JavaLite Plugin Snapshots</name>
+            <url>http://repo.javalite.io/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
             <snapshots>
             <snapshots>
                 <enabled>true</enabled>
                 <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-                <checksumPolicy>warn</checksumPolicy>
             </snapshots>
             </snapshots>
         </pluginRepository>
         </pluginRepository>
     </pluginRepositories>
     </pluginRepositories>

+ 10 - 11
frameworks/Java/activeweb/src/main/java/app/controllers/DbController.java

@@ -1,5 +1,5 @@
 /*
 /*
-Copyright 2009-2010 Igor Polevoy
+Copyright 2009-2015 Igor Polevoy
 
 
 Licensed under the Apache License, Version 2.0 (the "License");
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 you may not use this file except in compliance with the License.
@@ -13,24 +13,23 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 */
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 4:36 PM
- */
-
 package app.controllers;
 package app.controllers;
 
 
 import app.models.World;
 import app.models.World;
 import org.javalite.activeweb.AppController;
 import org.javalite.activeweb.AppController;
 
 
-import java.util.Date;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.ThreadLocalRandom;
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 4:36 PM
+ * @author Eric Nielsen
+ */
 public class DbController extends AppController {
 public class DbController extends AppController {
     public void index() {
     public void index() {
-        String json = World.findById(ThreadLocalRandom.current().nextInt(10000) + 1).toJson(false, "id", "randomNumber");
-        respond(json).contentType("application/json")
-                .header("Content-Length", String.valueOf(json.length()))
-                .header("Date", new Date().toString());
+        respond(World.findById(randomNumber()).toJson(false, "id", "randomNumber")).contentType("application/json");
+    }
+
+    protected int randomNumber(){
+        return ThreadLocalRandom.current().nextInt(10000) + 1;
     }
     }
 }
 }

+ 15 - 17
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;
 package app.controllers;
 
 
 import app.models.Fortune;
 import app.models.Fortune;
@@ -27,12 +22,15 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Collections;
 import java.util.List;
 import java.util.List;
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 9:11 PM
+ * @author Eric Nielsen
+ */
 public class FortunesController extends AppController {
 public class FortunesController extends AppController {
-
     public void index() {
     public void index() {
         List<Fortune> dbFortunes = Fortune.findAll();
         List<Fortune> dbFortunes = Fortune.findAll();
         List<Fortune> fortunes = new ArrayList<Fortune>(dbFortunes);
         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);
         Collections.sort(fortunes);
         view("fortunes", fortunes);
         view("fortunes", fortunes);
         render().noLayout();
         render().noLayout();

+ 31 - 30
frameworks/Java/activeweb/src/main/java/app/controllers/JsonController.java

@@ -1,46 +1,47 @@
 /*
 /*
-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;
 package app.controllers;
 
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
 import org.javalite.activeweb.AppController;
 import org.javalite.activeweb.AppController;
 
 
-import java.io.IOException;
-import java.util.Date;
+import java.util.Map;
+import java.util.TreeMap;
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 3:51 PM
+ * @author Eric Nielsen
+ */
 public class JsonController extends AppController {
 public class JsonController extends AppController {
-    public void index() throws IOException {
-        view("message", new Message("Hello, World!"));
-        header("Date", new Date().toString());
-        render().noLayout().contentType("application/json");
-    }
+    static final ObjectWriter WRITER = new ObjectMapper().writer();
 
 
-    public static final class Message {
-        private final String message;
+    private Map<String, Object> newMessage() {
+        Map<String, Object> message = new TreeMap<String, Object>();
+        message.put("message", "Hello, World!");
+        return message;
+    }
 
 
-        private Message(String message) {
-            this.message = message;
-        }
+    public void index() {
+        view("message", newMessage());
+        render().noLayout().contentType("application/json");
+    }
 
 
-        public String getMessage() {
-            return message;
-        }
+    public void jackson() throws JsonProcessingException {
+        respond(WRITER.writeValueAsString(newMessage())).contentType("application/json");
     }
     }
 }
 }

+ 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;
 package app.controllers;
 
 
 import org.javalite.activeweb.AppController;
 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 class PlaintextController extends AppController {
     public void index() {
     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");
     }
     }
 }
 }

+ 21 - 30
frameworks/Java/activeweb/src/main/java/app/controllers/QueriesController.java

@@ -1,39 +1,37 @@
 /*
 /*
-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;
 package app.controllers;
 
 
 import app.models.World;
 import app.models.World;
-import org.javalite.activeweb.AppController;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
-
-public class QueriesController extends AppController {
-
-    public void index() {
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 4:36 PM
+ * @author Eric Nielsen
+ */
+public class QueriesController extends DbController {
+    @Override public void index() {
         view("worlds", getWorlds());
         view("worlds", getWorlds());
-        render().contentType("application/json").header("Date", new Date().toString());
+        render().contentType("application/json");
+    }
+
+    @Override protected String getLayout() {
+        return null;
     }
     }
 
 
     protected List<World> getWorlds() {
     protected List<World> getWorlds() {
@@ -59,11 +57,4 @@ public class QueriesController extends AppController {
         }
         }
         return queries;
         return queries;
     }
     }
-    protected int randomNumber(){
-        return ThreadLocalRandom.current().nextInt(10000) + 1;
-    }
-
-    @Override protected String getLayout() {
-        return null;
-    }
 }
 }

+ 15 - 16
frameworks/Java/activeweb/src/main/java/app/controllers/UpdatesController.java

@@ -1,29 +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/18/13 9:51 PM
- */
-
 package app.controllers;
 package app.controllers;
 
 
 import app.models.World;
 import app.models.World;
 
 
 import java.util.List;
 import java.util.List;
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 9:51 PM
+ * @author Eric Nielsen
+ */
 public class UpdatesController extends QueriesController {
 public class UpdatesController extends QueriesController {
     @Override public void index() {
     @Override public void index() {
         List<World> worlds = getWorlds();
         List<World> worlds = getWorlds();
@@ -31,6 +30,6 @@ public class UpdatesController extends QueriesController {
             world.set("randomNumber", randomNumber()).saveIt();
             world.set("randomNumber", randomNumber()).saveIt();
         }
         }
         view("worlds", worlds);
         view("worlds", worlds);
-        render("/queries/index"); //same template
+        render("/queries/index").contentType("application/json"); //same template
     }
     }
 }
 }

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

@@ -1 +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}</td></tr></#list></table></body></html>
+<!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>

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

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

+ 15 - 9
frameworks/Java/activeweb/src/test/java/app/controllers/DbControllerSpec.java

@@ -1,5 +1,5 @@
 /*
 /*
-Copyright 2009-2010 Igor Polevoy
+Copyright 2009-2015 Igor Polevoy
 
 
 Licensed under the Apache License, Version 2.0 (the "License");
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 you may not use this file except in compliance with the License.
@@ -13,32 +13,38 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 */
 */
-
-/**
- * @author Igor Polevoy: 12/18/13 4:42 PM
- */
-
 package app.controllers;
 package app.controllers;
 
 
 import org.junit.Test;
 import org.junit.Test;
 
 
 import java.util.Map;
 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 {
 public class DbControllerSpec extends org.javalite.activeweb.DBControllerSpec {
 
 
     @Test
     @Test
     public void shouldRenderOneRecord(){
     public void shouldRenderOneRecord(){
-
         //execute controller
         //execute controller
         request().get("index");
         request().get("index");
-
         //process result
         //process result
         Map result = JsonHelper.toMap(responseContent());
         Map result = JsonHelper.toMap(responseContent());
-
         //test result
         //test result
         a(result.size()).shouldBeEqual(2);
         a(result.size()).shouldBeEqual(2);
         a(result.get("id")).shouldNotBeNull();
         a(result.get("id")).shouldNotBeNull();
         a(result.get("randomNumber")).shouldNotBeNull();
         a(result.get("randomNumber")).shouldNotBeNull();
         a(contentType()).shouldBeEqual("application/json");
         a(contentType()).shouldBeEqual("application/json");
     }
     }
+
+    @Ignore
+    public void shouldRenderResponseOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
+    }
 }
 }

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

@@ -0,0 +1,47 @@
+/*
+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't broken.</td></tr>");
+    }
+
+    @Ignore
+    public void shouldRenderHtmlOneMinute() {
+        long endMillis = System.currentTimeMillis() + 60*1000;
+        do {
+            request().integrateViews().get("index");
+            responseContent();
+        } while (System.currentTimeMillis() < endMillis);
+    }
+}

+ 23 - 19
frameworks/Java/activeweb/src/test/java/app/controllers/JsonControllerSpec.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 3:59 PM
- */
-
 package app.controllers;
 package app.controllers;
 
 
 import org.javalite.activeweb.ControllerSpec;
 import org.javalite.activeweb.ControllerSpec;
@@ -26,19 +21,28 @@ import org.junit.Test;
 import java.util.Map;
 import java.util.Map;
 import org.junit.Ignore;
 import org.junit.Ignore;
 
 
+/**
+ * @author Igor Polevoy: 12/18/13 3:59 PM
+ * @author Eric Nielsen
+ */
 public class JsonControllerSpec extends ControllerSpec {
 public class JsonControllerSpec extends ControllerSpec {
 
 
     @Test
     @Test
     public void shouldRenderMessage() {
     public void shouldRenderMessage() {
         request().integrateViews().get("index");
         request().integrateViews().get("index");
-
         //process result
         //process result
+        System.out.print(responseContent());
         Map result = JsonHelper.toMap(responseContent());
         Map result = JsonHelper.toMap(responseContent());
-
         //test result
         //test result
         the(result.size()).shouldBeEqual(1);
         the(result.size()).shouldBeEqual(1);
-        a(result.get("message")).shouldBeEqual("Hello, World!");
-        a(contentType()).shouldBeEqual("application/json");
+        the(result.get("message")).shouldBeEqual("Hello, World!");
+        the(contentType()).shouldBeEqual("application/json");
+    }
+
+    @Test
+    public void shouldRenderMessageWithJackson() {
+        request().get("jackson");
+        the(responseContent()).shouldBeEqual("{\"message\":\"Hello, World!\"}");
     }
     }
 
 
     @Ignore
     @Ignore

+ 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);
+    }
+}