commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r773234 - in /commons/proper/vfs/trunk: ./ core/src/main/java/org/apache/commons/vfs/ core/src/main/java/org/apache/commons/vfs/operations/ core/src/main/java/org/apache/commons/vfs/provider/ core/src/main/java/org/apache/commons/vfs/provid...
Date Sat, 09 May 2009 15:28:00 GMT
Author: rgoers
Date: Sat May  9 15:27:59 2009
New Revision: 773234

URL: http://svn.apache.org/viewvc?rev=773234&view=rev
Log:
Fix webdav unit tests broken by fix for VFS-169

Added:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
  (with props)
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
  (with props)
    commons/proper/vfs/trunk/findbugs-exclude-filter.xml   (with props)
Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystem.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/GenericFileName.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystem.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystem.java Sat
May  9 15:27:59 2009
@@ -34,12 +34,19 @@
     FileObject getRoot() throws FileSystemException;
 
     /**
-     * Returns the name of the root file of this file system.
+     * Returns the name of the root file of this file system. The root name always
+     * contains a path String of "/".
      * @return the root FileName.
      */
     FileName getRootName();
 
     /**
+     * The root URI passed as a file system option or obtained from the rootName.
+     * @return The root URI.
+     */
+    String getRootURI();
+
+    /**
      * Determines if this file system has a particular capability.
      *
      * @param capability The capability to check for.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/FileSystemConfigBuilder.java
Sat May  9 15:27:59 2009
@@ -27,6 +27,9 @@
     /** Default prefix to use when resolving system properties */
     private static final String PREFIX = "vfs.";
 
+    /** The root uri of the file system */
+    private static final String ROOTURI = "rootURI";
+
     /** The prefix to use when resolving system properties */
     private final String prefix;
 
@@ -39,6 +42,27 @@
         this.prefix = PREFIX + component;
     }
 
+    /**
+     * The root URI of the file system.
+     * @param opts The FileSystem options
+     * @param rootURI The creator name to be associated with the file.
+     */
+    public void setRootURI(FileSystemOptions opts, String rootURI)
+    {
+        setParam(opts, ROOTURI, rootURI);
+    }
+
+    /**
+     * Return the root URI of the file system.
+     * @param opts The FileSystem options
+     * @return The root URI.
+     */
+    public String getRootURI(FileSystemOptions opts)
+    {
+        return getString(opts, ROOTURI);
+    }
+
+
     protected void setParam(FileSystemOptions opts, String name, Object value)
     {
         opts.setOption(getConfigClass(), name, value);

Added: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html?rev=773234&view=auto
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
(added)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
Sat May  9 15:27:59 2009
@@ -0,0 +1,19 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<body>
+<p>VFS Operations handling.</p>
+</body>

Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/operations/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileSystem.java
Sat May  9 15:27:59 2009
@@ -30,6 +30,8 @@
 import org.apache.commons.vfs.FileSystemOptions;
 import org.apache.commons.vfs.FilesCache;
 import org.apache.commons.vfs.VfsLog;
+import org.apache.commons.vfs.FileSystemConfigBuilder;
+import org.apache.commons.vfs.impl.DefaultFileSystemConfigBuilder;
 import org.apache.commons.vfs.cache.OnCallRefreshFileObject;
 import org.apache.commons.vfs.events.AbstractFileChangeEvent;
 import org.apache.commons.vfs.events.ChangedEvent;
@@ -57,7 +59,18 @@
 {
     private final static Log log = LogFactory.getLog(AbstractFileSystem.class);
 
+    /**
+     * The "root" of the file system. This is always "/" so it isn't always the "real"
+     * root.
+     */
     private final FileName rootName;
+
+    /**
+     * The root URI of the file system. The base path specified as a file system option
+     * when the file system was created.
+     */
+    private final String rootURI;
+
     private FileObject parentLayer;
     // private FileObject root;
     private final Collection caps = new HashSet();
@@ -98,8 +111,13 @@
         this.parentLayer = parentLayer;
         this.rootName = rootName;
         this.fileSystemOptions = fileSystemOptions;
-
-        // this.files = null;
+        FileSystemConfigBuilder builder = DefaultFileSystemConfigBuilder.getInstance();
+        String uri = builder.getRootURI(fileSystemOptions);
+        if (uri == null)
+        {
+            uri = rootName.getURI();
+        }
+        this.rootURI = uri;
     }
 
     /**
@@ -159,6 +177,15 @@
     }
 
     /**
+     * Returns the root URI specified for this file System.
+     * @return The root URI used in this file system.
+     */
+    public String getRootURI()
+    {
+        return rootURI;
+    }
+
+    /**
      * Adds a file object to the cache.
      */
     protected void putFileToCache(final FileObject file)

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
Sat May  9 15:27:59 2009
@@ -41,7 +41,11 @@
     /**
      * Locates a file object, by absolute URI.
      *
-     * @param uri
+     * @param baseFile The base file object.
+     * @param uri The URI of the file to locate
+     * @param fileSystemOptions The FileSystem options.
+     * @return The located FileObject
+     * @throws FileSystemException if an error occurs.
      */
     public FileObject findFile(final FileObject baseFile,
                                final String uri,
@@ -64,6 +68,10 @@
 
     /**
      * Locates a file from its parsed URI.
+     * @param name The file name.
+     * @param fileSystemOptions FileSystem options.
+     * @return A FileObject associated with the file.
+     * @throws FileSystemException if an error occurs.
      */
     protected FileObject findFile(final FileName name, final FileSystemOptions fileSystemOptions)
         throws FileSystemException
@@ -71,17 +79,7 @@
         // Check in the cache for the file system
         final FileName rootName = getContext().getFileSystemManager().resolveName(name, FileName.ROOT_PATH);
 
-        FileSystem fs;
-        synchronized (this)
-        {
-            fs = findFileSystem(rootName, fileSystemOptions);
-            if (fs == null)
-            {
-                // Need to create the file system, and cache it
-                fs = doCreateFileSystem(rootName, fileSystemOptions);
-                addFileSystem(rootName, fs);
-            }
-        }
+        FileSystem fs = getFileSystem(rootName, fileSystemOptions);
 
         // Locate the file
         // return fs.resolveFile(name.getPath());
@@ -89,10 +87,35 @@
     }
 
     /**
+     * Returns the FileSystem associated with the specified root.
+     * @param rootName The root path.
+     * @param fileSystemOptions The FileSystem options.
+     * @return The FileSystem.
+     * @throws FileSystemException if an error occurs.
+     */
+    protected synchronized FileSystem getFileSystem(FileName rootName, final FileSystemOptions
fileSystemOptions)
+        throws FileSystemException
+    {
+        FileSystem fs = findFileSystem(rootName, fileSystemOptions);
+        if (fs == null)
+        {
+            // Need to create the file system, and cache it
+            fs = doCreateFileSystem(rootName, fileSystemOptions);
+            addFileSystem(rootName, fs);
+        }
+        return fs;
+    }
+
+
+
+    /**
      * Creates a {@link FileSystem}.  If the returned FileSystem implements
      * {@link VfsComponent}, it will be initialised.
      *
      * @param rootName The name of the root file of the file system to create.
+     * @param fileSystemOptions The FileSystem options.
+     * @return The FileSystem.
+     * @throws FileSystemException if an error occurs.
      */
     protected abstract FileSystem doCreateFileSystem(final FileName rootName, final FileSystemOptions
fileSystemOptions)
         throws FileSystemException;

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/GenericFileName.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/GenericFileName.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/GenericFileName.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/GenericFileName.java
Sat May  9 15:27:59 2009
@@ -148,7 +148,7 @@
                 }
                 else
                 {
-                    buffer.append("*****");
+                    buffer.append("***");
                 }
             }
             buffer.append('@');

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/http/HttpClientFactory.java
Sat May  9 15:27:59 2009
@@ -75,15 +75,15 @@
 
             if (fileSystemOptions != null)
             {
-                String proxyHost = HttpFileSystemConfigBuilder.getInstance().getProxyHost(fileSystemOptions);
-                int proxyPort = HttpFileSystemConfigBuilder.getInstance().getProxyPort(fileSystemOptions);
+                String proxyHost = builder.getProxyHost(fileSystemOptions);
+                int proxyPort = builder.getProxyPort(fileSystemOptions);
 
                 if (proxyHost != null && proxyPort > 0)
                 {
                     config.setProxy(proxyHost, proxyPort);
                 }
 
-                UserAuthenticator proxyAuth = HttpFileSystemConfigBuilder.getInstance().getProxyAuthenticator(fileSystemOptions);
+                UserAuthenticator proxyAuth = builder.getProxyAuthenticator(fileSystemOptions);
                 if (proxyAuth != null)
                 {
                     UserAuthenticationData authData = UserAuthenticatorUtils.authenticate(proxyAuth,
new UserAuthenticationData.Type[]
@@ -103,7 +103,7 @@
                     }
                 }
 
-                Cookie[] cookies = HttpFileSystemConfigBuilder.getInstance().getCookies(fileSystemOptions);
+                Cookie[] cookies = builder.getCookies(fileSystemOptions);
                 if (cookies != null)
                 {
                     client.getState().addCookies(cookies);

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java
Sat May  9 15:27:59 2009
@@ -34,9 +34,7 @@
  * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
  * @version $Revision$ $Date$
  */
-public class WebdavFileSystem
-    extends HttpFileSystem
-    implements FileSystem
+public class WebdavFileSystem extends HttpFileSystem implements FileSystem
 {
     protected WebdavFileSystem(final GenericFileName rootName, final HttpClient client,
                                final FileSystemOptions fileSystemOptions)

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=773234&r1=773233&r2=773234&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
Sat May  9 15:27:59 2009
@@ -23,6 +23,8 @@
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * A base class for VFS tests.  Provides utility methods for locating
@@ -36,6 +38,12 @@
 {
     private static File baseDir;
 
+    /** URL pattern */
+    private static final Pattern URL_PATTERN = Pattern.compile("[a-z]+://.*");
+
+    /** Password pattern */
+    private static final Pattern PASSWORD_PATTERN = Pattern.compile(":(?:[^/]+)@");
+
     /**
      * Returns the name of the package containing a class.
      *
@@ -200,6 +208,7 @@
                                          final Object[] params,
                                          final Throwable throwable)
     {
+        Object[] parmArray = params;
         if (throwable instanceof FileSystemException)
         {
             final FileSystemException fse = (FileSystemException) throwable;
@@ -207,15 +216,24 @@
             // Compare message code and params
             assertEquals(code, fse.getCode());
             assertEquals(params.length, fse.getInfo().length);
+            parmArray = new Object[params.length];
             for (int i = 0; i < params.length; i++)
             {
-                final Object param = params[i];
-                assertEquals(String.valueOf(param), fse.getInfo()[i]);
+                String value = String.valueOf(params[i]);
+                // mask passwords (VFS-169)
+                final Matcher urlMatcher = URL_PATTERN.matcher(value);
+                if (urlMatcher.find())
+                {
+                    final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(value);
+                    value = pwdMatcher.replaceFirst(":***@");
+                }
+                assertEquals(value, fse.getInfo()[i]);
+                parmArray[i] = value;
             }
         }
 
         // Compare formatted message
-        final String message = Messages.getString(code, params);
+        final String message = Messages.getString(code, parmArray);
         assertEquals(message, throwable.getMessage());
     }
 

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestCase.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestCase.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestCase.java
Sat May  9 15:27:59 2009
@@ -19,9 +19,11 @@
 import junit.framework.Test;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.FileSystemOptions;
 import org.apache.commons.vfs.impl.DefaultFileSystemManager;
 import org.apache.commons.vfs.provider.temp.TemporaryFileProvider;
 import org.apache.commons.vfs.provider.webdav.WebdavFileProvider;
+import org.apache.commons.vfs.provider.webdav.WebdavFileSystemConfigBuilder;
 import org.apache.commons.vfs.test.AbstractProviderTestConfig;
 import org.apache.commons.vfs.test.ProviderTestSuite;
 
@@ -39,7 +41,7 @@
     {
         if (System.getProperty(TEST_URI) != null)
         {
-            ProviderTestSuite suite = new ProviderTestSuite(new WebdavProviderTestCase());
+            ProviderTestSuite suite = new WebdavProviderTestSuite(new WebdavProviderTestCase());
             suite.addTests(WebdavVersioningTests.class);
             return suite;
         }
@@ -65,7 +67,11 @@
     public FileObject getBaseTestFolder(final FileSystemManager manager)
         throws Exception
     {
+        WebdavFileSystemConfigBuilder builder =
+            (WebdavFileSystemConfigBuilder)manager.getFileSystemConfigBuilder("webdav");
         final String uri = System.getProperty(TEST_URI);
-        return manager.resolveFile(uri);
+        FileSystemOptions opts = new FileSystemOptions();
+        builder.setRootURI(opts, uri);
+        return manager.resolveFile(uri, opts);
     }
 }

Added: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java?rev=773234&view=auto
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
(added)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
Sat May  9 15:27:59 2009
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs.provider.webdav.test;
+
+import org.apache.commons.vfs.impl.test.VfsClassLoaderTests;
+import org.apache.commons.vfs.test.AbstractTestSuite;
+import org.apache.commons.vfs.test.ProviderTestConfig;
+import org.apache.commons.vfs.test.ProviderCacheStrategyTests;
+import org.apache.commons.vfs.test.UriTests;
+import org.apache.commons.vfs.test.NamingTests;
+import org.apache.commons.vfs.test.ContentTests;
+import org.apache.commons.vfs.test.ProviderReadTests;
+import org.apache.commons.vfs.test.ProviderRandomReadTests;
+import org.apache.commons.vfs.test.ProviderWriteTests;
+import org.apache.commons.vfs.test.ProviderWriteAppendTests;
+import org.apache.commons.vfs.test.ProviderRandomReadWriteTests;
+import org.apache.commons.vfs.test.ProviderRenameTests;
+import org.apache.commons.vfs.test.ProviderDeleteTests;
+import org.apache.commons.vfs.test.LastModifiedTests;
+import org.apache.commons.vfs.test.UrlTests;
+import org.apache.commons.vfs.test.UrlStructureTests;
+import org.apache.commons.vfs.test.ProviderTestSuite;
+
+/**
+ * The suite of tests for a file system.
+ *
+ * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
+ * @version $Id$
+ */
+public class WebdavProviderTestSuite extends ProviderTestSuite
+{
+    /**
+     * Adds the tests for a file system to this suite.
+     */
+    public WebdavProviderTestSuite(final ProviderTestConfig providerConfig) throws Exception
+    {
+        this(providerConfig, "", false, false);
+    }
+
+    /**
+     * Adds the tests for a file system to this suite. Provider has an empty directory.
+     */
+    public WebdavProviderTestSuite(final ProviderTestConfig providerConfig,
+                             final boolean addEmptyDir) throws Exception
+    {
+        this(providerConfig, "", false, addEmptyDir);
+    }
+
+
+
+    protected WebdavProviderTestSuite(final ProviderTestConfig providerConfig,
+                                final String prefix,
+                                final boolean nested,
+                                final boolean addEmptyDir)
+        throws Exception
+    {
+        super(providerConfig, prefix, nested, addEmptyDir);
+    }
+
+    /**
+     * Adds base tests - excludes the nested test cases.
+     */
+    protected void addBaseTests() throws Exception
+    {
+        addTests(ProviderCacheStrategyTests.class);
+        addTests(UriTests.class);
+        addTests(NamingTests.class);
+        addTests(ContentTests.class);
+        addTests(ProviderReadTests.class);
+        addTests(ProviderRandomReadTests.class);
+        addTests(ProviderWriteTests.class);
+        addTests(ProviderWriteAppendTests.class);
+        addTests(ProviderRandomReadWriteTests.class);
+        addTests(ProviderRenameTests.class);
+        addTests(ProviderDeleteTests.class);
+        addTests(LastModifiedTests.class);
+        addTests(UrlTests.class);
+        addTests(UrlStructureTests.class);
+        // The class loader test requires the classes be uploaded to the webdav repo.
+        //addTests(VfsClassLoaderTests.class);
+    }
+}
\ No newline at end of file

Propchange: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavProviderTestSuite.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
Sat May  9 15:27:59 2009
@@ -24,6 +24,7 @@
 import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.Selectors;
 import org.apache.commons.vfs.provider.webdav.WebdavFileSystemConfigBuilder;
+import org.apache.commons.vfs.provider.URLFileName;
 import org.apache.commons.vfs.test.AbstractProviderTestCase;
 import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.apache.jackrabbit.webdav.version.VersionControlledResource;
@@ -56,8 +57,12 @@
         assertTrue(file.isReadable());
         assertTrue(file.isWriteable());
         Map map = file.getContent().getAttributes();
+        String name = ((URLFileName)file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()),"admin");
+        if (name != null)
+        {
+            assertEquals(name, map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
+        }
         assertTrue(map.containsKey(VersionControlledResource.CHECKED_OUT.toString()));
 
         // Create the source file
@@ -76,7 +81,10 @@
         assertSameContent(content, file);
         map = file.getContent().getAttributes();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
-        assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()),"admin");
+        if (name != null)
+        {
+            assertEquals(name, map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
+        }
         assertTrue(map.containsKey(VersionControlledResource.CHECKED_IN.toString()));
         builder.setVersioning(opts, false);
     }
@@ -104,10 +112,14 @@
         assertTrue(file.isReadable());
         assertTrue(file.isWriteable());
         Map map = file.getContent().getAttributes();
+        String name = ((URLFileName)file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()),"testUser");
-        assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
-        assertEquals(map.get(DeltaVConstants.COMMENT.toString()),"Modified by user admin");
+        if (name != null)
+        {
+            assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
+            assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
+        }
         assertTrue(map.containsKey(VersionControlledResource.CHECKED_OUT.toString()));
 
         // Create the source file
@@ -127,8 +139,11 @@
         map = file.getContent().getAttributes();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()),"testUser");
-        assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
-        assertEquals(map.get(DeltaVConstants.COMMENT.toString()),"Modified by user admin");
+        if (name != null)
+        {
+            assertTrue(map.containsKey(DeltaVConstants.COMMENT.toString()));
+            assertEquals("Modified by user " + name, map.get(DeltaVConstants.COMMENT.toString()));
+        }       
         assertTrue(map.containsKey(VersionControlledResource.CHECKED_IN.toString()));
         builder.setVersioning(opts, false);
         builder.setCreatorName(opts, null);

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
Sat May  9 15:27:59 2009
@@ -102,7 +102,10 @@
      */
     public void testRoot() throws FileSystemException
     {
-        final FileObject file = getReadFolder().getFileSystem().getRoot();
+        FileSystem fs = getReadFolder().getFileSystem();
+        String uri = fs.getRootURI();
+        final FileObject file = getManager().resolveFile(uri);
+        //final FileObject file = getReadFolder().getFileSystem().getRoot();
         assertTrue(file.exists());
         assertTrue(file.getType() != FileType.IMAGINARY);
     }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java?rev=773234&r1=773233&r2=773234&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
Sat May  9 15:27:59 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.FileSystem;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -91,20 +92,32 @@
 
             // Make sure all children were found
             assertNotNull(children);
+            int length = children.length;
             if (info.children.size() != children.length)
             {
                 for (int i=0; i < children.length; ++i)
                 {
+                    if (children[i].getName().getBaseName().startsWith("."))
+                    {
+                        --length;
+                        continue;
+                    }
                     System.out.println(children[i].getName());
                 }
             }
-            assertEquals("count children of \"" + file.getName() + "\"", info.children.size(),
children.length);
+
+            assertEquals("count children of \"" + file.getName() + "\"", info.children.size(),
length);
 
             // Recursively check each child
             for (int i = 0; i < children.length; i++)
             {
                 final FileObject child = children[i];
-                final FileInfo childInfo = (FileInfo) info.children.get(child.getName().getBaseName());
+                String childName = child.getName().getBaseName();
+                if (childName.startsWith("."))
+                {
+                    continue;
+                }
+                final FileInfo childInfo = (FileInfo) info.children.get(childName);
 
                 // Make sure the child is expected
                 assertNotNull(childInfo);
@@ -139,7 +152,9 @@
      */
     public void testRoot() throws FileSystemException
     {
-        final FileObject file = getReadFolder().getFileSystem().getRoot();
+        FileSystem fs = getReadFolder().getFileSystem();
+        String uri = fs.getRootURI();
+        final FileObject file = getManager().resolveFile(uri);
         file.getChildren();
     }
 

Added: commons/proper/vfs/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/findbugs-exclude-filter.xml?rev=773234&view=auto
==============================================================================
--- commons/proper/vfs/trunk/findbugs-exclude-filter.xml (added)
+++ commons/proper/vfs/trunk/findbugs-exclude-filter.xml Sat May  9 15:27:59 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<!-- ===================================================================== -->
+<!-- $Id$ -->
+<!-- ===================================================================== -->
+<FindBugsFilter>
+  <!-- Enable only high priority warnings -->
+  <Match>
+    <Priority value="2"/>
+  </Match>
+
+  <Match>
+    <Priority value="3"/>
+  </Match>
+</FindBugsFilter>

Propchange: commons/proper/vfs/trunk/findbugs-exclude-filter.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/vfs/trunk/findbugs-exclude-filter.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/proper/vfs/trunk/findbugs-exclude-filter.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message