forked from gwestersf/QualityFoundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Greg Wester
committed
Jun 4, 2012
0 parents
commit 95efb0b
Showing
7 changed files
with
382 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.* | ||
target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.salesforce</groupId> | ||
<artifactId>QualityFoundry</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<description>A test runner for the Salesforce platform. | ||
</description> | ||
<url>http://salesforce.com</url> | ||
<scm> | ||
<connection>scm:git:[email protected]:forcedotcom/QualityFoundry.git</connection> | ||
<developerConnection>scm:git:[email protected]:forcedotcom/QualityFoundry.git</developerConnection> | ||
<url>http://github.com/forcedotcom/TempStore</url> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>gwester</id> | ||
<name>Greg Wester</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
<developer> | ||
<id>bbirman</id> | ||
<name>Brianna Birman</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<prerequisites> | ||
<maven>2.2.1</maven> | ||
</prerequisites> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<!-- Licensing --> | ||
<licenses> | ||
<license> | ||
<name>BSD, Version 3.0</name> | ||
<url>http://www.opensource.org/licenses/BSD-3-Clause</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<organization> | ||
<name>salesforce.com</name> | ||
<url>http://salesforce.com</url> | ||
</organization> | ||
|
||
<dependencies> | ||
<!-- Core service dependencies: DropWizard and its Friends --> | ||
|
||
<dependency> | ||
<groupId>com.yammer.dropwizard</groupId> | ||
<artifactId>dropwizard-core</artifactId> | ||
<version>0.4.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.yammer.dropwizard</groupId> | ||
<artifactId>dropwizard-views</artifactId> | ||
<version>0.4.0</version> | ||
</dependency> | ||
|
||
<!-- Storage with Riak --> | ||
<dependency> | ||
<groupId>com.basho.riak</groupId> | ||
<artifactId>riak-client</artifactId> | ||
<version>1.0.5</version> | ||
</dependency> | ||
<!-- LZF for compressing files --> | ||
<dependency> | ||
<groupId>com.ning</groupId> | ||
<artifactId>compress-lzf</artifactId> | ||
<version>0.9.4</version> | ||
</dependency> | ||
<!-- Joda for Date calculations --> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
<version>2.1</version> | ||
</dependency> | ||
<!-- And Jackson 2.0 for 'custom' JSON, Smile needs --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>2.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>2.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.0.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.dataformat</groupId> | ||
<artifactId>jackson-dataformat-smile</artifactId> | ||
<version>2.0.2</version> | ||
</dependency> | ||
<!-- Async-http-client for HTTP access --> | ||
<dependency> | ||
<groupId>com.ning</groupId> | ||
<artifactId>async-http-client</artifactId> | ||
<version>1.7.5</version> | ||
</dependency> | ||
<!-- and actually also Apache HttpCore/Client, since it is much easier | ||
to use for actual blocking I/O | ||
--> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.2</version> | ||
</dependency> | ||
<!-- We'll use junit to run our tests --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.8.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<!-- DropWizard suggest doing "fat JARs", so let's: --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>1.4</version> | ||
<configuration> | ||
<createDependencyReducedPom>true</createDependencyReducedPom> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/*.SF</exclude> | ||
<exclude>META-INF/*.DSA</exclude> | ||
<exclude>META-INF/*.RSA</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>com.qualityfoundry.WebApp</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- other settings are pretty vanilla... --> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-release-plugin</artifactId> | ||
<version>2.1</version> | ||
<configuration> | ||
<mavenExecutorId>forked-path</mavenExecutorId> | ||
</configuration> | ||
</plugin> | ||
<plugin><!-- plug-in to attach source bundle in repo --> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>2.1.2</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.6.1</version> | ||
<configuration> | ||
<source>1.5</source> | ||
<target>1.5</target> | ||
<encoding>UTF-8</encoding> | ||
<maxmemory>512m</maxmemory> | ||
<links> | ||
<link>http://docs.oracle.com/javase/6/docs/api/</link> | ||
</links> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<!-- Ugh. Oracle can't push to central repo? --> | ||
<repositories> | ||
<repository> | ||
<id>oracleReleases</id> | ||
<name>Oracle Released Java Packages</name> | ||
<url>http://download.oracle.com/maven</url> | ||
<layout>default</layout> | ||
</repository> | ||
<repository> | ||
<id>project.local</id> | ||
<name>local</name> | ||
<layout>legacy</layout> | ||
<url>file:${project.basedir}/lib</url> | ||
</repository> | ||
</repositories> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.qualityfoundry; | ||
|
||
import com.yammer.dropwizard.Service; | ||
import com.yammer.dropwizard.config.Environment; | ||
|
||
public class WebApp extends Service<WebAppConfig> { | ||
|
||
|
||
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 | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.qualityfoundry; | ||
|
||
import com.yammer.dropwizard.config.Configuration; | ||
|
||
public class WebAppConfig extends Configuration { | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/qualityfoundry/api/TestResultsResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |