[maven-release-plugin] copy for tag commons-vfs-project-2.0
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/vfs/tags/commons-vfs-project-2.0@1031749 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java b/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
index 1c37eeb..16b9925 100644
--- a/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
+++ b/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
@@ -17,15 +17,16 @@
package org.apache.commons.vfs.provider.tar.test;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.InputStream;
import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
+
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
@@ -58,6 +59,7 @@
manager.addProvider("tgz", new TarFileProvider());
manager.addProvider("tar", new TarFileProvider());
+ new File(baseDir).mkdir(); // if test is run standalone
createLargeFile(largeFilePath, largeFileName);
}
@@ -140,61 +142,66 @@
}
//@SuppressWarnings("unused")
- protected void createLargeFile(String path, String name) throws Exception {
- long _1K = 1024;
- long _1M = 1024 * _1K;
- long _256M = 256 * _1M;
- long _512M = 512 * _1M;
- long _1G = 1024 * _1M;
+ protected void createLargeFile(String path, final String name) throws Exception {
+ final long _1K = 1024;
+ final long _1M = 1024 * _1K;
+// long _256M = 256 * _1M;
+// long _512M = 512 * _1M;
+ final long _1G = 1024 * _1M;
// File size of 3 GB
- long fileSize = 3 * _1G;
+ final long fileSize = 3 * _1G;
File tarGzFile = new File(path + name + ".tar.gz");
if(!tarGzFile.exists()) {
- System.out.println("This test is a bit slow. It needs to write a 3GB file to your hard drive");
+ System.out.println("This test is a bit slow. It needs to write 3GB of data as a compressed file (approx. 3MB) to your hard drive");
- // Create archive
- OutputStream outTarFileStream = new FileOutputStream(path + name + ".tar");
+ final PipedOutputStream outTarFileStream = new PipedOutputStream();
+ PipedInputStream inTarFileStream = new PipedInputStream(outTarFileStream);
+
+ Thread source = new Thread(){
- TarArchiveOutputStream outTarStream = (TarArchiveOutputStream)new ArchiveStreamFactory()
- .createArchiveOutputStream(ArchiveStreamFactory.TAR, outTarFileStream);
+ public void run() {
+ byte ba_1k[] = new byte[(int) _1K];
+ for(int i=0; i < ba_1k.length; i++){
+ ba_1k[i]='a';
+ }
+ try {
+ TarArchiveOutputStream outTarStream =
+ (TarArchiveOutputStream)new ArchiveStreamFactory()
+ .createArchiveOutputStream(ArchiveStreamFactory.TAR, outTarFileStream);
+ // Create archive contents
+ TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(name + ".txt");
+ tarArchiveEntry.setSize(fileSize);
- // Create archive contents
- TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(name + ".txt");
- tarArchiveEntry.setSize(fileSize);
-
- outTarStream.putArchiveEntry(tarArchiveEntry);
- for(long i = 0; i < fileSize; i++) {
- outTarStream.write('a');
- }
-
- outTarStream.closeArchiveEntry();
- outTarStream.close();
-
- outTarFileStream.close();
-
+ outTarStream.putArchiveEntry(tarArchiveEntry);
+ for(long i = 0; i < fileSize; i+= ba_1k.length) {
+ outTarStream.write(ba_1k);
+ }
+ outTarStream.closeArchiveEntry();
+ outTarStream.close();
+ outTarFileStream.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ };
+ source.start();
+
// Create compressed archive
OutputStream outGzipFileStream = new FileOutputStream(path + name + ".tar.gz");
GzipCompressorOutputStream outGzipStream = (GzipCompressorOutputStream)new CompressorStreamFactory()
.createCompressorOutputStream(CompressorStreamFactory.GZIP, outGzipFileStream);
- // Compress archive
- InputStream inTarFileStream = new FileInputStream(path + name + ".tar");
- // TODO: Change to a Piped Stream to conserve disk space
IOUtils.copy(inTarFileStream, outGzipStream);
inTarFileStream.close();
outGzipStream.close();
outGzipFileStream.close();
- // Cleanup original tar
- File tarFile = new File(path + name + ".tar");
- if(tarFile.exists()) {
- tarFile.delete();
- }
}
}
}
diff --git a/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java b/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
index e026f9f..d2c55d2 100644
--- a/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
+++ b/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
@@ -195,13 +195,13 @@
{
final Capability cap = caps[i];
FileSystem fs = readFolder.getFileSystem();
- String name = fs.getClass().getName();
- int index = name.lastIndexOf('.');
- String fsName = (index > 0) ? name.substring(index + 1) : name;
if (!fs.hasCapability(cap))
{
- System.out.println("skipping " + getName() + " because " +
- fsName + " does not have capability " + cap);
+// String name = fs.getClass().getName();
+// int index = name.lastIndexOf('.');
+// String fsName = (index > 0) ? name.substring(index + 1) : name;
+// System.out.println("skipping " + getName() + " because " +
+// fsName + " does not have capability " + cap);
return;
}
}
@@ -321,6 +321,7 @@
/**
* Builds the expected structure of the read tests folder.
+ * @throws FileSystemException (possibly)
*/
protected FileInfo buildExpectedStructure() throws FileSystemException
{
diff --git a/core/src/test/resources/test-data/largefile.tar.gz b/core/src/test/resources/test-data/largefile.tar.gz
new file mode 100644
index 0000000..5bcc47a
--- /dev/null
+++ b/core/src/test/resources/test-data/largefile.tar.gz
Binary files differ
diff --git a/pom.xml b/pom.xml
index 1054bfc..fac216a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,8 +122,8 @@
<commons.binary.suffix />
<commons.jira.id>VFS</commons.jira.id>
<commons.jira.pid>12310495</commons.jira.pid>
- <maven.compile.source>1.4</maven.compile.source>
- <maven.compile.target>1.4</maven.compile.target>
+ <maven.compile.source>1.5</maven.compile.source>
+ <maven.compile.target>1.5</maven.compile.target>
<commons.release.name>commons-vfs-${commons.release.version}</commons.release.name>
<vfs.parent.dir>${basedir}</vfs.parent.dir>
</properties>
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index de47152..62f759b 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -64,6 +64,21 @@
</section>
+ <section name="Requirements">
+ <p>
+ Commons VFS 2.0 requires Java 5. Many of the file systems require that optional components be present
+ in order for the protocol to be enabled. See the <a href="download.html">download and build</a> page for
+ information on the optional dependencies.
+ </p>
+ </section>
+
+ <section name="News">
+ <p>
+ Commons VFS 2.0 is now available. Support for FTPS and WebDav have been added in addition to many bugs
+ being fixed.
+ </p>
+ </section>
+
</body>
</document>