/** * Tests mounting only one invalid FileSystem * * @throws Exception */ @Test(expected = FileSystemException.class) public void testMountKo() throws Exception { logger.info("*************** testMountKo"); for (String fakeUrl : fakeUrls) { FileObject mounted = VFSMountManagerHelper.mount(fakeUrl); } }
/** * Tests closing all FileSystems * * @throws Exception */ @Ignore("vfs close file system doesn't seem to work properly") @Test public void testCloseFileSystems() throws Exception { logger.info("*************** testCloseFileSystems"); String[] validUrls = server.getVFSRootURLs(); ArrayList<FileObject> fos = new ArrayList<FileObject>(); for (String validUrl : validUrls) { FileObject mounted = VFSMountManagerHelper.mount(validUrl); Assert.assertTrue(mounted.exists()); fos.add(mounted); } VFSMountManagerHelper.closeFileSystems(Arrays.asList(validUrls)); boolean onlyExceptions = true; for (FileObject closedFo : fos) { try { FileObject toto = closedFo.resolveFile("toto"); toto.createFile(); onlyExceptions = false; logger.error(toto.getURL() + " exists : " + toto.exists()); } catch (FileSystemException e) { // this should occur } } Assert.assertTrue("Only Exceptions received", onlyExceptions); }
/** * Tests mounting only one valid FileSystem * * @throws Exception */ @Test public void testMountOk() throws Exception { logger.info("*************** testMountOk"); String[] validUrls = server.getVFSRootURLs(); for (String validUrl : validUrls) { FileObject mounted = VFSMountManagerHelper.mount(validUrl); Assert.assertTrue(mounted.exists()); } }