Author: krosenvold
Date: Tue Nov 30 19:07:28 2010
New Revision: 1040703
URL: http://svn.apache.org/viewvc?rev=1040703&view=rev
Log:
o Extracted constants so the same values weren't duplicated all over the place
Added:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
(with props)
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
(with props)
Modified:
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
Modified:
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java?rev=1040703&r1=1040702&r2=1040703&view=diff
==============================================================================
---
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
(original)
+++
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
Tue Nov 30 19:07:28 2010
@@ -19,7 +19,7 @@ package org.apache.maven.plugin.surefire
*/
import org.apache.maven.surefire.booter.BooterConfiguration;
-import org.apache.maven.surefire.booter.BooterDeserializer;
+import org.apache.maven.surefire.booter.BooterConstants;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.SystemPropertyManager;
import org.apache.maven.surefire.report.ReporterConfiguration;
@@ -51,10 +51,12 @@ import java.util.Properties;
* @author Kristian Rosenvold
* @version $Id$
*/
-public class BooterSerializer
+public class BooterSerializer implements BooterConstants
{
private final ForkConfiguration forkConfiguration;
+ public final String TESTSET = "testSet";
+
public BooterSerializer( ForkConfiguration forkConfiguration )
{
this.forkConfiguration = forkConfiguration;
@@ -69,7 +71,7 @@ public class BooterSerializer
if ( testSet != null && testSet instanceof String )
{
- properties.setProperty( "testSet", (String) testSet );
+ properties.setProperty( this.TESTSET, (String) testSet );
}
SystemPropertyManager systemPropertyManager = new
SystemPropertyManager();
return systemPropertyManager.writePropertiesFile( properties,
forkConfiguration.getTempDirectory(), "surefire",
@@ -82,10 +84,10 @@ public class BooterSerializer
{
throw new IllegalStateException( "Properties cannot be null" );
}
- addList( booterConfiguration.getReports(), properties,
BooterDeserializer.REPORT_PROPERTY_PREFIX );
+ addList( booterConfiguration.getReports(), properties,
BooterConstants.REPORT_PROPERTY_PREFIX );
List params = new ArrayList();
- params.add( new Object[]{ "directoryScannerOptions",
booterConfiguration.getDirScannerParamsArray() } );
- addPropertiesForTypeHolder( params, properties,
BooterDeserializer.DIRSCANNER_PROPERTY_PREFIX );
+ params.add( new Object[]{ DIRSCANNER_OPTIONS,
booterConfiguration.getDirScannerParamsArray() } );
+ addPropertiesForTypeHolder( params, properties,
BooterConstants.DIRSCANNER_PROPERTY_PREFIX );
booterConfiguration.getClasspathConfiguration().setForkProperties(
properties );
@@ -96,11 +98,11 @@ public class BooterSerializer
{
if ( testNg.getVersion() != null )
{
- properties.setProperty( "testNgVersion", testNg.getVersion() );
+ properties.setProperty( BooterConstants.TESTNGVERSION,
testNg.getVersion() );
}
if ( testNg.getClassifier() != null )
{
- properties.setProperty( "testNgClassifier",
testNg.getClassifier() );
+ properties.setProperty( BooterConstants.TESTNG_CLASSIFIER,
testNg.getClassifier() );
}
}
@@ -109,43 +111,43 @@ public class BooterSerializer
{
if ( testSuiteDefinition.getTestForFork() != null )
{
- properties.setProperty( "testSuiteDefinitionTest",
testSuiteDefinition.getTestForFork() );
+ properties.setProperty(
BooterConstants.TESTSUITEDEFINITIONTEST, testSuiteDefinition.getTestForFork() );
}
if ( testSuiteDefinition.getTestSourceDirectory() != null )
{
- properties.setProperty(
"testSuiteDefinitionTestSourceDirectory",
+ properties.setProperty( BooterConstants.SOURCE_DIRECTORY,
testSuiteDefinition.getTestSourceDirectory().toString() );
}
if ( testSuiteDefinition.getSuiteXmlFiles() != null )
{
- properties.setProperty( "testSuiteXmlFiles", getValues(
testSuiteDefinition.getSuiteXmlFiles() ) );
+ properties.setProperty( BooterConstants.TEST_SUITE_XML_FILES,
getValues( testSuiteDefinition.getSuiteXmlFiles() ) );
}
if ( testSuiteDefinition.getRequestedTest() != null )
{
- properties.setProperty( "requestedTest",
testSuiteDefinition.getRequestedTest() );
+ properties.setProperty( BooterConstants.REQUESTEDTEST,
testSuiteDefinition.getRequestedTest() );
}
}
DirectoryScannerParameters directoryScannerParameters =
booterConfiguration.getDirScannerParams();
if ( directoryScannerParameters != null )
{
- properties.setProperty( "failIfNoTests", String.valueOf(
directoryScannerParameters.isFailIfNoTests() ) );
- addList( directoryScannerParameters.getIncludes(), properties,
"includes" );
- addList( directoryScannerParameters.getExcludes(), properties,
"excludes" );
- properties.setProperty( "testClassesDirectory",
+ properties.setProperty(BooterConstants.FAILIFNOTESTS,
String.valueOf( directoryScannerParameters.isFailIfNoTests() ) );
+ addList( directoryScannerParameters.getIncludes(), properties,
BooterConstants.INCLUDES_PROPERTY_PREFIX);
+ addList( directoryScannerParameters.getExcludes(), properties,
BooterConstants.EXCLUDES_PROPERTY_PREFIX );
+ properties.setProperty( BooterConstants.TEST_CLASSES_DIRECTORY,
directoryScannerParameters.getTestClassesDirectory().toString() );
}
Boolean rep = reporterConfiguration.isTrimStackTrace();
- properties.setProperty( "isTrimStackTrace", rep.toString() );
- properties.setProperty( "reportsDirectory",
reporterConfiguration.getReportsDirectory().toString() );
+ properties.setProperty( BooterConstants.ISTRIMSTACKTRACE,
rep.toString() );
+ properties.setProperty( BooterConstants.REPORTSDIRECTORY,
reporterConfiguration.getReportsDirectory().toString() );
ClassLoaderConfiguration classLoaderConfiguration =
this.forkConfiguration.getClassLoaderConfiguration();
- properties.setProperty( "useSystemClassLoader",
+ properties.setProperty( BooterConstants.USESYSTEMCLASSLOADER,
String.valueOf(
classLoaderConfiguration.isUseSystemClassLoader() ) );
- properties.setProperty( "useManifestOnlyJar",
+ properties.setProperty( BooterConstants.USEMANIFESTONLYJAR,
String.valueOf(
classLoaderConfiguration.isManifestOnlyJarRequestedAndUsable() ) );
- properties.setProperty( "failIfNoTests", String.valueOf(
booterConfiguration.isFailIfNoTests() ) );
- properties.setProperty( "providerConfiguration",
+ properties.setProperty( BooterConstants.FAILIFNOTESTS, String.valueOf(
booterConfiguration.isFailIfNoTests() ) );
+ properties.setProperty( BooterConstants.PROVIDER_CONFIGURATION,
booterConfiguration.getProviderConfiguration().getClassName() );
}
@@ -193,8 +195,8 @@ public class BooterSerializer
{
String paramProperty = getValues( params );
String typeProperty = getTypes( params );
- properties.setProperty( propertyPrefix + i +
BooterDeserializer.PARAMS_SUFIX, paramProperty );
- properties.setProperty( propertyPrefix + i +
BooterDeserializer.TYPES_SUFIX, typeProperty );
+ properties.setProperty( propertyPrefix + i +
BooterConstants.PARAMS_SUFIX, paramProperty );
+ properties.setProperty( propertyPrefix + i +
BooterConstants.TYPES_SUFIX, typeProperty );
}
}
}
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java?rev=1040703&r1=1040702&r2=1040703&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java
Tue Nov 30 19:07:28 2010
@@ -55,22 +55,11 @@ public class BooterConfiguration
private final ProviderConfiguration providerConfiguration;
- private final List reports;
-
-
- private final boolean failIfNoTests;
+ private final DirectoryScannerParameters dirScannerParams;
private final ReporterConfiguration reporterConfiguration;
- private final boolean redirectTestOutputToFile;
-
-
- private final boolean isForkRequested;
-
-
- private final DirectoryScannerParameters dirScannerParams;
-
- private final boolean isInForkedVm;
+ private final List reports;
private final TestArtifactInfo testNg;
@@ -80,9 +69,18 @@ public class BooterConfiguration
private Properties properties; // todo: Zap out of here !
+ private final boolean failIfNoTests;
+
+ private final boolean redirectTestOutputToFile;
+
+ private final boolean isForkRequested;
+
+ private final boolean isInForkedVm;
+
public BooterConfiguration( ClassLoaderConfiguration
classLoaderConfiguration,
- ClasspathConfiguration classpathConfiguration,
List reports, DirectoryScannerParameters directoryScannerParameterses,
- boolean failIfNoTests, Properties properties,
ReporterConfiguration reporterConfiguration,
+ ClasspathConfiguration classpathConfiguration,
List reports,
+ DirectoryScannerParameters
directoryScannerParameterses, boolean failIfNoTests,
+ Properties properties, ReporterConfiguration
reporterConfiguration,
TestArtifactInfo testArtifactInfo,
TestSuiteDefinition testSuiteDefinition,
ProviderConfiguration providerConfiguration )
{
@@ -208,9 +206,11 @@ public class BooterConfiguration
return testSuiteDefinition;
}
- public TestSuiteDefinition getTestSuiteDefinition(String testName)
+ public TestSuiteDefinition getTestSuiteDefinition( String testName )
{
- return new TestSuiteDefinition(
testSuiteDefinition.getSuiteXmlFiles(), testName,
testSuiteDefinition.getTestSourceDirectory(),
testSuiteDefinition.getRequestedTest() );
+ return new TestSuiteDefinition(
testSuiteDefinition.getSuiteXmlFiles(), testName,
+
testSuiteDefinition.getTestSourceDirectory(),
+ testSuiteDefinition.getRequestedTest()
);
}
public ProviderConfiguration getProviderConfiguration()
Added:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java?rev=1040703&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
(added)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
Tue Nov 30 19:07:28 2010
@@ -0,0 +1,33 @@
+package org.apache.maven.surefire.booter;
+
+/**
+ * Constants used by the serializer/deserializer
+ * @author Kristian Rosenvold
+ */
+public interface BooterConstants
+{
+ String INCLUDES_PROPERTY_PREFIX = "includes";
+ String EXCLUDES_PROPERTY_PREFIX = "excludes";
+ String DIRSCANNER_PROPERTY_PREFIX = "dirscanner.";
+ String DIRSCANNER_OPTIONS = "directoryScannerOptions";
+ String REPORT_PROPERTY_PREFIX = "report.";
+ String PARAMS_SUFIX = ".params";
+ String TYPES_SUFIX = ".types";
+ String CLASSPATH_URL = "classPathUrl.";
+ String SUREFIRE_CLASSPATHURL = "surefireClassPathUrl.";
+ String CHILD_DELEGATION = "childDelegation";
+ String ENABLE_ASSERTIONS = "enableAssertions";
+ String USESYSTEMCLASSLOADER = "useSystemClassLoader";
+ String USEMANIFESTONLYJAR = "useManifestOnlyJar";
+ String FAILIFNOTESTS = "failIfNoTests";
+ String ISTRIMSTACKTRACE = "isTrimStackTrace";
+ String REPORTSDIRECTORY = "reportsDirectory";
+ String TESTNGVERSION = "testNgVersion";
+ String TESTNG_CLASSIFIER = "testNgClassifier";
+ String TESTSUITEDEFINITIONTEST = "testSuiteDefinitionTest";
+ String REQUESTEDTEST = "requestedTest";
+ String SOURCE_DIRECTORY = "testSuiteDefinitionTestSourceDirectory";
+ String TEST_CLASSES_DIRECTORY = "testClassesDirectory";
+ String TEST_SUITE_XML_FILES = "testSuiteXmlFiles";
+ String PROVIDER_CONFIGURATION = "providerConfiguration";
+}
Propchange:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java?rev=1040703&r1=1040702&r2=1040703&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
Tue Nov 30 19:07:28 2010
@@ -52,24 +52,14 @@ import java.util.TreeMap;
* @version $Id$
*/
public class BooterDeserializer
+ implements BooterConstants
{
- public static final String INCLUDES_PROPERTY_PREFIX = "includes";
-
- public static final String EXCLUDES_PROPERTY_PREFIX = "excludes";
-
- public static final String DIRSCANNER_PROPERTY_PREFIX = "dirscanner.";
-
- public static final String REPORT_PROPERTY_PREFIX = "report.";
-
- public static final String PARAMS_SUFIX = ".params";
-
- public static final String TYPES_SUFIX = ".types";
public BooterConfiguration deserialize( InputStream inputStream )
throws IOException
{
- Properties properties = SystemPropertyManager.loadProperties(
inputStream );
+ PropertiesWrapper properties = SystemPropertyManager.loadProperties(
inputStream );
DirectoryScannerParameters dirScannerParams;
boolean enableAssertions = false;
boolean childDelegation = true;
@@ -89,7 +79,7 @@ public class BooterDeserializer
String testNgClassifier = null;
String testForFork = null;
String requestedTest = null;
- File testSuiteDefinitionTestSourceDirectory = null;
+ File sourceDirectory = null;
Object[] testSuiteXmlFiles = null;
String providerConfiguration = null;
SortedMap includes = new TreeMap();
@@ -115,79 +105,77 @@ public class BooterDeserializer
String className = properties.getProperty( name );
excludes.put( name, className );
}
- else if ( name.startsWith( "classPathUrl." ) )
+ else if ( name.startsWith( CLASSPATH_URL ) )
{
classPathUrls.put( Integer.valueOf( name.substring(
name.indexOf( '.' ) + 1 ) ),
properties.getProperty( name ) );
}
- else if ( name.startsWith( "surefireClassPathUrl." ) )
+ else if ( name.startsWith( SUREFIRE_CLASSPATHURL ) )
{
surefireClassPathUrls.put( Integer.valueOf( name.substring(
name.indexOf( '.' ) + 1 ) ),
properties.getProperty( name ) );
}
- else if ( "childDelegation".equals( name ) )
+ else if ( CHILD_DELEGATION.equals( name ) )
{
- childDelegation = Boolean.valueOf( properties.getProperty(
"childDelegation" ) ).booleanValue();
+ childDelegation = properties.getBooleanProperty(
CHILD_DELEGATION );
}
- else if ( "enableAssertions".equals( name ) )
+ else if ( ENABLE_ASSERTIONS.equals( name ) )
{
- enableAssertions = Boolean.valueOf( properties.getProperty(
"enableAssertions" ) ).booleanValue();
+ enableAssertions = properties.getBooleanProperty(
ENABLE_ASSERTIONS );
}
- else if ( "useSystemClassLoader".equals( name ) )
+ else if ( USESYSTEMCLASSLOADER.equals( name ) )
{
- useSystemClassLoader =
- Boolean.valueOf( properties.getProperty(
"useSystemClassLoader" ) ).booleanValue();
+ useSystemClassLoader = properties.getBooleanProperty(
USESYSTEMCLASSLOADER );
}
- else if ( "useManifestOnlyJar".equals( name ) )
+ else if ( USEMANIFESTONLYJAR.equals( name ) )
{
- useManifestOnlyJar = Boolean.valueOf( properties.getProperty(
"useManifestOnlyJar" ) ).booleanValue();
+ useManifestOnlyJar = properties.getBooleanProperty(
USEMANIFESTONLYJAR );
}
- else if ( "failIfNoTests".equals( name ) )
+ else if ( FAILIFNOTESTS.equals( name ) )
{
- failIfNotests = Boolean.valueOf( properties.getProperty(
"failIfNoTests" ) ).booleanValue();
+ failIfNotests = properties.getBooleanProperty( FAILIFNOTESTS );
}
- else if ( "isTrimStackTrace".equals( name ) )
+ else if ( ISTRIMSTACKTRACE.equals( name ) )
{
- failIfNotests = Boolean.valueOf( properties.getProperty(
"isTrimStackTrace" ) ).booleanValue();
+ failIfNotests = properties.getBooleanProperty(
ISTRIMSTACKTRACE );
}
- else if ( "reportsDirectory".equals( name ) )
+ else if ( REPORTSDIRECTORY.equals( name ) )
{
- reportsDirectory = new File( properties.getProperty(
"reportsDirectory" ) );
+ reportsDirectory = new File( properties.getProperty(
REPORTSDIRECTORY ) );
}
- else if ( "testNgVersion".equals( name ) )
+ else if ( TESTNGVERSION.equals( name ) )
{
- testNgVersion = properties.getProperty( "testNgVersion" );
+ testNgVersion = properties.getProperty( TESTNGVERSION );
}
- else if ( "testNgClassifier".equals( name ) )
+ else if ( TESTNG_CLASSIFIER.equals( name ) )
{
- testNgClassifier = properties.getProperty( "testNgClassifier"
);
+ testNgClassifier = properties.getProperty( TESTNG_CLASSIFIER );
}
- else if ( "testSuiteDefinitionTest".equals( name ) )
+ else if ( TESTSUITEDEFINITIONTEST.equals( name ) )
{
- testForFork = properties.getProperty(
"testSuiteDefinitionTest" );
+ testForFork = properties.getProperty( TESTSUITEDEFINITIONTEST
);
}
- else if ( "requestedTest".equals( name ) )
+ else if ( REQUESTEDTEST.equals( name ) )
{
- requestedTest = properties.getProperty( "requestedTest" );
+ requestedTest = properties.getProperty( REQUESTEDTEST );
}
- else if ( "testSuiteDefinitionTestSourceDirectory".equals( name ) )
+ else if ( SOURCE_DIRECTORY.equals( name ) )
{
- testSuiteDefinitionTestSourceDirectory =
- (File) getParamValue( properties.getProperty(
"testSuiteDefinitionTestSourceDirectory" ),
- File.class.getName() );
+ sourceDirectory =
+ (File) getParamValue( properties.getProperty(
SOURCE_DIRECTORY ), File.class.getName() );
}
- else if ( "testClassesDirectory".equals( name ) )
+ else if ( TEST_CLASSES_DIRECTORY.equals( name ) )
{
testClassesDirectory =
- (File) getParamValue( properties.getProperty(
"testClassesDirectory" ), File.class.getName() );
+ (File) getParamValue( properties.getProperty(
TEST_CLASSES_DIRECTORY ), File.class.getName() );
}
- else if ( "testSuiteXmlFiles".equals( name ) )
+ else if ( TEST_SUITE_XML_FILES.equals( name ) )
{
- testSuiteXmlFiles = constructParamObjects(
properties.getProperty( "testSuiteXmlFiles" ), File.class );
+ testSuiteXmlFiles = constructParamObjects(
properties.getProperty( TEST_SUITE_XML_FILES ), File.class );
}
- else if ( "providerConfiguration".equals( name ) )
+ else if ( PROVIDER_CONFIGURATION.equals( name ) )
{
- providerConfiguration = properties.getProperty(
"providerConfiguration" );
+ providerConfiguration = properties.getProperty(
PROVIDER_CONFIGURATION );
}
}
@@ -197,10 +185,9 @@ public class BooterDeserializer
TestArtifactInfo testNg = new TestArtifactInfo( testNgVersion,
testNgClassifier );
TestSuiteDefinition testSuiteDefinition =
- new TestSuiteDefinition( testSuiteXmlFiles, testForFork,
testSuiteDefinitionTestSourceDirectory,
- requestedTest );
+ new TestSuiteDefinition( testSuiteXmlFiles, testForFork,
sourceDirectory, requestedTest );
- ClassLoaderConfiguration forkConfiguration =
+ ClassLoaderConfiguration classLoaderConfiguration =
new ClassLoaderConfiguration( useSystemClassLoader,
useManifestOnlyJar );
ClasspathConfiguration classpathConfiguration =
@@ -211,9 +198,9 @@ public class BooterDeserializer
ProviderConfiguration providerConfigurationObj = new
ProviderConfiguration( providerConfiguration );
List reports = new ArrayList( reportsMap.values() );
- return new BooterConfiguration( forkConfiguration,
classpathConfiguration, reports, dirScannerParams,
- failIfNotests, properties,
reporterConfiguration, testNg, testSuiteDefinition,
- providerConfigurationObj );
+ return new BooterConfiguration( classLoaderConfiguration,
classpathConfiguration, reports, dirScannerParams,
+ failIfNotests,
properties.getProperties(), reporterConfiguration, testNg,
+ testSuiteDefinition,
providerConfigurationObj );
}
private boolean isTypeHolderProperty( String name )
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java?rev=1040703&r1=1040702&r2=1040703&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
Tue Nov 30 19:07:28 2010
@@ -89,10 +89,10 @@ public class ClasspathConfiguration
public void setForkProperties( Properties properties )
{
- classpathUrls.setForkProperties( properties, "classPathUrl." );
- surefireClasspathUrls.setForkProperties( properties,
"surefireClassPathUrl." );
- properties.setProperty( "enableAssertions", String.valueOf(
enableAssertions ) );
- properties.setProperty( "childDelegation", String.valueOf(
childDelegation ) );
+ classpathUrls.setForkProperties( properties,
BooterConstants.CLASSPATH_URL);
+ surefireClasspathUrls.setForkProperties( properties,
BooterConstants.SUREFIRE_CLASSPATHURL );
+ properties.setProperty( BooterConstants.ENABLE_ASSERTIONS,
String.valueOf( enableAssertions ) );
+ properties.setProperty( BooterConstants.CHILD_DELEGATION,
String.valueOf( childDelegation ) );
}
Added:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java?rev=1040703&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
(added)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
Tue Nov 30 19:07:28 2010
@@ -0,0 +1,67 @@
+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 java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Properties;
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class PropertiesWrapper
+{
+ private final Properties properties;
+
+ public PropertiesWrapper( Properties properties )
+ {
+ this.properties = properties;
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setAsSystemProperties()
+ {
+ for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+ {
+ String key = (String) i.next();
+
+ System.setProperty( key, properties.getProperty( key ) );
+ }
+ }
+
+ public String getProperty( String key )
+ {
+ return properties.getProperty( key );
+ }
+
+ public boolean getBooleanProperty(String propertyName){
+ final Boolean aBoolean = Boolean.valueOf( properties.getProperty(
propertyName ) );
+ return aBoolean.booleanValue();
+ }
+
+ public Enumeration propertyNames()
+ {
+ return properties.propertyNames();
+ }
+}
Propchange:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java?rev=1040703&r1=1040702&r2=1040703&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
Tue Nov 30 19:07:28 2010
@@ -32,11 +32,6 @@ import java.util.Properties;
*/
public class SystemPropertyManager
{
- private static Properties loadProperties( File file )
- throws IOException
- {
- return loadProperties( new FileInputStream( file ) );
- }
/**
* Loads the properties, closes the stream
@@ -44,7 +39,7 @@ public class SystemPropertyManager
* @return The properties
* @throws java.io.IOException If something bad happens
*/
- public static Properties loadProperties( InputStream inStream )
+ public static PropertiesWrapper loadProperties( InputStream inStream )
throws IOException
{
Properties p = new Properties();
@@ -58,21 +53,21 @@ public class SystemPropertyManager
close( inStream );
}
- return p;
+ return new PropertiesWrapper( p);
}
-
- public static void setSystemProperties( File file )
+ private static PropertiesWrapper loadProperties( File file )
throws IOException
{
- Properties p = loadProperties( file );
+ return loadProperties( new FileInputStream( file ) );
+ }
- for ( Iterator i = p.keySet().iterator(); i.hasNext(); )
- {
- String key = (String) i.next();
- System.setProperty( key, p.getProperty( key ) );
- }
+ public static void setSystemProperties( File file )
+ throws IOException
+ {
+ PropertiesWrapper p = loadProperties( file );
+ p.setAsSystemProperties();
}
public File writePropertiesFile( Properties properties, File
tempDirectory, String name, boolean deleteOnExit)