You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2005/05/12 22:09:07 UTC
svn commit: r169878 - in /jakarta/commons/sandbox/vfs/trunk: ./
src/java/org/apache/commons/vfs/provider/webdav/ src/test-data/
src/test-data/basedir/ src/test/org/apache/commons/vfs/provider/sftp/test/
xdocs/
Author: imario
Date: Thu May 12 13:09:06 2005
New Revision: 169878
URL: http://svn.apache.org/viewcvs?rev=169878&view=rev
Log:
Documentation how to setup a VFS testserver.
On the way found some problems with the webdav provider.
Might be due to new apache?
Added:
jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.jar (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tar (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tbz2 (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tgz (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.zip (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/test.jar (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tar (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tbz2 (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tgz (with props)
jakarta/commons/sandbox/vfs/trunk/src/test-data/test.zip (with props)
jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml (with props)
Modified:
jakarta/commons/sandbox/vfs/trunk/maven.xml
jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
jakarta/commons/sandbox/vfs/trunk/src/test/org/apache/commons/vfs/provider/sftp/test/SftpProviderTestCase.java
Modified: jakarta/commons/sandbox/vfs/trunk/maven.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/maven.xml?rev=169878&r1=169877&r2=169878&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/maven.xml (original)
+++ jakarta/commons/sandbox/vfs/trunk/maven.xml Thu May 12 13:09:06 2005
@@ -8,6 +8,10 @@
<copy todir="${test.basedir}/read-tests">
<fileset dir="${test.data.src}/basedir"/>
</copy>
+ <copy todir="${test.basedir}/">
+ <fileset dir="${test.data.src}" includes="nested.*,test.*"/>
+ </copy>
+
<!-- Compile the code for the class loader test -->
<javac
@@ -24,7 +28,8 @@
<mkdir dir="${test.basedir}/read-tests/emptydir"/>
- <!-- Create a zip file -->
+ <!-- Create a zip file - its not possible to create tgz, tar and tbz2 so we provide
+ the whole set for download now
<zip zipfile="${test.basedir}/test.zip">
<zipfileset dir="${test.basedir}">
<include name="read-tests/**"/>
@@ -50,6 +55,7 @@
jarfile="${test.basedir}/nested.jar"
basedir="${test.basedir}"
includes="test.jar"/>
+ -->
</postGoal>
</project>
Modified: jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java?rev=169878&r1=169877&r2=169878&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java (original)
+++ jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java Thu May 12 13:09:06 2005
@@ -31,6 +31,7 @@
import org.apache.webdav.lib.methods.DepthSupport;
import org.apache.webdav.lib.methods.OptionsMethod;
import org.apache.webdav.lib.methods.XMLResponseMethodBase;
+import org.apache.webdav.lib.methods.DeleteMethod;
import org.apache.webdav.lib.properties.ResourceTypeProperty;
import java.io.ByteArrayOutputStream;
@@ -90,6 +91,12 @@
}
}
+ /**
+ * set the davResource
+ * @param resource
+ * @param bCheckExists might be removed soon
+ * @throws Exception
+ */
private void setDavResource(WebdavResource resource, boolean bCheckExists) throws Exception
{
redirectionResolved = false;
@@ -109,7 +116,7 @@
this.resource = resource;
- if (bCheckExists)
+ // if (bCheckExists)
{
/* now fill the dav properties */
final OptionsMethod optionsMethod = new OptionsMethod(getName().getPath());
@@ -213,7 +220,7 @@
if (status >= 200 && status <= 299)
{
setAllowedMethods(optionsMethod.getAllowedMethods());
- resource.getHttpURL().setPath(optionsMethod.getPath());
+ resource.getHttpURL().setEscapedPath(optionsMethod.getPath());
redirectionResolved = true;
}
}
@@ -327,7 +334,9 @@
*/
protected void doDelete() throws Exception
{
- final boolean ok = resource.deleteMethod(getName().getPathDecoded() /*url.getPath()*/);
+ resolveRedirection();
+ // final boolean ok = resource.deleteMethod(getName().getPathDecoded() /*url.getPath()*/);
+ final boolean ok = resource.deleteMethod();
if (!ok)
{
throw new FileSystemException("vfs.provider.webdav/delete-file.error", resource.getStatusMessage());
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%25.txt?rev=169878&view=auto
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt (added)
+++ jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt Thu May 12 13:09:06 2005
@@ -0,0 +1 @@
+This is a test file.
\ No newline at end of file
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/basedir/file%.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.jar
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.jar?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tar
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tar?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tbz2
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tbz2?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tbz2
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tgz
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tgz?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.tgz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.zip
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.zip?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/nested.zip
------------------------------------------------------------------------------
svn:mime-type = application/zip
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.jar
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/test.jar?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.jar
------------------------------------------------------------------------------
svn:mime-type = application/java-archive
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tar
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tar?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tbz2
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tbz2?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tbz2
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tgz
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tgz?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.tgz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.zip
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test-data/test.zip?rev=169878&view=auto
==============================================================================
Binary file - no diff available.
Propchange: jakarta/commons/sandbox/vfs/trunk/src/test-data/test.zip
------------------------------------------------------------------------------
svn:mime-type = application/zip
Modified: jakarta/commons/sandbox/vfs/trunk/src/test/org/apache/commons/vfs/provider/sftp/test/SftpProviderTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/test/org/apache/commons/vfs/provider/sftp/test/SftpProviderTestCase.java?rev=169878&r1=169877&r2=169878&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/test/org/apache/commons/vfs/provider/sftp/test/SftpProviderTestCase.java (original)
+++ jakarta/commons/sandbox/vfs/trunk/src/test/org/apache/commons/vfs/provider/sftp/test/SftpProviderTestCase.java Thu May 12 13:09:06 2005
@@ -57,6 +57,7 @@
final String uri = System.getProperty("test.sftp.uri");
FileSystemOptions fileSystemOptions = new FileSystemOptions();
+ SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fileSystemOptions, "no");
SftpFileSystemConfigBuilder.getInstance().setUserInfo(fileSystemOptions, new TrustEveryoneUserInfo());
return manager.resolveFile(uri, fileSystemOptions);
Added: jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml?rev=169878&view=auto
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml (added)
+++ jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml Thu May 12 13:09:06 2005
@@ -0,0 +1,209 @@
+<document>
+ <properties>
+ <title>Setup a Testserver</title>
+ <author email="imario@apache.org">Mario Ivankovits</author>
+ </properties>
+
+ <body>
+ <section name="Testserver">
+ <p>
+ This documentation describes how to setup a VFS testserver needet during development for the junit
+ tests.
+ </p>
+ <p>
+ I tried to simplify things as good as I can, e.g. this setup uses for all server the same vfs work
+ directory.
+ Thus it is needet to setup apache to use user 'vfsusr' instead of 'wwwrun'.
+ <br/>
+ Based on this description it should be possible for you to avoid this "insecurity" if needet.
+ </p>
+ <p>
+ I created it during setup a fresh server based on the following components:
+
+ <ol>
+ <li>SuSE Linux 9.3 Minimal Installation</li>
+ <li>Apache 2 Webserver (apache2-2.0.53)</li>
+ <li>Samba 3 (samba-3.0.12)</li>
+ <li>ssh (openssh-3.9p1)</li>
+ <li>vsftp (vsftpd-2.0.2-3)</li>
+ </ol>
+ </p>
+
+
+ <subsection name="System setup">
+ <ol>
+ <li>You need maven to build the local test-data structure. This is done automatically during build of VFS.</li>
+ <li>Create a user 'vfsusr' with password 'vfsusr' and home directory '/home/vfsusr'
+ <br/>
+ <code><![CDATA[
+useradd -p vfsusr -m vfsusr</code>
+ ]]></code>
+ </li>
+ <li>Create the directories
+ <ol>
+ <li>/vfstest</li>
+ <li>/vfstest/write-tests</li>
+ </ol>
+ and copy from your local 'target/test-data' the directories
+ <code>code,read-tests</code> into it.<br />
+ Now your structure looks like this:<br />
+ <code><![CDATA[
+/vfstest
+/vfstest/write-tests
+/vfstest/read-tests
+/vfstest/read-tests/emptydir
+/vfstest/read-tests/file1.txt
+/vfstest/read-tests/dir1
+/vfstest/read-tests/dir1/file1.txt
+/vfstest/read-tests/dir1/file2.txt
+/vfstest/read-tests/dir1/file3.txt
+/vfstest/read-tests/dir1/subdir1
+/vfstest/read-tests/dir1/subdir1/file1.txt
+/vfstest/read-tests/dir1/subdir1/file2.txt
+/vfstest/read-tests/dir1/subdir1/file3.txt
+/vfstest/read-tests/dir1/subdir2
+/vfstest/read-tests/dir1/subdir2/file1.txt
+/vfstest/read-tests/dir1/subdir2/file2.txt
+/vfstest/read-tests/dir1/subdir2/file3.txt
+/vfstest/read-tests/dir1/subdir3
+/vfstest/read-tests/dir1/subdir3/file1.txt
+/vfstest/read-tests/dir1/subdir3/file2.txt
+/vfstest/read-tests/dir1/subdir3/file3.txt
+/vfstest/read-tests/empty.txt
+/vfstest/read-tests/file%.txt
+/vfstest/code
+/vfstest/code/sealed
+/vfstest/code/sealed/AnotherClass.class
+/vfstest/code/ClassToLoad.class
+ ]]></code>
+ </li>
+ <li>Setup a symbolic link to '/vfstest'<br />
+ <code><![CDATA[
+ln -s /vfstest /home/vfsusr/vfstest
+ ]]></code>
+ </li>
+ <li>Set permissions
+ <br/>
+ <code><![CDATA[
+find /vfstest -print0 | xargs -0 chown vfsusr.users
+ ]]></code>
+ </li>
+ <li>After setup the server ensure they are installed and running
+ <br/>
+ <code><![CDATA[
+insserv apache2
+insserv smb
+insserv nmb
+/etc/rc.d/apache2 restart
+/etc/rc.d/smb restart
+/etc/rc.d/nmb restart
+ ]]></code>
+ </li>
+ </ol>
+ </subsection>
+
+ <subsection name="Apache 2 Webserver">
+ <ol>
+ <li>Create a file named '/etc/apache2/conf.d/vfstest.conf' with this content<br />
+ <code><![CDATA[
+#
+# 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>
+ ]]></code>
+ </li>
+ <li>change the permission on
+ <code><![CDATA[
+chown vfsusr.users /var/lib/apache2
+ ]]></code>
+ </li>
+ <li>Activate the WebDAV module by adding 'dav' and 'dav_fs' to the list of modules in '/etc/sysconfig/apache2'. e.g <br/>
+ <code><![CDATA[
+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"
+ ]]></code>
+ </li>
+ <li>Setup the webserver to use user-id 'vfsusr' and group 'users'. This can be done by changing the file '/etc/apache2/uid.conf'<br />
+ <code><![CDATA[
+User vfsusr
+Group users
+ ]]></code>
+ </li>
+ <li>Create the VFS user to access the Webdav resource<br />
+ <code><![CDATA[
+htpasswd2 -cmb /etc/apache2/passwd vfsusr vfsusr
+ ]]></code>
+ </li>
+ </ol>
+ </subsection>
+
+ <subsection name="Samba 3">
+ <ol>
+ <li>Create a share 'vfsusr'<br />
+ <code><![CDATA[
+[vfsusr]
+ comment = VFS Test Directory
+ path = /home/vfsusr
+ guest ok = yes
+ writable = yes
+ ]]></code>
+ </li>
+ <li>Setup a 'vfsusr' with password 'vfsusr'<br />
+ <code><![CDATA[
+smbpasswd -a vfsusr
+ ]]></code>
+ </li>
+ </ol>
+ </subsection>
+
+ <subsection name="ssh">
+ <ol>
+ <li>In '/etc/ssh/sshd_config' ensure<br />
+ <code><![CDATA[
+PasswordAuthentication yes
+ ]]></code>
+ </li>
+ </ol>
+ </subsection>
+
+ <subsection name="vsftp">
+ <ol>
+ <li>Ensure the server is not disabled in the xinetd configuration<br />
+ Set <code>disable=no</code> in '/etc/xinetd.d/vsftpd'
+ </li>
+
+ <li>Setup the server config: '/etc/vsftpd.conf'<br/>
+ <code>
+write_enable=YES
+local_enable=YES
+ </code>
+
+ </li>
+ </ol>
+ </subsection>
+
+ </section>
+ </body>
+</document>
\ No newline at end of file
Propchange: jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/commons/sandbox/vfs/trunk/xdocs/testserver.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org