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 2015/04/03 23:57:50 UTC

maven-surefire git commit: [SUREFIRE] Extensions

Repository: maven-surefire
Updated Branches:
  refs/heads/s1 71160434f -> 030b2e93f


[SUREFIRE] Extensions


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/030b2e93
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/030b2e93
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/030b2e93

Branch: refs/heads/s1
Commit: 030b2e93fb004257da61f79f2680abb9a890793f
Parents: 7116043
Author: Tibor17 <ti...@lycos.com>
Authored: Fri Apr 3 23:55:15 2015 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Fri Apr 3 23:55:15 2015 +0200

----------------------------------------------------------------------
 maven-failsafe-plugin/pom.xml                   |   1 -
 maven-surefire-common/pom.xml                   |   5 +-
 .../maven/surefire/common/BeanManager.java      | 188 +++++++++++++++++++
 .../maven/surefire/common/ContextHolder.java    |  97 ++++++++++
 .../maven/surefire/common/ContextStatus.java    |  28 +++
 maven-surefire-extensions/pom.xml               |  46 +++++
 .../extensions/ExecutionLifeCycleListener.java  |  46 +++++
 .../maven/surefire/extensions/Extension.java    |  27 +++
 .../extensions/PluginExecutionContext.java      |  47 +++++
 .../api/DependencyScannerFileFilter.java        |  34 ++++
 .../api/DirectoryScannerFileFilter.java         |  31 +++
 maven-surefire-plugin/pom.xml                   |   1 -
 maven-surefire-report-plugin/pom.xml            |   1 -
 pom.xml                                         |   6 +
 surefire-api/pom.xml                            |   1 -
 surefire-booter/pom.xml                         |   1 -
 surefire-grouper/pom.xml                        |   1 -
 surefire-integration-tests/pom.xml              |   1 -
 surefire-providers/common-java5/pom.xml         |   1 -
 surefire-providers/common-junit3/pom.xml        |   1 -
 surefire-providers/common-junit4/pom.xml        |   1 -
 surefire-providers/common-junit48/pom.xml       |   1 -
 surefire-providers/pom.xml                      |   1 -
 surefire-providers/surefire-junit3/pom.xml      |   1 -
 surefire-providers/surefire-junit4/pom.xml      |   1 -
 surefire-providers/surefire-junit47/pom.xml     |   1 -
 .../surefire-testng-utils/pom.xml               |   1 -
 surefire-providers/surefire-testng/pom.xml      |   1 -
 surefire-report-parser/pom.xml                  |   1 -
 surefire-setup-integration-tests/pom.xml        |   1 -
 surefire-shadefire/pom.xml                      |   1 -
 31 files changed, 554 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-failsafe-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml
index 26ebeac..f7475a9 100644
--- a/maven-failsafe-plugin/pom.xml
+++ b/maven-failsafe-plugin/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-common/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index b49798a..ef1f245 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>maven-surefire-common</artifactId>
@@ -48,6 +47,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>maven-surefire-extensions</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
       <artifactId>surefire-api</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/BeanManager.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/BeanManager.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/BeanManager.java
new file mode 100644
index 0000000..1f18a1c
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/BeanManager.java
@@ -0,0 +1,188 @@
+package org.apache.maven.surefire.common;
+
+/*
+ * 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.apache.maven.plugin.AbstractMojoExecutionException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.surefire.extensions.ExecutionLifeCycleListener;
+import org.apache.maven.surefire.extensions.Extension;
+import org.apache.maven.surefire.extensions.PluginExecutionContext;
+import org.apache.maven.surefire.extensions.api.DependencyScannerFileFilter;
+import org.apache.maven.surefire.extensions.api.DirectoryScannerFileFilter;
+import org.apache.maven.surefire.testset.RunOrderParameters;
+import org.apache.maven.surefire.util.DefaultRunOrderCalculator;
+import org.apache.maven.surefire.util.RunOrderCalculator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ServiceLoader;
+
+public final class BeanManager
+    implements ExecutionLifeCycleListener
+{
+    private volatile DependencyScannerFileFilter dependencyScannerFileFilter;
+
+    private volatile DirectoryScannerFileFilter directoryScannerFileFilter;
+
+    private volatile RunOrderCalculator runOrderCalculator;
+
+    private final Collection<ExecutionLifeCycleListener> listeners = new ArrayList<ExecutionLifeCycleListener>();
+
+    public BeanManager()
+        throws MojoExecutionException
+    {
+        Collection<Extension> extensions = makeCollection( ServiceLoader.load( Extension.class ) );
+        for ( Extension extension : extensions )
+        {
+            if ( extension instanceof DependencyScannerFileFilter )
+            {
+                if ( dependencyScannerFileFilter != null )
+                {
+                    failAmbiguousExtension( extension, DependencyScannerFileFilter.class, extensions );
+                }
+                else
+                {
+                    dependencyScannerFileFilter = (DependencyScannerFileFilter) extension;
+                }
+            }
+            else if ( extension instanceof DirectoryScannerFileFilter )
+            {
+                if ( directoryScannerFileFilter != null )
+                {
+                    failAmbiguousExtension( extension, DirectoryScannerFileFilter.class, extensions );
+                }
+                else
+                {
+                    directoryScannerFileFilter = (DirectoryScannerFileFilter) extension;
+                }
+            }
+            else if ( extension instanceof RunOrderCalculator )
+            {
+                if ( runOrderCalculator != null )
+                {
+                    failAmbiguousExtension( extension, RunOrderCalculator.class, extensions );
+                }
+                else
+                {
+                    runOrderCalculator = (RunOrderCalculator) extension;
+                }
+            }
+
+            if ( extension instanceof ExecutionLifeCycleListener )
+            {
+                listeners.add( (ExecutionLifeCycleListener) extension );
+            }
+        }
+
+        for ( ExecutionLifeCycleListener listener : ServiceLoader.load( ExecutionLifeCycleListener.class ) )
+        {
+            this.listeners.add( listener );
+        }
+    }
+
+    public void executionStarted( String id )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.executionStarted( id );
+        }
+    }
+
+    public void contextValidated( String id, AbstractMojoExecutionException e )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.contextValidated( id, e );
+        }
+    }
+
+    public void contextInitialized( PluginExecutionContext context )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.contextInitialized( context );
+        }
+    }
+
+    public void providerExecutionStarted( String providerName, PluginExecutionContext context )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.providerExecutionStarted( providerName, context );
+        }
+    }
+
+    public void providerExecutionFinished( String providerName, PluginExecutionContext context, Exception e )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.providerExecutionFinished( providerName, context, e );
+        }
+    }
+
+    public void executionFinished( PluginExecutionContext context, AbstractMojoExecutionException e )
+    {
+        for ( ExecutionLifeCycleListener listener : listeners )
+        {
+            listener.executionFinished( context, e );
+        }
+    }
+
+    public RunOrderCalculator createRunOrderCalculator( PluginExecutionContext context )
+    {
+        if ( runOrderCalculator != null )
+        {
+            return runOrderCalculator;
+        }
+        else
+        {
+            String runOrder = context.getRunOrder();
+            String statisticsHash = context.getRunStatisticsFileNameHash();
+            int threadCount = context.getThreadCount();//@todo be more smart and distinguish between class/method...
+            RunOrderParameters runOrderParameters = new RunOrderParameters( runOrder, statisticsHash );
+            return new DefaultRunOrderCalculator( runOrderParameters, threadCount );
+        }
+    }
+
+    private static void failAmbiguousExtension( Extension extension, Class<?> type, Collection<Extension> all )
+        throws MojoExecutionException
+    {
+        String extensions = "\n";
+        for ( Extension ext : all )
+        {
+            extensions += ext.getClass();
+            extensions += "\n";
+        }
+        String msg = String.format( "Too ambiguous bean %s declaration of type %s. See all beans: %s",
+                                    extension, type.getName(), extensions );
+
+        throw new MojoExecutionException( msg );
+    }
+
+    private static Collection<Extension> makeCollection( ServiceLoader<Extension> extensions )
+    {
+        Collection<Extension> c = new ArrayList<Extension>();
+        for ( Extension extension : extensions )
+        {
+            c.add( extension );
+        }
+        return c;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextHolder.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextHolder.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextHolder.java
new file mode 100644
index 0000000..331b1b7
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextHolder.java
@@ -0,0 +1,97 @@
+package org.apache.maven.surefire.common;
+
+/*
+ * 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.apache.maven.surefire.extensions.PluginExecutionContext;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import static org.apache.maven.surefire.common.ContextStatus.*;
+
+public final class ContextHolder<T extends PluginExecutionContext>
+{
+    private final Object lock;
+
+    private final Class<T> contextType;
+
+    private volatile T context;
+
+    private volatile ContextStatus status;
+
+    public ContextHolder( Class<T> contextType )
+    {
+        status = NOT_LOADED;
+        this.contextType = contextType;
+        lock = new Object();
+    }
+
+    public boolean isInitialized()
+    {
+        getContext();
+        return status == LOADED;
+    }
+
+    public boolean isMultipleSpiContext()
+    {
+        return status == FAILED_WITH_MORE_INSTANCES;
+    }
+
+    /**
+     * If the context is null, the default plugin context is taken.
+     */
+    public T getContext()
+    {
+        if ( status == NOT_LOADED )
+        {
+            synchronized ( lock )
+            {
+                if ( status == NOT_LOADED )
+                {
+                    ServiceLoader<T> spi = ServiceLoader.load( contextType );
+                    Iterator<T> it = spi.iterator();
+
+                    T currentContext = null;
+                    if ( it.hasNext() )
+                    {
+                        currentContext = it.next();
+                    }
+
+                    if ( currentContext == null )
+                    {
+                        status = FAILED;
+                    }
+                    else if ( it.hasNext() )
+                    {
+                        status = FAILED_WITH_MORE_INSTANCES;
+                    }
+                    else
+                    {
+                        context = currentContext;
+                        status = LOADED;
+                    }
+                }
+            }
+        }
+
+        return context;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextStatus.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextStatus.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextStatus.java
new file mode 100644
index 0000000..9350b70
--- /dev/null
+++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/common/ContextStatus.java
@@ -0,0 +1,28 @@
+package org.apache.maven.surefire.common;
+
+/*
+ * 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.
+ */
+
+/**
+ * Context status.
+ */
+enum ContextStatus
+{
+    NOT_LOADED, LOADED, FAILED, FAILED_WITH_MORE_INSTANCES
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/pom.xml b/maven-surefire-extensions/pom.xml
new file mode 100644
index 0000000..2cdd9a2
--- /dev/null
+++ b/maven-surefire-extensions/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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</artifactId>
+    <version>2.19-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-surefire-extensions</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>surefire-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/ExecutionLifeCycleListener.java
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/ExecutionLifeCycleListener.java b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/ExecutionLifeCycleListener.java
new file mode 100644
index 0000000..525137a
--- /dev/null
+++ b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/ExecutionLifeCycleListener.java
@@ -0,0 +1,46 @@
+package org.apache.maven.surefire.extensions;
+
+/*
+ * 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.apache.maven.plugin.AbstractMojoExecutionException;
+
+/**
+ * Life cycle of plugin execution is split in phases:<p>
+ *     <ul>
+ *         <li><em>executionStarted</em> called anyway
+ *         <li><em>contextValidated</em> If plugin parameters validation fails, the last phase is directly called.
+ *         <li><em>contextInitialized</em>
+ *         <li><em>providerExecutionStarted</em> and <em>providerExecutionFinished</em> both run for each provider.
+ *         <li><em>executionFinished</em> called anyway
+ *     </ul>
+ * The phases <em>providerExecutionStarted</em> and <em>providerExecutionFinished</em> may be executed
+ * several times depending on the number of providers.<p>
+ * The plugin context is just only one instance and it is initialized in the phase <em>contextInitialized</em>.
+ * The context is unmodifiable and valid until after last <em>executionFinished</em> was called.
+ */
+public interface ExecutionLifeCycleListener
+{
+    void executionStarted( String id );
+    void contextValidated( String id, AbstractMojoExecutionException e );
+    void contextInitialized( PluginExecutionContext context );
+    void providerExecutionStarted( String providerName, PluginExecutionContext context );
+    void providerExecutionFinished( String providerName, PluginExecutionContext context, Exception e );
+    void executionFinished( PluginExecutionContext context, AbstractMojoExecutionException e );
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/Extension.java
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/Extension.java b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/Extension.java
new file mode 100644
index 0000000..5129ad4
--- /dev/null
+++ b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/Extension.java
@@ -0,0 +1,27 @@
+package org.apache.maven.surefire.extensions;
+
+/*
+ * 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.
+ */
+
+/**
+ * The marker interface which denotes SPI Extension.
+ */
+public interface Extension
+{
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/PluginExecutionContext.java
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/PluginExecutionContext.java b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/PluginExecutionContext.java
new file mode 100644
index 0000000..5f5474d
--- /dev/null
+++ b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/PluginExecutionContext.java
@@ -0,0 +1,47 @@
+package org.apache.maven.surefire.extensions;
+
+/*
+ * 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.apache.maven.surefire.testset.TestListResolver;
+
+/**
+ * The context is implemented by <em>maven-surefire-common</em> module, however the user may provide own SPI context.
+ * If the SPI context is more than one, the phase <em>contextValidated</em> is called with exception and the lifecycle
+ * is finished with <em>executionFinished</em> and throwing {@link org.apache.maven.plugin.MojoExecutionException}
+ * in the plugin.
+ */
+public interface PluginExecutionContext
+{
+    String id();
+    String phase();
+    boolean isSurefirePlugin();
+    boolean isFailsafePlugin();
+    TestListResolver getSpecificTests();
+    TestListResolver getIncludedAndExcludedTests();
+    String getRunOrder();
+    String getRunStatisticsFileNameHash();
+    String getParallel();
+    boolean getUseUnlimitedThreads();
+    int getThreadsPerCpuCore();
+    int getThreadCount();
+    int getThreadCountSuites();
+    int getThreadCountClasses();
+    int getThreadCountMethods();
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DependencyScannerFileFilter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DependencyScannerFileFilter.java b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DependencyScannerFileFilter.java
new file mode 100644
index 0000000..5860a5d
--- /dev/null
+++ b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DependencyScannerFileFilter.java
@@ -0,0 +1,34 @@
+package org.apache.maven.surefire.extensions.api;
+
+/*
+ * 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.apache.maven.surefire.extensions.Extension;
+
+import java.io.File;
+import java.util.Set;
+
+/**
+ * Additional filter applied after <em>DependencyScanner</em> in particular dependency artifact.
+ */
+public interface DependencyScannerFileFilter
+    extends Extension
+{
+    void scanTo( Set<String> classFiles, File dependency );
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DirectoryScannerFileFilter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DirectoryScannerFileFilter.java b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DirectoryScannerFileFilter.java
new file mode 100644
index 0000000..bdf7e2d
--- /dev/null
+++ b/maven-surefire-extensions/src/main/java/org/apache/maven/surefire/extensions/api/DirectoryScannerFileFilter.java
@@ -0,0 +1,31 @@
+package org.apache.maven.surefire.extensions.api;
+
+/*
+ * 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.apache.maven.surefire.extensions.Extension;
+
+import java.io.File;
+import java.util.Set;
+
+public interface DirectoryScannerFileFilter
+    extends Extension
+{
+    void scanTo( Set<String> classFiles, File testClassesDirectory );
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/pom.xml b/maven-surefire-plugin/pom.xml
index c3f3fa7..8cd1266 100644
--- a/maven-surefire-plugin/pom.xml
+++ b/maven-surefire-plugin/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/maven-surefire-report-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml
index f6e7ccc..8f21d15 100644
--- a/maven-surefire-report-plugin/pom.xml
+++ b/maven-surefire-report-plugin/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <groupId>org.apache.maven.plugins</groupId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0b95611..c90ef99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
     <module>maven-surefire-report-plugin</module>
     <module>surefire-setup-integration-tests</module>
     <module>surefire-integration-tests</module>
+    <module>../maven-surefire-extensions</module>
   </modules>
 
   <scm>
@@ -95,6 +96,11 @@
     <dependencies>
       <dependency>
         <groupId>org.apache.maven.surefire</groupId>
+        <artifactId>maven-surefire-extensions</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.surefire</groupId>
         <artifactId>surefire-api</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-api/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-api/pom.xml b/surefire-api/pom.xml
index 6f66e66..8c91704 100644
--- a/surefire-api/pom.xml
+++ b/surefire-api/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-api</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-booter/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml
index c1287f1..f7a1a15 100644
--- a/surefire-booter/pom.xml
+++ b/surefire-booter/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-booter</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-grouper/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-grouper/pom.xml b/surefire-grouper/pom.xml
index 747a959..91fcc79 100644
--- a/surefire-grouper/pom.xml
+++ b/surefire-grouper/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-grouper</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml
index d1171d5..5b118d8 100644
--- a/surefire-integration-tests/pom.xml
+++ b/surefire-integration-tests/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-integration-tests</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/common-java5/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/common-java5/pom.xml b/surefire-providers/common-java5/pom.xml
index 4a4e03e..eed7b70 100644
--- a/surefire-providers/common-java5/pom.xml
+++ b/surefire-providers/common-java5/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>common-java5</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/common-junit3/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit3/pom.xml b/surefire-providers/common-junit3/pom.xml
index f7897be..56b7f3e 100644
--- a/surefire-providers/common-junit3/pom.xml
+++ b/surefire-providers/common-junit3/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>common-junit3</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/common-junit4/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/pom.xml b/surefire-providers/common-junit4/pom.xml
index 5c39af3..80110ae 100644
--- a/surefire-providers/common-junit4/pom.xml
+++ b/surefire-providers/common-junit4/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>common-junit4</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/common-junit48/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit48/pom.xml b/surefire-providers/common-junit48/pom.xml
index 8724ad3..c8467b2 100644
--- a/surefire-providers/common-junit48/pom.xml
+++ b/surefire-providers/common-junit48/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>common-junit48</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/pom.xml b/surefire-providers/pom.xml
index 19963ad..269c9d3 100644
--- a/surefire-providers/pom.xml
+++ b/surefire-providers/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-providers</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/surefire-junit3/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit3/pom.xml b/surefire-providers/surefire-junit3/pom.xml
index 6b22234..ea7fec2 100644
--- a/surefire-providers/surefire-junit3/pom.xml
+++ b/surefire-providers/surefire-junit3/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-junit3</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/surefire-junit4/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit4/pom.xml b/surefire-providers/surefire-junit4/pom.xml
index 4a03783..5aa586e 100644
--- a/surefire-providers/surefire-junit4/pom.xml
+++ b/surefire-providers/surefire-junit4/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-junit4</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/surefire-junit47/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/pom.xml b/surefire-providers/surefire-junit47/pom.xml
index 78b35c8..d790438 100644
--- a/surefire-providers/surefire-junit47/pom.xml
+++ b/surefire-providers/surefire-junit47/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-junit47</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/surefire-testng-utils/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng-utils/pom.xml b/surefire-providers/surefire-testng-utils/pom.xml
index 64d8518..dc93c7d 100644
--- a/surefire-providers/surefire-testng-utils/pom.xml
+++ b/surefire-providers/surefire-testng-utils/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-testng-utils</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-providers/surefire-testng/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/pom.xml b/surefire-providers/surefire-testng/pom.xml
index 78ac427..7a33fe0 100644
--- a/surefire-providers/surefire-testng/pom.xml
+++ b/surefire-providers/surefire-testng/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire-providers</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-testng</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-report-parser/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-report-parser/pom.xml b/surefire-report-parser/pom.xml
index c86f9f4..13816de 100644
--- a/surefire-report-parser/pom.xml
+++ b/surefire-report-parser/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-report-parser</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-setup-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-setup-integration-tests/pom.xml b/surefire-setup-integration-tests/pom.xml
index 75d58c3..91c1486 100644
--- a/surefire-setup-integration-tests/pom.xml
+++ b/surefire-setup-integration-tests/pom.xml
@@ -25,7 +25,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-setup-integration-tests</artifactId>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/030b2e93/surefire-shadefire/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-shadefire/pom.xml b/surefire-shadefire/pom.xml
index 5fd6d3f..6b07a85 100644
--- a/surefire-shadefire/pom.xml
+++ b/surefire-shadefire/pom.xml
@@ -24,7 +24,6 @@
     <groupId>org.apache.maven.surefire</groupId>
     <artifactId>surefire</artifactId>
     <version>2.19-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
   </parent>
 
   <artifactId>surefire-shadefire</artifactId>