Author: bdaw
Date: 2007-10-13 18:06:52 -0400 (Sat, 13 Oct 2007)
New Revision: 8639
Modified:
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
modules/test/trunk/unit/build.xml
modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
Log:
- enable usage of <sysproperty> in jboss unit tasks
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-13 21:55:45 UTC (rev 8638)
+++ modules/test/trunk/tooling/build.xml 2007-10-13 22:06:52 UTC (rev 8639)
@@ -256,6 +256,8 @@
<html toDir="./output/test-results"/>
</reports>
+ <sysproperty key="toto" value="totoValue"/>
+ <sysproperty key="nono" value="nonoValue"/>
<classpath>
Modified:
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-13
21:55:45 UTC (rev 8638)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/JBossUnitTask.java 2007-10-13
22:06:52 UTC (rev 8639)
@@ -28,9 +28,12 @@
import org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Environment;
import java.util.List;
import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
import java.io.File;
/**
@@ -46,6 +49,8 @@
private Path path;
+ private Set<Environment.Variable> sysproperties = new
HashSet<Environment.Variable>();
+
public JBossUnitTask()
{
}
@@ -85,7 +90,13 @@
{
testsType.addConfiguredClasspath(path);
}
-
+
+
+ Set<Environment.Variable> propCopy = new
HashSet<Environment.Variable>();
+ propCopy.addAll(sysproperties);
+
+ propCopy.addAll(testsType.getSysproperties());
+ testsType.setSysproperties(propCopy);
testsType.execute();
}
@@ -128,6 +139,11 @@
}
}
+ public void addConfiguredSysproperty(Environment.Variable variable)
+ {
+ sysproperties.add(variable);
+ }
+
// private void generateHTMLReports(XMLResultAggregator reporter) throws Exception
// {
//
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13
21:55:45 UTC (rev 8638)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-13
22:06:52 UTC (rev 8639)
@@ -22,7 +22,6 @@
package org.jboss.unit.tooling.ant;
-import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
@@ -67,7 +66,9 @@
private List<PropertyType> properties = new ArrayList<PropertyType>();
+ private Set<Environment.Variable> sysproperties = new
HashSet<Environment.Variable>();
+
public TestsType()
{
}
@@ -140,7 +141,15 @@
javaPath.add(getClasspath());
}
- // Set fork
+ // Set system properties
+
+ for (Environment.Variable sysproperty : sysproperties)
+ {
+ javaTask.addSysproperty(sysproperty);
+ }
+
+
+ // Set fork
if (isFork())
{
javaTask.setFork(true);
@@ -394,9 +403,16 @@
return parsedProps;
}
-
+ public Set<Environment.Variable> getSysproperties()
+ {
+ return sysproperties;
+ }
+ public void setSysproperties(Set<Environment.Variable> sysproperties)
+ {
+ this.sysproperties = sysproperties;
+ }
public void addConfiguredInclude(IncludeType include)
{
Modified: modules/test/trunk/unit/build.xml
===================================================================
--- modules/test/trunk/unit/build.xml 2007-10-13 21:55:45 UTC (rev 8638)
+++ modules/test/trunk/unit/build.xml 2007-10-13 22:06:52 UTC (rev 8639)
@@ -190,6 +190,7 @@
<jvmarg value="-Xdebug"/>
<jvmarg
value="-Xrunjdwp:transport=dt_socket,address=7878,server=y,suspend=y"/>
-->
+
<classpath>
<path location="${build.lib}/jboss-unit-lib.jar"/>
<path location="${build.lib}/jboss-unit-test.jar"/>
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 21:55:45
UTC (rev 8638)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/tooling/Main.java 2007-10-13 22:06:52
UTC (rev 8639)
@@ -153,6 +153,12 @@
System.out.println("TestRunnerContext contains: ");
System.out.println("Properties: " + properties.toString());
+// System.out.println("System properties:");
+// for (Object key : System.getProperties().keySet())
+// {
+//
+// System.out.println(key + "=" + System.getProperty((String)key));
+// }
TestRunnerContextSupport runnerContext = new TestRunnerContextSupport(properties,
new ParametrizationSet(), mainFilter, broadcaster);
runner.run(runnerContext);
Show replies by date