[ http://jira.codehaus.org/browse/MSUREFIRE-145?page=comments#action_69709 ]
Vincent Massol commented on MSUREFIRE-145: ------------------------------------------ Brett, I've found the problem. It is in surefire. The latest version of Surefire starts by instantiating the test class to execute and then only sets the system properties (by writing them to a file when forking is on). The problem is that the Cargo test suite that is used does the system property look up in its constructor.... I'm attaching separately a simple test to reproduce the issue. Here's the code that reproduces the problem: {code:java} public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { if (System.getProperty("cargo.containers") == null) { throw new RuntimeException("No cargo.containers system property set!!!"); } return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertEquals( "jetty6x", System.getProperty("cargo.containers") ); } } {code} It seems that in the Surefire jar corresponding to surefire plugin 2.1.3 had a different behavior. Of course we need to decide what to allow. But I think the user should assume that when his testing code is called the system properties would have alreayd been set. WDYT? Thanks -Vincent > Plugin not longer sets system properties when forking is on and debugging > information is not correct > ---------------------------------------------------------------------------------------------------- > > Key: MSUREFIRE-145 > URL: http://jira.codehaus.org/browse/MSUREFIRE-145 > Project: Maven 2.x Surefire Plugin > Type: Bug > Versions: 2.2 > Reporter: Vincent Massol > Assignee: Vincent Massol > Priority: Blocker > > > The following code is in SurefirePlugin.java: > {code:java} > processSystemProperties( !fork.isForking() ); > if ( getLog().isDebugEnabled() ) > { > showMap( systemProperties, "system property" ); > } > {code} > 2 problems: > 1) fork.isForking() is false when forking is enabled and thus system > properties are not set: > {code:java} > protected void processSystemProperties( boolean setInSystem ) > { > [...] > if ( setInSystem ) > { > // Add all system properties configured by the user > Iterator iter = systemProperties.keySet().iterator(); > while ( iter.hasNext() ) > { > String key = (String) iter.next(); > String value = systemProperties.getProperty( key ); > System.setProperty( key, value ); > } > } > } > {code} > 2) showMap() is called regardless of whether the system properties are set > or not, leading to the following kind of misleading logs: > {noformat} > [...] > [DEBUG] Setting system property [cargo.jetty4x.port]=[8280] > [DEBUG] Setting system property [cargo.jetty6x.port]=[8280] > [DEBUG] Setting system property [cargo.jetty5x.port]=[8280] > [...] > {noformat} > Those properties are actually NOT set. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira