Repository: maven-surefire Updated Branches: refs/heads/master e89a0ae2d -> 86b253ba4
[SUREFIRE] added missing interface MainCliOptionsAware Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/668b1b92 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/668b1b92 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/668b1b92 Branch: refs/heads/master Commit: 668b1b927de52dab37e36762cb8c718474eda3f1 Parents: e89a0ae Author: Tibor17 <tibo...@lycos.com> Authored: Fri Jul 24 23:22:35 2015 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Sun Sep 6 22:57:53 2015 +0200 ---------------------------------------------------------------------- .../surefire/booter/BaseProviderFactory.java | 2 +- .../surefire/booter/MainCliOptionsAware.java | 35 ++++++++++++++++++++ .../surefire/booter/SurefireReflector.java | 13 ++++++++ .../maven/surefire/booter/ProviderFactory.java | 1 + 4 files changed, 50 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/668b1b92/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java index a3ba5db..980f6d9 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java @@ -45,7 +45,7 @@ import java.util.Map; */ public class BaseProviderFactory implements DirectoryScannerParametersAware, ReporterConfigurationAware, SurefireClassLoadersAware, TestRequestAware, - ProviderPropertiesAware, ProviderParameters, TestArtifactInfoAware, RunOrderParametersAware + ProviderPropertiesAware, ProviderParameters, TestArtifactInfoAware, RunOrderParametersAware, MainCliOptionsAware { private static final int ROOT_CHANNEL = 0; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/668b1b92/surefire-api/src/main/java/org/apache/maven/surefire/booter/MainCliOptionsAware.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MainCliOptionsAware.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MainCliOptionsAware.java new file mode 100644 index 0000000..b3b3c9d --- /dev/null +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MainCliOptionsAware.java @@ -0,0 +1,35 @@ +package org.apache.maven.surefire.booter; + +/* + * 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.cli.CommandLineOption; + +import java.util.List; + +/** + * CLI options in plugin (main) JVM process. + * + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @since 2.19 + */ +public interface MainCliOptionsAware +{ + void setMainCliOptions( List<CommandLineOption> mainCliOptions ); +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/668b1b92/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java index 912babe..0e53a8f 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java @@ -26,6 +26,8 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.List; import java.util.Map; + +import org.apache.maven.surefire.cli.CommandLineOption; import org.apache.maven.surefire.providerapi.ProviderParameters; import org.apache.maven.surefire.report.ReporterConfiguration; import org.apache.maven.surefire.report.ReporterFactory; @@ -80,6 +82,8 @@ public class SurefireReflector private final Class<?> testListResolver; + private final Class<?> mainCliOptions; + public SurefireReflector( ClassLoader surefireClassLoader ) { @@ -102,6 +106,7 @@ public class SurefireReflector runResult = surefireClassLoader.loadClass( RunResult.class.getName() ); booterParameters = surefireClassLoader.loadClass( ProviderParameters.class.getName() ); testListResolver = surefireClassLoader.loadClass( TestListResolver.class.getName() ); + mainCliOptions = surefireClassLoader.loadClass( MainCliOptionsAware.class.getName() ); } catch ( ClassNotFoundException e ) { @@ -263,6 +268,14 @@ public class SurefireReflector } } + public void setMainCliOptions( Object o, List<CommandLineOption> options ) + { + if ( mainCliOptions.isAssignableFrom( o.getClass() ) ) + { + ReflectionUtils.invokeSetter( o, "setMainCliOptions", List.class, options ); + } + } + public void setDirectoryScannerParameters( Object o, DirectoryScannerParameters dirScannerParams ) { final Object param = createDirectoryScannerParameters( dirScannerParams ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/668b1b92/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java ---------------------------------------------------------------------- diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java index d529980..c5d93ab 100644 --- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java +++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java @@ -100,6 +100,7 @@ public class ProviderFactory surefireReflector.setTestArtifactInfoAware( o, providerConfiguration.getTestArtifact() ); surefireReflector.setRunOrderParameters( o, providerConfiguration.getRunOrderParameters() ); surefireReflector.setIfDirScannerAware( o, providerConfiguration.getDirScannerParams() ); + surefireReflector.setMainCliOptions( o, providerConfiguration.getMainCliOptions() ); Object provider = surefireReflector.instantiateProvider( startupConfiguration.getActualClassName(), o ); currentThread.setContextClassLoader( systemClassLoader );