You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/03/02 18:17:31 UTC
[maven-surefire] branch SUREFIRE-1004 updated (1821911 -> d2d516e)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch SUREFIRE-1004
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
discard 1821911 [SUREFIRE-1004] Fix compilation issue in DependenciesScannerTest, JUnit4SuiteTest
discard 1f05b23 [SUREFIRE-1004] Move ITs to match upstream project rename
discard 9c1dba2 [SUREFIRE-1004] Support full gavtc format for dependenciesToScan
discard 4eff880 [SUREFIRE-1004] Support full gavtc format for dependenciesToScan
add 001e807 [SUREFIRE-1546] JUnit 5 runner does not honor JUnit 5 display names
add 5f6e1bd Upgrade jacoco-maven-plugin:0.8.3
add 0a810de deployment (repository.apache.org)
add 0493e1b Add JUnit Jupiter integration test using DisplayName
add 0ed5353 build fix
add c4a4333 build fix JUnitPlatformEnginesIT
add aec60eb Add missing since tags to excludesFile and includesFile
add a69f10f [SUREFIRE-1635] Set properties readonly where it doesn't make sense to change values
add 275087c next version 3.0.0-SNAPSHOT
add 3316bea temporarily removed deployment
add de50626 [SUREFIRE-1585] Align JUnit Platform version at runtime
add 34c0211 [SUREFIRE-1642] Upgrade plexus-java to Version 1.0.3
new d2d516e [SUREFIRE-1004] Support full artifact coord filter in dependenciesToScan
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (1821911)
\
N -- N -- N refs/heads/SUREFIRE-1004 (d2d516e)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Jenkinsfile | 7 +-
maven-failsafe-plugin/pom.xml | 15 +-
.../maven/plugin/failsafe/IntegrationTestMojo.java | 6 +-
maven-surefire-common/pom.xml | 25 +-
.../plugin/surefire/AbstractSurefireMojo.java | 390 ++++--
.../apache/maven/plugin/surefire/ProviderInfo.java | 2 +-
.../surefire/StartupReportConfiguration.java | 8 +-
.../surefire/SurefireDependencyResolver.java | 103 +-
.../maven/plugin/surefire/TestClassPath.java | 34 +-
.../surefire/report/ConsoleOutputFileReporter.java | 2 +-
.../maven/plugin/surefire/report/FileReporter.java | 4 +-
.../surefire/report/StatelessXmlReporter.java | 318 ++---
.../plugin/surefire/report/WrappedReportEntry.java | 15 +-
.../surefire/runorder/StatisticsReporter.java | 5 +-
.../plugin/surefire/util/DependencyScanner.java | 82 +-
.../AbstractSurefireMojoJava7PlusTest.java | 5 +-
.../plugin/surefire/AbstractSurefireMojoTest.java | 1271 +++++++++++++++++++-
.../surefire/SurefireDependencyResolverTest.java | 8 +-
.../surefire/report/StatelessXmlReporterTest.java | 85 +-
.../surefire/report/WrappedReportEntryTest.java | 24 +-
.../runorder/RunEntryStatisticsMapTest.java | 128 +-
.../surefire/util/DependenciesScannerTest.java | 6 +-
maven-surefire-plugin/pom.xml | 7 +-
.../maven/plugin/surefire/SurefirePlugin.java | 4 +
.../site/apt/examples/inclusion-exclusion.apt.vm | 10 +-
.../src/site/apt/examples/junit-platform.apt.vm | 110 +-
maven-surefire-report-plugin/pom.xml | 7 +-
pom.xml | 49 +-
surefire-api/pom.xml | 6 +-
.../surefire/runorder/RunEntryStatistics.java | 47 +-
.../surefire/runorder/RunEntryStatisticsMap.java | 172 ++-
.../maven/surefire/booter/ForkingRunListener.java | 2 +-
.../surefire/report/CategorizedReportEntry.java | 4 +-
.../apache/maven/surefire/report/ReportEntry.java | 10 +-
.../maven/surefire/report/SimpleReportEntry.java | 41 +-
.../maven/surefire/util/internal}/ClassMethod.java | 32 +-
.../util/internal/TestClassMethodNameUtils.java | 32 +-
.../runorder/ThreadedExecutionSchedulerTest.java | 26 +-
surefire-booter/pom.xml | 2 +-
surefire-grouper/pom.xml | 2 +-
surefire-its/pom.xml | 4 +-
.../surefire/its/JUnit4RerunFailingTestsIT.java | 4 +-
.../maven/surefire/its/JUnitPlatformEnginesIT.java | 78 +-
.../apache/maven/surefire/its/JUnitPlatformIT.java | 21 +
.../Surefire1152RerunFailingTestsInSuiteIT.java | 8 +-
.../its/jiras/Surefire1209RerunAndForkCountIT.java | 36 +-
...urefire1534ReuseForksFalseWithJavaModuleIT.java | 6 +-
...e1211JUnitTestNgIT.java => Surefire1585IT.java} | 34 +-
.../its/jiras/Surefire943ReportContentIT.java | 5 +-
...g.apache.maven.surefire.test.SucceedingTest.xml | 68 --
.../org.apache.maven.surefire.test.FailingTest.txt | 84 --
...g.apache.maven.surefire.test.SucceedingTest.txt | 4 -
.../DisplayNameTest.javax} | 19 +-
.../surefire-1004-module1/pom.xml | 4 +-
.../pom.xml | 23 +-
.../src/test/java/JUnit4Test.java} | 5 +-
.../pom.xml | 11 +-
.../src/test/java/JupiterTest.java} | 6 +-
...refireReport.surefireReportTest.MyClassTest.xml | 0
...refireReport.surefireReportTest.MyClassTest.txt | 2 +-
...refireReport.surefireReportTest.MyClassTest.xml | 4 +-
...refireReport.surefireReportTest.MyClassTest.txt | 2 +-
.../surefire-570-multipleReportDirectories/pom.xml | 4 +-
surefire-logger-api/pom.xml | 4 +-
surefire-providers/common-java5/pom.xml | 6 +-
.../surefire/report/PojoStackTraceWriter.java | 24 +
surefire-providers/common-junit3/pom.xml | 2 +-
surefire-providers/common-junit4/pom.xml | 2 +-
.../surefire/common/junit4/JUnit4ProviderUtil.java | 38 +-
.../surefire/common/junit4/JUnit4Reflector.java | 2 +-
.../surefire/common/junit4/JUnit4RunListener.java | 55 +-
.../common/junit4/JUnit4StackTraceWriter.java | 23 +-
.../maven/surefire/common/junit4/Notifier.java | 4 +-
.../common/junit4/JUnit4ProviderUtilTest.java | 15 +-
surefire-providers/common-junit48/pom.xml | 2 +-
.../common/junit48/JUnit46StackTraceWriter.java | 60 -
surefire-providers/pom.xml | 2 +-
surefire-providers/surefire-junit-platform/pom.xml | 6 +-
.../surefire/junitplatform/RunListenerAdapter.java | 303 +++--
.../surefire/junitplatform/JUnit47SuiteTest.java | 16 +-
.../junitplatform/JUnitPlatformProviderTest.java | 57 +-
.../junitplatform/RunListenerAdapterTest.java | 223 +++-
surefire-providers/surefire-junit3/pom.xml | 2 +-
.../maven/surefire/junit/JUnit3Provider.java | 2 +-
.../junit/TestListenerInvocationHandler.java | 41 +-
.../maven/surefire/junit/JUnitTestSetTest.java | 12 +-
surefire-providers/surefire-junit4/pom.xml | 2 +-
.../maven/surefire/junit4/JUnit4Provider.java | 2 +-
.../maven/surefire/junit4/TestResolverFilter.java | 2 +-
surefire-providers/surefire-junit47/pom.xml | 2 +-
.../surefire/junitcore/JUnitCoreRunListener.java | 20 +-
.../junitcore/NonConcurrentRunListener.java | 21 +-
.../junitcore/JUnitCoreRunListenerTest.java | 2 -
surefire-providers/surefire-testng-utils/pom.xml | 2 +-
surefire-providers/surefire-testng/pom.xml | 2 +-
.../maven/surefire/testng/TestNGReporter.java | 32 +-
.../apache/maven/surefire/testng/TestSuite.java | 4 +-
surefire-report-parser/pom.xml | 6 +-
.../surefire/report/SurefireReportParser.java | 29 +-
.../surefire/report/SurefireReportParserTest.java | 42 +-
.../test-reports/com.shape.CircleTest.txt | 16 +-
.../test-reports/com.shapeclone.CircleTest.txt | 16 +-
surefire-shadefire/pom.xml | 2 +-
103 files changed, 3114 insertions(+), 1527 deletions(-)
rename {surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4 => surefire-api/src/main/java/org/apache/maven/surefire/util/internal}/ClassMethod.java (63%)
copy surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/{Surefire1211JUnitTestNgIT.java => Surefire1585IT.java} (66%)
delete mode 100644 surefire-its/src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.SucceedingTest.xml
delete mode 100644 surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.FailingTest.txt
delete mode 100644 surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.SucceedingTest.txt
copy surefire-its/src/test/resources/{junit-platform/src/test/java/junitplatform/JUnitPlatformTest.java => junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.javax} (72%)
copy surefire-its/src/test/resources/{junit-platform-engine-vintage => surefire-1585-junit4-vintage}/pom.xml (75%)
copy surefire-its/src/test/resources/{surefire-1185/src/test/java/pkg/RunningTest.java => surefire-1585-junit4-vintage/src/test/java/JUnit4Test.java} (95%)
copy surefire-its/src/test/resources/{junit-platform-tags => surefire-1585-jupiter-api}/pom.xml (84%)
copy surefire-its/src/test/resources/{junit-platform/src/test/java/junitplatform/JUnitPlatformTest.java => surefire-1585-jupiter-api/src/test/java/JupiterTest.java} (92%)
rename surefire-its/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/{surefire-reports => surefire-reports2}/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml (100%)
rename surefire-its/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/{surefire-reports => surefire-reports2}/org.apache.maven.surefireReport.surefireReportTest.MyClassTest.txt (86%)
rename surefire-its/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/{surefire-reports => surefire-reports2}/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml (97%)
rename surefire-its/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/{surefire-reports => surefire-reports2}/org.apache.maven.surefireReport.surefireReportTest.MyClassTest.txt (86%)
delete mode 100644 surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit46StackTraceWriter.java
copy maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/JUnit4SuiteTest.java => surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnit47SuiteTest.java (78%)
[maven-surefire] 01/01: [SUREFIRE-1004] Support full artifact coord
filter in dependenciesToScan
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch SUREFIRE-1004
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit d2d516ea269ae72fa2a5675ffeaee8433f12ac7c
Author: Bindul Bhowmik <bi...@gmail.com>
AuthorDate: Thu Jan 11 10:56:38 2018 -0700
[SUREFIRE-1004] Support full artifact coord filter in dependenciesToScan
- "dependenciesToScan" now uses PatternIncludesArtifactFilter from
maven-common-artifact-filters to support specifying filters across all
dimensions of an artifact coordinate, with glob wildcards, as:
groupId[:artifactId[:type[:classifier][:version]]]
Previously, the filter only matched against the artifact's groupId and
artifactId.
- This allows, for example, inclusion of tests from a "test-jar" type
dependency without also including the non-test-jar dependency.
- Updated plugin parameter and site documentation.
Related Issues:
- [SUREFIRE-1004] Enhance pattern/wildcard capabilities for
dependenciesToScan to GAVT
Co-authored-by: Shannon Carey <re...@gmail.com>
Co-authored-by: Bindul Bhowmik <bi...@gmail.com>
---
.gitignore | 1 +
.../plugin/surefire/AbstractSurefireMojo.java | 28 +++-
.../plugin/surefire/util/DependencyScanner.java | 49 +++---
.../surefire/util/DependenciesScannerTest.java | 167 +++++++++++++++++++--
.../org/apache/maven/surefire/JUnit4SuiteTest.java | 2 +-
.../site/apt/examples/inclusion-exclusion.apt.vm | 40 +++++
maven-surefire-plugin/src/site/fml/faq.fml | 5 +-
...nTestFromDependencyJarsTypeAndClassifierIT.java | 57 +++++++
.../pom.xml | 29 ++++
.../surefire-1004-module1/pom.xml | 66 ++++++++
.../test/java/org/acme/tests/ClasspathTestA.java | 36 +++++
.../surefire-1004-testjar/pom.xml | 71 +++++++++
.../org/acme/classifiedtests/ClassifiedTestA.java | 31 ++++
.../test/java/org/acme/othertests/OtherTestA.java | 33 ++++
.../src/test/java/org/acme/tests/TestA.java | 31 ++++
.../src/test/java/org/acme/tests/TestB.java | 31 ++++
16 files changed, 629 insertions(+), 48 deletions(-)
diff --git a/.gitignore b/.gitignore
index 19e9e0b..33eba3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ build
.classpath
.project
.settings
+.checkstyle
.idea
.surefire-*
.DS_Store
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index ba7f1e0..f938202 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -714,12 +714,28 @@ public abstract class AbstractSurefireMojo
/**
* List of dependencies to scan for test classes to include in the test run.
* The child elements of this element must be <dependency> elements, and the
- * contents of each of these elements must be a string which follows the format:
- * <br>
- * <i>groupId:artifactId</i>. For example: <i>org.acme:project-a</i>.
- * <br>
- * Since version 2.22.0 you can scan for test classes from a project
- * dependency of your multi-module project.
+ * contents of each of these elements must be a string which follows the general form:
+ *
+ * <p>{@code groupId[:artifactId[:type[:classifier][:version]]]}</p>
+ *
+ * <p>The wildcard character <code>*</code> can be used within the sub parts of those composite identifiers to
+ * do glob-like pattern matching. The classifier may be omitted when matching dependencies without a classifier.</p>
+ *
+ * <p>Examples:</p>
+ *
+ * <ul>
+ * <li>{@code group} or, equivalently, {@code group:*}</li>
+ * <li>{@code g*p:*rtifac*}</li>
+ * <li>{@code group:*:jar}</li>
+ * <li>{@code group:artifact:*:1.0.0} (no classifier)</li>
+ * <li>{@code group:*:test-jar:tests}</li>
+ * <li>{@code *:artifact:*:*:1.0.0}</li>
+ * </ul>
+ *
+ * <p>Since version 2.22.0 you can scan for test classes from a project
+ * dependency of your multi-module project.</p>
+ *
+ * <p>In versions before 3.0.0-M4, only <code>groupId:artifactId</code> is supported.</p>
*
* @since 2.15
*/
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
index 34e8e7f..7ddcfbe 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
@@ -19,12 +19,17 @@ package org.apache.maven.plugin.surefire.util;
* under the License.
*/
-import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertJarFileResourceToJavaClassName;
-import static org.apache.maven.plugin.surefire.util.ScannerUtil.isJavaClassFile;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
+import org.apache.maven.surefire.testset.TestFilter;
+import org.apache.maven.surefire.testset.TestListResolver;
+import org.apache.maven.surefire.util.DefaultScanResult;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.List;
@@ -32,11 +37,8 @@ import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.surefire.testset.TestFilter;
-import org.apache.maven.surefire.testset.TestListResolver;
-import org.apache.maven.surefire.util.DefaultScanResult;
+import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertJarFileResourceToJavaClassName;
+import static org.apache.maven.plugin.surefire.util.ScannerUtil.isJavaClassFile;
/**
* Scans dependencies looking for tests.
@@ -93,28 +95,29 @@ public class DependencyScanner
}
}
- public static List<Artifact> filter( List<Artifact> artifacts, List<String> groupArtifactIds )
+ /**
+ *
+ * @param artifacts a list to filter
+ * @param artifactPatterns a list of strings in the form
+ * <pre>groupId[:artifactId[:type[:classifier][:version]]]</pre>
+ * @return list of items from <code>artifacts</code> that match any of the filters in <code>groupArtifactIds</code>,
+ * empty if none match
+ */
+ public static List<Artifact> filter( List<Artifact> artifacts, List<String> artifactPatterns )
{
- List<Artifact> matches = new ArrayList<>();
- if ( groupArtifactIds == null || artifacts == null )
+ if ( artifactPatterns == null || artifacts == null || artifacts.isEmpty() )
{
- return matches;
+ return Collections.emptyList();
}
+
+ PatternIncludesArtifactFilter artifactFilter = new PatternIncludesArtifactFilter( artifactPatterns );
+
+ List<Artifact> matches = new ArrayList<>();
for ( Artifact artifact : artifacts )
{
- for ( String groups : groupArtifactIds )
+ if ( artifactFilter.include( artifact ) )
{
- String[] groupArtifact = groups.split( ":" );
- if ( groupArtifact.length != 2 )
- {
- throw new IllegalArgumentException( "dependencyToScan argument should be in format"
- + " 'groupid:artifactid': " + groups );
- }
- if ( artifact.getGroupId().matches( groupArtifact[0] )
- && artifact.getArtifactId().matches( groupArtifact[1] ) )
- {
- matches.add( artifact );
- }
+ matches.add( artifact );
}
}
return matches;
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
index e55c6a9..e0a3e49 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
@@ -19,12 +19,17 @@ package org.apache.maven.plugin.surefire.util;
* under the License.
*/
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.surefire.testset.TestListResolver;
import org.apache.maven.surefire.util.ScanResult;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.io.FileOutputStream;
@@ -36,12 +41,16 @@ import java.util.zip.ZipOutputStream;
* @author Aslak Knutsen
*/
public class DependenciesScannerTest
- extends TestCase
{
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder();
+
+ @Test
public void testLocateTestClasses()
throws Exception
{
- File testFile = writeTestFile();
+ File testFile = writeTestFile( "DependenciesScannerTest-tests.jar", "org/test/TestA.class", "org/test/TestB.class" );
// use target as people can configure ide to compile in an other place than maven
Artifact artifact =
@@ -56,11 +65,7 @@ public class DependenciesScannerTest
include.add( "**/*A.java" );
List<String> exclude = new ArrayList<>();
- List<File> dependenciesToScan = new ArrayList<>();
- for ( Artifact a : DependencyScanner.filter( Collections.singletonList( artifact ), scanDependencies ) )
- {
- dependenciesToScan.add( a.getFile() );
- }
+ List<File> dependenciesToScan = filterArtifactsAsFiles(scanDependencies, Collections.singletonList(artifact));
DependencyScanner scanner =
new DependencyScanner( dependenciesToScan, new TestListResolver( include, exclude ) );
@@ -74,18 +79,150 @@ public class DependenciesScannerTest
assertEquals( 1, props.size() );
}
- private File writeTestFile()
+ /**
+ * Test for artifact with classifier
+ */
+ @Test
+ public void testLocateTestClassesFromArtifactWithClassifier()
+ throws Exception
+ {
+ File testJarFile = writeTestFile( "DependenciesScannerTest2-1.0-tests-jdk15.jar", "org/test/TestA.class",
+ "org/test/other/TestAA.class", "org/test/TestB.class" );
+ Artifact testArtifact =
+ new DefaultArtifact( "org.surefire.dependency", "dependent-artifact2",
+ VersionRange.createFromVersion( "1.0" ), "test", "jar", "tests-jdk15", null );
+ testArtifact.setFile( testJarFile );
+
+ List<String> scanDependencies = new ArrayList<String>();
+ scanDependencies.add( "org.surefire.dependency:dependent-artifact2:*:*:tests-jdk15" );
+
+ List<String> include = new ArrayList<String>();
+ include.add( "**/*A.java" );
+ List<String> exclude = new ArrayList<String>();
+
+
+ List<File> filesToScan = filterArtifactsAsFiles(scanDependencies, Collections.singletonList(testArtifact));
+
+ DependencyScanner scanner =
+ new DependencyScanner( filesToScan, new TestListResolver( include, exclude ) );
+
+ ScanResult classNames = scanner.scan();
+ assertNotNull( classNames );
+ assertEquals( 2, classNames.size() );
+
+ Map<String, String> props = new HashMap<String, String>();
+ classNames.writeTo( props );
+ assertEquals( 2, props.size() );
+ }
+
+ /**
+ * Test with type when two artifacts are present, should only find the class in jar with correct type
+ */
+ @Test
+ public void testLocateTestClassesFromMultipleArtifactsWithType()
+ throws Exception
+ {
+ File jarFile =
+ writeTestFile( "DependenciesScannerTest3-1.0.jar", "org/test/ClassA.class", "org/test/ClassB.class" );
+ Artifact mainArtifact = new DefaultArtifact( "org.surefire.dependency", "dependent-artifact3",
+ VersionRange.createFromVersion( "1.0" ), "test", "jar", null,
+ new DefaultArtifactHandler() );
+ mainArtifact.setFile( jarFile );
+
+ File testJarFile =
+ writeTestFile( "DependenciesScannerTest3-1.0-tests.jar", "org/test/TestA.class", "org/test/TestB.class" );
+ Artifact testArtifact = new DefaultArtifact( "org.surefire.dependency", "dependent-artifact3",
+ VersionRange.createFromVersion( "1.0" ), "test", "test-jar", null,
+ new DefaultArtifactHandler() );
+ testArtifact.setFile( testJarFile );
+
+ List<String> scanDependencies = new ArrayList<String>();
+ scanDependencies.add( "org.surefire.dependency:dependent-artifact3:test-jar" );
+
+ List<String> include = new ArrayList<String>();
+ include.add( "**/*A.java" );
+ List<String> exclude = new ArrayList<String>();
+
+ List<Artifact> artifacts = Arrays.asList( mainArtifact, testArtifact );
+
+ List<File> filesToScan = filterArtifactsAsFiles(scanDependencies, artifacts);
+
+ DependencyScanner scanner = new DependencyScanner( filesToScan, new TestListResolver( include, exclude ) );
+
+ ScanResult classNames = scanner.scan();
+ assertNotNull( classNames );
+ assertEquals( 1, classNames.size() );
+ assertEquals( "org.test.TestA", classNames.getClassName( 0 ) );
+
+ Map<String, String> props = new HashMap<String, String>();
+ classNames.writeTo( props );
+ assertEquals( 1, props.size() );
+ }
+
+ /**
+ * Test to pick the right version of an artifact to scan
+ */
+ @Test
+ public void testLocateTestClassesFromMultipleVersionsOfArtifact()
+ throws Exception
+ {
+ File jarFile10 =
+ writeTestFile( "DependenciesScannerTest4-1.0.jar", "org/test/ClassA.class", "org/test/ClassB.class" );
+ Artifact artifact10 = new DefaultArtifact( "org.surefire.dependency", "dependent-artifact4",
+ VersionRange.createFromVersion( "1.0" ), "test", "jar", null,
+ new DefaultArtifactHandler() );
+ artifact10.setFile( jarFile10 );
+
+ File jarFile20 =
+ writeTestFile( "DependenciesScannerTest4-2.0.jar", "org/test2/ClassA.class", "org/test2/ClassB.class" );
+ Artifact artifact20 = new DefaultArtifact( "org.surefire.dependency", "dependent-artifact4",
+ VersionRange.createFromVersion( "2.0" ), "test", "jar", null,
+ new DefaultArtifactHandler() );
+ artifact20.setFile( jarFile20 );
+
+ List<String> scanDependencies = new ArrayList<String>();
+ scanDependencies.add( "org.surefire.dependency:dependent-artifact4:*:2.0" );
+
+ List<String> include = new ArrayList<String>();
+ include.add( "**/*A.java" );
+ List<String> exclude = new ArrayList<String>();
+
+ List<Artifact> artifacts = Arrays.asList( artifact10, artifact20 );
+
+ List<File> filesToScan = filterArtifactsAsFiles(scanDependencies, artifacts);
+ DependencyScanner scanner = new DependencyScanner( filesToScan, new TestListResolver( include, exclude ) );
+
+ ScanResult classNames = scanner.scan();
+ assertNotNull( classNames );
+ assertEquals( 1, classNames.size() );
+ assertEquals( "org.test2.ClassA", classNames.getClassName( 0 ) );
+
+ Map<String, String> props = new HashMap<String, String>();
+ classNames.writeTo( props );
+ assertEquals( 1, props.size() );
+ assertFalse( props.values().contains( "org.test.ClassA" ) );
+ }
+
+ private static List<File> filterArtifactsAsFiles(List<String> scanDependencies, List<Artifact> artifacts) {
+ List<File> filesToScan = new ArrayList<>();
+ for (Artifact a : DependencyScanner.filter(artifacts, scanDependencies)) {
+ filesToScan.add(a.getFile());
+ }
+ return filesToScan;
+ }
+
+ private File writeTestFile( String fileName, String... entries )
throws Exception
{
- File output = new File( "target/DependenciesScannerTest-tests.jar" );
- output.delete();
+ File output = tempFolder.newFile( fileName );
try ( ZipOutputStream out = new ZipOutputStream( new FileOutputStream( output ) ) )
{
- out.putNextEntry( new ZipEntry( "org/test/TestA.class" ) );
- out.closeEntry();
- out.putNextEntry( new ZipEntry( "org/test/TestB.class" ) );
- out.closeEntry();
+ for ( String entry : entries )
+ {
+ out.putNextEntry( new ZipEntry( entry ) );
+ out.closeEntry();
+ }
return output;
}
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
index 2f1f01f..9c6037b 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
@@ -70,7 +70,7 @@ public class JUnit4SuiteTest extends TestCase
suite.addTestSuite( SurefirePropertiesTest.class );
suite.addTestSuite( SpecificFileFilterTest.class );
suite.addTest( new JUnit4TestAdapter( DirectoryScannerTest.class ) );
- suite.addTestSuite( DependenciesScannerTest.class );
+ suite.addTest( new JUnit4TestAdapter( DependenciesScannerTest.class ) );
suite.addTestSuite( RunEntryStatisticsMapTest.class );
suite.addTestSuite( WrappedReportEntryTest.class );
suite.addTestSuite( StatelessXmlReporterTest.class );
diff --git a/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm b/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
index e5d3408..15c72ef 100644
--- a/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt.vm
@@ -209,4 +209,44 @@ Inclusions and Exclusions of Tests
Multiple formats can be additionally combined.
This syntax can be used in parameters: <<<test>>>, <<<includes>>>, <<<excludes>>>, <<<includesFile>>>, <<<excludesFile>>>.
+* Tests from dependencies
+
+ By default, ${thisPlugin} will only scan for test classes to execute in the configured <<<testSourceDirectory>>>. To
+ have the plugin scan dependencies to find test classes to execute, use the <<<dependenciesToScan>>> configuration.
+ Dependencies can be specified using the <<<groupId[:artifactId[:type[:classifier][:version]]]>>> format, and must already
+ be <<<dependency>>> elements in scope.
+
+ <Note:> Support for version, type and classifier was introduced in version <<<3.0.0-M4>>>. When using earlier versions,
+ ${thisPlugin} will fail with an <<<IllegalArgumentException>>> if more than groupId and artifactId are specified.
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <dependenciesToScan>
+ <dependency>org.acme:project-a</dependency>
+ <dependency>org.acme:project-b:test-jar</dependency>
+ <dependency>org.acme:project-c:*:tests-jdk15</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+ The configuration above will search for test classes in:
+
+ * All dependencies with the groupId <<<org.acme>>> and artifactId <<<project-a>>>
+
+ * All dependencies with the groupId <<<org.acme>>> and artifactId <<<project-b>>> and type <<<test-jar>>>
+
+ * All dependencies with the groupId <<<org.acme>>> and artifactId <<<project-c>>> and classifier <<<tests-jdk15>>>
diff --git a/maven-surefire-plugin/src/site/fml/faq.fml b/maven-surefire-plugin/src/site/fml/faq.fml
index 96053cf..6cb55f4 100644
--- a/maven-surefire-plugin/src/site/fml/faq.fml
+++ b/maven-surefire-plugin/src/site/fml/faq.fml
@@ -44,9 +44,8 @@ under the License.
<answer>
<p>
Visit this link for your reference,
- <a href="http://maven.apache.org/guides/mini/guide-attached-tests.html">
- | Attaching tests
- </a>
+ <a href="http://maven.apache.org/guides/mini/guide-attached-tests.html"> Attaching tests</a>.
+ Also see the examples for <a href="examples/inclusion-exclusion.html">Inclusions and Exclusions of Tests</a>.
</p>
</answer>
</faq>
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1004RunTestFromDependencyJarsTypeAndClassifierIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1004RunTestFromDependencyJarsTypeAndClassifierIT.java
new file mode 100644
index 0000000..d0f7aa6
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1004RunTestFromDependencyJarsTypeAndClassifierIT.java
@@ -0,0 +1,57 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * 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 static org.junit.Assert.*;
+
+import java.util.Collection;
+
+import org.apache.maven.surefire.its.fixture.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+public class Surefire1004RunTestFromDependencyJarsTypeAndClassifierIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Test
+ public void shouldScanAndRunTestsInDependencyJars()
+ throws Exception
+ {
+ SurefireLauncher launcher = unpack( "surefire-1004-RunTestFromDependencyJarsTypeAndClassifier" );
+ launcher.addGoal("test").addGoal("install");
+ OutputValidator wholeExecValidator = launcher.executeCurrentGoals();
+ wholeExecValidator.verifyErrorFreeLog();
+
+ OutputValidator module1 = launcher.getSubProjectValidator("surefire-1004-module1");
+ module1.assertTestSuiteResults(3, 0, 0, 0);
+
+ // Tests from dependencies
+ wholeExecValidator.verifyTextInLog( "Running org.acme.tests.TestA" );
+ wholeExecValidator.verifyTextInLog( "Running org.acme.classifiedtests.ClassifiedTestA" );
+ // Tests from module1 to verify classpath
+ wholeExecValidator.verifyTextInLog( "Running org.acme.tests.ClasspathTest" );
+ // Should not run these tests
+ Collection<String> logLines = wholeExecValidator.loadLogLines();
+ assertFalse( logLines.contains( "org.acme.othertests.OtherTestA" ) );
+ assertFalse( logLines.contains( "org.acme.tests.TestB" ) );
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/pom.xml b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/pom.xml
new file mode 100644
index 0000000..783dbf7
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/pom.xml
@@ -0,0 +1,29 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>surefire-1004-RunTestFromDependencyJarsTypeAndClassifier</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <modules>
+ <module>surefire-1004-testjar</module>
+ <module>surefire-1004-module1</module>
+ </modules>
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/pom.xml b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/pom.xml
new file mode 100644
index 0000000..6986b5c
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/pom.xml
@@ -0,0 +1,66 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-1004-RunTestFromDependencyJarsTypeAndClassifier</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <groupId>org.apache.maven.plugins.surefire.dependency-jar</groupId>
+ <artifactId>surefire-1004-module1</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.plugins.surefire.dependency-jar</groupId>
+ <artifactId>surefire-1004-testjar</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins.surefire.dependency-jar</groupId>
+ <artifactId>surefire-1004-testjar</artifactId>
+ <version>${project.version}</version>
+ <classifier>othertests</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins.surefire.dependency-jar</groupId>
+ <artifactId>surefire-1004-testjar</artifactId>
+ <version>${project.version}</version>
+ <classifier>classifiedtests</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>*TestA*</include>
+ </includes>
+ <!-- Tests from othertests should not run -->
+ <dependenciesToScan>
+ <dependency>org.apache.maven.plugins.surefire.dependency-jar:surefire-1004-testjar:test-jar</dependency>
+ <dependency>org.apache.maven.plugins.surefire.dependency-jar:surefire-1004-testjar:*:classifiedtests</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/src/test/java/org/acme/tests/ClasspathTestA.java b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/src/test/java/org/acme/tests/ClasspathTestA.java
new file mode 100644
index 0000000..eb73da5
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-module1/src/test/java/org/acme/tests/ClasspathTestA.java
@@ -0,0 +1,36 @@
+package org.acme.tests;
+
+/*
+ * 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 org.junit.Test;
+
+public class ClasspathTestA
+{
+
+ @Test
+ public void verifyAllTestClassesAreInClasspath()
+ throws Exception
+ {
+ Class.forName( "org.acme.tests.TestA" );
+ Class.forName( "org.acme.tests.TestB" );
+ Class.forName( "org.acme.othertests.OtherTestA" );
+ Class.forName( "org.acme.classifiedtests.ClassifiedTestA" );
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/pom.xml b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/pom.xml
new file mode 100644
index 0000000..4467908
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/pom.xml
@@ -0,0 +1,71 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-1004-RunTestFromDependencyJarsTypeAndClassifier</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <groupId>org.apache.maven.plugins.surefire.dependency-jar</groupId>
+ <artifactId>surefire-1004-testjar</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>main-test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <includes><include>**/tests/**</include></includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>other-test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <includes><include>**/othertests/**</include></includes>
+ <classifier>othertests</classifier>
+ </configuration>
+ </execution>
+ <execution>
+ <id>classified-test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <includes><include>**/classifiedtests/**</include></includes>
+ <classifier>classifiedtests</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/classifiedtests/ClassifiedTestA.java b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/classifiedtests/ClassifiedTestA.java
new file mode 100644
index 0000000..a794470
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/classifiedtests/ClassifiedTestA.java
@@ -0,0 +1,31 @@
+package org.acme.classifiedtests;
+
+/*
+ * 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 org.junit.Test;
+
+public class ClassifiedTestA
+{
+
+ @Test
+ public void shouldRun()
+ {
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/othertests/OtherTestA.java b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/othertests/OtherTestA.java
new file mode 100644
index 0000000..4f479ca
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/othertests/OtherTestA.java
@@ -0,0 +1,33 @@
+package org.acme.othertests;
+
+/*
+ * 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 static org.junit.Assert.*;
+import org.junit.Test;
+
+public class OtherTestA
+{
+
+ @Test
+ public void shouldNotRun()
+ {
+ fail( "This test should not run" );
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestA.java b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestA.java
new file mode 100644
index 0000000..efcb956
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestA.java
@@ -0,0 +1,31 @@
+package org.acme.tests;
+
+/*
+ * 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 org.junit.Test;
+
+public class TestA
+{
+
+ @Test
+ public void shouldRun()
+ {
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestB.java b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestB.java
new file mode 100644
index 0000000..ce620c9
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1004-RunTestFromDependencyJarsTypeAndClassifier/surefire-1004-testjar/src/test/java/org/acme/tests/TestB.java
@@ -0,0 +1,31 @@
+package org.acme.tests;
+
+/*
+ * 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 org.junit.Test;
+
+public class TestB
+{
+
+ @Test
+ public void shouldRun()
+ {
+ }
+}