You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/03/22 14:12:40 UTC
svn commit: r639990 - in /maven/plugins/trunk/maven-ant-plugin/src:
it/test-custom-selector-it/ it/test-custom-selector-it/src/
it/test-custom-selector-it/src/test/
it/test-custom-selector-it/src/test/java/
it/test-custom-selector-it/src/test/java/it/ ...
Author: bentmann
Date: Sat Mar 22 06:12:36 2008
New Revision: 639990
URL: http://svn.apache.org/viewvc?rev=639990&view=rev
Log:
[MANT-40] Use includes/excludes configured for Surefire when running tests
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/ (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/ (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java (with props)
maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 22 06:12:36 2008
@@ -0,0 +1,5 @@
+target
+build.xml
+maven-build.properties
+maven-build.xml
+build.log
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt Sat Mar 22 06:12:36 2008
@@ -0,0 +1,2 @@
+ant:ant
+initialize
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/goals.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml Sat Mar 22 06:12:36 2008
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.maven-ant-plugin.it</groupId>
+ <artifactId>test-custom-selector-it</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ <version>@pom.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <configuration>
+ <tasks>
+ <ant dir="${basedir}" antfile="${basedir}/build.xml" target="package" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Bad*.java</exclude>
+ <exclude>**/Broken*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <build.compiler>extJavac</build.compiler>
+ </properties>
+
+</project>
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class BadTest
+ extends TestCase
+{
+
+ public void testFail()
+ throws Exception
+ {
+ fail( "This test should have been excluded." );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BadTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class BrokenTest
+ extends TestCase
+{
+
+ public void testFail()
+ throws Exception
+ {
+ fail( "This test should have been excluded." );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/BrokenTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class ExcludedTestCase
+ extends TestCase
+{
+
+ public void testFail()
+ throws Exception
+ {
+ fail( "This test should have been excluded." );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/ExcludedTestCase.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class GoodTest
+ extends TestCase
+{
+
+ public void testPass()
+ throws Exception
+ {
+ assertTrue( true );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/GoodTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class TestExcluded
+ extends TestCase
+{
+
+ public void testFail()
+ throws Exception
+ {
+ fail( "This test should have been excluded." );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/src/test/java/it/TestExcluded.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh Sat Mar 22 06:12:36 2008
@@ -0,0 +1,23 @@
+import java.io.*;
+import java.util.*;
+
+try
+{
+ File reportDir = new File( basedir, "target/test-reports" );
+
+ {
+ File file = new File( reportDir, "TEST-it.GoodTest.xml" );
+ if ( !file.isFile() )
+ {
+ System.err.println( "Report file does not exist: " + file );
+ return false;
+ }
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-custom-selector-it/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Mar 22 06:12:36 2008
@@ -0,0 +1,5 @@
+target
+build.xml
+maven-build.properties
+maven-build.xml
+build.log
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt Sat Mar 22 06:12:36 2008
@@ -0,0 +1,2 @@
+ant:ant
+initialize
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/goals.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml Sat Mar 22 06:12:36 2008
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.maven-ant-plugin.it</groupId>
+ <artifactId>test-default-selector-it</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ <version>@pom.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <configuration>
+ <tasks>
+ <ant dir="${basedir}" antfile="${basedir}/build.xml" target="package" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- use default values for surefire includes/excludes -->
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <build.compiler>extJavac</build.compiler>
+ </properties>
+
+</project>
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public abstract class AbstractTest
+ extends TestCase
+{
+
+ public void testFail()
+ throws Exception
+ {
+ fail( "This test should have been excluded." );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/AbstractTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class GoodTest
+ extends TestCase
+{
+
+ public void testPass()
+ throws Exception
+ {
+ assertTrue( true );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class GoodTestCase
+ extends TestCase
+{
+
+ public void testPass()
+ throws Exception
+ {
+ assertTrue( true );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/GoodTestCase.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java Sat Mar 22 06:12:36 2008
@@ -0,0 +1,37 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 junit.framework.TestCase;
+
+/**
+ * @version $Id$
+ */
+public class TestGood
+ extends TestCase
+{
+
+ public void testPass()
+ throws Exception
+ {
+ assertTrue( true );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/src/test/java/it/TestGood.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh?rev=639990&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh Sat Mar 22 06:12:36 2008
@@ -0,0 +1,41 @@
+import java.io.*;
+import java.util.*;
+
+try
+{
+ File reportDir = new File( basedir, "target/test-reports" );
+
+ {
+ File file = new File( reportDir, "TEST-it.GoodTest.xml" );
+ if ( !file.isFile() )
+ {
+ System.err.println( "Report file does not exist: " + file );
+ return false;
+ }
+ }
+
+ {
+ File file = new File( reportDir, "TEST-it.GoodTestCase.xml" );
+ if ( !file.isFile() )
+ {
+ System.err.println( "Report file does not exist: " + file );
+ return false;
+ }
+ }
+
+ {
+ File file = new File( reportDir, "TEST-it.TestGood.xml" );
+ if ( !file.isFile() )
+ {
+ System.err.println( "Report file does not exist: " + file );
+ return false;
+ }
+ }
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/it/test-default-selector-it/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java?rev=639990&r1=639989&r2=639990&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java Sat Mar 22 06:12:36 2008
@@ -23,6 +23,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -744,6 +746,7 @@
* @param testCompileSourceRoots
*/
private void writeTestTargets( XMLWriter writer, List testCompileSourceRoots )
+ throws IOException
{
AntBuildWriterUtil.writeCommentText( writer, "Run all tests", 1 );
@@ -812,18 +815,27 @@
writer.startElement( "batchtest" );
writer.addAttribute( "todir", "${maven.test.reports}" );
+ List includes =
+ getSelectorList( AntBuildWriterUtil.getMavenSurefirePluginOptions( project, "includes", null ) );
+ if ( includes == null || includes.isEmpty() )
+ {
+ includes = Arrays.asList( new String[] { "**/Test*.java", "**/*Test.java", "**/*TestCase.java" } );
+ }
+
+ List excludes =
+ getSelectorList( AntBuildWriterUtil.getMavenSurefirePluginOptions( project, "excludes", null ) );
+ if ( excludes == null || excludes.isEmpty() )
+ {
+ excludes = Arrays.asList( new String[] { "**/*Abstract*Test.java" } );
+ }
+
String[] compileSourceRoots = (String[]) testCompileSourceRoots.toArray( new String[0] );
for ( int i = 0; i < compileSourceRoots.length; i++ )
{
writer.startElement( "fileset" );
writer.addAttribute( "dir", "${maven.build.testDir." + i + "}" );
- /* TODO: need to get these from the test plugin somehow?
- UnitTest unitTest = project.getBuild().getUnitTest();
- writeIncludesExcludes( writer, unitTest.getIncludes(), unitTest.getExcludes() );
- // TODO: m1 allows additional test exclusions via maven.ant.excludeTests
- */
- AntBuildWriterUtil.writeIncludesExcludes( writer, Collections.singletonList( "**/*Test.java" ),
- Collections.singletonList( "**/*Abstract*Test.java" ) );
+ // TODO: m1 allows additional test exclusions via maven.ant.excludeTests
+ AntBuildWriterUtil.writeIncludesExcludes( writer, includes, excludes );
writer.endElement(); // fileset
}
writer.endElement(); // batchtest
@@ -1265,4 +1277,35 @@
return sb.toString();
}
+
+ /**
+ * Flattens the specified file selector options into a simple string list. For instance, the input
+ *
+ * <pre>
+ * [ {include="*Test.java"}, {include="*TestCase.java"} ]
+ * </pre>
+ *
+ * is converted to
+ *
+ * <pre>
+ * [ "*Test.java", "*TestCase.java" ]
+ * </pre>
+ *
+ * @param options The file selector options to flatten, may be <code>null</code>.
+ * @return The string list, might be empty but never <code>null</code>.
+ */
+ private static List getSelectorList( Map[] options )
+ {
+ List list = new ArrayList();
+ if ( options != null && options.length > 0 )
+ {
+ for ( int i = 0; i < options.length; i++ )
+ {
+ Map option = options[i];
+ list.addAll( option.values() );
+ }
+ }
+ return list;
+ }
+
}
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java?rev=639990&r1=639989&r2=639990&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java Sat Mar 22 06:12:36 2008
@@ -779,6 +779,51 @@
}
/**
+ * Return the <code>optionName</code> value defined in a project for the "maven-surefire-plugin" plugin.
+ *
+ * @param project not null
+ * @param optionName the option name wanted
+ * @param defaultValue a default value
+ * @return the value for the option name or the default value. Could be null if not found.
+ * @throws IOException if any
+ */
+ public static String getMavenSurefirePluginBasicOption( MavenProject project, String optionName, String defaultValue )
+ throws IOException
+ {
+ return getMavenPluginBasicOption( project, "maven-surefire-plugin", optionName, defaultValue );
+ }
+
+ /**
+ * Return the map of <code>optionName</code> value defined in a project for the "maven-surefire-plugin" plugin.
+ *
+ * @param project not null
+ * @param optionName the option name wanted
+ * @param defaultValue a default value
+ * @return the map for the option name or the default value. Could be null if not found.
+ * @throws IOException if any
+ */
+ public static Map getMavenSurefirePluginOption( MavenProject project, String optionName, String defaultValue )
+ throws IOException
+ {
+ return getMavenPluginOption( project, "maven-surefire-plugin", optionName, defaultValue );
+ }
+
+ /**
+ * Return an array of map of <code>optionName</code> value defined in a project for the "maven-surefire-plugin" plugin.
+ *
+ * @param project not null
+ * @param optionName the option name wanted
+ * @param defaultValue a default value
+ * @return the array of option name or the default value. Could be null if not found.
+ * @throws IOException if any
+ */
+ public static Map[] getMavenSurefirePluginOptions( MavenProject project, String optionName, String defaultValue )
+ throws IOException
+ {
+ return getMavenPluginOptions( project, "maven-surefire-plugin", optionName, defaultValue );
+ }
+
+ /**
* Return the <code>optionName</code> value defined in a project for the "maven-javadoc-plugin" plugin.
*
* @param project not null