Apache Commons logo Commons VFS

Running the tests

This page details how to setup the tests for the various providers and then run them with Maven 2.

The tests were run on Mac OS/X 10.5. The tests requiring a remote repository were pointed to a second machine running Kubuntu 7.10 and the various servers that can be installed from the system administration tool. The only exception to this is that the WebDAV and Http support was testing using Day CRX 1.4 as the server.

Getting Started

First, from the root directory of the project, run mvn install. This will compile all the source and test source and then run all the tests for providers that use the local file system.

Setting up the remote server

Each remote service needs to have the test data placed within it's "repository". After running the maven build, the test data can be found in core/target/test-data. Each service may require a userid and password to be created. For example, to run the ftp test on a Linux system a user should be created and the test data placed within that user's home directory. See the following sections for details on each service.

Each repository should contain the following list of files for the tests to complete successfully.

write-tests
read-tests
read-tests/file1.txt
read-tests/dir1
read-tests/dir1/file1.txt
read-tests/dir1/file2.txt
read-tests/dir1/file3.txt
read-tests/dir1/subdir1
read-tests/dir1/subdir1/file1.txt
read-tests/dir1/subdir1/file2.txt
read-tests/dir1/subdir1/file3.txt
read-tests/dir1/subdir2
read-tests/dir1/subdir2/file1.txt
read-tests/dir1/subdir2/file2.txt
read-tests/dir1/subdir2/file3.txt
read-tests/dir1/subdir3
read-tests/dir1/subdir3/file1.txt
read-tests/dir1/subdir3/file2.txt
read-tests/dir1/subdir3/file3.txt
read-tests/empty.txt
read-tests/file%.txt
code
code/sealed
code/sealed/AnotherClass.class
code/ClassToLoad.class

Apache 2 Webserver

Create a user on the system

  1. Create a user 'vfsusr' with password 'vfs/%\te:st' and home directory '/home/vfsusr'
    useradd -p vfsusr -m vfsusr
  2. In vfsuser's home directory create the directories
    1. vfstest
    2. vfstest/write-tests
  3. Copy the test data into the vfstest directory
  4. Create a symbolic link at '/vfstest' to /home/vfsuser/vfstest
    ln -s /vfstest /home/vfsusr/vfstest
  5. Create a file named '/etc/apache2/conf.d/vfstest.conf' with this content
    #
    # VFSTEST
    #
    Alias /vfstest /vfstest/
    
    DAVLockDB /var/lib/apache2/dav.lockDB
    DAVMinTimeout 600
    
    <Directory /vfstest>
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    <Location />
            DAV On
            Options Indexes MultiViews
            AllowOverride None
    
            AuthType Basic
            AuthName vfstest_zone
            AuthUserFile /etc/apache2/passwd
            <Limit PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
                    Require user vfsusr
            </Limit>
    </Location>
  6. change the permission on
    chown vfsusr.users /var/lib/apache2
                            
  7. Activate the WebDAV module by adding 'dav' and 'dav_fs' to the list of modules in '/etc/sysconfig/apache2'. e.g
    APACHE_MODULES="access actions alias auth auth_dbm autoindex cgi dir env expires include log_config
    mime negotiation setenvif ssl suexec userdir php4 php5 dav dav_fs"
  8. Setup the webserver to use user-id 'vfsusr' and group 'users'. This can be done by changing the file '/etc/apache2/uid.conf'
    User vfsusr
    Group users
  9. Create the VFS user to access the Webdav resource
    htpasswd2 -cmb /etc/apache2/passwd  vfsusr 'vfstest'
  10. Add the following to profiles section of settings.xml in the Maven home directory. Modify the urls to match your setup.
       <profile>
          <id>http</id>
          <activation>
            <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
            <test.http.uri>http://vfsusr:vfstest@192.168.10.133:80/vfstest/test-data</test.http.uri>
          </properties>
        </profile>
        <profile>
          <id>webdav</id>
          <activation>
            <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
            <test.webdav.uri>webdav://vfsusr:vfstest@192.168.10.133:80/vfstest/test-data</test.webdav.uri>
          </properties>
        </profile>

Day CRX or Apache Jackrabbit

  1. Use Windows Explorer, Mac Finder or a similar tool to connect to the repository.
  2. Create a vfstest directory
  3. Drag the test-data from Explorer/Finder window to the repository window to copy the files to the vfstest directory in the repository
  4. Add the following to profiles section of settings.xml in the Maven home directory. Modify the urls to match your setup.
       <profile>
          <id>http</id>
          <activation>
            <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
            <test.http.uri>http://admin:admin@192.168.10.133:7402/vfstest/test-data</test.http.uri>
          </properties>
        </profile>
        <profile>
          <id>webdav</id>
          <activation>
            <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
            <test.webdav.uri>webdav://admin:admin@192.168.10.133:7402/vfstest/test-data</test.webdav.uri>
          </properties>
        </profile>

Samba 3

  1. Create a share 'vfsusr'
    [vfsusr]
       comment = VFS Test Directory
       path = /home/vfsusr
       guest ok = yes
       writable = yes
  2. Setup a 'vfsusr' with password 'vfstest'
    smbpasswd -a vfsusr

ssh

  1. In '/etc/ssh/sshd_config' ensure
    PasswordAuthentication yes

vsftp

  1. Create a user 'vfsusr' with password 'vfstest' and home directory '/home/vfsusr'
    useradd -p vfsusr -m vfsusr
  2. In vfsuser's home directory create the directories
    1. vfstest
    2. vfstest/write-tests
  3. Copy the test data into the vfstest directory
  4. Ensure the server is not disabled in the xinetd configuration
    Set
    disable=no
    in '/etc/xinetd.d/vsftpd'
  5. Setup the server config: '/etc/vsftpd.conf'
    write_enable=YES
    local_enable=YES
  6. Add the following to profiles section of settings.xml in the Maven home directory. Modify the urls to match your setup.
        <profile>
          <id>ftp</id>
          <activation>
            <activeByDefault>false</activeByDefault>
          </activation>
          <properties>
            <test.ftp.uri>ftp://admin:admin@192.168.10.133/vfstest/test-data</test.ftp.uri>
          </properties>
        </profile>

Running tests

Running tests simply requires that the appropriate profile be activated. For example, to run just the webdav test do mvn -P webdav test -Dtest=WebdavProviderTestCase. Multipe tests can be run by doing mvn -P webdav -P http test.