This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit 32c373c23ecc0239a9925e23115670da419113eb Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue May 28 07:59:53 2024 -0400 Sort members --- .../commons/vfs2/provider/test/JunctionTests.java | 104 ++++++++++----------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionTests.java index 9099b67c..51fb5999 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/JunctionTests.java @@ -31,6 +31,32 @@ import org.apache.commons.vfs2.provider.DelegateFileObject; import org.apache.commons.vfs2.util.WeakRefFileListener; import org.junit.Test; +class DebugFileListener implements FileListener { + private boolean changed; + private boolean created; + private boolean deleted; + + @Override + public void fileChanged(FileChangeEvent event) throws Exception { + changed = true; + } + + @Override + public void fileCreated(FileChangeEvent event) throws Exception { + created = true; + } + + @Override + public void fileDeleted(FileChangeEvent event) throws Exception { + deleted = true; + } + + @Override + public String toString() { + return "Listener " + changed + " " + created + " " + deleted; + } +} // class DebugListener + /** * Additional junction test cases. */ @@ -70,32 +96,6 @@ public class JunctionTests extends AbstractProviderTestCase { assertTrue("Does not exist", file.exists()); } - /** - * Checks nested junctions are not supported. - */ - @Test - 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 that change events from delegatedd files are fired. */ @@ -142,6 +142,32 @@ public class JunctionTests extends AbstractProviderTestCase { assertEquals("Weak Listener was abandoned", "Listener false true false", listener2.toString()); } + /** + * Checks nested junctions are not supported. + */ + @Test + 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); + } + } + // Check that file @ junction point exists only when backing file exists // Add 2 junctions with common parent // Compare real and virtual files @@ -150,29 +176,3 @@ public class JunctionTests extends AbstractProviderTestCase { } -class DebugFileListener implements FileListener { - private boolean changed; - private boolean created; - private boolean deleted; - - @Override - public void fileChanged(FileChangeEvent event) throws Exception { - changed = true; - } - - @Override - public void fileCreated(FileChangeEvent event) throws Exception { - created = true; - } - - @Override - public void fileDeleted(FileChangeEvent event) throws Exception { - deleted = true; - } - - @Override - public String toString() { - return "Listener " + changed + " " + created + " " + deleted; - } -} // class DebugListener -