use of org.apache.commons.vfs2.impl.DefaultFileSystemManager in project commons-vfs by apache.
the class Vfs444TestCase method prepare.
/**
* Prepares the file system manager. This implementation does nothing.
*/
@Override
public void prepare(final DefaultFileSystemManager manager) throws Exception {
manager.addProvider("res", new ResourceFileProvider());
manager.addProvider("zip", new ZipFileProvider());
}
use of org.apache.commons.vfs2.impl.DefaultFileSystemManager in project commons-vfs by apache.
the class WindowsFileNameTests method testWindowsFilenameUNCStartError.
@Test
public void testWindowsFilenameUNCStartError() {
try {
final String FILE = "file://///";
final DefaultFileSystemManager manager = getManager();
Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileObject fo = manager.resolveFile(FILE);
fail("Windows File Parser should not allow " + FILE + " " + fo);
} catch (FileSystemException ex) {
assertEquals("Exception code", "vfs.provider/invalid-absolute-uri.error", ex.getCode());
ex = (FileSystemException) ex.getCause();
assertEquals("Exception code", "vfs.provider.local/missing-share-name.error", ex.getCode());
}
}
use of org.apache.commons.vfs2.impl.DefaultFileSystemManager in project commons-vfs by apache.
the class WindowsFileNameTests method testWindowsWrongRoots.
@Test
public void testWindowsWrongRoots() {
final String[] tests = { "file:///C:", "file://C:", "file:/C:", "file:C:" };
for (final String name : tests) {
try {
final DefaultFileSystemManager manager = getManager();
Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileName fn = manager.resolveFile(name).getName();
fail("should not accept root " + name);
} catch (final FileSystemException ex) {
assertEquals("vfs.provider/invalid-absolute-uri.error", ex.getCode());
assertTrue(ex.toString().indexOf(name) >= 0);
}
}
}
use of org.apache.commons.vfs2.impl.DefaultFileSystemManager in project commons-vfs by apache.
the class WindowsFileNameTests method testWindowsFilenameParserError.
@Test
public void testWindowsFilenameParserError() {
// check VFS-338 with 2+4 slashes we want a dedicated error
try {
final String FILE = "file://////";
final DefaultFileSystemManager manager = getManager();
Assertions.assertNotNull(manager, "Unexpected null manager for test " + this);
final FileObject fo = manager.resolveFile(FILE);
fail("Windows File Parser should not allow " + FILE + " " + fo);
} catch (FileSystemException ex) {
assertEquals("Exception code", "vfs.provider/invalid-absolute-uri.error", ex.getCode());
ex = (FileSystemException) ex.getCause();
assertEquals("Exception code", "vfs.provider.local/not-absolute-file-name.error", ex.getCode());
}
}
use of org.apache.commons.vfs2.impl.DefaultFileSystemManager in project commons-vfs by apache.
the class CustomRamProviderTest method setUp.
@BeforeEach
public void setUp() throws Exception {
manager = new DefaultFileSystemManager();
manager.addProvider("ram", new RamFileProvider());
manager.init();
// File Systems Options
RamFileSystemConfigBuilder.getInstance().setMaxSize(zeroSizedFso, 0L);
RamFileSystemConfigBuilder.getInstance().setMaxSize(smallSizedFso, 10L);
}
Aggregations