Browse Source

initial commit of javalin framework with two tests - json and plaintext (#4110)

* initial commit of javalin framework with two tests - json and plaintext

* removed unncecessary gradle files and adjusted the dockerfile and build.gradle to add a gradle build step prior to running

* removed commented-out line from dockerfile

* aded javalin to travis.yml file

* Delete gradle-wrapper.properties
jenriquez-techempower 7 years ago
parent
commit
56f40f8c61

+ 1 - 0
.travis.yml

@@ -50,6 +50,7 @@ env:
      - "TESTDIR=Java/grizzly"
      - "TESTDIR=Java/grizzly-jersey"
      - "TESTDIR=Java/jawn"
+     - "TESTDIR=Java/javalin"
      - "TESTDIR=Java/jetty"
      - "TESTDIR=Java/jlhttp"
      - "TESTDIR=Java/jooby"

+ 17 - 0
frameworks/Java/javalin/README.md

@@ -0,0 +1,17 @@
+# Javalin framework benchmarking test
+This is an implementation of [javalin](https://javalin.io/)
+as a portion of a [benchmarking test suite](../) comparing a variety 
+of web development platforms.
+
+
+## Running the application
+Have [gradle](http://gradle.org) installed, then:
+```
+gradle run
+```
+
+## json test
+Point your browser at `localhost:8080/json`
+
+## plaintext test
+Point your browser at `localhost:8080/plaintext`

+ 25 - 0
frameworks/Java/javalin/benchmark_config.json

@@ -0,0 +1,25 @@
+{
+  "framework": "javalin",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Stripped",
+        "classification": "Platform",
+        "database": "None",
+        "framework": "None",
+        "language": "Java",
+        "flavor": "None",
+        "orm": "Raw",
+        "platform": "Servlet",
+        "webserver": "None",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "javalin",
+        "versus": ""
+      }
+    }
+  ]
+}

+ 31 - 0
frameworks/Java/javalin/build.gradle

@@ -0,0 +1,31 @@
+apply plugin: 'java'
+apply plugin: 'application'
+
+group 'com.lostsys.test.javalin'
+version '1.0-SNAPSHOT'
+
+mainClassName = 'com.lostsys.test.javalin.Bench'
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    compile 'io.javalin:javalin:2.3.0'
+    compile "com.fasterxml.jackson.core:jackson-databind:2.9.6"
+    compile "org.slf4j:slf4j-simple:1.7.25"
+}
+
+//create a single Jar with all dependencies
+task fatJar(type: Jar) {
+    manifest {
+        attributes(
+                "Main-Class": mainClassName
+        )
+    }
+    baseName = project.name + '-all'
+    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
+    with jar
+}

+ 15 - 0
frameworks/Java/javalin/javalin.dockerfile

@@ -0,0 +1,15 @@
+FROM gradle:4.7.0-jdk8
+USER root
+WORKDIR /javalin
+COPY build.gradle build.gradle
+COPY src src
+RUN gradle --refresh-dependencies clean fatJar
+
+CMD java \
+    -Xmx2G \
+    -Xms2G \
+    -server \
+    -XX:+UseNUMA \
+    -XX:+UseParallelGC \
+    -XX:+AggressiveOpts \
+    -jar build/libs/javalin-all-1.0-SNAPSHOT.jar env=prod

+ 2 - 0
frameworks/Java/javalin/settings.gradle

@@ -0,0 +1,2 @@
+rootProject.name = 'javalin'
+

+ 19 - 0
frameworks/Java/javalin/src/main/java/com/lostsys/test/javalin/Bench.java

@@ -0,0 +1,19 @@
+package com.lostsys.test.javalin;
+
+import io.javalin.Javalin;
+
+import java.util.Collections;
+
+public class Bench {
+
+    public static void main(String[] args) {
+
+        Javalin app = Javalin.create().start(8080);
+        app.get("/plaintext", ctx -> ctx.result("Hello, World!"));
+
+        app.get("/json", ctx -> {
+            ctx.json(Collections.singletonMap("message", "Hello, World!"));
+        });
+
+    }
+}