Browse Source

remove sabina

Keith Newman 9 years ago
parent
commit
9dfdd48dcd

+ 0 - 1
.travis.yml

@@ -98,7 +98,6 @@ env:
     - "TESTDIR=Java/servlet"
     - "TESTDIR=Java/servlet3-cass"
     - "TESTDIR=Java/spark"
-    - "TESTDIR=Java/sabina"
     - "TESTDIR=Java/spring"
     - "TESTDIR=Java/tapestry"
     - "TESTDIR=Java/undertow"

+ 0 - 101
frameworks/Java/sabina/benchmark_config.json

@@ -1,101 +0,0 @@
-{
-  "framework": "sabina",
-  "tests": [{
-    "default": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "plaintext_url": "/plaintext",
-
-      "port": 5050,
-      "setup_file": "undertow-mongodb",
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MongoDB",
-      "framework": "Sabina",
-      "language": "Java",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Sabina Undertow MongoDB",
-      "notes": "",
-      "versus": "servlet"
-    },
-    "undertow-mysql": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "plaintext_url": "/plaintext",
-
-      "port": 5050,
-      "setup_file": "undertow",
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "Sabina",
-      "language": "Java",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Sabina Undertow MySQL",
-      "notes": "",
-      "versus": "servlet"
-    },
-    "jetty-mysql": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "plaintext_url": "/plaintext",
-
-      "port": 5050,
-      "setup_file": "jetty",
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "Sabina",
-      "language": "Java",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Sabina Jetty MySQL",
-      "notes": "",
-      "versus": "servlet"
-    },
-    "jetty-mongodb": {
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "plaintext_url": "/plaintext",
-
-      "port": 5050,
-      "setup_file": "jetty-mongodb",
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MongoDB",
-      "framework": "Sabina",
-      "language": "Java",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Sabina Jetty MongoDB",
-      "notes": "",
-      "versus": "servlet"
-    }
-  }]
-}

+ 0 - 5
frameworks/Java/sabina/jetty-mongodb.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-fw_depends java maven
-
-./setup.sh -Dsabina.backend=jetty -Dsabina.benchmark.repository=mongodb

+ 0 - 5
frameworks/Java/sabina/jetty.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-fw_depends java maven
-
-./setup.sh -Dsabina.backend=jetty -Dsabina.benchmark.repository=mysql

+ 0 - 179
frameworks/Java/sabina/pom.xml

@@ -1,179 +0,0 @@
-<!--
- ! Copyright © 2015 Juan José Aguililla. All rights reserved.
- !
- ! 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.
- !-->
-
-<project
-    xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>sabina</groupId>
-    <artifactId>sabina</artifactId>
-    <version>1.0.0</version>
-
-    <name>Sabina benchmark project</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-
-        <maven.compiler.source>${java.specification.version}</maven.compiler.source>
-        <maven.compiler.target>${java.specification.version}</maven.compiler.target>
-        <maven.compiler.debug>false</maven.compiler.debug>
-
-        <db.host>localhost</db.host>
-
-        <sabina-version>1.3.5</sabina-version>
-    </properties>
-
-    <repositories>
-        <repository>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <id>central</id>
-            <name>bintray</name>
-            <url>http://jcenter.bintray.com</url>
-        </repository>
-    </repositories>
-    <pluginRepositories>
-        <pluginRepository>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <id>central</id>
-            <name>bintray-plugins</name>
-            <url>http://jcenter.bintray.com</url>
-        </pluginRepository>
-    </pluginRepositories>
-
-    <dependencies>
-        <dependency>
-            <groupId>sabina</groupId>
-            <artifactId>http</artifactId>
-            <version>${sabina-version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>javax.servlet-api</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>sabina</groupId>
-            <artifactId>extra</artifactId>
-            <version>${sabina-version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.spec.javax.servlet</groupId>
-            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
-            <version>1.0.0.Final</version>
-        </dependency>
-        <dependency>
-            <groupId>com.mchange</groupId>
-            <artifactId>c3p0</artifactId>
-            <version>0.9.2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>5.1.38</version>
-        </dependency>
-        <dependency>
-            <groupId>org.mongodb</groupId>
-            <artifactId>mongo-java-driver</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>6.8.21</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>fluent-hc</artifactId>
-            <version>4.3.3</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
-
-        <plugins>
-            <plugin>
-                <artifactId>maven-shade-plugin</artifactId>
-                <version>2.3</version>
-                <configuration>
-                    <createDependencyReducedPom>false</createDependencyReducedPom>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.5</version>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <mainClass>sabina.benchmark.Application</mainClass>
-                        </manifest>
-                    </archive>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>2.6</version>
-                <configuration>
-                    <warName>ROOT</warName>
-                    <failOnMissingWebXml>false</failOnMissingWebXml>
-                    <packagingExcludes>
-                        WEB-INF/lib/jetty-*.jar,
-                        WEB-INF/lib/undertow-*.jar,
-                        WEB-INF/lib/freemarker-*.jar,
-                        WEB-INF/lib/rythm-*.jar,
-                        WEB-INF/lib/mysql-*.jar,
-                        WEB-INF/lib/xnio-*.jar,
-                        WEB-INF/lib/scribe-*.jar,
-                        WEB-INF/lib/jboss-*.jar
-                    </packagingExcludes>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>webapp</id>
-                        <goals>
-                            <goal>war</goal>
-                        </goals>
-                        <phase>package</phase>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 40
frameworks/Java/sabina/readme.md

@@ -1,40 +0,0 @@
-
-# Sabina Benchmarking Test
-
-This is the Sabina portion of a [benchmarking test suite](../) comparing a variety of web
-development platforms. The test utilizes Sabina routes, Gson for JSON serialization and a custom
-OSIV pattern created with Sabina filters.
-
-
-## Tests
-
-* [Sabina application](/src/main/java/sabina/benchmark/Application.java)
-
-
-## Infrastructure Software Versions
-
-* [Sabina 1.0](http://there4.co/)
-
-
-## Different test setups
-
-* Local environment with Sabina's built in embedded Jetty (port=8080, context=/)
- * Start application from [Application](/src/main/java/sabina/benchmark/Application.java)'s main method
-* Local environment with Sabina's built in embedded Undertow (port=8080, context=/)
- * Start application from [Application](/src/main/java/sabina/benchmark/Application.java)'s main method
-
-
-## Test URLs
-
-### JSON Encoding Test
-
-http://localhost:8080/json
-
-### Data-Store/Database Mapping Test
-
-http://localhost:8080/db?queries=5
-
-### Plain Text Test
-
-http://localhost:8080/plaintext
-

+ 0 - 4
frameworks/Java/sabina/setup.sh

@@ -1,4 +0,0 @@
-#!/bin/bash
-
-mvn clean package -DskipTests -Ddb.host=${DBHOST}
-$JAVA_HOME/bin/java -jar target/sabina-1.0.0.jar &

+ 0 - 7
frameworks/Java/sabina/source_code

@@ -1,7 +0,0 @@
-./sabina/src/main/java/sabina/benchmark/
-./sabina/src/main/java/sabina/benchmark/Application.java
-./sabina/src/main/java/sabina/benchmark/Message.java
-./sabina/src/main/java/sabina/benchmark/World.java
-./sabina/src/main/java/sabina/benchmark/Fortune.java
-./sabina/src/main/resources/fortunes.mustache
-./sabina/src/main/resources/server.properties

+ 0 - 159
frameworks/Java/sabina/src/main/java/sabina/benchmark/Application.java

@@ -1,159 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-import static java.lang.Integer.parseInt;
-import static java.lang.System.getProperty;
-import static sabina.content.JsonContent.toJson;
-import static sabina.view.MustacheView.renderMustache;
-
-import sabina.Request;
-import sabina.server.ServletApplication;
-
-import java.util.*;
-import java.util.Date;
-import javax.servlet.annotation.WebListener;
-
-@WebListener public final class Application extends sabina.Application {
-    static final String SETTINGS_RESOURCE = "/server.properties";
-    static final int DB_ROWS = 10000;
-
-    private static final String MESSAGE = "Hello, World!";
-    private static final String CONTENT_TYPE_TEXT = "text/plain";
-    private static final String CONTENT_TYPE_JSON = "application/json";
-    private static final String QUERIES_PARAM = "queries";
-
-    static Repository repository = loadRepository ();
-
-    static Properties loadConfiguration () {
-        try {
-            Properties settings = new Properties ();
-            settings.load (Application.class.getResourceAsStream (SETTINGS_RESOURCE));
-            return settings;
-        }
-        catch (Exception ex) {
-            throw new RuntimeException (ex);
-        }
-    }
-
-    static Repository loadRepository () {
-        switch (getProperty ("sabina.benchmark.repository", "mongodb")) {
-            case "mongodb":
-                return new MongoDbRepository (loadConfiguration ());
-            case "mysql":
-            default:
-                return new MySqlRepository (loadConfiguration ());
-        }
-    }
-
-    private Object getDb (Request it) {
-        try {
-            final World[] worlds = repository.getWorlds (getQueries (it), false);
-            it.response.type (CONTENT_TYPE_JSON);
-            return toJson (it.queryParams (QUERIES_PARAM) == null? worlds[0] : worlds);
-        }
-        catch (Exception e) {
-            e.printStackTrace ();
-            return e.getMessage ();
-        }
-    }
-
-    private Object getFortunes (Request it) {
-        try {
-            List<Fortune> fortunes = repository.getFortunes ();
-            fortunes.add (new Fortune (0, "Additional fortune added at request time."));
-            fortunes.sort ((a, b) -> a.message.compareTo (b.message));
-
-            it.response.type ("text/html; charset=utf-8");
-            return renderMustache ("fortunes.mustache", fortunes);
-        }
-        catch (Exception e) {
-            e.printStackTrace ();
-            return e.getMessage ();
-        }
-    }
-
-    private Object getUpdates (Request it) {
-        try {
-            World[] worlds = repository.getWorlds (getQueries (it), true);
-            it.response.type (CONTENT_TYPE_JSON);
-            return toJson (it.queryParams (QUERIES_PARAM) == null? worlds[0] : worlds);
-        }
-        catch (Exception e) {
-            e.printStackTrace ();
-            return e.getMessage ();
-        }
-    }
-
-    private int getQueries (final Request request) {
-        try {
-            String parameter = request.queryParams (QUERIES_PARAM);
-            if (parameter == null)
-                return 1;
-
-            int queries = parseInt (parameter);
-            if (queries < 1)
-                return 1;
-            if (queries > 500)
-                return 500;
-
-            return queries;
-        }
-        catch (NumberFormatException ex) {
-            return 1;
-        }
-    }
-
-    private Object getPlaintext (Request it) {
-        it.response.type (CONTENT_TYPE_TEXT);
-        return MESSAGE;
-    }
-
-    private Object getJson (Request it) {
-        it.response.type (CONTENT_TYPE_JSON);
-        return toJson (new Message ());
-    }
-
-    private void addCommonHeaders (Request it) {
-        it.header ("Server", "Undertow/1.1.2");
-        it.response.addDateHeader ("Date", new Date ().getTime ());
-    }
-
-    public Application () {
-        routes ();
-
-        Properties settings = loadConfiguration ();
-
-        bind (settings.getProperty ("web.host"));
-        port (parseInt (settings.getProperty ("web.port")));
-
-        start ();
-    }
-
-    public static void main (String[] args) {
-        new Application ();
-    }
-
-//    @Override
-    protected void routes () {
-        get ("/json", this::getJson);
-        get ("/db", this::getDb);
-        get ("/query", this::getDb);
-        get ("/fortune", this::getFortunes);
-        get ("/update", this::getUpdates);
-        get ("/plaintext", this::getPlaintext);
-        after (this::addCommonHeaders);
-    }
-}

+ 0 - 25
frameworks/Java/sabina/src/main/java/sabina/benchmark/Fortune.java

@@ -1,25 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-final class Fortune {
-    final int id;
-    final String message;
-
-    Fortune (final int id, final String message) {
-        this.id = id;
-        this.message = message;
-    }
-}

+ 0 - 19
frameworks/Java/sabina/src/main/java/sabina/benchmark/Message.java

@@ -1,19 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-final class Message {
-    final String message = "Hello, World!";
-}

+ 0 - 90
frameworks/Java/sabina/src/main/java/sabina/benchmark/MongoDbRepository.java

@@ -1,90 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-import static com.mongodb.client.model.Filters.eq;
-import static java.lang.Integer.parseInt;
-import static sabina.benchmark.Application.DB_ROWS;
-
-import java.util.*;
-import java.util.concurrent.ThreadLocalRandom;
-
-import com.mongodb.*;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoDatabase;
-import org.bson.Document;
-
-final class MongoDbRepository implements Repository {
-    private MongoCollection<Document> worldCollection;
-    private MongoCollection<Document> fortuneCollection;
-
-    MongoDbRepository (Properties settings) {
-        final int PORT = parseInt (settings.getProperty ("mongodb.port"));
-        final String HOST = settings.getProperty ("mongodb.host");
-        final String DATABASE = settings.getProperty ("mongodb.database");
-        final String WORLD = settings.getProperty ("mongodb.world.collection");
-        final String FORTUNE = settings.getProperty ("mongodb.fortune.collection");
-
-        MongoClient mongoClient = new MongoClient (HOST, PORT);
-        MongoDatabase db = mongoClient.getDatabase (DATABASE);
-        worldCollection = db.getCollection (WORLD);
-        fortuneCollection = db.getCollection (FORTUNE);
-    }
-
-    @Override public List<Fortune> getFortunes () {
-        List<Fortune> fortunes = new ArrayList<> ();
-
-        fortuneCollection.find ().forEach ((Block<Document>)doc ->
-            fortunes.add (
-                new Fortune (
-                    doc.get ("_id", Number.class).intValue (),
-                    (String)doc.get ("message")
-                )
-            )
-        );
-
-        return fortunes;
-    }
-
-    @Override public World[] getWorlds (int queries, boolean update) {
-        final World[] worlds = new World[queries];
-        final Random random = ThreadLocalRandom.current ();
-
-        for (int ii = 0; ii < queries; ii++) {
-            int id = random.nextInt (DB_ROWS) + 1;
-            worlds[ii] = update? updateWorld (id, random.nextInt (DB_ROWS) + 1) : findWorld (id);
-        }
-
-        return worlds;
-    }
-
-    private World findWorld (int id) {
-        return createWorld (worldCollection.find(eq ("_id", id)).first ());
-    }
-
-    private World createWorld (Document world) {
-        return new World (
-            world.get ("_id", Number.class).intValue (),
-            world.get ("randomNumber", Number.class).intValue ()
-        );
-    }
-
-    public World updateWorld (int id, int random) {
-        Document newWorld = new Document ("_id", id).append ("randomNumber", random);
-        worldCollection.replaceOne (eq ("_id", id), newWorld);
-
-        return new World (id, random);
-    }
-}

+ 0 - 139
frameworks/Java/sabina/src/main/java/sabina/benchmark/MySqlRepository.java

@@ -1,139 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-import static java.lang.System.getProperty;
-import static sabina.benchmark.Application.DB_ROWS;
-
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-
-import javax.sql.DataSource;
-
-import com.mchange.v2.c3p0.ComboPooledDataSource;
-
-final class MySqlRepository implements Repository {
-    private static final boolean AUTOCOMMIT = getProperty ("sabina.benchmark.autocommit") != null;
-    private static final String SELECT_WORLD = "select * from world where id = ?";
-    private static final String UPDATE_WORLD = "update world set randomNumber = ? where id = ?";
-    private static final String SELECT_FORTUNES = "select * from fortune";
-
-    private final DataSource DATA_SOURCE;
-
-    MySqlRepository (Properties settings) {
-        final String jdbcUrl = settings.getProperty ("mysql.uri");
-        DATA_SOURCE = createSessionFactory (jdbcUrl);
-    }
-
-    private DataSource createSessionFactory (String jdbcUrl) {
-        try {
-            ComboPooledDataSource dataSource = new ComboPooledDataSource ();
-            dataSource.setMinPoolSize (32);
-            dataSource.setMaxPoolSize (256);
-            dataSource.setCheckoutTimeout (1800);
-            dataSource.setMaxStatements (50);
-            dataSource.setJdbcUrl (jdbcUrl);
-            return dataSource;
-        }
-        catch (Exception ex) {
-            throw new RuntimeException (ex);
-        }
-    }
-
-    private void commitUpdate (Connection con, PreparedStatement stmtUpdate)
-        throws SQLException {
-        int count = 0;
-        boolean retrying;
-
-        do {
-            try {
-                stmtUpdate.executeBatch ();
-                retrying = false;
-            }
-            catch (BatchUpdateException e) {
-                retrying = true;
-            }
-        }
-        while (count++ < 10 && retrying);
-
-        con.commit ();
-    }
-
-    private void updateWorld (World world, PreparedStatement stmtUpdate)
-        throws SQLException {
-        stmtUpdate.setInt (1, world.randomNumber);
-        stmtUpdate.setInt (2, world.id);
-
-        if (AUTOCOMMIT) {
-            stmtUpdate.executeUpdate ();
-        }
-        else {
-            stmtUpdate.addBatch ();
-        }
-    }
-
-    @Override public List<Fortune> getFortunes () {
-        final List<Fortune> fortunes = new ArrayList<> ();
-
-        try (final Connection con = DATA_SOURCE.getConnection ()) {
-            final ResultSet rs = con.prepareStatement (SELECT_FORTUNES).executeQuery ();
-            while (rs.next ())
-                fortunes.add (new Fortune (rs.getInt (1), rs.getString (2)));
-        }
-        catch (SQLException e) {
-            e.printStackTrace ();
-        }
-
-        return fortunes;
-    }
-
-    @Override public World[] getWorlds (int queries, boolean update) {
-        final World[] worlds = new World[queries];
-
-        try (final Connection con = DATA_SOURCE.getConnection ()) {
-            if (update)
-                con.setAutoCommit (AUTOCOMMIT);
-
-            final Random random = ThreadLocalRandom.current ();
-            final PreparedStatement stmtSelect = con.prepareStatement (SELECT_WORLD);
-            final PreparedStatement stmtUpdate = update? con.prepareStatement (UPDATE_WORLD) : null;
-
-            for (int ii = 0; ii < queries; ii++) {
-                stmtSelect.setInt (1, random.nextInt (DB_ROWS) + 1);
-                final ResultSet rs = stmtSelect.executeQuery ();
-                while (rs.next ()) {
-                    worlds[ii] = new World (rs.getInt (1), rs.getInt (2));
-
-                    if (update) {
-                        worlds[ii] = new World (worlds[ii].id, random.nextInt (DB_ROWS) + 1);
-                        updateWorld (worlds[ii], stmtUpdate);
-                    }
-                }
-            }
-
-            if (update && !AUTOCOMMIT)
-                commitUpdate (con, stmtUpdate);
-        }
-        catch (SQLException e) {
-            e.printStackTrace ();
-        }
-
-        return worlds;
-    }
-}

+ 0 - 22
frameworks/Java/sabina/src/main/java/sabina/benchmark/Repository.java

@@ -1,22 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-import java.util.List;
-
-interface Repository {
-    List<Fortune> getFortunes ();
-    World[] getWorlds (int queries, boolean update);
-}

+ 0 - 24
frameworks/Java/sabina/src/main/java/sabina/benchmark/World.java

@@ -1,24 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-final class World {
-    final int id, randomNumber;
-
-    World (final int id, final int randomNumber) {
-        this.id = id;
-        this.randomNumber = randomNumber;
-    }
-}

+ 0 - 20
frameworks/Java/sabina/src/main/resources/fortunes.mustache

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

+ 0 - 42
frameworks/Java/sabina/src/main/resources/server.properties

@@ -1,42 +0,0 @@
-#
-# Copyright \u00A9 2015 Juan Jos\u00E9 Aguililla. All rights reserved.
-#
-# 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.
-#
-
-web.port=5050
-web.host=0.0.0.0
-
-mongodb.host=${db.host}
-mongodb.port=27017
-mongodb.database=hello_world
-mongodb.world.collection=world
-mongodb.fortune.collection=fortune
-
-mysql.uri=jdbc:mysql://${db.host}:3306/hello_world?\
-user=benchmarkdbuser&\
-password=benchmarkdbpass&\
-jdbcCompliantTruncation=false&\
-elideSetAutoCommits=true&\
-useLocalSessionState=true&\
-cachePrepStmts=true&\
-cacheCallableStmts=true&\
-alwaysSendSetIsolation=false&\
-prepStmtCacheSize=4096&\
-cacheServerConfiguration=true&\
-prepStmtCacheSqlLimit=2048&\
-zeroDateTimeBehavior=convertToNull&\
-traceProtocol=false&\
-useUnbufferedInput=false&\
-useReadAheadInput=false&\
-maintainTimeStats=false&\
-useServerPrepStmts&\
-cacheRSMetadata=true

+ 0 - 197
frameworks/Java/sabina/src/test/java/sabina/benchmark/ApplicationTest.java

@@ -1,197 +0,0 @@
-/*
- * Copyright © 2015 Juan José Aguililla. All rights reserved.
- *
- * 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 sabina.benchmark;
-
-import static org.apache.http.client.fluent.Request.Get;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-
-import com.google.gson.Gson;
-import org.apache.http.HttpResponse;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * <p>TODO
- * Write article about stress test with TestNG (scenarios, combine different tests in scenarios,
- * adding random pauses...)
- */
-@Test public final class ApplicationTest {
-    private static final String ENDPOINT = "http://localhost:5050";
-    private static final Gson GSON = new Gson ();
-
-    private static Application application;
-
-    @BeforeClass public void setup () throws IOException {
-        application = new Application ();
-    }
-
-    @AfterClass public void close () {
-        application.stop ();
-    }
-
-    public void json () throws IOException {
-        HttpResponse response = get (ENDPOINT + "/json");
-        String content = getContent (response);
-
-        checkResponse (response, content, "application/json");
-        assert "Hello, World!".equals (GSON.fromJson (content, Map.class).get ("message"));
-    }
-
-    public void plaintext () throws IOException {
-        HttpResponse response = get (ENDPOINT + "/plaintext");
-        String content = getContent (response);
-
-        checkResponse (response, content, "text/plain");
-        assert "Hello, World!".equals (content);
-    }
-
-    public void no_query_parameter () throws IOException {
-        HttpResponse response = get (ENDPOINT + "/db");
-        String content = getContent (response);
-
-        checkResponse (response, content, "application/json");
-        Map<?, ?> resultsMap = GSON.fromJson (content, Map.class);
-        assert resultsMap.containsKey ("id") && resultsMap.containsKey ("randomNumber");
-    }
-
-    public void empty_query_parameter () throws IOException {
-        checkDbRequest ("/query?queries", 1);
-    }
-
-    public void text_query_parameter () throws IOException {
-        checkDbRequest ("/query?queries=text", 1);
-    }
-
-    public void zero_queries () throws IOException {
-        checkDbRequest ("/query?queries=0", 1);
-    }
-
-    public void one_thousand_queries () throws IOException {
-        checkDbRequest ("/query?queries=1000", 500);
-    }
-
-    public void one_query () throws IOException {
-        checkDbRequest ("/query?queries=1", 1);
-    }
-
-    public void ten_queries () throws IOException {
-        checkDbRequest ("/query?queries=10", 10);
-    }
-
-    public void one_hundred_queries () throws IOException {
-        checkDbRequest ("/query?queries=100", 100);
-    }
-
-    public void five_hundred_queries () throws IOException {
-        checkDbRequest ("/query?queries=500", 500);
-    }
-
-    public void five_hundred_and_one_queries () throws IOException {
-        checkDbRequest ("/query?queries=501", 500);
-    }
-
-    public void fortunes () throws IOException {
-        HttpResponse response = get (ENDPOINT + "/fortune");
-        String content = getContent (response);
-        String contentType = response.getEntity ().getContentType ().getValue ();
-
-        assert response.getFirstHeader ("Server") != null;
-        assert response.getFirstHeader ("Date") != null;
-        assert content.contains ("&lt;script&gt;alert(&quot;This should not be displayed");
-        assert content.contains ("フレームワークのベンチマーク");
-        assert "text/html; charset=utf-8".equals (contentType.toLowerCase ());
-    }
-
-    public void no_updates_parameter () throws IOException {
-        HttpResponse response = get (ENDPOINT + "/update");
-        String content = getContent (response);
-
-        checkResponse (response, content, "application/json");
-        Map<?, ?> resultsMap = GSON.fromJson (content, Map.class);
-        assert resultsMap.containsKey ("id") && resultsMap.containsKey ("randomNumber");
-    }
-
-    public void empty_updates_parameter () throws IOException {
-        checkDbRequest ("/update?queries", 1);
-    }
-
-    public void text_updates_parameter () throws IOException {
-        checkDbRequest ("/update?queries=text", 1);
-    }
-
-    public void zero_updates () throws IOException {
-        checkDbRequest ("/update?queries=0", 1);
-    }
-
-    public void one_thousand_updates () throws IOException {
-        checkDbRequest ("/update?queries=1000", 500);
-    }
-
-    public void one_update () throws IOException {
-        checkDbRequest ("/update?queries=1", 1);
-    }
-
-    public void ten_updates () throws IOException {
-        checkDbRequest ("/update?queries=10", 10);
-    }
-
-    public void one_hundred_updates () throws IOException {
-        checkDbRequest ("/update?queries=100", 100);
-    }
-
-    public void five_hundred_updates () throws IOException {
-        checkDbRequest ("/update?queries=500", 500);
-    }
-
-    private void checkDbRequest (String path, int itemsCount) throws IOException {
-        HttpResponse response = get (ENDPOINT + path);
-        String content = getContent (response);
-
-        checkResponse (response, content, "application/json");
-        checkResultItems (content, itemsCount);
-    }
-
-    private HttpResponse get (String uri) throws IOException {
-        return Get (uri).execute ().returnResponse ();
-    }
-
-    private String getContent (HttpResponse response) throws IOException {
-        InputStream in = response.getEntity ().getContent ();
-        return new Scanner (in).useDelimiter ("\\A").next ();
-    }
-
-    private void checkResponse (HttpResponse res, String content, String contentType) {
-        assert res.getFirstHeader ("Server") != null;
-        assert res.getFirstHeader ("Date") != null;
-        assert content.length () == res.getEntity ().getContentLength ();
-        assert res.getEntity ().getContentType ().getValue ().contains (contentType);
-    }
-
-    private void checkResultItems (String result, int size) {
-        List<?> resultsList = GSON.fromJson (result, List.class);
-        assert size == resultsList.size ();
-
-        for (int ii = 0; ii < size; ii++) {
-            Map<?, ?> r = (Map)resultsList.get (ii);
-            assert r.containsKey ("id") && r.containsKey ("randomNumber");
-        }
-    }
-}

+ 0 - 5
frameworks/Java/sabina/undertow-mongodb.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-fw_depends java maven
-
-./setup.sh -Dsabina.backend=undertow -Dsabina.benchmark.repository=mongodb

+ 0 - 5
frameworks/Java/sabina/undertow.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-fw_depends java maven
-
-./setup.sh -Dsabina.backend=undertow -Dsabina.benchmark.repository=mysql