commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r452181 - in /jakarta/commons/proper/vfs/trunk/src: java/org/apache/commons/vfs/provider/ test/org/apache/commons/vfs/test/
Date Mon, 02 Oct 2006 19:46:02 GMT
Author: imario
Date: Mon Oct  2 12:46:01 2006
New Revision: 452181

URL: http://svn.apache.org/viewvc?view=rev&rev=452181
Log:
VFS-81: pass down the FileName instance down to the filesystem to not loose the url query
parameters

fixed test-problems with the virtualFileSytem test case

Modified:
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileProvider.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
    jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/AbstractProviderTestCase.java
    jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/ProviderCacheStrategyTests.java

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileProvider.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileProvider.java?view=diff&rev=452181&r1=452180&r2=452181
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileProvider.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileProvider.java
Mon Oct  2 12:46:01 2006
@@ -146,7 +146,10 @@
 
         synchronized (fileSystems)
         {
-            fileSystems.remove(fs.getCacheKey());
+            if (fs.getCacheKey() != null)
+            {
+                fileSystems.remove(fs.getCacheKey());
+            }
         }
 
         removeComponent(fs);

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java?view=diff&rev=452181&r1=452180&r2=452181
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
Mon Oct  2 12:46:01 2006
@@ -78,7 +78,8 @@
         }
 
         // Locate the file
-        return fs.resolveFile(name.getPath());
+        // return fs.resolveFile(name.getPath());
+        return fs.resolveFile(name);
     }
 
     /**

Modified: jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/AbstractProviderTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/AbstractProviderTestCase.java?view=diff&rev=452181&r1=452180&r2=452181
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/AbstractProviderTestCase.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/AbstractProviderTestCase.java
Mon Oct  2 12:46:01 2006
@@ -22,6 +22,7 @@
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.FileSystemManager;
 import org.apache.commons.vfs.impl.DefaultFileSystemManager;
 import org.apache.commons.vfs.provider.AbstractFileSystem;
 import org.apache.commons.vfs.provider.local.DefaultLocalFileProvider;
@@ -105,6 +106,15 @@
 	        fs.addProvider("file", new DefaultLocalFileProvider());
 	    }
 	    return fs;
+    }
+
+    /**
+     * some provider config do some post-initialization in getBaseTestFolder.
+     * This is a hack to allow access to this code for <code>createManager</code>
+     */
+    protected FileObject getBaseTestFolder(FileSystemManager fs) throws Exception
+    {
+        return providerConfig.getBaseTestFolder(fs);
     }
     
     /**

Modified: jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/ProviderCacheStrategyTests.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/ProviderCacheStrategyTests.java?view=diff&rev=452181&r1=452180&r2=452181
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/ProviderCacheStrategyTests.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/test/ProviderCacheStrategyTests.java
Mon Oct  2 12:46:01 2006
@@ -22,6 +22,7 @@
 import org.apache.commons.vfs.provider.ram.RamFileObject;
 import org.apache.commons.vfs.util.FileObjectUtils;
 import org.apache.commons.vfs.impl.DefaultFileSystemManager;
+import org.apache.commons.vfs.impl.VirtualFileSystem;
 
 /**
  * Test the cache stragey
@@ -49,20 +50,22 @@
      */
     public void testManualCache() throws Exception
     {
-        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class))
+        FileObject scratchFolder = getWriteFolder();
+        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) ||
+            scratchFolder.getFileSystem() instanceof VirtualFileSystem)
         {
             // cant check ram filesystem as every manager holds its own ram filesystem data
             return;
         }
 
-        FileObject scratchFolder = getWriteFolder();
         scratchFolder.delete(Selectors.EXCLUDE_SELF);
         
         DefaultFileSystemManager fs = createManager();
 	    fs.setCacheStrategy(CacheStrategy.MANUAL);
         fs.init();
-        
-        FileObject cachedFolder = fs.resolveFile(scratchFolder.getName().getURI());
+        FileObject foBase2 = getBaseTestFolder(fs);
+
+        FileObject cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
         
         FileObject[] fos = cachedFolder.getChildren();
         assertContainsNot(fos, "file1.txt");
@@ -82,20 +85,22 @@
      */
     public void testOnResolveCache() throws Exception
     {
-        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class))
+        FileObject scratchFolder = getWriteFolder();
+        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) ||
+            scratchFolder.getFileSystem() instanceof VirtualFileSystem)
         {
             // cant check ram filesystem as every manager holds its own ram filesystem data
             return;
         }
 
-        FileObject scratchFolder = getWriteFolder();
         scratchFolder.delete(Selectors.EXCLUDE_SELF);
         
         DefaultFileSystemManager fs = createManager();
 	    fs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
         fs.init();
-        
-        FileObject cachedFolder = fs.resolveFile(scratchFolder.getName().getURI());
+        FileObject foBase2 = getBaseTestFolder(fs);
+
+        FileObject cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
         
         FileObject[] fos = cachedFolder.getChildren();
         assertContainsNot(fos, "file1.txt");
@@ -105,7 +110,7 @@
         fos = cachedFolder.getChildren();
         assertContainsNot(fos, "file1.txt");
         
-        cachedFolder = fs.resolveFile(scratchFolder.getName().getURI());
+        cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
         fos = cachedFolder.getChildren();
         assertContains(fos, "file1.txt");
     }
@@ -115,20 +120,22 @@
      */
     public void testOnCallCache() throws Exception
     {
-        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class))
+        FileObject scratchFolder = getWriteFolder();
+        if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) ||
+            scratchFolder.getFileSystem() instanceof VirtualFileSystem)
         {
             // cant check ram filesystem as every manager holds its own ram filesystem data
             return;
         }
 
-        FileObject scratchFolder = getWriteFolder();
         scratchFolder.delete(Selectors.EXCLUDE_SELF);
         
         DefaultFileSystemManager fs = createManager();
 	    fs.setCacheStrategy(CacheStrategy.ON_CALL);
         fs.init();
-        
-        FileObject cachedFolder = fs.resolveFile(scratchFolder.getName().getURI());
+        FileObject foBase2 = getBaseTestFolder(fs);
+
+        FileObject cachedFolder = foBase2.resolveFile(scratchFolder.getName().getPath());
         
         FileObject[] fos = cachedFolder.getChildren();
         assertContainsNot(fos, "file1.txt");



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message