You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by jm...@apache.org on 2006/08/26 06:29:11 UTC
svn commit: r437073 - in /maven/continuum/trunk:
continuum-api/src/main/java/org/apache/maven/continuum/execution/
continuum-core/src/main/java/org/apache/maven/continuum/core/action/
continuum-core/src/main/java/org/apache/maven/continuum/execution/ c...
Author: jmcconnell
Date: Fri Aug 25 21:29:06 2006
New Revision: 437073
URL: http://svn.apache.org/viewvc?rev=437073&view=rev
Log:
applied CONTINUUN-819 and CONTINUUM-309 and modified a bit to get working with latest trunk, thanks much
Added:
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java (with props)
maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp (with props)
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm
maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResult.jsp
maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResults.jsp
maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/execution/ContinuumBuildExecutor.java Fri Aug 25 21:29:06 2006
@@ -18,6 +18,7 @@
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.TestResult;
import java.io.File;
import java.util.List;
@@ -41,5 +42,8 @@
void killProcess( Project project );
List getDeployableArtifacts( File workingDirectory, BuildDefinition buildDefinition )
+ throws ContinuumBuildExecutorException;
+
+ TestResult getTestResults(Project project)
throws ContinuumBuildExecutorException;
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Fri Aug 25 21:29:06 2006
@@ -24,6 +24,7 @@
import org.apache.maven.continuum.model.project.BuildResult;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.model.scm.ScmResult;
+import org.apache.maven.continuum.model.scm.TestResult;
import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.apache.maven.continuum.store.ContinuumStore;
@@ -162,9 +163,20 @@
project.setState( build.getState() );
// ----------------------------------------------------------------------
- // Copy over the build result
+ // Set the test result
// ----------------------------------------------------------------------
+ try {
+ TestResult testResult = buildExecutor.getTestResults( project );
+ build.setTestResult(testResult);
+ } catch (Throwable t) {
+ getLogger().error("Error getting test results", t);
+ }
+
+ // ----------------------------------------------------------------------
+ // Copy over the build result
+ // ----------------------------------------------------------------------
+
store.updateBuildResult( build );
build = store.getBuildResult( build.getId() );
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java Fri Aug 25 21:29:06 2006
@@ -18,6 +18,8 @@
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.scm.TestResult;
import org.apache.maven.continuum.utils.WorkingDirectoryService;
import org.apache.maven.continuum.utils.shell.ExecutionResult;
import org.apache.maven.continuum.utils.shell.ShellCommandHelper;
@@ -217,5 +219,10 @@
public File getWorkingDirectory( Project project )
{
return workingDirectoryService.getWorkingDirectory( project );
+ }
+
+ public TestResult getTestResults(Project project)
+ throws ContinuumBuildExecutorException {
+ return null;
}
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java Fri Aug 25 21:29:06 2006
@@ -27,11 +27,21 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
+import org.apache.maven.continuum.model.scm.TestResult;
+import org.apache.maven.continuum.model.scm.SuiteResult;
+import org.apache.maven.continuum.model.scm.TestCaseFailure;
import org.codehaus.plexus.util.StringUtils;
-
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.xml.pull.XmlPullParser;
+import org.codehaus.plexus.util.xml.pull.MXParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
import java.io.File;
+import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
+import java.io.IOException;
+import java.io.FileNotFoundException;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -241,5 +251,94 @@
}
return artifacts;
+ }
+
+ public TestResult getTestResults(Project project)
+ throws ContinuumBuildExecutorException {
+ return getTestResults(getWorkingDirectory(project));
+ }
+
+ private TestResult getTestResults(File workingDir)
+ throws ContinuumBuildExecutorException {
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir(workingDir);
+ scanner.setIncludes(new String[] {
+ "**/target/surefire-reports/TEST-*.xml",
+ "**/target/surefire-it-reports/TEST-*.xml"
+ });
+ scanner.scan();
+
+ TestResult testResult = new TestResult();
+ int testCount = 0;
+ int failureCount = 0;
+ int totalTime = 0;
+ String[] testResultFiles = scanner.getIncludedFiles();
+ for (int i = 0; i < testResultFiles.length; i++) {
+ File xmlFile = new File(workingDir, testResultFiles[i]);
+ SuiteResult suite = new SuiteResult();
+ try {
+ XmlPullParser parser = new MXParser();
+ parser.setInput(new FileReader(xmlFile));
+ if (parser.next() != XmlPullParser.START_TAG || !"testsuite".equals(parser.getName())) {
+ continue;
+ }
+
+ suite.setName(parser.getAttributeValue(null, "name"));
+
+ int suiteFailureCount =
+ Integer.parseInt(parser.getAttributeValue(null, "errors")) +
+ Integer.parseInt(parser.getAttributeValue(null, "failures"));
+
+ long suiteTotalTime =
+ (long) (1000 * Double.parseDouble(parser.getAttributeValue(null, "time")));
+
+ // TODO: add tests attribute to testsuite element so we only
+ // have to parse the rest of the file if there are failures
+ int suiteTestCount = 0;
+ while (!(parser.next() == XmlPullParser.END_TAG && "testsuite".equals(parser.getName()))) {
+ if (parser.getEventType() == XmlPullParser.START_TAG && "testcase".equals(parser.getName())) {
+ suiteTestCount++;
+ String name = parser.getAttributeValue(null, "name");
+ do {
+ parser.next();
+ } while (parser.getEventType() != XmlPullParser.START_TAG &&
+ parser.getEventType() != XmlPullParser.END_TAG);
+ if (parser.getEventType() == XmlPullParser.START_TAG &&
+ ("error".equals(parser.getName()) || "failure".equals(parser.getName()))) {
+ TestCaseFailure failure = new TestCaseFailure();
+ failure.setName(name);
+ if (parser.next() == XmlPullParser.TEXT) {
+ failure.setException(parser.getText());
+ }
+ suite.addFailure(failure);
+ }
+ }
+ }
+
+ testCount += suiteTestCount;
+ failureCount += suiteFailureCount;
+ totalTime += suiteTotalTime;
+
+ suite.setTestCount(suiteTestCount);
+ suite.setFailureCount(suiteFailureCount);
+ suite.setTotalTime(suiteTotalTime);
+ } catch (XmlPullParserException xppex) {
+ throw new ContinuumBuildExecutorException(
+ "Error parsing file: " + xmlFile, xppex);
+ } catch (FileNotFoundException fnfex) {
+ throw new ContinuumBuildExecutorException(
+ "Test file not found", fnfex);
+ } catch (IOException ioex) {
+ throw new ContinuumBuildExecutorException(
+ "Parsing error for file: " + xmlFile, ioex);
+ }
+ testResult.addSuiteResult(suite);
+ }
+
+ testResult.setTestCount(testCount);
+ testResult.setFailureCount(failureCount);
+ testResult.setTotalTime(totalTime);
+
+ return testResult;
}
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/FormatterTool.java Fri Aug 25 21:29:06 2006
@@ -84,6 +84,9 @@
public String formatTimestamp( long timestamp )
{
+ if (timestamp <= 0) {
+ return null;
+ }
return getSimpleDateFormat( timestampFormat, timestampFormatString ).format( new Date( timestamp ) );
}
@@ -132,5 +135,12 @@
}
return dateFormat;
+ }
+
+ public String trim(String str) {
+ if (str == null) {
+ return "";
+ }
+ return str.trim();
}
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java Fri Aug 25 21:29:06 2006
@@ -47,6 +47,18 @@
// return new File( projectGroup.getWorkingDirectory(),
// project.getPath() );
- return new File( configurationService.getWorkingDirectory(), Integer.toString( project.getId() ) );
+ File workDir;
+ if ( project.getWorkingDirectory() == null )
+ {
+ workDir = new File( configurationService.getWorkingDirectory(), Integer.toString( project.getId() ) );
+
+ project.setWorkingDirectory( workDir.getAbsolutePath() );
+ }
+ else
+ {
+ workDir = new File( project.getWorkingDirectory() );
+ }
+
+ return workDir;
}
}
Modified: maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm (original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/common.vm Fri Aug 25 21:29:06 2006
@@ -32,26 +32,69 @@
Java version : $javaVersion
#if ( $build.scmResult )
-Changes
- #if ( $build.scmResult.changes.size() == 0 )
- No files changed
- #else
- #foreach ( $changeSet in $build.scmResult.changes )
- #if ($changeSet.author) $changeSet.author #end
- #if ($changeSet.date > 0) $date.format('medium',$changeSet.date) #end
- #if ($changeSet.comment) $changeSet.comment #end
- #foreach ( $file in $changeSet.files )
- $!file.name
- #end
- #end
- #end
+****************************************************************************
+Changes:
+****************************************************************************
+#if ( $build.scmResult.changes.size() == 0 )
+No files changed
+
+#else
+#foreach ( $changeSet in $build.scmResult.changes )
+#if ($changeSet.author)
+#set($author = $changeSet.author)
+#else
+#set($author = "no author")
+#end
+#set($date = $formatter.formatTimestamp($changeSet.date))
+#if (!$date)
+#set($date = "no date")
+#end
+#if ($changeSet.comment)
+#set($comment = $formatter.trim($changeSet.comment))
+#else
+#set($comment = "no comment")
+#end
+Changed: $author @ $date
+Comment: $comment
+Files changed:
+#foreach ( $file in $changeSet.files )
+ $!file.name (#if ($file.revision) $file.revision #else no revision #end)
+#end
+
+#end
+#end
#end
+#if ( $build.testResult )
+****************************************************************************
+Test Summary:
+****************************************************************************
+Tests: $build.testResult.testCount
+Failures: $build.testResult.failureCount
+Total time: $build.testResult.totalTime
+#end
#if ( $build.state == 4 )
****************************************************************************
Build Error:
****************************************************************************
$build.error
+
+#if ( $build.testResult && $build.testResult.failureCount > 0)
+****************************************************************************
+Test Failures:
+****************************************************************************
+
+#foreach( $suite in $build.testResult.suiteResults )
+#if ( $suite.failureCount > 0)
+$suite.name
+ #foreach( $failure in $suite.failures )
+ $failure.name
+ $failure.exception
+
+ #end
+#end
+#end
+#end
#else
****************************************************************************
Output:
Modified: maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/mdo/continuum.mdo Fri Aug 25 21:29:06 2006
@@ -441,6 +441,13 @@
<type>ScmResult</type>
</association>
</field>
+ <field jpox.fetchGroupNames="build-result-with-details">
+ <name>testResult</name>
+ <version>1.0.0+</version>
+ <association>
+ <type>TestResult</type>
+ </association>
+ </field>
</fields>
</class>
@@ -618,6 +625,91 @@
]]></code>
</codeSegment>
</codeSegments>
+ </class>
+
+ <class>
+ <name>TestResult</name>
+ <packageName>org.apache.maven.continuum.model.scm</packageName>
+ <version>1.0.0+</version>
+ <fields>
+ <field>
+ <name>testCount</name>
+ <version>1.0.0+</version>
+ <type>int</type>
+ </field>
+ <field>
+ <name>failureCount</name>
+ <version>1.0.0+</version>
+ <type>int</type>
+ </field>
+ <field>
+ <name>totalTime</name>
+ <version>1.0.0+</version>
+ <type>long</type>
+ </field>
+ <field>
+ <name>suiteResults</name>
+ <version>1.0.0+</version>
+ <association stash.part="true" jpox.join="false">
+ <type>SuiteResult</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>SuiteResult</name>
+ <packageName>org.apache.maven.continuum.model.scm</packageName>
+ <version>1.0.0+</version>
+ <fields>
+ <field>
+ <name>name</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ </field>
+ <field>
+ <name>testCount</name>
+ <version>1.0.0+</version>
+ <type>int</type>
+ </field>
+ <field>
+ <name>failureCount</name>
+ <version>1.0.0+</version>
+ <type>int</type>
+ </field>
+ <field>
+ <name>totalTime</name>
+ <version>1.0.0+</version>
+ <type>long</type>
+ </field>
+ <field>
+ <name>failures</name>
+ <version>1.0.0+</version>
+ <association stash.part="true" jpox.join="false">
+ <type>TestCaseFailure</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>TestCaseFailure</name>
+ <packageName>org.apache.maven.continuum.model.scm</packageName>
+ <version>1.0.0+</version>
+ <fields>
+ <field>
+ <name>name</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ </field>
+ <field stash.maxSize="8192">
+ <name>exception</name>
+ <version>1.0.0+</version>
+ <type>String</type>
+ </field>
+ </fields>
</class>
<class>
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java Fri Aug 25 21:29:06 2006
@@ -18,6 +18,8 @@
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.util.FileUtils;
import java.util.List;
@@ -44,11 +46,20 @@
private List changeSet;
+ private boolean hasSurefireResults;
+
public String execute()
throws ContinuumException
{
+ //todo get this working for other types of test case rendering other then just surefire
+ // check if there are surefire results to display
+ Project project = getContinuum().getProject( projectId );
+ hasSurefireResults = FileUtils.fileExists( project.getWorkingDirectory() + "/target/surefire-reports" );
+
+
buildResult = getContinuum().getBuildResult( buildId );
+
changeSet = getContinuum().getChangesSinceLastSuccess( projectId, buildId );
return SUCCESS;
@@ -92,5 +103,15 @@
public List getChangesSinceLastSuccess()
{
return changeSet;
+ }
+
+ public boolean isHasSurefireResults()
+ {
+ return hasSurefireResults;
+ }
+
+ public void setHasSurefireResults( boolean hasSurefireResults )
+ {
+ this.hasSurefireResults = hasSurefireResults;
}
}
Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java Fri Aug 25 21:29:06 2006
@@ -35,6 +35,8 @@
private int projectId;
+ private String projectName;
+
public String execute()
throws ContinuumException
{
@@ -56,5 +58,15 @@
public Collection getBuildResults()
{
return buildResults;
+ }
+
+ public String getProjectName()
+ {
+ return projectName;
+ }
+
+ public void setProjectName( String projectName )
+ {
+ this.projectName = projectName;
}
}
Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java?rev=437073&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java Fri Aug 25 21:29:06 2006
@@ -0,0 +1,736 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.StringUtils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.File;
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * @author Edwin Punzalan
+ *
+ * @plexus.component
+ * role="com.opensymphony.xwork.Action"
+ * role-hint="surefireReport"
+ *
+ * @todo too many inner classes, maybe a continuum-reports project group ?
+ */
+public class SurefireReportAction
+ extends ContinuumActionSupport
+{
+ private int buildId;
+
+ private int projectId;
+
+ private List testSuites;
+
+ private List testSummaryList;
+
+ private List testPackageList;
+
+ private String projectName;
+
+ public String execute()
+ throws ContinuumException
+ {
+ Project project = getContinuum().getProject( projectId );
+
+ //@todo maven-surefire-report reportsDirectory should be detected ?
+ File reportsDirectory = new File( project.getWorkingDirectory() + "/target/surefire-reports" );
+
+ parseReports( reportsDirectory );
+
+ getSummary( testSuites );
+
+ getDetails( testSuites );
+
+ return SUCCESS;
+ }
+
+ private void parseReports( File reportsDirectory )
+ throws ContinuumException
+ {
+ String[] xmlReportFiles = getIncludedFiles( reportsDirectory, "*.xml", "*.txt" );
+
+ testSuites = new ArrayList();
+
+ for ( int index = 0; index < xmlReportFiles.length; index++ )
+ {
+ ReportTestSuite testSuite = new ReportTestSuite();
+
+ String currentReport = xmlReportFiles[index];
+
+ try
+ {
+ testSuite.parse( reportsDirectory + "/" + currentReport );
+ }
+ catch ( ParserConfigurationException e )
+ {
+ throw new ContinuumException( "Error setting up parser for Surefire XML report", e );
+ }
+ catch ( SAXException e )
+ {
+ throw new ContinuumException( "Error parsing Surefire XML report " + currentReport, e );
+ }
+ catch ( IOException e )
+ {
+ throw new ContinuumException( "Error reading Surefire XML report " + currentReport, e );
+ }
+
+ testSuites.add( testSuite );
+ }
+ }
+
+ private void getSummary( List suiteList )
+ {
+ int totalTests = 0;
+
+ int totalErrors = 0;
+
+ int totalFailures = 0;
+
+ float totalTime = 0.0f;
+
+ for( Iterator suites = suiteList.iterator(); suites.hasNext(); )
+ {
+ ReportTestSuite suite = (ReportTestSuite) suites.next();
+
+ totalTests += suite.getNumberOfTests();
+
+ totalErrors += suite.getNumberOfErrors();
+
+ totalFailures += suite.getNumberOfFailures();
+
+ totalTime += suite.getTimeElapsed();
+ }
+
+ ReportTest report = new ReportTest();
+ report.setTests( totalTests );
+ report.setErrors( totalErrors );
+ report.setFailures( totalFailures );
+ report.setElapsedTime( totalTime );
+
+ testSummaryList = Collections.singletonList( report );
+ }
+
+ private void getDetails( List suiteList )
+ {
+ Map testsByPackage = new LinkedHashMap();
+
+ for( Iterator suites = suiteList.iterator(); suites.hasNext(); )
+ {
+ ReportTestSuite suite = (ReportTestSuite) suites.next();
+
+ ReportTest report = (ReportTest) testsByPackage.get( suite.getPackageName() );
+
+ if ( report == null )
+ {
+ report = new ReportTest();
+
+ report.setId( suite.getPackageName() );
+
+ report.setName( suite.getPackageName() );
+ }
+
+ report.setTests( report.getTests() + suite.getNumberOfTests() );
+ report.setErrors( report.getErrors() + suite.getNumberOfErrors() );
+ report.setFailures( report.getFailures() + suite.getNumberOfFailures() );
+ report.setElapsedTime( report.getElapsedTime() + suite.getTimeElapsed() );
+
+ ReportTest reportTest = new ReportTest();
+ reportTest.setId( suite.getPackageName() + "." + suite.getName() );
+ reportTest.setName( suite.getName() );
+ reportTest.setTests( suite.getNumberOfTests() );
+ reportTest.setErrors( suite.getNumberOfErrors() );
+ reportTest.setFailures( suite.getNumberOfFailures() );
+ reportTest.setElapsedTime( suite.getTimeElapsed() );
+ reportTest.setChildren( suite.getTestCases() );
+
+ report.getChildren().add( reportTest );
+
+ testsByPackage.put( suite.getPackageName(), report );
+ }
+
+ testPackageList = new ArrayList( testsByPackage.values() );
+ }
+
+ public int getBuildId()
+ {
+ return buildId;
+ }
+
+ public void setBuildId( int buildId )
+ {
+ this.buildId = buildId;
+ }
+
+ public int getProjectId()
+ {
+ return projectId;
+ }
+
+ public void setProjectId( int projectId )
+ {
+ this.projectId = projectId;
+ }
+
+ private String[] getIncludedFiles( File directory, String includes, String excludes )
+ {
+ DirectoryScanner scanner = new DirectoryScanner();
+
+ scanner.setBasedir( directory );
+
+ scanner.setIncludes( StringUtils.split( includes, "," ) );
+
+ scanner.setExcludes( StringUtils.split( excludes, "," ) );
+
+ scanner.scan();
+
+ return scanner.getIncludedFiles();
+ }
+
+ public List getTestSuites()
+ {
+ return testSuites;
+ }
+
+ public void setTestSuites( List testSuites )
+ {
+ this.testSuites = testSuites;
+ }
+
+ public String getProjectName()
+ {
+ return projectName;
+ }
+
+ public void setProjectName( String projectName )
+ {
+ this.projectName = projectName;
+ }
+
+ public List getTestSummaryList()
+ {
+ return testSummaryList;
+ }
+
+ public void setTestSummaryList( List testSummaryList )
+ {
+ this.testSummaryList = testSummaryList;
+ }
+
+ public List getTestPackageList()
+ {
+ return testPackageList;
+ }
+
+ public void setTestPackageList( List testPackageList )
+ {
+ this.testPackageList = testPackageList;
+ }
+
+ public class ReportTest
+ {
+ private String id;
+
+ private String name;
+
+ private int tests;
+
+ private int errors;
+
+ private int failures;
+
+ private float elapsedTime;
+
+ private List children;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public int getTests()
+ {
+ return tests;
+ }
+
+ public void setTests( int tests )
+ {
+ this.tests = tests;
+ }
+
+ public int getErrors()
+ {
+ return errors;
+ }
+
+ public void setErrors( int errors )
+ {
+ this.errors = errors;
+ }
+
+ public int getFailures()
+ {
+ return failures;
+ }
+
+ public void setFailures( int failures )
+ {
+ this.failures = failures;
+ }
+
+ public float getSuccessRate()
+ {
+ float percentage;
+ if ( tests == 0 )
+ {
+ percentage = 0;
+ }
+ else
+ {
+ percentage = ( (float) ( tests - errors - failures ) / (float) tests ) * 100;
+ }
+
+ return percentage;
+ }
+
+ public float getElapsedTime()
+ {
+ return elapsedTime;
+ }
+
+ public void setElapsedTime( float elapsedTime )
+ {
+ this.elapsedTime = elapsedTime;
+ }
+
+ public List getChildren()
+ {
+ if ( children == null )
+ {
+ children = new ArrayList();
+ }
+
+ return children;
+ }
+
+ public void setChildren( List children )
+ {
+ this.children = children;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+ }
+
+ /**
+ * Taken from maven-surefire-report-plugin
+ */
+ private class ReportTestSuite
+ extends DefaultHandler
+ {
+ private List testCases;
+
+ private int numberOfErrors;
+
+ private int numberOfFailures;
+
+ private int numberOfTests;
+
+ private String name;
+
+ private String fullClassName;
+
+ private String packageName;
+
+ private float timeElapsed;
+
+ private NumberFormat numberFormat = NumberFormat.getInstance();
+
+ /**
+ * @noinspection StringBufferField
+ */
+ private StringBuffer currentElement;
+
+ private ReportTestCase testCase;
+
+ public void parse( String xmlPath )
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+
+ SAXParser saxParser = factory.newSAXParser();
+
+ saxParser.parse( new File( xmlPath ), this );
+ }
+
+ public void startElement( String uri, String localName, String qName, Attributes attributes )
+ throws SAXException
+ {
+ try
+ {
+ if ( "testsuite".equals( qName ) )
+ {
+ numberOfErrors = Integer.parseInt( attributes.getValue( "errors" ) );
+
+ numberOfFailures = Integer.parseInt( attributes.getValue( "failures" ) );
+
+ numberOfTests = Integer.parseInt( attributes.getValue( "tests" ) );
+
+ Number time = numberFormat.parse( attributes.getValue( "time" ) );
+
+ timeElapsed = time.floatValue();
+
+ //check if group attribute is existing
+ if ( attributes.getValue( "group" ) != null && !"".equals( attributes.getValue( "group" ) ) )
+ {
+ packageName = attributes.getValue( "group" );
+
+ name = attributes.getValue( "name" );
+
+ fullClassName = packageName + "." + name;
+ }
+ else
+ {
+ fullClassName = attributes.getValue( "name" );
+
+ name = fullClassName.substring( fullClassName.lastIndexOf( "." ) + 1, fullClassName.length() );
+
+ int lastDotPosition = fullClassName.lastIndexOf( "." );
+ if ( lastDotPosition < 0 )
+ {
+ /* no package name */
+ packageName = "";
+ }
+ else
+ {
+ packageName = fullClassName.substring( 0, lastDotPosition );
+ }
+ }
+
+ testCases = new ArrayList();
+ }
+ else if ( "testcase".equals( qName ) )
+ {
+ currentElement = new StringBuffer();
+
+ testCase = new ReportTestCase();
+
+ testCase.setFullClassName( fullClassName );
+
+ testCase.setName( attributes.getValue( "name" ) );
+
+ testCase.setClassName( name );
+
+ String timeAsString = attributes.getValue( "time" );
+
+ Number time = new Integer( 0 );
+
+ if ( timeAsString != null )
+ {
+ time = numberFormat.parse( timeAsString );
+ }
+
+ testCase.setTime( time.floatValue() );
+
+ testCase.setFullName( packageName + "." + name + "." + testCase.getName() );
+ }
+ else if ( "failure".equals( qName ) )
+ {
+ testCase.setFailureType( attributes.getValue( "type" ) );
+ testCase.setFailureMessage( attributes.getValue( "message" ) );
+ }
+ else if ( "error".equals( qName ) )
+ {
+ testCase.setFailureType( attributes.getValue( "type" ) );
+ testCase.setFailureMessage( attributes.getValue( "message" ) );
+ }
+ }
+ catch ( ParseException e )
+ {
+ throw new SAXException( e.getMessage(), e );
+ }
+ }
+
+ public void endElement( String uri, String localName, String qName )
+ throws SAXException
+ {
+ if ( "testcase".equals( qName ) )
+ {
+ testCases.add( testCase );
+ }
+ else if ( "failure".equals( qName ) )
+ {
+ testCase.setFailureDetails( currentElement.toString() );
+ }
+ else if ( "error".equals( qName ) )
+ {
+ testCase.setFailureDetails( currentElement.toString() );
+ }
+ }
+
+ public void characters( char[] ch, int start, int length )
+ throws SAXException
+ {
+ String s = new String( ch, start, length );
+
+ if ( ! "".equals( s.trim() ) )
+ {
+ currentElement.append( s );
+ }
+ }
+
+ public List getTestCases()
+ {
+ return this.testCases;
+ }
+
+ public int getNumberOfErrors()
+ {
+ return numberOfErrors;
+ }
+
+ public void setNumberOfErrors( int numberOfErrors )
+ {
+ this.numberOfErrors = numberOfErrors;
+ }
+
+ public int getNumberOfFailures()
+ {
+ return numberOfFailures;
+ }
+
+ public void setNumberOfFailures( int numberOfFailures )
+ {
+ this.numberOfFailures = numberOfFailures;
+ }
+
+ public int getNumberOfTests()
+ {
+ return numberOfTests;
+ }
+
+ public void setNumberOfTests( int numberOfTests )
+ {
+ this.numberOfTests = numberOfTests;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getFName()
+ {
+ return name;
+ }
+
+ public void setFName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getPackageName()
+ {
+ return packageName;
+ }
+
+ public void setPackageName( String packageName )
+ {
+ this.packageName = packageName;
+ }
+
+ public float getTimeElapsed()
+ {
+ return this.timeElapsed;
+ }
+
+ public void setTimeElapsed( float timeElapsed )
+ {
+ this.timeElapsed = timeElapsed;
+ }
+
+ private List parseCause( String detail )
+ {
+ String fullName = testCase.getFullName();
+ String name = fullName.substring( fullName.lastIndexOf( "." ) + 1 );
+ return parseCause( detail, name );
+ }
+
+ private List parseCause( String detail, String compareTo )
+ {
+ StringTokenizer stringTokenizer = new StringTokenizer( detail, "\n" );
+ List parsedDetail = new ArrayList( stringTokenizer.countTokens() );
+
+ while ( stringTokenizer.hasMoreTokens() )
+ {
+ String lineString = stringTokenizer.nextToken().trim();
+ parsedDetail.add( lineString );
+ if ( lineString.indexOf( compareTo ) >= 0 )
+ {
+ break;
+ }
+ }
+
+ return parsedDetail;
+ }
+
+ public void setTestCases( List testCases )
+ {
+ this.testCases = Collections.unmodifiableList( testCases );
+ }
+ }
+
+ /**
+ * Taken from maven-surefire-report-plugin
+ */
+ public class ReportTestCase
+ {
+ private String fullClassName;
+
+ private String className;
+
+ private String fullName;
+
+ private String name;
+
+ private float time;
+
+ private String failureType;
+
+ private String failureMessage;
+
+ private String failureDetails;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getFullClassName()
+ {
+ return fullClassName;
+ }
+
+ public void setFullClassName( String name )
+ {
+ this.fullClassName = name;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName( String name )
+ {
+ this.className = name;
+ }
+
+ public float getTime()
+ {
+ return time;
+ }
+
+ public void setTime( float time )
+ {
+ this.time = time;
+ }
+
+ public String getFullName()
+ {
+ return fullName;
+ }
+
+ public void setFullName( String fullName )
+ {
+ this.fullName = fullName;
+ }
+
+ public String getFailureType()
+ {
+ return failureType;
+ }
+
+ public void setFailureType( String failureType )
+ {
+ this.failureType = failureType;
+ }
+
+ public String getFailureMessage()
+ {
+ return failureMessage;
+ }
+
+ public void setFailureMessage( String failureMessage )
+ {
+ this.failureMessage = failureMessage;
+ }
+
+ public String getFailureDetails()
+ {
+ return failureDetails;
+ }
+
+ public void setFailureDetails( String failureDetails )
+ {
+ this.failureDetails = failureDetails;
+ }
+ }
+}
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SurefireReportAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Fri Aug 25 21:29:06 2006
@@ -315,6 +315,8 @@
buildResult.changes.comment = Comment
buildResult.changes.files = Files
buildResult.changesSinceLastSuccess = Other Changes Since Last Success
+buildResult.generatedReports.title = Generated Reports
+buildResult.generatedReports.surefire = Surefire Report
# ----------------------------------------------------------------------
# Page: WorkingCopy
@@ -350,3 +352,21 @@
schedule.quietPeriod.message = Enter a quiet period period for this schedule
schedule.enabled.label = Enabled
schedule.enabled.message = Enable/Disable the schedule
+
+# ----------------------------------------------------------------------
+# Page: SurefireReport
+# ----------------------------------------------------------------------
+surefireReport.page.title = Continuum - Surefire Report
+surefireReport.section.title = Surefire Report for {0} Build Number {1}
+surefireReport.summary = Summary
+surefireReport.tests = Tests
+surefireReport.errors = Errors
+surefireReport.failures = Failures
+surefireReport.successRate = Success Rate
+surefireReport.time = Time
+surefireReport.packageList = Package List
+surefireReport.testCases = Test Cases
+surefireReport.package = Package Name
+surefireReport.class = Class
+surefireReport.testCase = Test Case
+surefireReport.failureDetails = Failure Details
Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Fri Aug 25 21:29:06 2006
@@ -271,6 +271,10 @@
<result name="success">buildResult.jsp</result>
</action>
+ <action name="surefireReport" class="surefireReport">
+ <result name="success">surefireReport.jsp</result>
+ </action>
+
<action name="workingCopy" class="workingCopy">
<result name="success">workingCopy.jsp</result>
</action>
Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResult.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResult.jsp?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResult.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResult.jsp Fri Aug 25 21:29:06 2006
@@ -75,6 +75,17 @@
<b><ww:text name="buildResult.noChanges"/></b>
</ww:else>
+ <ww:if test="hasSurefireResults">
+ <h4><ww:text name="buildResult.generatedReports.title"/></h4>
+
+ <ww:url id="surefireReportUrl" action="surefireReport">
+ <ww:param name="projectId" value="projectId"/>
+ <ww:param name="buildId" value="buildId"/>
+ <ww:param name="projectName" value="projectName"/>
+ </ww:url>
+ <ww:a href="%{surefireReportUrl}"><ww:text name="buildResult.generatedReports.surefire"/></ww:a>
+ </ww:if>
+
<ww:if test="changesSinceLastSuccess != null && changesSinceLastSuccess.size() > 0">
<h4><ww:text name="buildResult.changesSinceLastSuccess"/></h4>
<ww:set name="changes" value="changesSinceLastSuccess" scope="request"/>
Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResults.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResults.jsp?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResults.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/buildResults.jsp Fri Aug 25 21:29:06 2006
@@ -39,11 +39,12 @@
<ec:column property="endTime" title="buildResults.endTime" cell="date"/>
<ec:column property="state" title="buildResults.state" cell="org.apache.maven.continuum.web.view.buildresults.StateCell"/>
<ec:column property="actions" title=" ">
- <a href='<ww:url action="buildResult">
+ <ww:url id="buildResultUrl" action="buildResult">
<ww:param name="projectId" value="${projectId}"/>
- <ww:param name="projectName" value="${projectName}"/>
+ <ww:param name="projectName" value="%{projectName}"/>
<ww:param name="buildId" value="${buildResult.id}"/>
- </ww:url>'>Result</a>
+ </ww:url>
+ <ww:a href="%{buildResultUrl}">Result</ww:a>
</ec:column>
</ec:row>
</ec:table>
Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp?rev=437073&r1=437072&r2=437073&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/components/projectSummaryComponent.jsp Fri Aug 25 21:29:06 2006
@@ -12,9 +12,10 @@
<ec:row highlightRow="true">
<ec:column property="state" title=" " width="1%" cell="org.apache.maven.continuum.web.view.StateCell"/>
<ec:column property="name" title="summary.projectTable.name" width="48%">
- <a href="<ww:url action="projectView">
- <ww:param name="projectId" value="${project.id}"/>
- </ww:url>">${project.name}</a>
+ <ww:url id="projectUrl" action="projectView" namespace="/">
+ <ww:param name="projectId" value="${project.id}"/>
+ </ww:url>
+ <ww:a href="%{projectUrl}">${pageScope.project.name}</ww:a>
</ec:column>
<ec:column property="version" title="summary.projectTable.version" width="13%"/>
<ec:column property="buildNumber" title="summary.projectTable.build" width="5%"
@@ -25,10 +26,12 @@
<ec:column property="buildHistoryAction" title=" " width="1%" sortable="false">
<c:choose>
<c:when test="${pageScope.project.latestBuildId > 0}">
- <a href='<ww:url action="buildResults">
- <ww:param name="projectId" value="${project.id}"/>
- </ww:url>'><img src="<ww:url value='/images/buildhistory.gif'/>" alt="Build History"
- title="Build History" border="0"></a>
+ <ww:url id="buildResultsUrl" action="buildResults" namespace="/">
+ <ww:param name="projectId" value="${project.id}"/>
+ <ww:param name="projectName" value="${project.name}"/>
+ </ww:url>
+ <ww:a href="%{buildResultsUrl}"><img src="<ww:url value='/images/buildhistory.gif'/>" alt="Build History"
+ title="Build History" border="0"></ww:a>
</c:when>
<c:otherwise>
<img src="<ww:url value='/images/buildhistory_disabled.gif'/>" alt="Build History" title="Build History"
@@ -40,10 +43,11 @@
<c:choose>
<c:when
test="${pageScope.project.state == 10 || pageScope.project.state == 2 || pageScope.project.state == 3 || pageScope.project.state == 4 || pageScope.project.state == 6}">
- <a href='<ww:url action="workingCopy">
- <ww:param name="projectId" value="${project.id}"/>
- </ww:url>'><img src="<ww:url value='/images/workingcopy.gif'/>" alt="Working Copy"
- title="Working Copy" border="0"></a>
+ <ww:url id="workingCopyUrl" action="workingCopy" namespace="/">
+ <ww:param name="projectId" value="${project.id}"/>
+ </ww:url>
+ <ww:a href="%{workingCopyurl}"><img src="<ww:url value='/images/workingcopy.gif'/>" alt="Working Copy"
+ title="Working Copy" border="0"></ww:a>
</c:when>
<c:otherwise>
<img src="<ww:url value='/images/workingcopy_disabled.gif'/>" alt="Working Copy" title="Working Copy"
@@ -55,12 +59,13 @@
<c:choose>
<c:when
test="${pageScope.project.state == 1 || pageScope.project.state == 10 || pageScope.project.state == 2 || pageScope.project.state == 3 || pageScope.project.state == 4}">
- <a href='<ww:url value="/deleteProject!default.action">
- <ww:param name="projectId" value="${project.id}"/>
- <ww:param name="projectName" value="${project.name}"/>
- </ww:url>'>
+ <ww:url id="deleteProjectUrl" value="deleteProject!default.action" namespace="/">
+ <ww:param name="projectId" value="${project.id}"/>
+ <ww:param name="projectName" value="${project.name}"/>
+ </ww:url>
+ <ww:a href="%{deleteProjectUrl}">
<img src="<ww:url value='/images/delete.gif'/>" alt="Delete" title="Delete" border="0">
- </a>
+ </ww:a>
</c:when>
<c:otherwise>
<img src="<ww:url value='/images/delete_disabled.gif'/>" alt="Delete" title="Delete" border="0">
Added: maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp?rev=437073&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp Fri Aug 25 21:29:06 2006
@@ -0,0 +1,129 @@
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
+<%@ taglib prefix="c1" uri="continuum" %>
+<html>
+ <ww:i18n name="localization.Continuum">
+ <head>
+ <title><ww:text name="surefireReport.page.title"/></title>
+ </head>
+ <body>
+ <div id="h3">
+ <div>
+ <p style="border-top: 1px solid transparent; border-bottom: 1px solid #DFDEDE;">
+ <a style="border: 1px solid #DFDEDE; padding-left: 1em; padding-right: 1em; text-decoration: none;" href="<ww:url value="/projectView.action?projectId="/><ww:property value="projectId"/>&projectName=<ww:property value="projectName"/>"><ww:text name="info"/></a>
+ <a style="border: 1px solid #DFDEDE; padding-left: 1em; padding-right: 1em; text-decoration: none;" href="<ww:url value="/buildResults.action?projectId="/><ww:property value="projectId"/>&projectName=<ww:property value="projectName"/>"><ww:text name="builds"/></a>
+ <a style="border: 1px solid #DFDEDE; padding-left: 1em; padding-right: 1em; text-decoration: none;" href="<ww:url value="/workingCopy.action?projectId="/><ww:property value="projectId"/>&projectName=<ww:property value="projectName"/>"><ww:text name="workingCopy"/></a>
+ </p>
+ </div>
+
+ <h3>
+ <ww:text name="surefireReport.section.title">
+ <ww:param><ww:property value="projectName"/></ww:param>
+ <ww:param><ww:property value="buildId"/></ww:param>
+ </ww:text>
+ </h3>
+
+ <h4><ww:text name="surefireReport.summary"/></h4>
+ <ec:table items="testSummaryList"
+ var="summary"
+ showExports="false"
+ showPagination="false"
+ showStatusBar="false"
+ filterable="false">
+ <ec:row>
+ <ec:column property="tests" title="surefireReport.tests" sortable="false"/>
+ <ec:column property="errors" title="surefireReport.errors" sortable="false"/>
+ <ec:column property="failures" title="surefireReport.failures" sortable="false"/>
+ <ec:column property="successRate" title="surefireReport.successRate" sortable="false"/>
+ <ec:column property="elapsedTime" title="surefireReport.time" sortable="false"/>
+ </ec:row>
+ </ec:table>
+
+ <h4><ww:text name="surefireReport.packageList"/></h4>
+ <ec:table items="testPackageList"
+ var="report"
+ showExports="false"
+ showPagination="false"
+ showStatusBar="false"
+ filterable="false">
+ <ec:row>
+ <ec:column property="name" title="surefireReport.package" sortable="false">
+ <a href="#<c:out value="${pageScope.report.name}"/>"><c:out value="${pageScope.report.name}"/></a>
+ </ec:column>
+ <ec:column property="tests" title="surefireReport.tests" sortable="false"/>
+ <ec:column property="errors" title="surefireReport.errors" sortable="false"/>
+ <ec:column property="failures" title="surefireReport.failures" sortable="false"/>
+ <ec:column property="successRate" title="surefireReport.successRate" sortable="false"/>
+ <ec:column property="elapsedTime" title="surefireReport.time" sortable="false"/>
+ </ec:row>
+ </ec:table>
+
+ <ww:iterator value="testPackageList">
+ <h5><a name="<ww:property value="name"/>"><ww:property value="name"/></a></h5>
+ <ec:table items="children"
+ var="report"
+ showExports="false"
+ showPagination="false"
+ showStatusBar="false"
+ filterable="false">
+ <ec:row>
+ <!-- @todo there must be a better option than to use #attr -->
+ <ww:if test="#attr.report.errors > 0 || #attr.report.failures > 0">
+ <ec:column property="icon" title=" ">
+ <img src="<ww:url value="/images/icon_error_sml.gif"/>" alt="<ww:text name="message.error"/>" title="<ww:text name="message.error"/>"/>
+ </ec:column>
+ </ww:if>
+ <ww:else>
+ <ec:column property="icon" title=" ">
+ <img src="<ww:url value="/images/icon_success_sml.gif"/>" alt="<ww:text name="message.success"/>" title="<ww:text name="message.success"/>"/>
+ </ec:column>
+ </ww:else>
+ <ec:column property="name" title="surefireReport.class" sortable="false">
+ <a href="#<c:out value="${pageScope.report.id}"/>"><c:out value="${pageScope.report.name}"/></a>
+ </ec:column>
+ <ec:column property="tests" title="surefireReport.tests" sortable="false"/>
+ <ec:column property="errors" title="surefireReport.errors" sortable="false"/>
+ <ec:column property="failures" title="surefireReport.failures" sortable="false"/>
+ <ec:column property="successRate" title="surefireReport.successRate" sortable="false"/>
+ <ec:column property="elapsedTime" title="surefireReport.time" sortable="false"/>
+ </ec:row>
+ </ec:table>
+ </ww:iterator>
+
+ <h4><ww:text name="surefireReport.testCases"/></h4>
+ <ww:iterator value="testPackageList">
+ <ww:iterator value="children">
+ <h5><a name="<ww:property value="id"/>"><ww:property value="name"/></a></h5>
+ <ec:table items="children"
+ var="testCase"
+ showExports="false"
+ showPagination="false"
+ showStatusBar="false"
+ filterable="false">
+ <ec:row>
+ <!-- @todo there must be a better option than to use #attr -->
+ <ww:if test="#attr.testCase.failureType != null">
+ <ec:column property="icon" title=" ">
+ <img src="<ww:url value="/images/icon_error_sml.gif"/>" alt="<ww:text name="message.error"/>" title="<ww:text name="message.error"/>"/>
+ </ec:column>
+ <ec:column property="name" title="surefireReport.testCase" sortable="false">
+ <c:out value="${pageScope.testCase.name}"/><br/><br/>
+ <c:out value="${pageScope.testCase.failureDetails}"/>
+ </ec:column>
+ </ww:if>
+ <ww:else>
+ <ec:column property="icon" title=" ">
+ <img src="<ww:url value="/images/icon_success_sml.gif"/>" alt="<ww:text name="message.success"/>" title="<ww:text name="message.success"/>"/>
+ </ec:column>
+ <ec:column property="name" title="surefireReport.testCase" sortable="false"/>
+ </ww:else>
+ <ec:column property="time" title="surefireReport.time" sortable="false"/>
+ </ec:row>
+ </ec:table>
+ </ww:iterator>
+ </ww:iterator>
+ </div>
+ </body>
+ </ww:i18n>
+</html>
Propchange: maven/continuum/trunk/continuum-webapp/src/main/webapp/surefireReport.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Re: svn commit: r437073 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/execution/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/java/org/apache/maven/continuum/execution/ c...
Posted by Brett Porter <br...@apache.org>.
Should this have a Submitted By: line? Wondering who you are thanking :)
On 26/08/2006, at 2:29 PM, jmcconnell@apache.org wrote:
> Author: jmcconnell
> Date: Fri Aug 25 21:29:06 2006
> New Revision: 437073
>
> URL: http://svn.apache.org/viewvc?rev=437073&view=rev
> Log:
> applied CONTINUUN-819 and CONTINUUM-309 and modified a bit to get
> working with latest trunk, thanks much
>