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 b4d6fc0048a0a9c1bde418fea261d4d00d4b1a12 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Oct 18 18:15:47 2020 -0400 More converting from JUnit 3 to 4: Add @Test and minor formatting. --- .../provider/webdav/test/WebdavVersioningTests.java | 8 ++++---- .../webdav4/test/Webdav4VersioningTests.java | 8 ++++---- .../vfs2/cache/AbstractFilesCacheTestsBase.java | 4 ++++ .../commons/vfs2/cache/DefaultFilesCacheTests.java | 3 +++ .../commons/vfs2/cache/LRUFilesCacheTests.java | 4 ++++ .../commons/vfs2/cache/NullFilesCacheTests.java | 5 +++++ .../commons/vfs2/cache/SoftRefFilesCacheTests.java | 4 ++++ .../commons/vfs2/cache/WeakRefFilesCacheTests.java | 4 ++++ .../commons/vfs2/impl/test/VfsClassLoaderTests.java | 6 ++++++ .../vfs2/provider/local/test/FileNameTests.java | 2 ++ .../commons/vfs2/provider/local/test/UrlTests.java | 4 ++++ .../provider/local/test/WindowsFileNameTests.java | 6 ++++++ .../vfs2/provider/res/test/Vfs444TestCase.java | 14 +++++++++++--- .../sftp/test/SftpMultiThreadWriteTests.java | 2 ++ .../commons/vfs2/provider/test/JunctionTests.java | 4 ++++ .../vfs2/test/AbstractProviderTestConfig.java | 2 ++ .../org/apache/commons/vfs2/test/ContentTests.java | 21 +++++++++++++++++++++ .../apache/commons/vfs2/test/LastModifiedTests.java | 7 +++++++ .../org/apache/commons/vfs2/test/NamingTests.java | 10 ++++++++++ .../org/apache/commons/vfs2/test/PathTests.java | 1 + .../apache/commons/vfs2/test/PermissionsTests.java | 4 ++++ .../vfs2/test/ProviderCacheStrategyTests.java | 4 ++++ .../commons/vfs2/test/ProviderDeleteTests.java | 7 +++++++ .../commons/vfs2/test/ProviderRandomReadTests.java | 3 +++ .../vfs2/test/ProviderRandomReadWriteTests.java | 2 ++ .../vfs2/test/ProviderRandomSetLengthTests.java | 2 ++ .../apache/commons/vfs2/test/ProviderReadTests.java | 17 +++++++++++++++++ .../commons/vfs2/test/ProviderRenameTests.java | 4 ++++ .../commons/vfs2/test/ProviderWriteAppendTests.java | 2 ++ .../commons/vfs2/test/ProviderWriteTests.java | 16 ++++++++++++++++ .../java/org/apache/commons/vfs2/test/UriTests.java | 1 + .../apache/commons/vfs2/test/UrlStructureTests.java | 2 ++ .../java/org/apache/commons/vfs2/test/UrlTests.java | 7 +++++-- 33 files changed, 177 insertions(+), 13 deletions(-) diff --git a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java index ddaa70c..d6c4ce0 100644 --- a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java +++ b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java @@ -28,13 +28,14 @@ import org.apache.commons.vfs2.provider.webdav.WebdavFileSystemConfigBuilder; import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.apache.jackrabbit.webdav.version.DeltaVConstants; import org.apache.jackrabbit.webdav.version.VersionControlledResource; +import org.junit.Test; /** * Test to verify Webdav Versioning support */ public class WebdavVersioningTests extends AbstractProviderTestCase { - /** - */ + + @Test public void testVersioning() throws Exception { final FileObject scratchFolder = createScratchFolder(); final FileSystemOptions opts = scratchFolder.getFileSystem().getFileSystemOptions(); @@ -80,8 +81,7 @@ public class WebdavVersioningTests extends AbstractProviderTestCase { builder.setVersioning(opts, false); } - /** - */ + @Test public void testVersioningWithCreator() throws Exception { final FileObject scratchFolder = createScratchFolder(); final FileSystemOptions opts = scratchFolder.getFileSystem().getFileSystemOptions(); diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java index a194145..12e0cff 100644 --- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java +++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4VersioningTests.java @@ -28,6 +28,7 @@ import org.apache.commons.vfs2.provider.webdav4.Webdav4FileSystemConfigBuilder; import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.apache.jackrabbit.webdav.version.DeltaVConstants; import org.apache.jackrabbit.webdav.version.VersionControlledResource; +import org.junit.Test; /** * Test to verify Webdav Versioning support @@ -35,8 +36,8 @@ import org.apache.jackrabbit.webdav.version.VersionControlledResource; * @since 2.5.0 */ public class Webdav4VersioningTests extends AbstractProviderTestCase { - /** - */ + + @Test public void testVersioning() throws Exception { final FileObject scratchFolder = createScratchFolder(); final FileSystemOptions opts = scratchFolder.getFileSystem().getFileSystemOptions(); @@ -82,8 +83,7 @@ public class Webdav4VersioningTests extends AbstractProviderTestCase { builder.setVersioning(opts, false); } - /** - */ + @Test public void testVersioningWithCreator() throws Exception { final FileObject scratchFolder = createScratchFolder(); final FileSystemOptions opts = scratchFolder.getFileSystem().getFileSystemOptions(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java index 0457f40..e47949c 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java @@ -23,6 +23,7 @@ import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FilesCache; import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.apache.commons.vfs2.test.CacheTestSuite; +import org.junit.Test; /** * Base class for different FilesCache tests. @@ -30,10 +31,12 @@ import org.apache.commons.vfs2.test.CacheTestSuite; * Make sure {@link CacheTestSuite} is configured with correct FilesCache. */ public abstract class AbstractFilesCacheTestsBase extends AbstractProviderTestCase { + /** * Will test if the cache is cleared and if it is still useable afterwards. It will actually ensure the test is * hitting the cache. */ + @Test public void testClearFiles() throws Exception { final FilesCache cache = getManager().getFilesCache(); @@ -52,6 +55,7 @@ public abstract class AbstractFilesCacheTestsBase extends AbstractProviderTestCa /** * Basic Cache operations, work for all caches (besides {@link NullFilesCache#testBasicCacheOps() NullFilesCache}). */ + @Test public void testBasicCacheOps() throws Exception { final FilesCache cache = getManager().getFilesCache(); final FileObject fo = getWriteFolder().resolveFile("dir1"); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java index f3c402a..a8b10f4 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java @@ -17,11 +17,14 @@ package org.apache.commons.vfs2.cache; import org.apache.commons.vfs2.FileObject; +import org.junit.Test; /** * Tests for {@link DefaultFilesCache} used by {@link DefaultFilesCacheTestCase}. */ public class DefaultFilesCacheTests extends AbstractFilesCacheTestsBase { + + @Test public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java index d5bf5b0..27dfa5a 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java @@ -22,11 +22,14 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FilesCache; import org.apache.commons.vfs2.impl.DefaultFileSystemManager; import org.junit.Assert; +import org.junit.Test; /** * Tests for {@link LRUFilesCache} used by {@link LRUFilesCacheTestCase}. */ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase { + + @Test public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); Assert.assertNotNull("scratchFolder", scratchFolder); @@ -71,6 +74,7 @@ public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase { assertNotSame(dir1, dir1_2); } + @Test public void testClass() { @SuppressWarnings("resource") final DefaultFileSystemManager manager = getManager(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java index 2eda9b3..3b362e1 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java @@ -22,12 +22,15 @@ import org.apache.commons.vfs2.FileSystem; import org.apache.commons.vfs2.FilesCache; import org.apache.commons.vfs2.impl.DefaultFileSystemManager; import org.junit.Assert; +import org.junit.Test; /** * Tests for {@link NullFilesCache} used by {@link NullFilesCacheTestCase}. */ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase { + + @Test public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); Assert.assertNotNull("This test should not have a null FileObject scratch folder", scratchFolder); @@ -39,6 +42,7 @@ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase { } @Override + @Test public void testBasicCacheOps() throws Exception { final DefaultFileSystemManager manager = getManager(); Assert.assertNotNull("This test should not have a null DefaultFileSystemManager", manager); @@ -61,6 +65,7 @@ public class NullFilesCacheTests extends AbstractFilesCacheTestsBase { assertNull(cache.getFile(fs, fn)); } + @Test public void testClass() { final DefaultFileSystemManager manager = getManager(); Assert.assertNotNull("This test should not have a null DefaultFileSystemManager", manager); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java index e06d209..cb48e44 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java @@ -17,11 +17,14 @@ package org.apache.commons.vfs2.cache; import org.apache.commons.vfs2.FileObject; +import org.junit.Test; /** * Tests for {@link SoftRefFilesCache} used by {@link SoftRefFilesCacheTestCase}. */ public class SoftRefFilesCacheTests extends AbstractFilesCacheTestsBase { + + @Test public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); @@ -32,6 +35,7 @@ public class SoftRefFilesCacheTests extends AbstractFilesCacheTestsBase { assertSame(dir1, dir1_2); } + @Test public void testClass() { assertTrue(getManager().getFilesCache() instanceof SoftRefFilesCache); } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java index 40123de..ca9916b 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java @@ -17,11 +17,14 @@ package org.apache.commons.vfs2.cache; import org.apache.commons.vfs2.FileObject; +import org.junit.Test; /** * Tests for {@link WeakRefFilesCache} used by {@link WeakRefFilesCacheTestCase}. */ public class WeakRefFilesCacheTests extends AbstractFilesCacheTestsBase { + + @Test public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); @@ -32,6 +35,7 @@ public class WeakRefFilesCacheTests extends AbstractFilesCacheTestsBase { assertSame(dir1, dir1_2); } + @Test public void testClass() { assertTrue(getManager().getFilesCache() instanceof WeakRefFilesCache); } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java index 70659c5..d967560 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java @@ -31,6 +31,7 @@ import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.impl.VFSClassLoader; import org.apache.commons.vfs2.test.AbstractProviderTestCase; +import org.junit.Test; /** * VfsClassLoader test cases. @@ -56,6 +57,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase { /** * Tests loading a class. */ + @Test public void testLoadClass() throws Exception { final VFSClassLoader loader = createClassLoader(); @@ -71,6 +73,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase { /** * Tests loading a resource. */ + @Test public void testLoadResource() throws Exception { final VFSClassLoader loader = createClassLoader(); @@ -84,6 +87,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase { /** * Tests package sealing. */ + @Test public void testSealing() throws Exception { final VFSClassLoader loader = createClassLoader(); final Class<?> testClass = loader.loadClass("code.sealed.AnotherClass"); @@ -99,6 +103,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase { * actually carry out all tests. * </p> */ + @Test public void testGetResourcesJARs() throws Exception { final FileSystemManager manager = getManager(); try { @@ -148,6 +153,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase { * This test is repeated with various provider configurations but works on local files, only. * </p> */ + @Test public void testGetResourcesNoLayerLocal() throws Exception { final FileSystemManager manager = getManager(); try { diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java index 8104d8a..e97b94c 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/FileNameTests.java @@ -22,6 +22,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.impl.DefaultFileSystemManager; import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.junit.Assert; +import org.junit.Test; /** * Additional naming tests for local file system. @@ -31,6 +32,7 @@ public class FileNameTests extends AbstractProviderTestCase { /** * Tests resolution of an absolute file name. */ + @Test public void testAbsoluteFileName() throws Exception { // Locate file by absolute file name final String fileName = new File("testdir").getAbsolutePath(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java index 378e7d9..dfb6424 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java @@ -22,15 +22,18 @@ import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.VFS; import org.apache.commons.vfs2.provider.UriParser; import org.apache.commons.vfs2.test.AbstractProviderTestCase; +import org.junit.Test; /** * Additional URL tests for local file system. * */ public class UrlTests extends AbstractProviderTestCase { + /** * Tests FindFiles with a file name that has a hash sign in it. */ + @Test public void testHashFindFiles() throws Exception { final FileSystemManager fsManager = VFS.getManager(); @@ -53,6 +56,7 @@ public class UrlTests extends AbstractProviderTestCase { /** * Tests resolution of an absolute file name. */ + @Test public void testHashURL() throws Exception { final FileObject file = getReadFolder().resolveFile("test-hash-#test.txt"); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java index a13c13b..e8cf01d 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/local/test/WindowsFileNameTests.java @@ -23,6 +23,7 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager; import org.apache.commons.vfs2.provider.local.WindowsFileName; import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.junit.Assert; +import org.junit.Test; /** * Additional naming tests for local file system. @@ -30,6 +31,8 @@ import org.junit.Assert; * Only executed on Windows O/S. */ public class WindowsFileNameTests extends AbstractProviderTestCase { + + @Test public void testWindowsRoots() throws Exception { // valid URI forms of the filesystem root final String[] tests = new String[] { "file:///C:/", "file://C:/", "file:/C:/", "file:C:/" }; @@ -56,6 +59,7 @@ public class WindowsFileNameTests extends AbstractProviderTestCase { } } + @Test public void testWindowsWrongRoots() throws Exception { final String[] tests = new String[] { "file:///C:", "file://C:", "file:/C:", "file:C:" }; @@ -72,6 +76,7 @@ public class WindowsFileNameTests extends AbstractProviderTestCase { } } + @Test public void testWindowsFilenameUNCStartError() throws Exception { try { final String FILE = "file://///"; @@ -86,6 +91,7 @@ public class WindowsFileNameTests extends AbstractProviderTestCase { } } + @Test public void testWindowsFilenameParserError() throws Exception { // check VFS-338 with 2+4 slashes we want a dedicated error try { diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/Vfs444TestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/Vfs444TestCase.java index 8b681ce..91a0330 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/Vfs444TestCase.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/res/test/Vfs444TestCase.java @@ -29,14 +29,14 @@ import org.apache.commons.vfs2.test.AbstractProviderTestCase; import org.apache.commons.vfs2.test.AbstractProviderTestConfig; import org.apache.commons.vfs2.test.ProviderTestSuite; import org.junit.Assert; - -import junit.framework.Test; +import org.junit.Test; /** * Test cases for VFS-444. */ public class Vfs444TestCase extends AbstractProviderTestConfig { - public static Test suite() throws Exception { + + public static junit.framework.Test suite() throws Exception { final ProviderTestSuite suite = new ProviderTestSuite(new Vfs444TestCase(), true); suite.addTests(Vfs444Tests.class); return suite; @@ -62,41 +62,49 @@ public class Vfs444TestCase extends AbstractProviderTestConfig { public static class Vfs444Tests extends AbstractProviderTestCase { + @Test public void testResolveFullPathURI0() throws FileSystemException { final FileName result = getManager().resolveURI("res:test-data/test.zip"); Assert.assertTrue(result.isFile()); } + @Test public void testResolveFullPathFile0() throws FileSystemException { final FileObject result = getManager().resolveFile("res:test-data/test.zip"); Assert.assertTrue(result.exists()); } + @Test public void testResolveFullPathURI1() throws FileSystemException { final FileName result = getManager().resolveURI("res:/test-data/test.zip"); Assert.assertTrue(result.isFile()); } + @Test public void testResolveFullPathFile1() throws FileSystemException { final FileObject result = getManager().resolveFile("res:/test-data/test.zip"); Assert.assertTrue(result.exists()); } + @Test public void testResolveFullPathURI2() throws FileSystemException { final FileName result = getManager().resolveURI("res://test-data/test.zip"); Assert.assertTrue(result.isFile()); } + @Test public void testResolveFullPathFile2() throws FileSystemException { final FileObject result = getManager().resolveFile("res://test-data/test.zip"); Assert.assertTrue(result.exists()); } + @Test public void testResolvePartialPath1() throws FileSystemException { final FileName result = getManager().resolveURI("res:test-data"); Assert.assertTrue(result.isFile()); } + @Test public void testResolvePartialPath2() throws FileSystemException { final FileName root = getManager().resolveURI("res:test-data"); final FileName file = getManager().resolveName(root, "test.zip"); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java index e8db381..483e794 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/test/SftpMultiThreadWriteTests.java @@ -30,6 +30,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.VFS; import org.apache.commons.vfs2.test.AbstractProviderTestCase; +import org.junit.Test; /** * MultiThread tests for writing with SFTP provider. @@ -61,6 +62,7 @@ public class SftpMultiThreadWriteTests extends AbstractProviderTestCase { /** * Tests file copy from local file system in parallel mode. This was a problem with SFTP channels. */ + @Test public void testParallelCopyFromLocalFileSystem() throws Exception { final File localFile = new File("src/test/resources/test-data/test.zip"); 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 b27b157..ff8a9e0 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 @@ -23,11 +23,13 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystem; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.test.AbstractProviderTestCase; +import org.junit.Test; /** * Additional junction test cases. */ public class JunctionTests extends AbstractProviderTestCase { + private FileObject getBaseDir() throws FileSystemException { final File file = AbstractVfsTestCase.getTestDirectoryFile(); assertTrue(file.exists()); @@ -37,6 +39,7 @@ public class JunctionTests extends AbstractProviderTestCase { /** * Checks nested junctions are not supported. */ + @Test public void testNestedJunction() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs:").getFileSystem(); final FileObject baseDir = getBaseDir(); @@ -62,6 +65,7 @@ public class JunctionTests extends AbstractProviderTestCase { /** * Checks ancestors are created when a junction is created. */ + @Test public void testAncestors() throws Exception { final FileSystem fs = getManager().createVirtualFileSystem("vfs://").getFileSystem(); final FileObject baseDir = getBaseDir(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestConfig.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestConfig.java index 3f3e529..3ef10b5 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestConfig.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestConfig.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager; * A partial {@link org.apache.commons.vfs2.test.ProviderTestConfig} implementation. */ public abstract class AbstractProviderTestConfig extends AbstractProviderTestCase implements ProviderTestConfig { + private FilesCache cache = null; /** @@ -39,6 +40,7 @@ public abstract class AbstractProviderTestConfig extends AbstractProviderTestCas */ @Override public void prepare(final DefaultFileSystemManager manager) throws Exception { + // default is do nothing. } @Override diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java index cb698f5..9d926a4 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ContentTests.java @@ -26,14 +26,17 @@ import org.apache.commons.vfs2.FileSystem; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.NameScope; +import org.junit.Test; /** * Test cases for reading file content. */ public class ContentTests extends AbstractProviderTestCase { + /** * Asserts that every expected file exists, and has the expected content. */ + @Test public void testAllContent() throws Exception { final FileInfo expectedFileInfo = buildExpectedStructure(); final FileObject actualFolder = getReadFolder(); @@ -60,6 +63,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests existence determination. */ + @Test public void testExists() throws Exception { // Test a file FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -85,6 +89,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests attributes */ + @Test public void testAttributes() throws FileSystemException { this.getReadFolder().getContent().getAttributes(); } @@ -92,6 +97,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests root of file system exists. */ + @Test public void testRootURI() throws FileSystemException { if (!this.getProviderConfig().isFileSystemRootAccessible()) { return; @@ -104,6 +110,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests root of file system exists. */ + @Test public void testRootAPI() throws FileSystemException { if (!this.getProviderConfig().isFileSystemRootAccessible()) { return; @@ -119,6 +126,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests parent identity */ + @Test public void testParent() throws FileSystemException { // Test when both exist FileObject folder = getReadFolder().resolveFile("dir1"); @@ -156,6 +164,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that children cannot be listed for non-folders. */ + @Test public void testChildren() throws FileSystemException { // Check for file FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -190,6 +199,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests content. */ + @Test public void testContent() throws Exception { // Test non-empty file FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -203,6 +213,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that unknown files have no content. */ + @Test public void testUnknownContent() throws Exception { // Try getting the content of an unknown file @@ -225,6 +236,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests concurrent reads on a file. */ + @Test public void testReadSingleSequencial() throws Exception { final FileObject file = getReadFolder().resolveFile("file1.txt"); assertTrue(file.exists()); @@ -236,6 +248,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests concurrent reads on a file. */ + @Test public void testReadSingleConcurrent() throws Exception { final FileObject file = getReadFolder().resolveFile("file1.txt"); assertTrue(file.exists()); @@ -250,6 +263,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests concurrent reads on different files works. */ + @Test public void testReadMultipleConcurrent() throws Exception { final FileObject file = getReadFolder().resolveFile("file1.txt"); assertTrue(file.exists()); @@ -266,6 +280,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that content and file objects are usable after being closed. */ + @Test public void testReuse() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -289,6 +304,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that input streams are cleaned up on file close. */ + @Test public void testInputStreamMultipleCleanup() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -312,6 +328,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that input streams are cleaned up on file close. */ + @Test public void testInputStreamSingleCleanup() throws Exception { // Get the test file final FileObject file = getReadFolder().resolveFile("file1.txt"); @@ -332,6 +349,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that input streams are cleaned up on file close. */ + @Test public void testInputStreamReadAll() throws Exception { // Get the test file try (final FileObject file = getReadFolder().resolveFile("file1.txt")) { @@ -347,6 +365,7 @@ public class ContentTests extends AbstractProviderTestCase { /** * Tests that input streams are cleaned up on file close. */ + @Test public void testByteArrayReadAll() throws Exception { // Get the test file try (final FileObject file = getReadFolder().resolveFile("file1.txt")) { @@ -357,6 +376,7 @@ public class ContentTests extends AbstractProviderTestCase { } } + @Test public void testGetString_Charset() throws Exception { // Get the test file try (final FileObject file = getReadFolder().resolveFile("file1.txt")) { @@ -367,6 +387,7 @@ public class ContentTests extends AbstractProviderTestCase { } } + @Test public void testGetString_String() throws Exception { // Get the test file try (final FileObject file = getReadFolder().resolveFile("file1.txt")) { diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/LastModifiedTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/LastModifiedTests.java index 4e5a6dc..3e684df 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/LastModifiedTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/LastModifiedTests.java @@ -24,11 +24,13 @@ import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.junit.Assert; +import org.junit.Test; /** * Test cases for getting and setting file last modified time. */ public class LastModifiedTests extends AbstractProviderTestCase { + private void assertDelta(final String message, final long expected, final long actual, final long delta) { if (expected == actual) { return; @@ -54,6 +56,7 @@ public class LastModifiedTests extends AbstractProviderTestCase { * * @throws FileSystemException if error occurred */ + @Test public void testGetAccurary() throws FileSystemException { final FileObject file = getReadFolder().resolveFile("file1.txt"); final long lastModTimeAccuracy = (long) file.getFileSystem().getLastModTimeAccuracy(); @@ -68,6 +71,7 @@ public class LastModifiedTests extends AbstractProviderTestCase { * * @throws FileSystemException if error occurred */ + @Test public void testGetLastModifiedFolder() throws FileSystemException { final FileObject file = getReadFolder().resolveFile("dir1"); assertNotEquals(0L, file.getContent().getLastModifiedTime()); @@ -78,6 +82,7 @@ public class LastModifiedTests extends AbstractProviderTestCase { * * @throws FileSystemException if error occurred */ + @Test public void testGetLastModifiedFile() throws FileSystemException { final FileObject file = getReadFolder().resolveFile("file1.txt"); assertNotEquals(0L, file.getContent().getLastModifiedTime()); @@ -88,6 +93,7 @@ public class LastModifiedTests extends AbstractProviderTestCase { * * @throws FileSystemException if error occurred */ + @Test public void testSetLastModifiedFolder() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; @@ -107,6 +113,7 @@ public class LastModifiedTests extends AbstractProviderTestCase { * * @throws FileSystemException if error occurred */ + @Test public void testSetLastModifiedFile() throws FileSystemException { final long yesterday = System.currentTimeMillis() - 24 * 60 * 60 * 1000; diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java index 3de8620..b871db5 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/NamingTests.java @@ -20,6 +20,7 @@ import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.NameScope; +import org.junit.Test; /** * Test cases for file naming. @@ -27,9 +28,11 @@ import org.apache.commons.vfs2.NameScope; * TODO - Add tests for all FileName methods. */ public class NamingTests extends AbstractProviderTestCase { + /** * Tests resolution of relative file names via the FS manager */ + @Test public void testRelativeURI() throws Exception { // Build base dir getManager().setBaseFile(getReadFolder()); @@ -57,6 +60,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests encoding of relative URI. */ + @Test public void testRelativeUriEncoding() throws Exception { // Build base dir getManager().setBaseFile(getReadFolder()); @@ -116,6 +120,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests the root file name. */ + @Test public void testRootFileName() throws Exception { // Locate the root file final FileName rootName = getReadFolder().getFileSystem().getRoot().getName(); @@ -133,6 +138,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests child file names. */ + @Test public void testChildName() throws Exception { final FileName baseName = getReadFolder().getName(); final String basePath = baseName.getPath(); @@ -225,6 +231,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests relative name resolution, relative to the base folder. */ + @Test public void testNameResolution() throws Exception { final FileName baseName = getReadFolder().getName(); final String parentPath = baseName.getParent().getPath(); @@ -285,6 +292,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests descendent name resolution. */ + @Test public void testDescendentName() throws Exception { final FileName baseName = getReadFolder().getName(); @@ -308,6 +316,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests resolution of absolute names. */ + @Test public void testAbsoluteNames() throws Exception { // Test against the base folder FileName name = getReadFolder().getName(); @@ -358,6 +367,7 @@ public class NamingTests extends AbstractProviderTestCase { /** * Tests conversion from absolute to relative names. */ + @Test public void testAbsoluteNameConvert() throws Exception { final FileName baseName = getReadFolder().getName(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PathTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PathTests.java index f2c6b03..d681a48 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PathTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PathTests.java @@ -44,6 +44,7 @@ public class PathTests extends AbstractProviderTestCase { /** * Tests resolution of absolute URI. */ + @Test public void testAbsoluteURI() throws Exception { final FileObject readFolder = getReadFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java index 5ef635c..de36e4d 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/PermissionsTests.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.provider.local.LocalFileSystem; import org.junit.Assert; +import org.junit.Test; /** * Additional file permission tests. @@ -47,6 +48,7 @@ public class PermissionsTests extends AbstractProviderTestCase { /** * Tests for the execution permission. */ + @Test public void testExecutable() throws Exception { final FileObject file = createTestFile(); @@ -72,6 +74,7 @@ public class PermissionsTests extends AbstractProviderTestCase { /** * Tests for the writeable permission */ + @Test public void testWriteable() throws Exception { final FileObject file = createTestFile(); @@ -91,6 +94,7 @@ public class PermissionsTests extends AbstractProviderTestCase { /** * Tests for the readable permission */ + @Test public void testReadable() throws Exception { final FileObject file = createTestFile(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderCacheStrategyTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderCacheStrategyTests.java index c42037a..a1a56f8 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderCacheStrategyTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderCacheStrategyTests.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.impl.DefaultFileSystemManager; import org.apache.commons.vfs2.impl.VirtualFileSystem; import org.apache.commons.vfs2.provider.ram.RamFileObject; import org.apache.commons.vfs2.util.FileObjectUtils; +import org.junit.Test; /** * Test the cache stragey @@ -40,6 +41,7 @@ public class ProviderCacheStrategyTests extends AbstractProviderTestCase { /** * Test the manual cache strategy */ + @Test public void testManualCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) @@ -73,6 +75,7 @@ public class ProviderCacheStrategyTests extends AbstractProviderTestCase { /** * Test the on_resolve strategy */ + @Test public void testOnResolveCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) @@ -106,6 +109,7 @@ public class ProviderCacheStrategyTests extends AbstractProviderTestCase { /** * Test the on_call strategy */ + @Test public void testOnCallCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); if (FileObjectUtils.isInstanceOf(getBaseFolder(), RamFileObject.class) diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java index ae06fb4..9941d29 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderDeleteTests.java @@ -23,11 +23,13 @@ import org.apache.commons.vfs2.FileSelector; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.FileTypeSelector; import org.apache.commons.vfs2.Selectors; +import org.junit.Test; /** * File system test that do some delete operations. */ public class ProviderDeleteTests extends AbstractProviderTestCase { + private class FileNameSelector implements FileSelector { final String basename; @@ -80,6 +82,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { /** * deletes the complete structure */ + @Test public void testDeleteFiles() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -89,6 +92,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { /** * deletes a single file */ + @Test public void testDeleteFile() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -100,6 +104,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { /** * Deletes a non existent file */ + @Test public void testDeleteNonExistantFile() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -111,6 +116,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { /** * deletes files */ + @Test public void testDeleteAllFiles() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -120,6 +126,7 @@ public class ProviderDeleteTests extends AbstractProviderTestCase { /** * deletes a.txt */ + @Test public void testDeleteOneFiles() throws Exception { final FileObject scratchFolder = createScratchFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java index 52a3d7b..ce40d38 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadTests.java @@ -20,12 +20,14 @@ import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.RandomAccessContent; import org.apache.commons.vfs2.util.RandomAccessMode; +import org.junit.Test; /** * Random read-only test case for file providers. * */ public class ProviderRandomReadTests extends AbstractProviderTestCase { + private static final String TEST_DATA = "This is a test file."; /** @@ -39,6 +41,7 @@ public class ProviderRandomReadTests extends AbstractProviderTestCase { /** * Read a file */ + @Test public void testRandomRead() throws Exception { try (FileObject file = getReadFolder().resolveFile("file1.txt")) { final RandomAccessContent ra = file.getContent().getRandomAccessContent(RandomAccessMode.READ); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadWriteTests.java index 61e5b0b..09d81d7 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadWriteTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomReadWriteTests.java @@ -21,6 +21,7 @@ import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.RandomAccessContent; import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.util.RandomAccessMode; +import org.junit.Test; /** * Random read and write test case for file providers. @@ -54,6 +55,7 @@ public class ProviderRandomReadWriteTests extends AbstractProviderTestCase { /** * Writes a file */ + @Test public void testRandomWrite() throws Exception { try (FileObject file = createScratchFolder().resolveFile("random_write.txt")) { file.createFile(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java index 3f092db..31e3d2d 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRandomSetLengthTests.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.RandomAccessContent; import org.apache.commons.vfs2.Selectors; import org.apache.commons.vfs2.util.RandomAccessMode; import org.junit.Assert; +import org.junit.Test; /** * Random set length test cases for file providers. @@ -57,6 +58,7 @@ public class ProviderRandomSetLengthTests extends AbstractProviderTestCase { /** * Writes a file */ + @Test public void testRandomSetLength() throws Exception { try (FileObject file = this.createScratchFolder().resolveFile("random_write.txt")) { file.createFile(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java index 6ad0af1..0d1fd97 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java @@ -30,6 +30,7 @@ import org.apache.commons.vfs2.FileSystem; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.junit.Assert; +import org.junit.Test; /** * Read-only test cases for file providers. @@ -59,6 +60,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Walks the base folder structure, asserting it contains exactly the expected files and folders. */ + @Test public void testStructure() throws Exception { final FileInfo baseInfo = buildExpectedStructure(); assertSameStructure(getReadFolder(), baseInfo); @@ -125,6 +127,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests type determination. */ + @Test public void testType() throws Exception { // Test a file FileObject file = resolveFile1Txt(); @@ -144,6 +147,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests the contents of root of file system can be listed. */ + @Test public void testRoot() throws FileSystemException { if (!this.getProviderConfig().isFileSystemRootAccessible()) { return; @@ -157,6 +161,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that FileObjects can be sorted. */ + @Test public void testSort() throws FileSystemException { final FileInfo fileInfo = buildExpectedStructure(); final VerifyingFileSelector selector = new VerifyingFileSelector(fileInfo); @@ -185,6 +190,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that folders have no content. */ + @Test public void testFolderContent() throws Exception { if (getFileSystem().hasCapability(Capability.DIRECTORY_READ_CONTENT)) { // test wont fail @@ -204,6 +210,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that test read folder is not hidden. */ + @Test public void testFolderIsHidden() throws Exception { final FileObject folder = getReadFolderDir1(); Assert.assertFalse(folder.isHidden()); @@ -212,6 +219,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that test read folder is not a symbolic link. */ + @Test public void testFolderIsSymbolicLink() throws Exception { final FileObject folder = getReadFolderDir1(); Assert.assertFalse(folder.isSymbolicLink()); @@ -220,11 +228,13 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that test read folder is readable. */ + @Test public void testFolderIsReadable() throws Exception { final FileObject folder = getReadFolderDir1(); Assert.assertTrue(folder.isReadable()); } + @Test public void testGetContent() throws Exception { final FileObject file = resolveFile1Txt(); assertTrue(file.exists()); @@ -232,6 +242,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { assertNotNull(content); } + @Test public void testGetContentInfo() throws Exception { final FileObject file = resolveFile1Txt(); assertTrue(file.exists()); @@ -248,6 +259,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests can read multiple time end of stream of empty file */ + @Test public void testReadEmptyMultipleEOF() throws Exception { final FileObject file = getReadFolder().resolveFile("empty.txt"); assertTrue(file.exists()); @@ -265,6 +277,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests can read multiple time end of stream */ + @Test public void testReadFileEOFMultiple() throws Exception { final FileObject file = getReadFolder().resolveFile("file1.txt"); assertTrue(file.exists()); @@ -284,6 +297,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests can perform operations on a folder while reading from a different files. */ + @Test public void testConcurrentReadFolder() throws Exception { final FileObject file = resolveFile1Txt(); assertTrue(file.exists()); @@ -302,6 +316,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that findFiles() works. */ + @Test public void testFindFiles() throws Exception { final FileInfo fileInfo = buildExpectedStructure(); final VerifyingFileSelector selector = new VerifyingFileSelector(fileInfo); @@ -323,6 +338,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that we can traverse a folder that has JAR name. */ + @Test public void testDotJarFolderName() throws Exception { final FileObject folder = getReadFolderDir1().resolveFile("subdir4.jar"); Assert.assertTrue(folder.exists()); @@ -333,6 +349,7 @@ public class ProviderReadTests extends AbstractProviderTestCase { /** * Tests that a folder can't be layered. */ + @Test public void testDotJarFolderNameLayer() throws Exception { final FileObject folder = getReadFolderDir1().resolveFile("subdir4.jar"); Assert.assertTrue("subdir4.jar/ must exist as folder, check test setup.", folder.isFolder()); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java index f0672b7..38c8d8a 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderRenameTests.java @@ -24,6 +24,7 @@ import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.Selectors; +import org.junit.Test; /** * File system test that check that a file system can be renamed. @@ -83,6 +84,7 @@ public class ProviderRenameTests extends AbstractProviderTestCase { /** * Tests create-delete-create-a-file sequence on the same file system. */ + @Test public void testRenameFile() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -101,6 +103,7 @@ public class ProviderRenameTests extends AbstractProviderTestCase { * <P> * This fails with VFS-558, but only with a CacheStrategy.ON_CALL. */ + @Test public void testRenameFileIntoEmptyFolder() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -123,6 +126,7 @@ public class ProviderRenameTests extends AbstractProviderTestCase { * * See [VFS-298] FTP: Exception is thrown when renaming a file. */ + @Test public void testRenameFileAndLeaveFolderEmpty() throws Exception { final FileObject scratchFolder = createScratchFolder(); final FileObject folder = scratchFolder.resolveFile("folder"); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java index 67a2d1b..6f38f65 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteAppendTests.java @@ -21,6 +21,7 @@ import java.io.OutputStream; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.Selectors; +import org.junit.Test; /** * File system test that check that a file system can be modified. @@ -51,6 +52,7 @@ public class ProviderWriteAppendTests extends AbstractProviderTestCase { /** * Tests create-delete-create-a-file sequence on the same file system. */ + @Test public void testAppendContent() throws Exception { final FileObject scratchFolder = createScratchFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java index faff325..a9752cf 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java @@ -31,6 +31,7 @@ import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; import org.apache.commons.vfs2.Selectors; import org.junit.Assert; +import org.junit.Test; /** * File system test that check that a file system can be modified. @@ -66,6 +67,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests folder creation. */ + @Test public void testFolderCreate() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -99,6 +101,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests file creation */ + @Test public void testFileCreate() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -154,6 +157,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests file/folder creation with mismatched types. */ + @Test public void testFileCreateMismatched() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -194,6 +198,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests deletion */ + @Test public void testDelete() throws Exception { // Set-up the test structure final FileObject folder = createScratchFolder(); @@ -240,6 +245,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests deletion */ + @Test public void testDeleteAllDescendents() throws Exception { // Set-up the test structure final FileObject folder = createScratchFolder(); @@ -323,6 +329,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests file copy to and from the same file system type. This was a problem w/ FTP. */ + @Test public void testCopySameFileSystem() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -349,6 +356,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests overwriting a file on the same file system. */ + @Test public void testCopyFromOverwriteSameFileSystem() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -381,6 +389,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests create-delete-create-a-file sequence on the same file system. */ + @Test public void testCreateDeleteCreateSameFileSystem() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -417,6 +426,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests that test read folder is not hidden. */ + @Test public void testFolderIsHidden() throws Exception { final FileObject folder = getReadFolderDir1(); Assert.assertFalse(folder.isHidden()); @@ -425,6 +435,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests that test read folder is readable. */ + @Test public void testFolderIsReadable() throws Exception { final FileObject folder = getReadFolderDir1(); Assert.assertTrue(folder.isReadable()); @@ -433,6 +444,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests that test folder iswritable. */ + @Test public void testFolderIsWritable() throws Exception { final FileObject folder = getWriteFolder().resolveFile("dir1"); Assert.assertTrue(folder.isWriteable()); @@ -441,6 +453,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Test that children are handled correctly by create and delete. */ + @Test public void testListChildren() throws Exception { final FileObject folder = createScratchFolder(); final HashSet<String> names = new HashSet<>(); @@ -488,6 +501,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Check listeners are notified of changes. */ + @Test public void testListener() throws Exception { final FileObject baseFile = createScratchFolder(); @@ -631,6 +645,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests file write to and from the same file system type */ + @Test public void testWriteSameFileSystem() throws Exception { final FileObject scratchFolder = createScratchFolder(); @@ -678,6 +693,7 @@ public class ProviderWriteTests extends AbstractProviderTestCase { /** * Tests overwriting a file on the same file system. */ + @Test public void testOverwriteSameFileSystem() throws Exception { final FileObject scratchFolder = createScratchFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UriTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UriTests.java index 494c13c..79f20e8 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UriTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UriTests.java @@ -42,6 +42,7 @@ public class UriTests extends AbstractProviderTestCase { /** * Tests resolution of absolute URI. */ + @Test public void testAbsoluteURI() throws Exception { final FileObject readFolder = getReadFolder(); diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlStructureTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlStructureTests.java index 99a7a16..698d6c9 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlStructureTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlStructureTests.java @@ -21,6 +21,7 @@ import java.io.InputStream; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileObject; +import org.junit.Test; /** * URL Test cases for providers that supply structural info. @@ -37,6 +38,7 @@ public class UrlStructureTests extends AbstractProviderTestCase { /** * Tests that folders have no content. */ + @Test public void testFolderURL() throws Exception { final FileObject folder = getReadFolder().resolveFile("dir1"); if (folder.getFileSystem().hasCapability(Capability.DIRECTORY_READ_CONTENT)) { diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlTests.java index d51ff36..ccb05e6 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlTests.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/test/UrlTests.java @@ -17,8 +17,6 @@ package org.apache.commons.vfs2.test; import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; import java.net.URL; import java.net.URLConnection; @@ -32,6 +30,7 @@ import org.junit.Test; * URL test cases for providers. */ public class UrlTests extends AbstractProviderTestCase { + /** * Returns the capabilities required by the tests of this test case. The tests are not run if the provider being * tested does not support all the required capabilities. Return null or an empty array to always run the tests. @@ -58,6 +57,7 @@ public class UrlTests extends AbstractProviderTestCase { /** * Tests that unknown files have no content. */ + @Test public void testUnknownURL() throws Exception { // Try getting the content of an unknown file final FileObject unknownFile = getReadFolder().resolveFile("unknown-file"); @@ -76,6 +76,7 @@ public class UrlTests extends AbstractProviderTestCase { /** * Tests url. */ + @Test public void testURL() throws Exception { final FileObject file = getReadFolder().resolveFile("some-dir/"); final URL url = file.getURL(); @@ -92,6 +93,7 @@ public class UrlTests extends AbstractProviderTestCase { /** * Tests content. */ + @Test public void testURLContent() throws Exception { testURLContent(getReadFolder()); } @@ -115,6 +117,7 @@ public class UrlTests extends AbstractProviderTestCase { /** * Tests content. */ + @Test public void testURLContentProvider() throws Exception { // Test non-empty file final FileObject file = getReadFolder().resolveFile("file1.txt");