Friday, August 24, 2012

Maven Jacoco plugin, Standalone JVM, Jacoco report generation


Steps to generate coverage data

1. Add the below JVM line when starting up your java program
-javaagent:${project.deploy.path}/org.jacoco.agent-0.5.7.201204190339-runtime.jar=destfile=${project.jacoco.path}/jacoco/jacoco.exec,dumponexit=true

-javaagent:${project.deploy.path}/org.jacoco.agent-0.5.7.201204190339-runtime.jar
path to jacoco runtime jar which is needed to instrument(add probes) to all classes/jar files

destfile=${project.jacoco.path}/jacoco/jacoco.exec
file where the coverage data is stored.

dumponexit=true
other optional parameters used by Jacoco

2. Start the java program.

3. Run your integration tests thru the java program that has been instrumented by Jacoco.

4. Stop the  java program.
When the JVM exits, it will dump all the coverage data in destfile


When generating coverage report using maven-jacoco-plugin

1. copy coverage file (destfile) to Hudson/Jenkins view location. The Hudson/Jenkins view is the place where the jacoco report will be generated.
example: cp -f ${project.jacoco.path}/jacoco/jacoco.exec /test/view/myproject/target

2. copy all instrumented jars of java program to Jenkins view under the target/classes folder.  These jar files should be present in your java program's \lib folder
example: cp -rf /myproject/lib /test/view/myproject/target/classes

3. for line level coverage with sourcecode highlighting, copy all the *.java files to the view where the jacoco report is being generated.
example: rsync -avm --include='*.java' -f 'hide,! */' /myproject/src/main/java /test/view/myproject/src/main/java

4. invoke jacoco:report maven goal
jacoco:report

5. view the line level coverage report at /test/view/myproject/target/site/jacoco/index.html
For the line level coverage to work, the java code has to be compiled with debug information. see the configuration for below maven compiler plugin


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<debug>on</debug>
<debuglevel>lines,source</debuglevel>
</configuration>
</plugin>


<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.7.201204190339</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>        
</plugin>

Thursday, August 23, 2012

Korn tour of India 2012


As per their website, Korn will be touring india in 2012 and will be performing in Delhi, Mumbai and Bangalore.

Wed, Sep 5, 2012 Delhi, Leisure Valley Gurgaon
Fri, Sep 7, 2012 Mumbai, MMRDA Grounds
Sun, Sep 9, 2012 Bengaluru, Clarks Exotica

copy select files recursively in linux


In Linux to recursively copy select files within a directory structure to a destination folder (without maintaining the source directory structure) use the below command,

find . -name '*tests.txt' -exec cp {} /myprojects/myfiles \;

note: the '\;' is needed by the exec command 

Wednesday, August 1, 2012

Slash featuring Myles Kennedy and The Conspirators tour 2012 setlist

Halo
Nightrain
Back From Cali
Apocalyptic Love
Godfather Theme/ Anastasia
Mr. Brownstone
Doctor Alibi
Out Ta Get Me
Beggars & Hangers-On
Ghost
You're a Lie
Slither
Standing in the Sun
Not for Me
Starlight
Sweet Child O' Mine
Rocket Queen
No More Heroes

Encore:
By the Sword
Paradise City