Author: ggregory
Date: Thu Aug 8 17:53:05 2013
New Revision: 1511900
URL: http://svn.apache.org/r1511900
Log:
[VFS-483][RAM] Many suggestions to improve the RAM file provider. Use long for
FS size limit. Apply test patch
https://issues.apache.org/jira/secure/attachment/12596890/unittest-fsoption.patch.
Thanks to Bernd Eckenfels.
Modified:
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
Modified:
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java?rev=1511900&r1=1511899&r2=1511900&view=diff
==============================================================================
---
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
(original)
+++
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ram/test/CustomRamProviderTest.java
Thu Aug 8 17:53:05 2013
@@ -219,19 +219,33 @@ public class CustomRamProviderTest
}
@Test
- public void testSmallFS() throws Exception
+ public void testFSOptions() throws Exception
{
// Default FS
final FileObject fo1 = manager.resolveFile("ram:/");
final FileObject fo2 = manager.resolveFile("ram:/");
assertTrue("Both files should exist in the same fs instance.",
fo1.getFileSystem() == fo2.getFileSystem());
+ FileSystemOptions fsOptions =
fo1.getFileSystem().getFileSystemOptions();
+ long maxFilesystemSize =
RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
+ assertEquals("Filesystem option maxSize must be unlimited",
Long.MAX_VALUE, maxFilesystemSize);
+
// Small FS
final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
final FileObject fo4 = manager.resolveFile("ram:/", smallSizedFso);
assertTrue("Both files should exist in the same FileSystem instance.",
fo3.getFileSystem() == fo4.getFileSystem());
assertTrue("Both files should exist in different FileSystem
instance.", fo1.getFileSystem() != fo3.getFileSystem());
+ fsOptions = fo3.getFileSystem().getFileSystemOptions();
+ maxFilesystemSize =
RamFileSystemConfigBuilder.getInstance().getLongMaxSize(fsOptions);
+ assertEquals("Filesystem option maxSize must be set", 10,
maxFilesystemSize);
+ }
+
+ @Test
+ public void testSmallFS() throws Exception
+ {
+ // Small FS
+ final FileObject fo3 = manager.resolveFile("ram:/fo3", smallSizedFso);
fo3.createFile();
try
{