spring-projects/spring-security — pull request #143 by chrisisbeef (2014-10-24 18:48:33+00:00)
Title: Integrating Cargo + Contrast Agent

Robert -

I have successfully ran the contrast agent during integration testing on the helloworld-jc sample application with this configuration. There are obviously still some things that would need to happen to fully integrate this, but the result is Cargo running a forked tomcat (as opposed to the tomcat plugin running an embedded server) which is instrumented with the contrast agent.

The configuration for the agent and the agent itself would currently just be stored someplace on the filesystem (preferably in `$HOME/.contrast`) - this will keep account credentials out of source control.

Improvements that could be made:
1. The agent could be pulled down using the REST API (1) during the build
2. The port should be dynamically selected, like in the tomcat plugin
3. The context root for geb is currently hard-coded (as well as the port) - I'm not 100% sure how to get at this information, we should be able to get it from the deployable.

Let me know what you think.

![image](https://cloud.githubusercontent.com/assets/622346/4774445/6234cf78-5bad-11e4-84bf-af6674f9d17c.png)

![image](https://cloud.githubusercontent.com/assets/622346/4774450/6ceb8e66-5bad-11e4-843f-09cb751b7e1b.png)

```
Tomcat 7.x starting...
Deploying [/Users/cschmidt/IdeaProjects/spring-security/samples/helloworld-jc/build/libs/sample-4.0.0.CI-SNAPSHOT.war] to [/var/folders/nk/g_40jzwd6pbfdty4s394pmq80000gn/T/cargo/conf/webapps]...
[ContrastLauncher] Fri Oct 24 12:26:34 MDT 2014 Loading configuration from file: /Users/cschmidt/.contrast/spring-security.contrast.config.xmlobjc[71873]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

[ContrastLauncher] Fri Oct 24 12:26:34 MDT 2014 Using /var/folders/nk/g_40jzwd6pbfdty4s394pmq80000gn/T/cargo/conf/temp/.contrast/agents for storage. To override, use -Dcontrast.dir.
[ContrastLauncher] Fri Oct 24 12:26:34 MDT 2014 Asking if updates are available...
[ContrastLauncher] Fri Oct 24 12:26:35 MDT 2014 Latest version is 3.1.0
[ContrastLauncher] Fri Oct 24 12:26:35 MDT 2014 Downloading latest agent from TeamServer...
[ContrastLauncher] Fri Oct 24 12:26:41 MDT 2014 Using /var/folders/nk/g_40jzwd6pbfdty4s394pmq80000gn/T/cargo/conf/temp/.contrast/agents for storage. To override, use -Dcontrast.dir.
[ContrastLauncher] Fri Oct 24 12:26:41 MDT 2014 Saving agent (4122267 bytes) to /var/folders/nk/g_40jzwd6pbfdty4s394pmq80000gn/T/cargo/conf/temp/.contrast/agents under the name contrast-3.1.0.jar
[ContrastLauncher] Fri Oct 24 12:26:41 MDT 2014 Downloaded latest agent version 3.1.0 from TeamServer
[ContrastLauncher] Fri Oct 24 12:26:41 MDT 2014 Launching Contrast agent: 3.1.0
[ContrastEngine] Fri Oct 24 12:26:41 MDT 2014 Starting Contrast (build 3.1.0-r15316) Pat. 8,458,789 B2
[ContrastEngine] Fri Oct 24 12:26:41 MDT 2014 Using /Users/cschmidt/.contrast/ for storage. To override, use -Dcontrast.dir.
[ContrastEngine] Fri Oct 24 12:26:41 MDT 2014 Not using bootstrap performance enhancements! Speed powerup disabled.
[ContrastEngine] Fri Oct 24 12:26:41 MDT 2014 Loading configuration from file: /Users/cschmidt/.contrast/spring-security.contrast.config.xml
[ContrastEngine] Fri Oct 24 12:26:42 MDT 2014 Using pre-packaged policy from engine
[ContrastEngine] Fri Oct 24 12:26:43 MDT 2014 Initializing Contrast. This could take a few minutes...
[ContrastEngine] Fri Oct 24 12:26:57 MDT 2014 Starting JVM...
```