Browse Source

Merge branch 'round-14' of https://github.com/TechEmpower/FrameworkBenchmarks into round-14

Keith Newman 9 years ago
parent
commit
31cf2e9310

+ 1 - 0
frameworks/Java/restexpress/benchmark_config.json

@@ -4,6 +4,7 @@
     "default": {
       "setup_file": "setup",
       "json_url": "/restexpress/json",
+      "plaintext_url": "/restexpress/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",

+ 1 - 1
frameworks/Java/restexpress/config/dev/environment.properties

@@ -11,4 +11,4 @@ mysql.uri = jdbc:mysql://localhost:3306/hello_world
 # MySQL useConfigs value, See section "21.3.5.1.1. Properties Files for the useConfigs Option" of:
 # http://dev.mysql.com/doc/refman/5.6/en/connector-j-reference-configuration-properties.html
 # Empty is a valid selection.
-mysql.useConfigs = maxPerformance
+mysql.useConfigs = maxPerformance

+ 3 - 0
frameworks/Java/restexpress/src/main/java/hello/Main.java

@@ -24,6 +24,9 @@ public class Main
 		server.uri("/restexpress/json", config.getJsonController())
 			.action("helloWorld", HttpMethod.GET);
 
+                server.uri("/restexpress/plaintext", config.getPlaintextController())
+                        .action("helloWorld", HttpMethod.GET);
+
 		server.uri("/restexpress/mysql", config.getMysqlController())
 			.method(HttpMethod.GET);
 

+ 8 - 0
frameworks/Java/restexpress/src/main/java/hello/config/Configuration.java

@@ -4,6 +4,7 @@ import hello.controller.JsonController;
 import hello.controller.MongodbController;
 import hello.controller.MysqlController;
 import hello.controller.persistence.WorldsMongodbRepository;
+import hello.controller.PlaintextController;
 
 import java.util.Properties;
 
@@ -30,6 +31,7 @@ extends Environment
 	private JsonController jsonController;
 	private MysqlController mysqlController;
 	private MongodbController mongodbController;
+        private PlaintextController plaintextController;
 
 	@Override
 	protected void fillValues(Properties p)
@@ -46,6 +48,7 @@ extends Environment
 	private void initialize(MysqlConfig mysqlSettings, MongoConfig mongo)
 	{
 		jsonController = new JsonController();
+                plaintextController = new PlaintextController();
 		mysqlController = new MysqlController(mysqlSettings.getDataSource());
         WorldsMongodbRepository worldMongodbRepository = new WorldsMongodbRepository(mongo.getClient(), mongo.getDbName());
         worldMongodbRepository.setIdentifierAdapter(new IdentiferAdapter<Long>()
@@ -93,4 +96,9 @@ extends Environment
 	{
 		return mongodbController;
 	}
+
+        public PlaintextController getPlaintextController()
+        {
+            return plaintextController;
+        }
 }

+ 14 - 0
frameworks/Java/restexpress/src/main/java/hello/controller/PlaintextController.java

@@ -0,0 +1,14 @@
+package hello.controller;
+
+import com.strategicgains.restexpress.Request;
+import com.strategicgains.restexpress.Response;
+
+public class PlaintextController
+{
+	private static final String MESSAGE = "Hello, World!";
+
+	public String helloWorld(Request request, Response response)
+	{
+		return MESSAGE;
+	}
+}

+ 1 - 0
frameworks/Java/undertow-jersey-c3p0/benchmark_config.json

@@ -7,6 +7,7 @@
       "db_url": "/db?single=true",
       "query_url": "/db?queries=",
       "fortune_url": "/fortunes",
+      "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Micro",

+ 1 - 1
frameworks/Java/undertow-jersey-c3p0/src/main/java/hello/JerseyWebServer.java

@@ -35,7 +35,7 @@ public class JerseyWebServer
     final int dbPort = Integer.parseInt(cmd.getOptionValue("dbport", "3306"));
 
     ResourceConfig config = new ResourceConfig(DbResource.class,
-        FortunesResource.class, JsonResource.class,
+        FortunesResource.class, JsonResource.class, PlaintextResource.class,
         JsonMessageBodyWriter.class, ServerResponseFilter.class, RequestExceptionMapper.class);
 
     config.setProperties(new HashMap<String, Object>()

+ 17 - 0
frameworks/Java/undertow-jersey-c3p0/src/main/java/hello/PlaintextResource.java

@@ -0,0 +1,17 @@
+package hello;
+
+import javax.inject.*;
+import javax.ws.rs.*;
+import java.util.*;
+
+@Singleton
+@Path("/plaintext")
+public class PlaintextResource
+{
+  @GET
+  @Produces("text/plain")
+  public String plaintext()
+  {
+    return "Hello, World!";
+  }
+}