[jboss-svn-commits] JBL Code SVN: r28099 - in labs/jbosstm/trunk/qa: tests/src/org/jboss/jbossts/qa/junit and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 16 09:44:05 EDT 2009
Author: jhalliday
Date: 2009-07-16 09:44:05 -0400 (Thu, 16 Jul 2009)
New Revision: 28099
Modified:
labs/jbosstm/trunk/qa/TaskImpl.properties
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TaskImpl.java
Log:
Add property substitution to TaskImpl, allowing platform neutral paths and hence testing on windows. JBTM-390
Modified: labs/jbosstm/trunk/qa/TaskImpl.properties
===================================================================
--- labs/jbosstm/trunk/qa/TaskImpl.properties 2009-07-16 13:42:48 UTC (rev 28098)
+++ labs/jbosstm/trunk/qa/TaskImpl.properties 2009-07-16 13:44:05 UTC (rev 28099)
@@ -5,22 +5,49 @@
# properties in muleric order, starting at 0 and counting up until a property is found missing.
# Care should be taken when renumbering - don't reuse the same number or miss any out!
#
+# Substitution of tokens of the form ${value} is performed, with token being resolved
+# first using properties from this file (non-recursive substitution though) and if not
+# found then using System properties and if still not found replaced with the empty string.
+# This is useful for e.g. constructing platform neutral paths using
+# file.separator ('/' or '\') and path.separator (":" or ";")
+#
+#
# Location of the JVM to use. Should usually be jdk6. Tweak according to your machine.
# Note: the version in svn should have the right value for the hudson server - don't check in you own!
+#
+COMMAND_LINE_0=/opt/jdk1.6.0_11/bin/java
+# use this form to inherit the java version used by ant:
+#COMMAND_LINE_0=${java.home}${file.separator}bin${file.separator}java
#COMMAND_LINE_0=/usr/local/jdk1.6.0_14/bin/java
-COMMAND_LINE_0=/opt/jdk1.6.0_11/bin/java
#
COMMAND_LINE_1=-classpath
#
-# The classpath consists (appox) of the JBossTS build (from its original home in 'install' - we no longer copy to
+# The classpath consists (approx) of the JBossTS build (from its original home in 'install' - we no longer copy to
# qa/build/) plus its bundled runtime dependencies, including jacorb, plus the qa tests jar, plus a dir in which the build
# script places any requied db driver. Note the use of wildcards for this - don't expect it to work on jdk5.
#
-# The effective properties file for JBossTS is the one in ../install/etc but not that later in this
+# The effective properties file for JBossTS is the one in ../install/etc but note that later in this
# file we use command line override of some properties.
#
-## yeah I know it won't work on windows. - we either need another file or some clever internal munging. TODO.
-COMMAND_LINE_2=../install/lib/jbossjts.jar:../install/lib/ext/jta-1_1-classes.zip:../install/lib/ext/connector-api.jar:../install/lib/ext/commons-logging-1.1.jar:../install/lib/ext/log4j-1.2.8.jar:../install/etc/:../install/jacorb/lib/idl.jar:../install/jacorb/lib/backport-util-concurrent.jar:../install/jacorb/lib/jacorb.jar:../install/jacorb/lib/antlr-2.7.2.jar:../install/jacorb/lib/picocontainer-1.2.jar:../install/jacorb/lib/logkit-1.2.jar:../install/jacorb/lib/wrapper-3.1.0.jar:../install/jacorb/lib/avalon-framework-4.1.5.jar:../install/jacorb/etc/:ext/fscontext.jar:ext/providerutil.jar:tests/build/jbossts-jts-qa.jar:dbdrivers/selected_dbdriver/*
+COMMAND_LINE_2=\
+ ..${file.separator}install${file.separator}lib${file.separator}jbossjts.jar\
+ ${path.separator}..${file.separator}install${file.separator}lib${file.separator}ext${file.separator}jta-1_1-classes.zip\
+ ${path.separator}..${file.separator}install${file.separator}lib${file.separator}ext${file.separator}connector-api.jar\
+ ${path.separator}..${file.separator}install${file.separator}lib${file.separator}ext${file.separator}commons-logging-1.1.jar\
+ ${path.separator}..${file.separator}install${file.separator}lib${file.separator}ext${file.separator}log4j-1.2.8.jar\
+ ${path.separator}..${file.separator}install${file.separator}etc${file.separator}\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}idl.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}backport-util-concurrent.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}jacorb.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}antlr-2.7.2.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}picocontainer-1.2.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}logkit-1.2.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}wrapper-3.1.0.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}lib${file.separator}avalon-framework-4.1.5.jar\
+ ${path.separator}..${file.separator}install${file.separator}jacorb${file.separator}etc${file.separator}\
+ ${path.separator}ext${file.separator}fscontext.jar${path.separator}ext${file.separator}providerutil.jar\
+ ${path.separator}tests${file.separator}build${file.separator}jbossts-jts-qa.jar\
+ ${path.separator}dbdrivers${file.separator}selected_dbdriver${file.separator}*
#
# properties used by the tests or test framework:
#
Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TaskImpl.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TaskImpl.java 2009-07-16 13:42:48 UTC (rev 28098)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TaskImpl.java 2009-07-16 13:44:05 UTC (rev 28099)
@@ -23,6 +23,8 @@
import org.junit.Assert;
import java.util.*;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
import java.util.concurrent.atomic.AtomicBoolean;
import java.io.*;
@@ -41,11 +43,32 @@
private final static String PROPERTIES_FILE = "TaskImpl.properties";
- private static Properties properties;
+ private static Properties properties = new Properties();
static {
try {
- properties = new Properties();
- properties.load(new FileInputStream(PROPERTIES_FILE));
+ Properties rawproperties = new Properties();
+ rawproperties.load(new FileInputStream(PROPERTIES_FILE));
+
+ // do property value token substitution, copy result to the actual properties:
+
+ Pattern substitutionPattern = Pattern.compile("\\$\\{(.*?)\\}");
+
+ Enumeration propertyNames = rawproperties.propertyNames();
+ while(propertyNames.hasMoreElements()) {
+ String name = (String)propertyNames.nextElement();
+ String rawvalue = rawproperties.getProperty(name);
+ StringBuffer buffer = new StringBuffer();
+ Matcher matcher = substitutionPattern.matcher(rawvalue);
+ while(matcher.find()) {
+ String group = matcher.group(1);
+ String replacement = Matcher.quoteReplacement(rawproperties.getProperty(group, System.getProperty(group, "")));
+ matcher.appendReplacement(buffer, replacement);
+ }
+ matcher.appendTail(buffer);
+ String mungedvalue = buffer.toString();
+ properties.setProperty(name, mungedvalue);
+ }
+
} catch(Exception e) {
throw new ExceptionInInitializerError(e);
}
More information about the jboss-svn-commits
mailing list