Repository: maven-surefire
Updated Branches:
  refs/heads/master 7b8b2ede6 -> e156ab812


[SUREFIRE-1053] small adjustment to suppress the new "defined twice" warning 
for properties that can not be set via system properties (or user properties) 
and thus need to be part of argLine (as well).


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

Branch: refs/heads/master
Commit: e156ab812f7df257bcc99f3034ac4dda8bdc6116
Parents: 7b8b2ed
Author: Andreas Gudian <agud...@apache.org>
Authored: Wed Oct 29 20:28:45 2014 +0100
Committer: Andreas Gudian <agud...@apache.org>
Committed: Wed Oct 29 20:28:45 2014 +0100

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java      |  3 +++
 .../its/jiras/Surefire1053SystemPropertiesIT.java  | 17 +++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e156ab81/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
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 5820a62..341b301 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
@@ -967,6 +967,9 @@ public abstract class AbstractSurefireMojo
                     intersection.add( systemProperty );
                 }
             }
+
+            Set<Object> ignored = 
result.propertiesThatCannotBeSetASystemProperties();
+            intersection.removeAll( ignored );
         }
         return intersection;
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e156ab81/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1053SystemPropertiesIT.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1053SystemPropertiesIT.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1053SystemPropertiesIT.java
index 09c1d6c..c33f6c9 100644
--- 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1053SystemPropertiesIT.java
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1053SystemPropertiesIT.java
@@ -19,10 +19,13 @@ package org.apache.maven.surefire.its.jiras;
  * under the License.
  */
 
+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;
 
+import static org.junit.Assert.assertFalse;
+
 /**
  * @author <a href="mailto:tibordig...@apache.org";>Tibor Digana (tibor17)</a>
  * @see {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1053}
@@ -41,15 +44,25 @@ public class Surefire1053SystemPropertiesIT
                                   + "file.encoding=...<argLine> instead" );
     }
     @Test
-    public void checkWarningsSysPropTwice()
+    public void checkWarningsSysPropTwice() throws Exception
     {
-        unpack().argLine( "-DmyArg=myVal2" )
+        OutputValidator validator = unpack()
+            .argLine( "-DmyArg=myVal2 -Dfile.encoding=ISO-8859-1" )
+            .sysProp( "file.encoding", "ISO-8859-1" )
             .executeTest()
             .verifyErrorFree( 1 )
             .verifyTextInLog( "The system property myArg is configured twice! "
                                   + "The property appears in <argLine/> and 
any of <systemPropertyVariables/>, "
                                   + "<systemProperties/> or user property." );
 
+        for ( String line : validator.loadLogLines() )
+        {
+            assertFalse( "no warning for file.encoding not in argLine",
+                         line.contains( "file.encoding cannot be set as system 
property, use <argLine>" ) );
+            assertFalse( "no warning for double definition of file.encoding",
+                         line.contains( "The system property file.encoding is 
configured twice!" ) );
+        }
+
     }
 
     private SurefireLauncher unpack()

Reply via email to