maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1078097 - in /maven/surefire/trunk: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ surefire-integration-tests/src/test/resources/surefire-634-sy...
Date Fri, 04 Mar 2011 18:41:34 GMT
Author: krosenvold
Date: Fri Mar  4 18:41:34 2011
New Revision: 1078097

URL: http://svn.apache.org/viewvc?rev=1078097&view=rev
Log:
[SUREFIRE-634] Issue warning upon unsettable system properties

Fixed with IT

Added:
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java
  (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
  (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java
  (with props)
Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1078097&r1=1078096&r2=1078097&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
(original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
Fri Mar  4 18:41:34 2011
@@ -553,6 +553,8 @@ public abstract class AbstractSurefireMo
 
         processSystemProperties( !fork.isForking() );
 
+        verifyLegalSystemProperties();
+
         if ( getLog().isDebugEnabled() )
         {
             showMap( getInternalSystemProperties(), "system property" );
@@ -613,6 +615,22 @@ public abstract class AbstractSurefireMo
         return fork;
     }
 
+    private void verifyLegalSystemProperties()
+    {
+        final Properties properties = getInternalSystemProperties();
+        Iterator iter = properties.keySet().iterator();
+
+        while ( iter.hasNext() )
+        {
+            String key = (String) iter.next();
+
+            if ("java.library.path".equals( key ))
+            {
+               getLog().warn( "java.library.path cannot be set as system property, use <argLine>-Djava.library.path=...<argLine>
instead");
+            }
+        }
+    }
+
 
     /**
      * Where surefire stores its own temp files

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java?rev=1078097&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java
Fri Mar  4 18:41:34 2011
@@ -0,0 +1,42 @@
+package org.apache.maven.surefire.its;
+/*
+ * 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.
+ */
+
+
+/**
+ * SUREFIRE-634 Verifies error message on unsettable system properties
+ *
+ * @author Kristian Rosenvold
+ */
+public class Surefire634UnsettableSystemPropertiesWarningIT
+    extends SurefireVerifierTestClass
+{
+
+    public Surefire634UnsettableSystemPropertiesWarningIT()
+    {
+        super( "/surefire-634-systemPropertiesWarning" );
+    }
+
+    public void testJunit3ParallelBuildResultCount()
+        throws Exception
+    {
+        executeTest();
+        verifyTextInLog( "java.library.path cannot be set as system property" );
+    }
+}
\ No newline at end of file

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire634UnsettableSystemPropertiesWarningIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml?rev=1078097&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
Fri Mar  4 18:41:34 2011
@@ -0,0 +1,68 @@
+<?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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>surefire-634-propertiesWarning</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for warning about system properties that cannot be set</name>
+
+
+  <properties>
+    <junitVersion>4.4</junitVersion>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junitVersion}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <systemPropertyVariables>
+            <java.library.path>${basedir}/src/main</java.library.path>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java?rev=1078097&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java
Fri Mar  4 18:41:34 2011
@@ -0,0 +1,44 @@
+package junit4;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class BasicTest
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+    
+    @Before
+    public void setUp()
+    {
+        setUpCalled = true;
+        tearDownCalled = false;
+        System.out.println( "Called setUp" );
+    }
+
+    @After
+    public void tearDown()
+    {
+        setUpCalled = false;
+        tearDownCalled = true;
+        System.out.println( "Called tearDown" );
+    }
+
+    @Test
+    public void testSetUp()
+    {
+        Assert.assertTrue( "setUp was not called", setUpCalled );
+    }
+
+    @AfterClass
+    public static void oneTimeTearDown()
+    {
+        
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-634-systemPropertiesWarning/src/test/java/junit4/BasicTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message