/** * Checks nested junctions are not supported. */ public void testNestedJunction() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs:").getFileSystem(); final FileObject baseDir = getBaseDir(); fs.addJunction("/a", baseDir); // Nested try { fs.addJunction("/a/b", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a/b", e); } // At same point try { fs.addJunction("/a", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a", e); } }
/** * Checks nested junctions are not supported. */ public void testNestedJunction() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs:").getFileSystem(); final FileObject baseDir = getBaseDir(); fs.addJunction("/a", baseDir); // Nested try { fs.addJunction("/a/b", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a/b", e); } // At same point try { fs.addJunction("/a", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a", e); } }
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final FileObject baseFolder = config.getBaseTestFolder(manager); // Create an empty file system, then link in the base folder final FileSystem newFs = manager.createVirtualFileSystem("vfs:").getFileSystem(); final String junctionPoint = "/some/dir"; newFs.addJunction(junctionPoint, baseFolder); return newFs.resolveFile(junctionPoint); }
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final FileObject baseFolder = config.getBaseTestFolder(manager); // Create an empty file system, then link in the base folder final FileSystem newFs = manager.createVirtualFileSystem("vfs:").getFileSystem(); final String junctionPoint = "/some/dir"; newFs.addJunction(junctionPoint, baseFolder); return newFs.resolveFile(junctionPoint); }
/** * Returns the base folder for tests. */ @Override public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final FileObject baseFolder = config.getBaseTestFolder(manager); // Create an empty file system, then link in the base folder final FileSystem newFs = manager.createVirtualFileSystem("vfs:").getFileSystem(); final String junctionPoint = "/some/dir"; newFs.addJunction(junctionPoint, baseFolder); return newFs.resolveFile(junctionPoint); }
/** * Checks nested junctions are not supported. */ public void testNestedJunction() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs:").getFileSystem(); final FileObject baseDir = getBaseDir(); fs.addJunction("/a", baseDir); // Nested try { fs.addJunction("/a/b", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a/b", e); } // At same point try { fs.addJunction("/a", baseDir); fail(); } catch (final Exception e) { assertSameMessage("vfs.impl/nested-junction.error", "vfs:/a", e); } }
/** * Checks ancestors are created when a junction is created. */ public void testAncestors() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs://").getFileSystem(); final FileObject baseDir = getBaseDir(); // Make sure the file at the junction point and its ancestors do not exist FileObject file = fs.resolveFile("/a/b"); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); // Add the junction fs.addJunction("/a/b", baseDir); // Make sure the file at the junction point and its ancestors exist file = fs.resolveFile("/a/b"); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); }
/** * Checks ancestors are created when a junction is created. */ public void testAncestors() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs://").getFileSystem(); final FileObject baseDir = getBaseDir(); // Make sure the file at the junction point and its ancestors do not exist FileObject file = fs.resolveFile("/a/b"); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); // Add the junction fs.addJunction("/a/b", baseDir); // Make sure the file at the junction point and its ancestors exist file = fs.resolveFile("/a/b"); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); }
/** * Checks ancestors are created when a junction is created. */ public void testAncestors() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs://").getFileSystem(); final FileObject baseDir = getBaseDir(); // Make sure the file at the junction point and its ancestors do not exist FileObject file = fs.resolveFile("/a/b"); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); file = file.getParent(); assertFalse(file.exists()); // Add the junction fs.addJunction("/a/b", baseDir); // Make sure the file at the junction point and its ancestors exist file = fs.resolveFile("/a/b"); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); file = file.getParent(); assertTrue("Does not exist", file.exists()); }