Author: krosenvold
Date: Sun Jan 2 20:53:53 2011
New Revision: 1054471
URL: http://svn.apache.org/viewvc?rev=1054471&view=rev
Log:
[SUREFIRE-510] surefire.test.class.path not set
Fixed with IT
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java
(with props)
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java?rev=1054471&r1=1054470&r2=1054471&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
Sun Jan 2 20:53:53 2011
@@ -140,4 +140,8 @@ public class Classpath
}
}
+ public void setAsSystemProperty( String propertyName ){
+ System.setProperty( propertyName, getClassPathAsString());
+ }
+
}
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java?rev=1054471&r1=1054470&r2=1054471&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
Sun Jan 2 20:53:53 2011
@@ -50,6 +50,8 @@ public class SurefireStarter
private final StartupConfiguration startupConfiguration;
+ private final String SUREFIRE_TEST_CLASSPATH = "surefire.test.class.path";
+
public SurefireStarter( StartupConfiguration startupConfiguration,
ProviderConfiguration providerConfiguration )
{
this.providerConfiguration = providerConfiguration;
@@ -62,6 +64,8 @@ public class SurefireStarter
final StartupConfiguration starterConfiguration = startupConfiguration;
final ClasspathConfiguration classpathConfiguration =
starterConfiguration.getClasspathConfiguration();
+ classpathConfiguration.getTestClasspath().setAsSystemProperty(
SUREFIRE_TEST_CLASSPATH );
+
ClassLoader testsClassLoader =
classpathConfiguration.createTestClassLoaderConditionallySystem(
starterConfiguration.useSystemClassLoader() );
@@ -97,7 +101,8 @@ public class SurefireStarter
String testClassPath =
classpathConfiguration.getTestClasspath().getClassPathAsString();
- System.setProperty( "surefire.test.class.path", testClassPath );
+ classpathConfiguration.getTestClasspath().setAsSystemProperty(
SUREFIRE_TEST_CLASSPATH );
+
if ( startupConfiguration.isManifestOnlyJarRequestedAndUsable() )
{
testsClassLoader = getClass().getClassLoader(); //
ClassLoader.getSystemClassLoader()
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java?rev=1054471&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java
Sun Jan 2 20:53:53 2011
@@ -0,0 +1,51 @@
+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-621 Asserts proper test counts when running junit 3 tests in
parallel
+ *
+ * @author Kristian Rosenvold
+ */
+public class Surefire510TestClassPathForkModesIT
+ extends SurefireVerifierTestClass
+{
+
+ public Surefire510TestClassPathForkModesIT()
+ {
+ super( "/surefire-510-testClassPath" );
+ }
+
+ public void testForkAlways()
+ throws Exception
+ {
+ forkAlways();
+ execute( "test" );
+ verifyTextInLog( "tcp is set" );
+ }
+
+ public void testForkOnce()
+ throws Exception
+ {
+ forkOnce();
+ execute( "test" );
+ verifyTextInLog( "tcp is set" );
+ }
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire510TestClassPathForkModesIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml?rev=1054471&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml
Sun Jan 2 20:53:53 2011
@@ -0,0 +1,59 @@
+<?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-510-systemprops</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Surefire-510-systemprops</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <forkMode>${forkMode}</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java?rev=1054471&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java
Sun Jan 2 20:53:53 2011
@@ -0,0 +1,17 @@
+package surefire510;
+
+import junit.framework.TestCase;
+
+import java.io.IOException;
+
+public class Test1
+ extends TestCase
+{
+
+ public void test1() throws IOException {
+ String tcp = System.getProperty( "surefire.test.class.path");
+ if (tcp != null){
+ System.out.println( "tcp is set");
+ }
+ }
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-510-testClassPath/src/test/java/surefire510/Test1.java
------------------------------------------------------------------------------
svn:eol-style = native