From 4e6e27b059493f5cc7de60deff2c8cb2686920c2 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 11:42:29 -0400 Subject: [PATCH 1/5] emma.repports -> emma.report.formats --- .../java/org/sonatype/maven/plugin/emma/EmmaReportMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sonatype/maven/plugin/emma/EmmaReportMojo.java b/src/main/java/org/sonatype/maven/plugin/emma/EmmaReportMojo.java index edd3726..c5861fa 100644 --- a/src/main/java/org/sonatype/maven/plugin/emma/EmmaReportMojo.java +++ b/src/main/java/org/sonatype/maven/plugin/emma/EmmaReportMojo.java @@ -152,9 +152,9 @@ public class EmmaReportMojo protected List pluginClasspath; /** - * Reports format to generated (coma separated list) + * Reports format to generated (comma separated list) * - * @parameter expression="${emma.repports}" default-value="html" + * @parameter expression="${emma.report.formats}" default-value="html" */ protected String formats; From d6f9dc8cfdf98ccec23cad3edd51fe0f97c5ccd3 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 14:03:17 -0400 Subject: [PATCH 2/5] Formatting --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 1eb9852..4a9034a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 5 - org.sonatype.maven.plugin + org.sonatype.maven.plugin emma-maven-plugin 1.3-SNAPSHOT 2007 @@ -150,9 +150,9 @@ **/it03/b/pom.xml - - **/it05/pom.xml - + + **/it05/pom.xml + verify.bsh From 545c4e29203dc054fde815ff5cd07da9bdc36333 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 16:29:18 -0400 Subject: [PATCH 3/5] Removed local configuration files (committed by mistake?) --- src/it/it03/a/.project | 17 ----------------- src/it/it03/b/.project | 17 ----------------- 2 files changed, 34 deletions(-) delete mode 100644 src/it/it03/a/.project delete mode 100644 src/it/it03/b/.project diff --git a/src/it/it03/a/.project b/src/it/it03/a/.project deleted file mode 100644 index 79b16b0..0000000 --- a/src/it/it03/a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - it03-a - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/src/it/it03/b/.project b/src/it/it03/b/.project deleted file mode 100644 index 859757b..0000000 --- a/src/it/it03/b/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - it03-b - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - From 616dc079211f0239c3633671dc7da015ec326934 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 16:37:43 -0400 Subject: [PATCH 4/5] Integration tests now install before the test and use the current emma-maven-plugin version. Also now actually *generating* the report in the EmmaCheckMojo if it's not present. --- pom.xml | 4 + src/it/it01/pom.xml | 56 +++++++++-- src/it/it02/pom.xml | 98 ++++++++++++++----- src/it/it03/pom.xml | 74 +++++++++++--- src/it/it04/pom.xml | 39 ++++---- src/it/it05/pom.xml | 51 +++++----- .../maven/plugin/emma/EmmaCheckMojo.java | 1 + 7 files changed, 235 insertions(+), 88 deletions(-) diff --git a/pom.xml b/pom.xml index 4a9034a..12d05a2 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,9 @@ src/it + + ${project.build.directory}/it + site verify @@ -163,6 +166,7 @@ integration-test integration-test + install run diff --git a/src/it/it01/pom.xml b/src/it/it01/pom.xml index bfe7ad7..73d6bb6 100644 --- a/src/it/it01/pom.xml +++ b/src/it/it01/pom.xml @@ -15,12 +15,52 @@ test - - - - org.sonatype.maven.plugin - emma-maven-plugin - - - + + + maven-2 + + + + ${basedir} + + + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + + + + maven-3 + + + + ${basedir} + + + + + + + maven-site-plugin + 3.0-beta-3 + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + + + + + + + diff --git a/src/it/it02/pom.xml b/src/it/it02/pom.xml index 687da31..da96ca9 100644 --- a/src/it/it02/pom.xml +++ b/src/it/it02/pom.xml @@ -55,26 +55,80 @@ - - - - org.sonatype.maven.plugin - emma-maven-plugin - - - ${project.build.outputDirectory} - ${project.build.directory}/dependency - - - +org.apache.commons.lang.StringUtils - +hello.* - - - src/main/java - ${project.build.directory}/dependency-sources - - - - - + + + maven-2 + + + + ${basedir} + + + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + ${project.build.outputDirectory} + ${project.build.directory}/dependency + + + +org.apache.commons.lang.StringUtils + +hello.* + + + src/main/java + ${project.build.directory}/dependency-sources + + + + + + + + maven-3 + + + + ${basedir} + + + + + + + maven-site-plugin + 3.0-beta-3 + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + ${project.build.outputDirectory} + ${project.build.directory}/dependency + + + +org.apache.commons.lang.StringUtils + +hello.* + + + src/main/java + ${project.build.directory}/dependency-sources + + + + + + + + + + + diff --git a/src/it/it03/pom.xml b/src/it/it03/pom.xml index 205fdff..7bb49fe 100644 --- a/src/it/it03/pom.xml +++ b/src/it/it03/pom.xml @@ -26,20 +26,66 @@ test - - - - org.sonatype.maven.plugin - emma-maven-plugin - - - +hello.* - +byebye.* - - - - - + + + maven-2 + + + + ${basedir} + + + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + +hello.* + +byebye.* + + + + + + + + maven-3 + + + + ${basedir} + + + + + + + maven-site-plugin + 3.0-beta-3 + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + +hello.* + +byebye.* + + + + + + + + + + + a b diff --git a/src/it/it04/pom.xml b/src/it/it04/pom.xml index e3af676..32f4335 100644 --- a/src/it/it04/pom.xml +++ b/src/it/it04/pom.xml @@ -16,24 +16,25 @@ - - - org.sonatype.maven.plugin - emma-maven-plugin - - - 90 - - - - - - clean - check - - - - - + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + 90 + + + + + + clean + check + + + + + diff --git a/src/it/it05/pom.xml b/src/it/it05/pom.xml index 8ddd2da..806dbd3 100644 --- a/src/it/it05/pom.xml +++ b/src/it/it05/pom.xml @@ -16,30 +16,31 @@ - - - org.sonatype.maven.plugin - emma-maven-plugin - - - 80 - - - hello.Hello.* - 100 - - - - - - - - clean - check - - - - - + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + + 80 + + + hello.Hello.* + 100 + + + + + + + + clean + check + + + + + diff --git a/src/main/java/org/sonatype/maven/plugin/emma/EmmaCheckMojo.java b/src/main/java/org/sonatype/maven/plugin/emma/EmmaCheckMojo.java index a97d818..25b98c9 100644 --- a/src/main/java/org/sonatype/maven/plugin/emma/EmmaCheckMojo.java +++ b/src/main/java/org/sonatype/maven/plugin/emma/EmmaCheckMojo.java @@ -424,6 +424,7 @@ private File generateReport() throws MojoExecutionException properties.setProperty( "report.xml.out.file", new File( outputDirectory, "coverage.xml" ).getAbsolutePath() ); properties.setProperty( "report.txt.out.file", new File( outputDirectory, "coverage.txt" ).getAbsolutePath() ); reporter.setPropertyOverrides( properties ); + reporter.run(); return new File( outputDirectory, "coverage.xml" ); } From c48add552e623ad9715067464e9957f4bcd6d00d Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 16:40:28 -0400 Subject: [PATCH 5/5] Added an integration test for the new multi-format report output feature --- src/it/it06/pom.xml | 72 +++++++++++++++++++ src/it/it06/src/main/java/hello/Hello.java | 10 +++ .../it06/src/test/java/hello/HelloTest.java | 13 ++++ src/it/it06/verify.bsh | 19 +++++ 4 files changed, 114 insertions(+) create mode 100644 src/it/it06/pom.xml create mode 100644 src/it/it06/src/main/java/hello/Hello.java create mode 100644 src/it/it06/src/test/java/hello/HelloTest.java create mode 100644 src/it/it06/verify.bsh diff --git a/src/it/it06/pom.xml b/src/it/it06/pom.xml new file mode 100644 index 0000000..2f0ef42 --- /dev/null +++ b/src/it/it06/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + emma.test + it06 + 1.0 + EMMA plugin :: Integration test 06 + + + junit + junit + 3.8.2 + test + + + + + maven-2 + + + + ${basedir} + + + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + html,xml,txt + + + + + + + maven-3 + + + + ${basedir} + + + + + + + maven-site-plugin + 3.0-beta-3 + + + + org.sonatype.maven.plugin + emma-maven-plugin + @project.version@ + + html,xml,txt + + + + + + + + + + + diff --git a/src/it/it06/src/main/java/hello/Hello.java b/src/it/it06/src/main/java/hello/Hello.java new file mode 100644 index 0000000..18ef7c6 --- /dev/null +++ b/src/it/it06/src/main/java/hello/Hello.java @@ -0,0 +1,10 @@ +package hello; + +public class Hello +{ + public String hello( String name ) + { + final String myName = name == null ? "world" : name; + return "Hello " + myName + "!"; + } +} diff --git a/src/it/it06/src/test/java/hello/HelloTest.java b/src/it/it06/src/test/java/hello/HelloTest.java new file mode 100644 index 0000000..8b80b5a --- /dev/null +++ b/src/it/it06/src/test/java/hello/HelloTest.java @@ -0,0 +1,13 @@ +package hello; + +import junit.framework.TestCase; + +public class HelloTest extends TestCase +{ + public void testHello() + { + final Hello hello = new Hello(); + assertEquals( "Hello world!", hello.hello( null ) ); + assertEquals( "Hello EMMA!", hello.hello( "EMMA" ) ); + } +} diff --git a/src/it/it06/verify.bsh b/src/it/it06/verify.bsh new file mode 100644 index 0000000..028ded8 --- /dev/null +++ b/src/it/it06/verify.bsh @@ -0,0 +1,19 @@ +File emmaIndex = new File(basedir, "target/site/emma/index.html"); +if(!emmaIndex.exists() || emmaIndex.length() == 0) { + System.out.println("Missing 'index.html'"); + return false; +} + +File emmaXmlReport = new File(basedir, "target/site/emma/coverage.xml"); +if(!emmaXmlReport.exists() || emmaXmlReport.length() == 0) { + System.out.println("Missing 'coverage.xml'"); + return false; +} + +File emmaTxtReport = new File(basedir, "target/site/emma/coverage.txt"); +if(!emmaTxtReport.exists() || emmaTxtReport.length() == 0) { + System.out.println("Missing 'coverage.txt'"); + return false; +} + +return true;