[jbpm-commits] JBoss JBPM SVN: r1887 - in jbpm4/pvm/trunk/modules/core/src/test: java/org/jbpm/pvm/internal/util and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Aug 14 05:45:17 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-08-14 05:45:17 -0400 (Thu, 14 Aug 2008)
New Revision: 1887
Added:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/util/
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/util/FileUtil.java
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/file.properties
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/resource.properties
jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/url.properties
Removed:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/file.properties
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/resource.properties
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/url.properties
Modified:
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/PropertiesWireTest.java
Log:
fixed space problem in directory name in wire tests
Added: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/util/FileUtil.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/util/FileUtil.java (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/util/FileUtil.java 2008-08-14 09:45:17 UTC (rev 1887)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.util;
+
+import java.io.File;
+import java.net.URL;
+import java.util.StringTokenizer;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class FileUtil {
+
+ private static final String FILE_SEPARATOR = System.getProperty("file.separator");
+
+ public static String getFileNameForResource(String resource) throws Exception {
+ String testClassesUrl = FileUtil.class.getProtectionDomain().getCodeSource().getLocation().toString();
+ URL fileUrl = new URL(testClassesUrl);
+ File file = new File(fileUrl.toURI());
+ String fileName = file.getAbsolutePath();
+
+ StringTokenizer tokenizer = new StringTokenizer(resource, "/");
+ while (tokenizer.hasMoreTokens()) {
+ fileName = fileName+FILE_SEPARATOR+tokenizer.nextToken();
+ }
+
+ return fileName;
+ }
+}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/PropertiesWireTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/PropertiesWireTest.java 2008-08-13 17:36:40 UTC (rev 1886)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/PropertiesWireTest.java 2008-08-14 09:45:17 UTC (rev 1887)
@@ -21,9 +21,13 @@
*/
package org.jbpm.pvm.internal.wire;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.List;
import java.util.Properties;
+import org.jbpm.pvm.internal.util.FileUtil;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireException;
import org.jbpm.pvm.internal.xml.Problem;
@@ -75,11 +79,8 @@
assertTextPresent("property must have name and value attribute", problems.get(0).toString());
}
- public void testFileProperties() {
- String testClassesUrl = PropertiesWireTest.class.getProtectionDomain().getCodeSource().getLocation().toString();
- // skip the "file:" to get a file string
- String testClassesDir = testClassesUrl.substring(5);
- String propertiesFile = testClassesDir+"/org/jbpm/wire/file.properties";
+ public void testFileProperties() throws Exception {
+ String propertiesFile = FileUtil.getFileNameForResource("org/jbpm/pvm/internal/wire/file.properties");
WireContext wireContext = createWireContext(
"<objects>" +
@@ -167,11 +168,8 @@
}
}
- public void testOverridenFileProperties() {
- String testClassesUrl = PropertiesWireTest.class.getProtectionDomain().getCodeSource().getLocation().toString();
- // skip the "file:" to get a file string
- String testClassesDir = testClassesUrl.substring(5);
- String propertiesFile = testClassesDir+"/org/jbpm/wire/file.properties";
+ public void testOverridenFileProperties() throws Exception {
+ String propertiesFile = FileUtil.getFileNameForResource("/org/jbpm/wire/file.properties");
WireContext wireContext = createWireContext(
"<objects>" +
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/file.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/file.properties 2008-08-13 17:36:40 UTC (rev 1886)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/file.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -1,3 +0,0 @@
-1=flute
-2=fagot
-3=fecundity
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/resource.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/resource.properties 2008-08-13 17:36:40 UTC (rev 1886)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/resource.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -1,3 +0,0 @@
-1=rubber
-2=rack
-3=ramblas
Deleted: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/url.properties
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/url.properties 2008-08-13 17:36:40 UTC (rev 1886)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/url.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -1,3 +0,0 @@
-1=umbrella
-2=ultraviolet
-3=ubiquitous
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/file.properties (from rev 1886, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/file.properties)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/file.properties (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/file.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -0,0 +1,3 @@
+1=flute
+2=fagot
+3=fecundity
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/file.properties
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/resource.properties (from rev 1886, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/resource.properties)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/resource.properties (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/resource.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -0,0 +1,3 @@
+1=rubber
+2=rack
+3=ramblas
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/resource.properties
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/url.properties (from rev 1886, jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/wire/url.properties)
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/url.properties (rev 0)
+++ jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/url.properties 2008-08-14 09:45:17 UTC (rev 1887)
@@ -0,0 +1,3 @@
+1=umbrella
+2=ultraviolet
+3=ubiquitous
Property changes on: jbpm4/pvm/trunk/modules/core/src/test/resources/org/jbpm/pvm/internal/wire/url.properties
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the jbpm-commits
mailing list