Bläddra i källkod

add plaintext test to java/restexpress (#2185)

Matthew Flickner 9 år sedan
förälder
incheckning
a16029a920

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