MPDASHBOARD-17: Prevent failure in <code><junitpassrate.jelly/code> due to a division by zero when there is a unit test source directory defined but no tests are executed.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@157343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
70602fb776
commit
5e4b3fd5f2
7 files changed
+97
-163
No files matched your search
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
* Copyright 2001-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.
|
||||
@@ -17,20 +18,27 @@
|
||||
*/
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
JUnit aggregator. Calculates pass rate from junit report
|
||||
========================================================================
|
||||
-->
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:u="jelly:util">
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:a="jelly:ant" xmlns:x="jelly:xml" xmlns:u="jelly:util">
|
||||
|
||||
<u:file var="artifactAsFile" name="${maven.dashboard.aggregator.junittests.artifact}"/>
|
||||
<j:choose>
|
||||
<j:when test="${artifactAsFile.exists()}">
|
||||
<x:parse var="doc" xml="${artifactAsFile}"/>
|
||||
<x:expr select="floor(100 - 100 * (sum($doc/testsuites/testsuite/@failures) + sum($doc/testsuites/testsuite/@errors)) div sum($doc/testsuites/testsuite/@tests))"/>
|
||||
%
|
||||
<j:choose>
|
||||
<x:set var="nbTests" select="sum($doc/testsuites/testsuite/@tests)"/>
|
||||
<j:when test="${nbTests != 0}">
|
||||
<x:parse var="doc" xml="${artifactAsFile}"/>
|
||||
<x:expr select="floor(100 - 100 * (sum($doc/testsuites/testsuite/@failures) + sum($doc/testsuites/testsuite/@errors)) div sum($doc/testsuites/testsuite/@tests))"/>
|
||||
%
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<j:expr value="-"/>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<j:expr value="-"/>
|
||||
|
||||
+12
-52
@@ -1,60 +1,20 @@
|
||||
package org.apache.maven.dashboard.test.subproject1;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
* 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
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.dashboard.test.subproject1;
|
||||
|
||||
/**
|
||||
* Example voluntarily generating checsktyle errors.
|
||||
@@ -62,7 +22,7 @@ package org.apache.maven.dashboard.test.subproject1;
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: Sample.java,v 1.3 2004/11/26 08:33:00 vmassol Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Sample
|
||||
{
|
||||
|
||||
+12
-52
@@ -1,60 +1,20 @@
|
||||
package org.apache.maven.dashboard.test.subproject1;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
* 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
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.dashboard.test.subproject1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -63,7 +23,7 @@ import junit.framework.TestCase;
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: TestSample.java,v 1.1 2003/11/17 21:37:00 vmassol Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class TestSample extends TestCase
|
||||
{
|
||||
|
||||
+13
-53
@@ -1,67 +1,27 @@
|
||||
package org.apache.maven.dashboard.test.subproject2;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
* 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
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
* 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.dashboard.test.subproject2;
|
||||
|
||||
/**
|
||||
* Example voluntarily generating checsktyle errors.
|
||||
* Example voluntarily generating checkstyle errors.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id: Sample.java,v 1.2 2004/11/05 15:30:11 vmassol Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Sample
|
||||
{
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/* ====================================================================
|
||||
* Copyright 2001-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.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.apache.maven.dashboard.test.subproject2;
|
||||
|
||||
/**
|
||||
* Dummy test simply there to ensure the directory is not empty.
|
||||
* This is to verify the use case where the user has a test directory but
|
||||
* no tests are run. The aggregators using unit tests should handle this
|
||||
* gracefully.
|
||||
*
|
||||
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Dummy
|
||||
{
|
||||
}
|
||||
@@ -21,4 +21,14 @@
|
||||
<extend>${basedir}/../common/project.xml</extend>
|
||||
<id>test-maven-dashboard-plugin-subproject3</id>
|
||||
<name>Maven Dashboard plugin test - Subproject3</name>
|
||||
<reports>
|
||||
<report>maven-changes-plugin</report>
|
||||
<report>maven-tasklist-plugin</report>
|
||||
<report>maven-linkcheck-plugin</report>
|
||||
<report>maven-javadoc-plugin</report>
|
||||
<report>maven-jxr-plugin</report>
|
||||
<report>maven-jdepend-plugin</report>
|
||||
<report>maven-checkstyle-plugin</report>
|
||||
<report>maven-junit-report-plugin</report>
|
||||
</reports>
|
||||
</project>
|
||||
@@ -25,6 +25,11 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.8-SNAPSHOT" date="in SVN">
|
||||
<action dev="vmassol" type="fix" issue="MPDASHBOARD-17" due-to="Philippe Kernevez">
|
||||
Prevent failure in <code><junitpassrate.jelly/code> due to a division
|
||||
by zero when there is a unit test source directory defined but no tests
|
||||
are executed.
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.7" date="2005-03-05">
|
||||
<action dev="vmassol" type="add" issue="MPDASHBOARD-9" due-to="Philippe Kernevez">Added links to reports for all aggregators.</action>
|
||||
|
||||
Reference in new issue
Block a user