You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2013/01/30 13:28:58 UTC

svn commit: r1440372 - in /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons: AbstractVfsTestCase.java vfs2/provider/ram/test/RamProviderTestCase.java

Author: tn
Date: Wed Jan 30 12:28:58 2013
New Revision: 1440372

URL: http://svn.apache.org/viewvc?rev=1440372&view=rev
Log:
Fix failing unit test.

Modified:
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java?rev=1440372&r1=1440371&r2=1440372&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java (original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java Wed Jan 30 12:28:58 2013
@@ -19,6 +19,8 @@ package org.apache.commons;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -105,9 +107,17 @@ public abstract class AbstractVfsTestCas
     {
         if (baseDir == null)
         {
-            // final String baseDirProp = System.getProperty("test.basedir");
             final String baseDirProp = getTestDirectoryString();
-            baseDir = getCanonicalFile(new File(baseDirProp));
+            // the directory maybe expressed as URI in certain environments
+            if (baseDirProp.startsWith("file://")) {
+                try {
+                    baseDir = getCanonicalFile(new File(new URI(baseDirProp)));
+                } catch (URISyntaxException e) {
+                    baseDir = getCanonicalFile(new File(baseDirProp));
+                }
+            } else {
+                baseDir = getCanonicalFile(new File(baseDirProp));                
+            }
         }
         return baseDir;
     }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java?rev=1440372&r1=1440371&r2=1440372&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java (original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/RamProviderTestCase.java Wed Jan 30 12:28:58 2013
@@ -16,11 +16,9 @@
  */
 package org.apache.commons.vfs2.provider.ram.test;
 
-import java.io.File;
 
 import junit.framework.Test;
 
-import org.apache.commons.AbstractVfsTestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.vfs2.FileObject;
@@ -87,7 +85,7 @@ public class RamProviderTestCase extends
             // Import the test tree
             final FileObject fo = manager.resolveFile("ram:/");
             final RamFileSystem fs = (RamFileSystem) fo.getFileSystem();
-            fs.importTree(new File(AbstractVfsTestCase.getTestDirectoryString()));
+            fs.importTree(getTestDirectory());
             fo.close();
 
             inited=true;