geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject svn commit: r487448 - in /geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite: SurefireXMLGeneratorMojo.java report/SurefireReportGenerator.java
Date Fri, 15 Dec 2006 05:20:04 GMT
Author: prasad
Date: Thu Dec 14 21:20:01 2006
New Revision: 487448

URL: http://svn.apache.org/viewvc?view=rev&rev=487448
Log:
* handle the case of writing to a grandparent surefire-reports dir

Modified:
    geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/SurefireXMLGeneratorMojo.java
    geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/report/SurefireReportGenerator.java

Modified: geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/SurefireXMLGeneratorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/SurefireXMLGeneratorMojo.java?view=diff&rev=487448&r1=487447&r2=487448
==============================================================================
--- geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/SurefireXMLGeneratorMojo.java
(original)
+++ geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/SurefireXMLGeneratorMojo.java
Thu Dec 14 21:20:01 2006
@@ -74,6 +74,16 @@
 
     private File parentReportsDirectory;
 
+    /**
+     * Sometimes it is necessary to generate the surefire xml in a grand parent project because
+     * the current pom was not invoked by the maven-maven-plugin by a parent project.
+     * Such a parent project whose packaging is set to pom will not transfer the surefire
data to it's parent.
+     * So we will directly write to the grandparent's surefire-reports dir.
+     * 
+    * @parameter default-value="false"
+    */
+    private boolean grandParent;
+
     //
     // MojoSupport Hooks
     //
@@ -98,7 +108,11 @@
         ant.setProject(getProject());
 
         currentReportsDirectory = new File(currentBuildDirectory, "surefire-reports");
+        if (grandParent) {
+            parentBuildDirectory = new File(project.getParent().getParent().getBuild().getDirectory());
+        }
         parentReportsDirectory = new File(parentBuildDirectory, "surefire-reports");
+        log.info("Updating directory: " + parentReportsDirectory.getAbsolutePath() );
     }
 
     protected void doExecute() throws Exception {
@@ -121,6 +135,14 @@
             parentReportsDirectory.mkdirs();
         }
         File parentSurefireXMLFile = new File(parentReportsDirectory, "TEST-" + artifactName
+ ".xml");
+        if ( parentSurefireXMLFile.exists() )
+        {
+            parentSurefireXMLFile.delete();
+        }
+
+        if (grandParent) {
+            artifactName = project.getParent().getBasedir().getName() + "@" + artifactName;
+        }
 
         ArrayList xmlFiles = (ArrayList) FileUtils.getFiles(currentReportsDirectory, "TEST*.xml",
null);
         for ( int i=0; i < xmlFiles.size(); i++ )
@@ -140,7 +162,7 @@
 
             if ( parentSurefireXMLFile.exists() )
             {
-                log.info("Loading parent surefire xml for xmlproperty");
+                log.info("Loading parent surefire xml for xmlproperty: " + parentSurefireXMLFile.getAbsolutePath()
);
                 String parentPrefix = "parent" + prefix;
                 loadXMLProperty(parentSurefireXMLFile, parentPrefix);
 

Modified: geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/report/SurefireReportGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/report/SurefireReportGenerator.java?view=diff&rev=487448&r1=487447&r2=487448
==============================================================================
--- geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/report/SurefireReportGenerator.java
(original)
+++ geronimo/server/trunk/maven-plugins/testsuite-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/testsuite/report/SurefireReportGenerator.java
Thu Dec 14 21:20:01 2006
@@ -712,8 +712,9 @@
 
     private String getLink(String link) {
         if ( link.endsWith("#") ) {
-            int index = link.lastIndexOf("#");
-            return link.substring(0, index) + "/surefire-report.html";
+            link = link.replace("#", "/");
+            link = link.replace("@", "/");
+            return link + "surefire-report.html";
         }
         return "#" + link;
     }



Mime
View raw message