From 95efb0bd0b7111bc525929d2e67602861c3b0841 Mon Sep 17 00:00:00 2001 From: Greg Wester Date: Sun, 3 Jun 2012 20:44:08 -0700 Subject: [PATCH] initial --- .gitignore | 3 + pom.xml | 231 ++++++++++++++++++ .../com/qualityfoundry/IndexResource.java | 63 +++++ src/main/java/com/qualityfoundry/WebApp.java | 22 ++ .../java/com/qualityfoundry/WebAppConfig.java | 7 + .../api/TestResultsResource.java | 40 +++ src/main/resources/config/config.json | 16 ++ 7 files changed, 382 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/qualityfoundry/IndexResource.java create mode 100644 src/main/java/com/qualityfoundry/WebApp.java create mode 100644 src/main/java/com/qualityfoundry/WebAppConfig.java create mode 100644 src/main/java/com/qualityfoundry/api/TestResultsResource.java create mode 100644 src/main/resources/config/config.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2594419 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.* +target + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7e0451e --- /dev/null +++ b/pom.xml @@ -0,0 +1,231 @@ + + 4.0.0 + com.salesforce + QualityFoundry + 0.0.1-SNAPSHOT + jar + A test runner for the Salesforce platform. + + http://salesforce.com + + scm:git:git@github.com:forcedotcom/QualityFoundry.git + scm:git:git@github.com:forcedotcom/QualityFoundry.git + http://github.com/forcedotcom/TempStore + + + + gwester + Greg Wester + gwester@salesforce.com + + + bbirman + Brianna Birman + bbirman@contractor.salesforce.com + + + + + 2.2.1 + + + UTF-8 + + + + + + BSD, Version 3.0 + http://www.opensource.org/licenses/BSD-3-Clause + repo + + + + salesforce.com + http://salesforce.com + + + + + + + com.yammer.dropwizard + dropwizard-core + 0.4.0 + + + com.yammer.dropwizard + dropwizard-views + 0.4.0 + + + + + com.basho.riak + riak-client + 1.0.5 + + + + com.ning + compress-lzf + 0.9.4 + + + + joda-time + joda-time + 2.1 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.0.2 + + + com.fasterxml.jackson.core + jackson-core + 2.0.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.0.2 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-smile + 2.0.2 + + + + com.ning + async-http-client + 1.7.5 + + + + org.apache.httpcomponents + httpclient + 4.2 + + + + junit + junit + 4.8.2 + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 1.4 + + true + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + com.qualityfoundry.WebApp + + + + + + + + + + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-release-plugin + 2.1 + + forked-path + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.6.1 + + 1.5 + 1.5 + UTF-8 + 512m + + http://docs.oracle.com/javase/6/docs/api/ + + + + + attach-javadocs + verify + + jar + + + + + + + + + + oracleReleases + Oracle Released Java Packages + http://download.oracle.com/maven + default + + + project.local + local + legacy + file:${project.basedir}/lib + + + \ No newline at end of file diff --git a/src/main/java/com/qualityfoundry/IndexResource.java b/src/main/java/com/qualityfoundry/IndexResource.java new file mode 100644 index 0000000..f907f07 --- /dev/null +++ b/src/main/java/com/qualityfoundry/IndexResource.java @@ -0,0 +1,63 @@ +package com.qualityfoundry; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * Resource that handles access to both index file(s) (root page), + * and FreeMarker-enhanced actual pages. + * + * @author tatu + */ +@Produces(MediaType.TEXT_HTML) +@Path("") +public class IndexResource { + + private final byte[] _indexContents; + private final byte[] _faviconContents; + + public IndexResource(byte[] index, byte[] favicon) { + _indexContents = index; + _faviconContents = favicon; + } + + @GET + @Path("/index.html") + public byte[] indexHtml() { + return index(); + } + + @GET + @Path("/") + public byte[] std() { + return index(); + } + + @GET + @Path("/index.htm") + public byte[] indexHtm() { + return index(); + } + + @GET + @Path("/favicon.ico") + public byte[] getFavicon() { + return favicon(); + } + + /* + /////////////////////////////////////////////////////////////////////// + // Helper methods + /////////////////////////////////////////////////////////////////////// + */ + + private byte[] index() { + return _indexContents; + } + + private byte[] favicon() { + return _faviconContents; + } +} diff --git a/src/main/java/com/qualityfoundry/WebApp.java b/src/main/java/com/qualityfoundry/WebApp.java new file mode 100644 index 0000000..ec9d5b2 --- /dev/null +++ b/src/main/java/com/qualityfoundry/WebApp.java @@ -0,0 +1,22 @@ +package com.qualityfoundry; + +import com.yammer.dropwizard.Service; +import com.yammer.dropwizard.config.Environment; + +public class WebApp extends Service { + + + protected WebApp() { + super("QualityFoundry"); + } + + public static void main(String[] args) throws Exception { + new WebApp().run(args); + } + + @Override + protected void initialize(WebAppConfig arg0, Environment arg1) throws Exception { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/com/qualityfoundry/WebAppConfig.java b/src/main/java/com/qualityfoundry/WebAppConfig.java new file mode 100644 index 0000000..c61d15c --- /dev/null +++ b/src/main/java/com/qualityfoundry/WebAppConfig.java @@ -0,0 +1,7 @@ +package com.qualityfoundry; + +import com.yammer.dropwizard.config.Configuration; + +public class WebAppConfig extends Configuration { + +} diff --git a/src/main/java/com/qualityfoundry/api/TestResultsResource.java b/src/main/java/com/qualityfoundry/api/TestResultsResource.java new file mode 100644 index 0000000..73453ec --- /dev/null +++ b/src/main/java/com/qualityfoundry/api/TestResultsResource.java @@ -0,0 +1,40 @@ +package com.qualityfoundry.api; + +import java.io.InputStream; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import com.yammer.metrics.annotation.Timed; + +@Path("/results/") +public class TestResultsResource { + + @GET @Timed + @Produces(MediaType.APPLICATION_JSON) + @Path("{externalPath: .*}") + public Response getPrimary( + //@QueryParam("testRunId") String testRunId, + @PathParam("externalPath") String externalPath, + @Context HttpHeaders headers, + InputStream dataIn) + { + return handleGet("GET", externalPath, headers, + dataIn, System.currentTimeMillis()); + } + + private Response handleGet(String method, String externalPath, + HttpHeaders headers, InputStream dataIn, long currentTimeMillis) { + // TODO Auto-generated method stub + return null; + } + + +} diff --git a/src/main/resources/config/config.json b/src/main/resources/config/config.json new file mode 100644 index 0000000..1f50230 --- /dev/null +++ b/src/main/resources/config/config.json @@ -0,0 +1,16 @@ +{ + /* First Servlet (HTTP) configuration + * + * NOTE: can override with sys params: "-Ddw.http.port=8080" etc + */ + + "http" : { + "port" : 9090 + ,"adminPort" : 9091 + ,"gzip" : { // No automated gzip; we'll handle it explicitly as need be + "enabled" : false + } + // default is 200 seconds, lower a bit, don't want to be a connection hog... :) + ,"maxIdleTime" : "30 seconds" + } +} \ No newline at end of file