Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/AbstractVfsTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,12 +30,9 @@ import org.apache.commons.vfs2.FileSyste import org.apache.commons.vfs2.util.Messages; /** - * A base class for VFS tests. Provides utility methods for locating - * test resources. + * A base class for VFS tests. Provides utility methods for locating test resources. */ -public abstract class AbstractVfsTestCase - extends TestCase -{ +public abstract class AbstractVfsTestCase extends TestCase { private static File baseDir; /** URL pattern */ @@ -47,20 +44,16 @@ public abstract class AbstractVfsTestCas /** * Returns the name of the package containing a class. * - * @return The . delimited package name, or an empty string if the class - * is in the default package. + * @return The . delimited package name, or an empty string if the class is in the default package. */ - public static String getPackageName(final Class<?> clazz) - { + public static String getPackageName(final Class<?> clazz) { final Package pkg = clazz.getPackage(); - if (null != pkg) - { + if (null != pkg) { return pkg.getName(); } final String name = clazz.getName(); - if (-1 == name.lastIndexOf(".")) - { + if (-1 == name.lastIndexOf(".")) { return ""; } return name.substring(0, name.lastIndexOf(".")); @@ -71,8 +64,7 @@ public abstract class AbstractVfsTestCas * * @param name path of the resource, relative to this test's base directory. */ - public static File getTestResource(final String name) - { + public static File getTestResource(final String name) { return getTestResource(name, true); } @@ -81,16 +73,12 @@ public abstract class AbstractVfsTestCas * * @param name path of the resource, relative to this test's base directory. */ - public static File getTestResource(final String name, final boolean mustExist) - { + public static File getTestResource(final String name, final boolean mustExist) { File file = new File(getTestDirectoryFile(), name); file = getCanonicalFile(file); - if (mustExist) - { + if (mustExist) { assertTrue("Test file \"" + file + "\" does not exist.", file.exists()); - } - else - { + } else { assertTrue("Test file \"" + file + "\" should not exist.", !file.exists()); } @@ -100,10 +88,8 @@ public abstract class AbstractVfsTestCas /** * Locates the base directory for this test. */ - public static File getTestDirectoryFile() - { - if (baseDir == null) - { + public static File getTestDirectoryFile() { + if (baseDir == null) { final String baseDirProp = getTestDirectory(); // the directory maybe expressed as URI in certain environments if (baseDirProp.startsWith("file://")) { @@ -126,13 +112,11 @@ public abstract class AbstractVfsTestCas * * @return the test directory as a String */ - public static String getTestDirectory() - { + public static String getTestDirectory() { return System.getProperty("test.basedir", "target/test-classes/test-data"); } - public static String getResourceTestDirectory() - { + public static String getResourceTestDirectory() { return System.getProperty("test.basedir.res", "test-data"); } @@ -141,26 +125,21 @@ public abstract class AbstractVfsTestCas * * @param name path of the directory, relative to this test's base directory. */ - public static File getTestDirectory(final String name) - { + public static File getTestDirectory(final String name) { File file = new File(getTestDirectoryFile(), name); file = getCanonicalFile(file); assertTrue("Test directory \"" + file + "\" does not exist or is not a directory.", - file.isDirectory() || file.mkdirs()); + file.isDirectory() || file.mkdirs()); return file; } /** * Makes a file canonical */ - public static File getCanonicalFile(final File file) - { - try - { + public static File getCanonicalFile(final File file) { + try { return file.getCanonicalFile(); - } - catch (final IOException e) - { + } catch (final IOException e) { return file.getAbsoluteFile(); } } @@ -168,17 +147,13 @@ public abstract class AbstractVfsTestCas /** * Asserts that an exception chain contains the expected messages. * - * @param messages The messages, in order. A null entry in this array - * indicates that the message should be ignored. + * @param messages The messages, in order. A null entry in this array indicates that the message should be ignored. */ - public static void assertSameMessage(final String[] messages, final Throwable throwable) - { + public static void assertSameMessage(final String[] messages, final Throwable throwable) { Throwable current = throwable; - for (final String message : messages) - { + for (final String message : messages) { assertNotNull(current); - if (message != null) - { + if (message != null) { assertEquals(message, current.getMessage()); } @@ -190,15 +165,11 @@ public abstract class AbstractVfsTestCas /** * Returns the cause of an exception. */ - public static Throwable getCause(final Throwable throwable) - { - try - { + public static Throwable getCause(final Throwable throwable) { + try { final Method method = throwable.getClass().getMethod("getCause", (Class[]) null); return (Throwable) method.invoke(throwable, (Object[]) null); - } - catch (final Exception e) - { + } catch (final Exception e) { return null; } } @@ -206,35 +177,27 @@ public abstract class AbstractVfsTestCas /** * Asserts that an exception contains the expected message. */ - public static void assertSameMessage(final String code, - final Throwable throwable) - { + public static void assertSameMessage(final String code, final Throwable throwable) { assertSameMessage(code, new Object[0], throwable); } /** * Asserts that an exception contains the expected message. */ - public static void assertSameMessage(final String code, - final Object[] params, - final Throwable throwable) - { + public static void assertSameMessage(final String code, final Object[] params, final Throwable throwable) { Object[] parmArray = params; - if (throwable instanceof FileSystemException) - { + if (throwable instanceof FileSystemException) { final FileSystemException fse = (FileSystemException) throwable; // Compare message code and params assertEquals(code, fse.getCode()); assertEquals(params.length, fse.getInfo().length); parmArray = new Object[params.length]; - for (int i = 0; i < params.length; i++) - { + for (int i = 0; i < params.length; i++) { String value = String.valueOf(params[i]); // mask passwords (VFS-169) final Matcher urlMatcher = URL_PATTERN.matcher(value); - if (urlMatcher.find()) - { + if (urlMatcher.find()) { final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(value); value = pwdMatcher.replaceFirst(":***@"); } @@ -251,25 +214,18 @@ public abstract class AbstractVfsTestCas /** * Asserts that an exception contains the expected message. */ - public static void assertSameMessage(final String code, - final Object param, - final Throwable throwable) - { - assertSameMessage(code, new Object[]{param}, throwable); + public static void assertSameMessage(final String code, final Object param, final Throwable throwable) { + assertSameMessage(code, new Object[] { param }, throwable); } /** - * Compares 2 objects for equality, nulls are equal. Used by the test - * classes' equals() methods. + * Compares 2 objects for equality, nulls are equal. Used by the test classes' equals() methods. */ - public static boolean equals(final Object o1, final Object o2) - { - if (o1 == null && o2 == null) - { + public static boolean equals(final Object o1, final Object o2) { + if (o1 == null && o2 == null) { return true; } - if (o1 == null || o2 == null) - { + if (o1 == null || o2 == null) { return false; } return o1.equals(o2);
Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileExtensionSelectorTest.java Thu Sep 14 19:26:39 2017 @@ -31,8 +31,7 @@ import org.junit.Test; * * @since 2.1 */ -public class FileExtensionSelectorTest -{ +public class FileExtensionSelectorTest { private static FileObject BaseFolder; private static final int FileCount = 9; @@ -47,8 +46,7 @@ public class FileExtensionSelectorTest * @throws Exception */ @BeforeClass - public static void setUpClass() throws Exception - { + public static void setUpClass() throws Exception { BaseFolder = VFS.getManager().resolveFile("ram://" + FileExtensionSelectorTest.class.getName()); BaseFolder.deleteAll(); BaseFolder.createFolder(); @@ -69,10 +67,8 @@ public class FileExtensionSelectorTest * @throws Exception */ @AfterClass - public static void tearDownClass() throws Exception - { - if (BaseFolder != null) - { + public static void tearDownClass() throws Exception { + if (BaseFolder != null) { BaseFolder.deleteAll(); } } @@ -83,8 +79,7 @@ public class FileExtensionSelectorTest * @throws Exception */ @Test - public void testEmpty() throws Exception - { + public void testEmpty() throws Exception { final FileSelector selector = new FileExtensionSelector(); final FileObject[] foList = BaseFolder.findFiles(selector); Assert.assertEquals(0, foList.length); @@ -96,14 +91,12 @@ public class FileExtensionSelectorTest * @throws Exception */ @Test - public void testManyExtensions() throws Exception - { + public void testManyExtensions() throws Exception { final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES); Assert.assertTrue(foArray.length > 0); // gather file extensions. final Set<String> extensionSet = new HashSet<>(); - for (final FileObject fo : foArray) - { + for (final FileObject fo : foArray) { extensionSet.add(fo.getName().getExtension()); } final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(), @@ -122,8 +115,7 @@ public class FileExtensionSelectorTest * @throws Exception */ @Test - public void testNullCollection() throws Exception - { + public void testNullCollection() throws Exception { final FileSelector selector0 = new FileExtensionSelector((Collection<String>) null); final FileObject[] foList = BaseFolder.findFiles(selector0); Assert.assertEquals(0, foList.length); @@ -135,8 +127,7 @@ public class FileExtensionSelectorTest * @throws Exception */ @Test - public void testNullString() throws Exception - { + public void testNullString() throws Exception { final FileSelector selector0 = new FileExtensionSelector((String) null); final FileObject[] foList = BaseFolder.findFiles(selector0); Assert.assertEquals(0, foList.length); @@ -148,29 +139,25 @@ public class FileExtensionSelectorTest * @throws Exception */ @Test - public void testOneExtension() throws Exception - { + public void testOneExtension() throws Exception { final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES); Assert.assertTrue(foArray.length > 0); // gather file extensions. final Set<String> extensionSet = new HashSet<>(); - for (final FileObject fo : foArray) - { + for (final FileObject fo : foArray) { extensionSet.add(fo.getName().getExtension()); } final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(), Arrays.asList(foArray).toString()); Assert.assertEquals(message, ExtensionCount, extensionSet.size()); // check each extension - for (final String extension : extensionSet) - { + for (final String extension : extensionSet) { final FileSelector selector = new FileExtensionSelector(extension); final FileObject[] list = BaseFolder.findFiles(selector); Assert.assertEquals(FilesPerExtensionCount, list.length); } // check each file against itself - for (final FileObject fo : foArray) - { + for (final FileObject fo : foArray) { final FileSelector selector = new FileExtensionSelector(fo.getName().getExtension()); final FileObject[] list = BaseFolder.findFiles(selector); Assert.assertEquals(FilesPerExtensionCount, list.length); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java Thu Sep 14 19:26:39 2017 @@ -24,11 +24,10 @@ import org.junit.BeforeClass; import org.junit.Test; /** - * Tests {@link FileObject}s with iterators its implementation the {@link Iterable} interface to allow a FileObject to be the target of the - * Java 5 "foreach" statement. + * Tests {@link FileObject}s with iterators its implementation the {@link Iterable} interface to allow a FileObject to + * be the target of the Java 5 "foreach" statement. */ -public class FileIteratorTest -{ +public class FileIteratorTest { private static FileObject BaseFolder; @@ -40,8 +39,7 @@ public class FileIteratorTest * @throws Exception */ @BeforeClass - public static void setUpClass() throws Exception - { + public static void setUpClass() throws Exception { BaseFolder = VFS.getManager().resolveFile("ram://" + FileIteratorTest.class.getName()); BaseFolder.deleteAll(); BaseFolder.resolveFile("a.htm").createFile(); @@ -65,32 +63,27 @@ public class FileIteratorTest * @throws Exception */ @AfterClass - public static void tearDownClass() throws Exception - { - if (BaseFolder != null) - { + public static void tearDownClass() throws Exception { + if (BaseFolder != null) { BaseFolder.deleteAll(); } } @Test - public void testIterator() throws FileSystemException - { + public void testIterator() throws FileSystemException { final FileObject[] findFiles = BaseFolder.findFiles(Selectors.SELECT_ALL); Assert.assertEquals(FileCount, findFiles.length); final FileObject[] listFiles = BaseFolder.getChildren(); Assert.assertTrue(FileCount > listFiles.length); int i = 0; - for (final FileObject actualFile : BaseFolder) - { + for (final FileObject actualFile : BaseFolder) { final FileObject expectedFile = findFiles[i]; Assert.assertEquals(expectedFile, actualFile); i++; } final Iterator<FileObject> iter = BaseFolder.iterator(); i = 0; - while (iter.hasNext()) - { + while (iter.hasNext()) { final FileObject expectedFile = findFiles[i]; Assert.assertEquals(expectedFile, iter.next()); i++; Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemExceptionTest.java Thu Sep 14 19:26:39 2017 @@ -20,44 +20,39 @@ import static org.junit.Assert.assertEqu import org.junit.Test; - /** * Tests the {@link FileSystemException}. */ public class FileSystemExceptionTest { /** - * Tests a {@link FileSystemException} containing info with a URL containing a complete - * basic authentication. + * Tests a {@link FileSystemException} containing info with a URL containing a complete basic authentication. */ @Test public void testMasksPasswordOfUrlsWithBasicAuthentication() { - final FileSystemException fse = new FileSystemException( - "vfs.provider/rename.error", - "file://test.bin", "http://foo:[email protected]/test.bin"); + final FileSystemException fse = new FileSystemException("vfs.provider/rename.error", "file://test.bin", + "http://foo:[email protected]/test.bin"); assertEquals("file://test.bin", fse.getInfo()[0]); assertEquals("http://foo:***@junit.org/test.bin", fse.getInfo()[1]); } /** - * Tests a {@link FileSystemException} containing info with a URL containing only the user - * information. + * Tests a {@link FileSystemException} containing info with a URL containing only the user information. */ @Test public void testDoesNotModifyUrlsWithoutPassword() { - final FileSystemException fse = new FileSystemException( - "vfs.provider/delete.error", "http://[email protected]/test.bin"); + final FileSystemException fse = new FileSystemException("vfs.provider/delete.error", + "http://[email protected]/test.bin"); assertEquals("http://[email protected]/test.bin", fse.getInfo()[0]); } /** - * Tests a {@link FileSystemException} containing info with a nested URL containing a - * complete basic authentication. + * Tests a {@link FileSystemException} containing info with a nested URL containing a complete basic authentication. */ @Test public void testProperDetectionOfUrl() { - final FileSystemException fse = new FileSystemException( - "vfs.provider/delete.error", "zip:http://foo:[email protected]/test.bin"); + final FileSystemException fse = new FileSystemException("vfs.provider/delete.error", + "zip:http://foo:[email protected]/test.bin"); assertEquals("zip:http://foo:***@junit.org/test.bin", fse.getInfo()[0]); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileSystemOptionsTest.java Thu Sep 14 19:26:39 2017 @@ -31,55 +31,49 @@ public class FileSystemOptionsTest { final JUnitConfigBuilder builder = JUnitConfigBuilder.getInstance(); final FileSystemOptions expected = new FileSystemOptions(); builder.setId(expected, "Test"); - + final FileSystemOptions actual = new FileSystemOptions(); builder.setId(actual, "Test"); - + Assert.assertEquals(expected, actual); Assert.assertEquals(0, actual.compareTo(expected)); Assert.assertEquals(expected.hashCode(), actual.hashCode()); - builder.setNames(expected, new String[]{"A", "B", "C"}); - + builder.setNames(expected, new String[] { "A", "B", "C" }); + Assert.assertNotEquals(expected, actual); Assert.assertEquals(-1, actual.compareTo(expected)); Assert.assertNotEquals(expected.hashCode(), actual.hashCode()); - builder.setNames(actual, new String[]{"A", "B", "C"}); - + builder.setNames(actual, new String[] { "A", "B", "C" }); + Assert.assertEquals(expected, actual); Assert.assertEquals(0, actual.compareTo(expected)); Assert.assertEquals(expected.hashCode(), actual.hashCode()); } - - public static class JUnitConfigBuilder extends FileSystemConfigBuilder - { + + public static class JUnitConfigBuilder extends FileSystemConfigBuilder { private static final JUnitConfigBuilder BUILDER = new JUnitConfigBuilder(); - public static JUnitConfigBuilder getInstance() - { + public static JUnitConfigBuilder getInstance() { return BUILDER; } - public void setId(final FileSystemOptions opts, final String id) - { + public void setId(final FileSystemOptions opts, final String id) { setParam(opts, "id", id); } - public void setNames(final FileSystemOptions opts, final String[] names) - { + public void setNames(final FileSystemOptions opts, final String[] names) { setParam(opts, "names", names); } @Override - protected Class<? extends FileSystem> getConfigClass() - { + protected Class<? extends FileSystem> getConfigClass() { return JUnitFS.class; } - private abstract static class JUnitFS implements FileSystem - { + private abstract static class JUnitFS implements FileSystem { } } - + } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileTypeSelectorTest.java Thu Sep 14 19:26:39 2017 @@ -26,8 +26,7 @@ import org.junit.Test; * * @since 2.1 */ -public class FileTypeSelectorTest -{ +public class FileTypeSelectorTest { private static FileObject BaseFolder; /** @@ -36,8 +35,7 @@ public class FileTypeSelectorTest * @throws Exception */ @BeforeClass - public static void setUpClass() throws Exception - { + public static void setUpClass() throws Exception { BaseFolder = VFS.getManager().resolveFile("ram://" + FileTypeSelectorTest.class.getName()); BaseFolder.resolveFile("root1.html").createFile(); BaseFolder.resolveFile("root2.html").createFile(); @@ -55,17 +53,14 @@ public class FileTypeSelectorTest * @throws Exception */ @AfterClass - public static void tearDownClass() throws Exception - { - if (BaseFolder != null) - { + public static void tearDownClass() throws Exception { + if (BaseFolder != null) { BaseFolder.deleteAll(); } } @Test - public void testFileOrFolders() throws Exception - { + public void testFileOrFolders() throws Exception { final FileSelector selector = new FileTypeSelector(FileType.FILE_OR_FOLDER); final FileObject[] foList = BaseFolder.findFiles(selector); // Why 0? @@ -73,16 +68,14 @@ public class FileTypeSelectorTest } @Test - public void testFiles() throws Exception - { + public void testFiles() throws Exception { final FileSelector selector = new FileTypeSelector(FileType.FILE); final FileObject[] foList = BaseFolder.findFiles(selector); Assert.assertEquals(5, foList.length); } @Test - public void testFolders() throws Exception - { + public void testFolders() throws Exception { final FileSelector selector = new FileTypeSelector(FileType.FOLDER); final FileObject[] foList = BaseFolder.findFiles(selector); Assert.assertEquals(8, foList.length); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/PatternFileSelectorTest.java Thu Sep 14 19:26:39 2017 @@ -30,8 +30,7 @@ import org.junit.Test; * * @since 2.1 */ -public class PatternFileSelectorTest -{ +public class PatternFileSelectorTest { private static FileObject BaseFolder; /** @@ -49,8 +48,7 @@ public class PatternFileSelectorTest * @throws Exception */ @BeforeClass - public static void setUpClass() throws Exception - { + public static void setUpClass() throws Exception { BaseFolder = VFS.getManager().resolveFile("ram://" + PatternFileSelectorTest.class.getName()); BaseFolder.deleteAll(); BaseFolder.createFolder(); @@ -71,10 +69,8 @@ public class PatternFileSelectorTest * @throws Exception */ @AfterClass - public static void tearDownClass() throws Exception - { - if (BaseFolder != null) - { + public static void tearDownClass() throws Exception { + if (BaseFolder != null) { BaseFolder.deleteAll(); } } @@ -85,8 +81,7 @@ public class PatternFileSelectorTest * @throws Exception */ @Test(expected = NullPointerException.class) - public void testNullString() throws Exception - { + public void testNullString() throws Exception { // Yep, this will blow up. new PatternFileSelector((String) null); } @@ -97,8 +92,7 @@ public class PatternFileSelectorTest * @throws Exception */ @Test - public void testMatchAll() throws Exception - { + public void testMatchAll() throws Exception { final FileObject[] list = BaseFolder.findFiles(new PatternFileSelector(".*")); Assert.assertEquals(EntryCount, list.length); } @@ -109,30 +103,26 @@ public class PatternFileSelectorTest * @throws Exception */ @Test - public void testFileExtensions() throws Exception - { + public void testFileExtensions() throws Exception { final FileObject[] foArray = BaseFolder.findFiles(Selectors.SELECT_FILES); Assert.assertTrue(foArray.length > 0); final String regExPrefix = ".*\\."; // gather file extensions. final Set<String> extensionSet = new HashSet<>(); - for (final FileObject fo : foArray) - { + for (final FileObject fo : foArray) { extensionSet.add(regExPrefix + fo.getName().getExtension()); } final String message = String.format("Extensions: %s; files: %s", extensionSet.toString(), Arrays.asList(foArray).toString()); Assert.assertEquals(message, ExtensionCount, extensionSet.size()); // check each extension - for (final String extension : extensionSet) - { + for (final String extension : extensionSet) { final FileSelector selector = new PatternFileSelector(extension); final FileObject[] list = BaseFolder.findFiles(selector); Assert.assertEquals(FilesPerExtensionCount, list.length); } // check each file against itself - for (final FileObject fo : foArray) - { + for (final FileObject fo : foArray) { final FileSelector selector = new PatternFileSelector(regExPrefix + fo.getName().getExtension()); final FileObject[] list = BaseFolder.findFiles(selector); Assert.assertEquals(FilesPerExtensionCount, list.length); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java Thu Sep 14 19:26:39 2017 @@ -22,10 +22,8 @@ import junit.framework.AssertionFailedEr import junit.framework.Test; import junit.framework.TestResult; -public class RunTest -{ - public static void main(final String[] args) throws Exception - { +public class RunTest { + public static void main(final String[] args) throws Exception { final String ip = "192.168.0.128"; final Properties props = System.getProperties(); @@ -34,79 +32,66 @@ public class RunTest props.setProperty("test.basedir.res", "test-data"); props.setProperty("test.policy", "src/test-data/test.policy"); props.setProperty("test.secure", "false"); - props.setProperty("test.smb.uri", - "smb://HOME\\vfsusr:vfs%2f%25\\te:st@" + ip + "/vfsusr/vfstest"); - props.setProperty("test.ftp.uri", - "ftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); - props.setProperty("test.ftps.uri", - "ftps://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); + props.setProperty("test.smb.uri", "smb://HOME\\vfsusr:vfs%2f%25\\te:st@" + ip + "/vfsusr/vfstest"); + props.setProperty("test.ftp.uri", "ftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); + props.setProperty("test.ftps.uri", "ftps://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); props.setProperty("test.http.uri", "http://" + ip + "/vfstest"); - props.setProperty("test.webdav.uri", - "webdav://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); - props.setProperty("test.sftp.uri", - "sftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); - - final Test tests[] = new Test[] - { -// LocalProviderTestCase.suite(), -// FtpProviderTestCase.suite(), -// UrlProviderHttpTestCase.suite(), -// VirtualProviderTestCase.suite(), -// TemporaryProviderTestCase.suite(), -// UrlProviderTestCase.suite(), -// ResourceProviderTestCase.suite(), -// HttpProviderTestCase.suite(), -// SftpProviderTestCase.suite(), -// JarProviderTestCase.suite(), -// NestedJarTestCase.suite(), -// ZipProviderTestCase.suite(), -// NestedZipTestCase.suite(), -// TarProviderTestCase.suite(), -// TgzProviderTestCase.suite(), -// Tbz2ProviderTestCase.suite(), -// NestedTarTestCase.suite(), -// NestedTgzTestCase.suite(), -// NestedTbz2TestCase.suite(), -// RamProviderTestCase.suite(), + props.setProperty("test.webdav.uri", "webdav://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); + props.setProperty("test.sftp.uri", "sftp://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest"); -// SmbProviderTestCase.suite(), -// WebdavProviderTestCase.suite(), + final Test tests[] = new Test[] { + // LocalProviderTestCase.suite(), + // FtpProviderTestCase.suite(), + // UrlProviderHttpTestCase.suite(), + // VirtualProviderTestCase.suite(), + // TemporaryProviderTestCase.suite(), + // UrlProviderTestCase.suite(), + // ResourceProviderTestCase.suite(), + // HttpProviderTestCase.suite(), + // SftpProviderTestCase.suite(), + // JarProviderTestCase.suite(), + // NestedJarTestCase.suite(), + // ZipProviderTestCase.suite(), + // NestedZipTestCase.suite(), + // TarProviderTestCase.suite(), + // TgzProviderTestCase.suite(), + // Tbz2ProviderTestCase.suite(), + // NestedTarTestCase.suite(), + // NestedTgzTestCase.suite(), + // NestedTbz2TestCase.suite(), + // RamProviderTestCase.suite(), + + // SmbProviderTestCase.suite(), + // WebdavProviderTestCase.suite(), }; - final TestResult result = new TestResult() - { + final TestResult result = new TestResult() { @Override - public void startTest(final Test test) - { + public void startTest(final Test test) { System.out.println("start " + test); System.out.flush(); } @Override - public void endTest(final Test test) - { + public void endTest(final Test test) { // System.err.println("end " + test); } @Override - public synchronized void addError(final Test test, final Throwable throwable) - { + public synchronized void addError(final Test test, final Throwable throwable) { // throw new RuntimeException(throwable.getMessage()); throwable.printStackTrace(); } @Override - public synchronized void addFailure(final Test test, - final AssertionFailedError assertionFailedError) - { + public synchronized void addFailure(final Test test, final AssertionFailedError assertionFailedError) { // throw new RuntimeException(assertionFailedError.getMessage()); assertionFailedError.printStackTrace(); } }; - for (int i = 0; i < tests.length; i++) - { + for (int i = 0; i < tests.length; i++) { System.out.println("start test#" + i); System.out.flush(); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/UserAuthenticationDataTestCase.java Thu Sep 14 19:26:39 2017 @@ -22,11 +22,9 @@ import static org.junit.Assert.assertSam import org.junit.Test; -public class UserAuthenticationDataTestCase -{ +public class UserAuthenticationDataTestCase { @Test - public void testCharacterBasedData() - { + public void testCharacterBasedData() { final UserAuthenticationData data = new UserAuthenticationData(); final char[] array = "PMC".toCharArray(); data.setData(UserAuthenticationData.USERNAME, array); @@ -40,13 +38,12 @@ public class UserAuthenticationDataTestC data.cleanup(); assertNull(data.getData(UserAuthenticationData.USERNAME)); assertNull(data.getData(UserAuthenticationData.DOMAIN)); - final char[] nulls = {0,0,0}; + final char[] nulls = { 0, 0, 0 }; assertArrayEquals(nulls, array); } @Test - public void testCustomType() - { + public void testCustomType() { final UserAuthenticationData.Type type = new UserAuthenticationData.Type("JUNIT"); final UserAuthenticationData data = new UserAuthenticationData(); final char[] array = "test".toCharArray(); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/auth/StaticUserAuthenticatorTestCase.java Thu Sep 14 19:26:39 2017 @@ -26,27 +26,24 @@ import org.apache.commons.vfs2.UserAuthe import org.apache.commons.vfs2.UserAuthenticator; import org.junit.Test; -public class StaticUserAuthenticatorTestCase -{ +public class StaticUserAuthenticatorTestCase { @Test - public void testAuthenticationRequest() - { + public void testAuthenticationRequest() { final UserAuthenticator userAuthenticator = new StaticUserAuthenticator("DOMAIN", "USER", "PWD"); - UserAuthenticationData authenticationData = - userAuthenticator.requestAuthentication(ArrayUtils.toArray(UserAuthenticationData.DOMAIN)); + UserAuthenticationData authenticationData = userAuthenticator + .requestAuthentication(ArrayUtils.toArray(UserAuthenticationData.DOMAIN)); assertArrayEquals("DOMAIN".toCharArray(), authenticationData.getData(UserAuthenticationData.DOMAIN)); assertNull(authenticationData.getData(UserAuthenticationData.USERNAME)); assertNull(authenticationData.getData(UserAuthenticationData.PASSWORD)); authenticationData = userAuthenticator.requestAuthentication( - ArrayUtils.toArray(UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD)); + ArrayUtils.toArray(UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD)); assertNull(authenticationData.getData(UserAuthenticationData.DOMAIN)); assertArrayEquals("USER".toCharArray(), authenticationData.getData(UserAuthenticationData.USERNAME)); assertArrayEquals("PWD".toCharArray(), authenticationData.getData(UserAuthenticationData.PASSWORD)); } @Test - public void testEquality() - { + public void testEquality() { final UserAuthenticator userAuthenticator = new StaticUserAuthenticator("DOMAIN", "USER", "PWD"); assertEquals(new StaticUserAuthenticator("DOMAIN", "USER", "PWD"), userAuthenticator); assertNotEquals(new StaticUserAuthenticator("DOMAIN", "USER", null), userAuthenticator); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/AbstractFilesCacheTestsBase.java Thu Sep 14 19:26:39 2017 @@ -27,17 +27,14 @@ import org.apache.commons.vfs2.test.Cach /** * Base class for different FilesCache tests. * <p> - * Make sure {@link CacheTestSuite} is configured - * with correct FilesCache. + * Make sure {@link CacheTestSuite} is configured with correct FilesCache. */ -public abstract class AbstractFilesCacheTestsBase extends AbstractProviderTestCase -{ +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. + * Will test if the cache is cleared and if it is still useable afterwards. It will actually ensure the test is + * hitting the cache. */ - public void testClearFiles() throws Exception - { + public void testClearFiles() throws Exception { final FilesCache cache = getManager().getFilesCache(); final FileObject fo1 = getWriteFolder().resolveFile("dir1"); @@ -53,11 +50,9 @@ public abstract class AbstractFilesCache } /** - * Basic Cache operations, work for all caches - * (besides {@link NullFilesCache#testBasicCacheOps() NullFilesCache}). + * Basic Cache operations, work for all caches (besides {@link NullFilesCache#testBasicCacheOps() NullFilesCache}). */ - public void testBasicCacheOps() throws Exception - { + public void testBasicCacheOps() throws Exception { final FilesCache cache = getManager().getFilesCache(); final FileObject fo = getWriteFolder().resolveFile("dir1"); final FileName fn = fo.getName(); @@ -80,11 +75,9 @@ public abstract class AbstractFilesCache } /** Helper method, may be used in cache specific tests. */ - protected int getFileHashCode() throws FileSystemException - { + protected int getFileHashCode() throws FileSystemException { final FileObject fo = getWriteFolder().resolveFile("file2"); - if (!fo.exists()) - { + if (!fo.exists()) { fo.createFile(); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,25 +30,20 @@ import junit.framework.Test; /** * Tests the {@link DefaultFilesCache} using {@link DefaultFilesCacheTests}. */ -public class DefaultFilesCacheTestCase - extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class DefaultFilesCacheTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { final CacheTestSuite suite = new CacheTestSuite(new DefaultFilesCacheTestCase()); suite.addTests(DefaultFilesCacheTests.class); return suite; } @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return new DefaultFilesCache(); } @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/DefaultFilesCacheTests.java Thu Sep 14 19:26:39 2017 @@ -21,10 +21,8 @@ import org.apache.commons.vfs2.FileObjec /** * Tests for {@link DefaultFilesCache} used by {@link DefaultFilesCacheTestCase}. */ -public class DefaultFilesCacheTests extends AbstractFilesCacheTestsBase -{ - public void testFilesCache() throws Exception - { +public class DefaultFilesCacheTests extends AbstractFilesCacheTestsBase { + public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); final FileObject dir1 = scratchFolder.resolveFile("dir1"); Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,25 +30,20 @@ import junit.framework.Test; /** * Tests the {@link LRUFilesCache} using {@link LRUFilesCacheTestss}. */ -public class LRUFilesCacheTestCase - extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class LRUFilesCacheTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { final CacheTestSuite suite = new CacheTestSuite(new LRUFilesCacheTestCase()); suite.addTests(LRUFilesCacheTests.class); return suite; } @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return new LRUFilesCache(5); } @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/LRUFilesCacheTests.java Thu Sep 14 19:26:39 2017 @@ -21,10 +21,8 @@ import org.apache.commons.vfs2.FileObjec /** * Tests for {@link LRUFilesCache} used by {@link LRUFilesCacheTestCase}. */ -public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase -{ - public void testFilesCache() throws Exception - { +public class LRUFilesCacheTests extends AbstractFilesCacheTestsBase { + public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); // releaseable @@ -36,33 +34,27 @@ public class LRUFilesCacheTests extends // releaseable @SuppressWarnings("unused") - final - FileObject dir3 = scratchFolder.resolveFile("dir3"); + final FileObject dir3 = scratchFolder.resolveFile("dir3"); // releaseable @SuppressWarnings("unused") - final - FileObject dir4 = scratchFolder.resolveFile("dir4"); + final FileObject dir4 = scratchFolder.resolveFile("dir4"); // releaseable @SuppressWarnings("unused") - final - FileObject dir5 = scratchFolder.resolveFile("dir5"); + final FileObject dir5 = scratchFolder.resolveFile("dir5"); // releaseable @SuppressWarnings("unused") - final - FileObject dir6 = scratchFolder.resolveFile("dir6"); + final FileObject dir6 = scratchFolder.resolveFile("dir6"); // releaseable @SuppressWarnings("unused") - final - FileObject dir7 = scratchFolder.resolveFile("dir7"); + final FileObject dir7 = scratchFolder.resolveFile("dir7"); // releaseable @SuppressWarnings("unused") - final - FileObject dir8 = scratchFolder.resolveFile("dir8"); + final FileObject dir8 = scratchFolder.resolveFile("dir8"); // check if the cache still holds the right instance final FileObject dir2_2 = scratchFolder.resolveFile("dir2"); @@ -73,8 +65,7 @@ public class LRUFilesCacheTests extends assertFalse(dir1 == dir1_2); } - public void testClass() - { + public void testClass() { assertTrue(getManager().getFilesCache() instanceof LRUFilesCache); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,25 +30,20 @@ import junit.framework.Test; /** * Tests the {@link NullFilesCache} using {@link NullFilesCacheTests}. */ -public class NullFilesCacheTestCase - extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class NullFilesCacheTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { final CacheTestSuite suite = new CacheTestSuite(new NullFilesCacheTestCase()); suite.addTests(NullFilesCacheTests.class); return suite; } @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return new NullFilesCache(); } @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/NullFilesCacheTests.java Thu Sep 14 19:26:39 2017 @@ -24,10 +24,8 @@ import org.apache.commons.vfs2.FilesCach /** * Tests for {@link NullFilesCache} used by {@link NullFilesCacheTestCase}. */ -public class NullFilesCacheTests extends AbstractFilesCacheTestsBase -{ - public void testFilesCache() throws Exception - { +public class NullFilesCacheTests extends AbstractFilesCacheTestsBase { + public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); final FileObject dir1 = scratchFolder.resolveFile("dir1"); @@ -37,8 +35,7 @@ public class NullFilesCacheTests extends } @Override - public void testBasicCacheOps() throws Exception - { + public void testBasicCacheOps() throws Exception { // the basic test looks different for a null cache: final FilesCache cache = getManager().getFilesCache(); @@ -59,9 +56,7 @@ public class NullFilesCacheTests extends assertNull(cache.getFile(fs, fn)); } - - public void testClass() - { + public void testClass() { assertTrue(getManager().getFilesCache() instanceof NullFilesCache); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,25 +30,20 @@ import junit.framework.Test; /** * Tests the {@link SoftRefFilesCache} using {@link SoftRefFilesCacheTests}. */ -public class SoftRefFilesCacheTestCase - extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class SoftRefFilesCacheTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { final CacheTestSuite suite = new CacheTestSuite(new SoftRefFilesCacheTestCase()); suite.addTests(SoftRefFilesCacheTests.class); return suite; } @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return new SoftRefFilesCache(); } @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/SoftRefFilesCacheTests.java Thu Sep 14 19:26:39 2017 @@ -21,10 +21,8 @@ import org.apache.commons.vfs2.FileObjec /** * Tests for {@link SoftRefFilesCache} used by {@link SoftRefFilesCacheTestCase}. */ -public class SoftRefFilesCacheTests extends AbstractFilesCacheTestsBase -{ - public void testFilesCache() throws Exception - { +public class SoftRefFilesCacheTests extends AbstractFilesCacheTestsBase { + public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); final FileObject dir1 = scratchFolder.resolveFile("dir1"); @@ -34,8 +32,7 @@ public class SoftRefFilesCacheTests exte assertSame(dir1, dir1_2); } - public void testClass() - { + public void testClass() { assertTrue(getManager().getFilesCache() instanceof SoftRefFilesCache); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTestCase.java Thu Sep 14 19:26:39 2017 @@ -30,25 +30,20 @@ import junit.framework.Test; /** * Tests the {@link WeakRefFilesCache} using {@link WeakRefFilesCacheTests}. */ -public class WeakRefFilesCacheTestCase - extends AbstractProviderTestConfig -{ - public static Test suite() throws Exception - { +public class WeakRefFilesCacheTestCase extends AbstractProviderTestConfig { + public static Test suite() throws Exception { final CacheTestSuite suite = new CacheTestSuite(new WeakRefFilesCacheTestCase()); suite.addTests(WeakRefFilesCacheTests.class); return suite; } @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return new WeakRefFilesCache(); } @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final File testDir = AbstractVfsTestCase.getTestDirectoryFile(); return manager.toFileObject(testDir); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/cache/WeakRefFilesCacheTests.java Thu Sep 14 19:26:39 2017 @@ -21,10 +21,8 @@ import org.apache.commons.vfs2.FileObjec /** * Tests for {@link WeakRefFilesCache} used by {@link WeakRefFilesCacheTestCase}. */ -public class WeakRefFilesCacheTests extends AbstractFilesCacheTestsBase -{ - public void testFilesCache() throws Exception - { +public class WeakRefFilesCacheTests extends AbstractFilesCacheTestsBase { + public void testFilesCache() throws Exception { final FileObject scratchFolder = getWriteFolder(); final FileObject dir1 = scratchFolder.resolveFile("dir1"); @@ -34,8 +32,7 @@ public class WeakRefFilesCacheTests exte assertSame(dir1, dir1_2); } - public void testClass() - { + public void testClass() { assertTrue(getManager().getFilesCache() instanceof WeakRefFilesCache); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileMonitorTests.java Thu Sep 14 19:26:39 2017 @@ -30,48 +30,41 @@ import org.apache.commons.vfs2.impl.Defa /** * Test to verify DefaultFileMonitor */ -public class DefaultFileMonitorTests extends AbstractVfsTestCase -{ +public class DefaultFileMonitorTests extends AbstractVfsTestCase { private FileSystemManager fsManager; private File testDir; private int changeStatus = 0; private File testFile; @Override - public void setUp() throws Exception - { + public void setUp() throws Exception { super.setUp(); fsManager = VFS.getManager(); testDir = AbstractVfsTestCase.getTestDirectoryFile(); changeStatus = 0; testFile = new File(testDir, "testReload.properties"); - if (testFile.exists()) - { + if (testFile.exists()) { testFile.delete(); } } @Override - public void tearDown() throws Exception - { - if (testFile != null && testFile.exists()) - { + public void tearDown() throws Exception { + if (testFile != null && testFile.exists()) { testFile.delete(); } super.tearDown(); } - public void testFileCreated() throws Exception - { + public void testFileCreated() throws Exception { final FileObject fileObj = fsManager.resolveFile(testFile.toURI().toURL().toString()); final DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener()); // TestFileListener manipulates changeStatus monitor.setDelay(100); monitor.addFile(fileObj); monitor.start(); - try - { + try { writeToFile(testFile); Thread.sleep(300); assertTrue("No event occurred", changeStatus != 0); @@ -81,8 +74,7 @@ public class DefaultFileMonitorTests ext } } - public void testFileDeleted() throws Exception - { + public void testFileDeleted() throws Exception { writeToFile(testFile); final FileObject fileObj = fsManager.resolveFile(testFile.toURI().toString()); final DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener()); @@ -90,8 +82,7 @@ public class DefaultFileMonitorTests ext monitor.setDelay(100); monitor.addFile(fileObj); monitor.start(); - try - { + try { testFile.delete(); Thread.sleep(300); assertTrue("No event occurred", changeStatus != 0); @@ -101,8 +92,7 @@ public class DefaultFileMonitorTests ext } } - public void testFileModified() throws Exception - { + public void testFileModified() throws Exception { writeToFile(testFile); final FileObject fileObj = fsManager.resolveFile(testFile.toURI().toURL().toString()); final DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener()); @@ -110,14 +100,13 @@ public class DefaultFileMonitorTests ext monitor.setDelay(100); monitor.addFile(fileObj); monitor.start(); - try - { + try { // Need a long delay to insure the new timestamp doesn't truncate to be the same as // the current timestammp. Java only guarantees the timestamp will be to 1 second. Thread.sleep(1000); final long value = System.currentTimeMillis(); final boolean rc = testFile.setLastModified(value); - assertTrue("setLastModified succeeded",rc); + assertTrue("setLastModified succeeded", rc); Thread.sleep(300); assertTrue("No event occurred", changeStatus != 0); assertTrue("Incorrect event", changeStatus == 1); @@ -126,17 +115,14 @@ public class DefaultFileMonitorTests ext } } - - public void testFileRecreated() throws Exception - { + public void testFileRecreated() throws Exception { final FileObject fileObj = fsManager.resolveFile(testFile.toURI().toURL().toString()); final DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener()); // TestFileListener manipulates changeStatus monitor.setDelay(100); monitor.addFile(fileObj); monitor.start(); - try - { + try { writeToFile(testFile); Thread.sleep(300); assertTrue("No event occurred", changeStatus != 0); @@ -158,16 +144,14 @@ public class DefaultFileMonitorTests ext } } - public void testChildFileRecreated() throws Exception - { + public void testChildFileRecreated() throws Exception { writeToFile(testFile); final FileObject fileObj = fsManager.resolveFile(testDir.toURI().toURL().toString()); final DefaultFileMonitor monitor = new DefaultFileMonitor(new TestFileListener()); monitor.setDelay(2000); monitor.addFile(fileObj); monitor.start(); - try - { + try { changeStatus = 0; Thread.sleep(300); testFile.delete(); @@ -185,31 +169,25 @@ public class DefaultFileMonitorTests ext } } - private void writeToFile(final File file) throws Exception - { + private void writeToFile(final File file) throws Exception { final FileWriter out = new FileWriter(file); out.write("string=value1"); out.close(); } - - public class TestFileListener implements FileListener - { + public class TestFileListener implements FileListener { @Override - public void fileChanged(final FileChangeEvent event) throws Exception - { + public void fileChanged(final FileChangeEvent event) throws Exception { changeStatus = 1; } @Override - public void fileDeleted(final FileChangeEvent event) throws Exception - { + public void fileDeleted(final FileChangeEvent event) throws Exception { changeStatus = 2; } @Override - public void fileCreated(final FileChangeEvent event) throws Exception - { + public void fileCreated(final FileChangeEvent event) throws Exception { changeStatus = 3; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java Thu Sep 14 19:26:39 2017 @@ -24,49 +24,42 @@ import org.apache.commons.vfs2.FileSyste import org.apache.commons.vfs2.VFS; import org.junit.Test; -public class DefaultFileSystemManagerTest -{ +public class DefaultFileSystemManagerTest { @Test(expected = NullPointerException.class) - public void testResolveFileRelativeThrows() throws FileSystemException - { + public void testResolveFileRelativeThrows() throws FileSystemException { VFS.getManager().resolveFile((File) null, "relativePath"); } /** - * Even if the file name is absolute, the base file must be given. This is - * an inconsistency in the API, but it is documented as such. + * Even if the file name is absolute, the base file must be given. This is an inconsistency in the API, but it is + * documented as such. * * @see "VFS-519" */ @Test(expected = NullPointerException.class) - public void testResolveFileAbsoluteThrows() throws FileSystemException - { + public void testResolveFileAbsoluteThrows() throws FileSystemException { final String absolute = new File("/").getAbsoluteFile().toURI().toString(); VFS.getManager().resolveFile((File) null, absolute); } @Test(expected = FileSystemException.class) - public void testResolveFileObjectRelativeThrows() throws FileSystemException - { + public void testResolveFileObjectRelativeThrows() throws FileSystemException { VFS.getManager().resolveFile((FileObject) null, "relativePath"); } @Test - public void testResolveFileObjectNullAbsolute() throws FileSystemException - { + public void testResolveFileObjectNullAbsolute() throws FileSystemException { final String absolute = new File("/").getAbsoluteFile().toURI().toString(); VFS.getManager().resolveFile((FileObject) null, absolute); } /** - * If the base name is {@code null}, the file system manager should fail - * throwing a FileSystemException. + * If the base name is {@code null}, the file system manager should fail throwing a FileSystemException. * * @see VFS-189 */ @Test(expected = FileSystemException.class) - public void testResolveFileNameNull() throws FileSystemException - { + public void testResolveFileNameNull() throws FileSystemException { VFS.getManager().resolveName((FileName) null, "../"); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/VfsClassLoaderTests.java Thu Sep 14 19:26:39 2017 @@ -35,27 +35,19 @@ import org.apache.commons.vfs2.test.Abst /** * VfsClassLoader test cases. */ -public class VfsClassLoaderTests - extends AbstractProviderTestCase -{ +public class VfsClassLoaderTests extends AbstractProviderTestCase { /** * Returns the capabilities required by the tests of this test case. */ @Override - protected Capability[] getRequiredCaps() - { - return new Capability[] - { - Capability.READ_CONTENT, - Capability.URI - }; + protected Capability[] getRequiredCaps() { + return new Capability[] { Capability.READ_CONTENT, Capability.URI }; } /** * Creates the classloader to use when testing. */ - private VFSClassLoader createClassLoader() throws FileSystemException - { + private VFSClassLoader createClassLoader() throws FileSystemException { final FileObject file = getBaseFolder(); return new VFSClassLoader(file, getManager()); } @@ -63,8 +55,7 @@ public class VfsClassLoaderTests /** * Tests loading a class. */ - public void testLoadClass() throws Exception - { + public void testLoadClass() throws Exception { final VFSClassLoader loader = createClassLoader(); final Class<?> testClass = loader.loadClass("code.ClassToLoad"); @@ -79,8 +70,7 @@ public class VfsClassLoaderTests /** * Tests loading a resource. */ - public void testLoadResource() throws Exception - { + public void testLoadResource() throws Exception { final VFSClassLoader loader = createClassLoader(); final URL resource = loader.getResource("read-tests/file1.txt"); @@ -93,8 +83,7 @@ public class VfsClassLoaderTests /** * Tests package sealing. */ - public void testSealing() throws Exception - { + public void testSealing() throws Exception { final VFSClassLoader loader = createClassLoader(); final Class<?> testClass = loader.loadClass("code.sealed.AnotherClass"); final Package pack = testClass.getPackage(); @@ -105,20 +94,15 @@ public class VfsClassLoaderTests /** * Tests retrieving resources (from JAR searchpath). * <p> - * This is run for all providers, but only when a local - * provider is present and jar extension is registered - * it will actually carry out all tests. + * This is run for all providers, but only when a local provider is present and jar extension is registered it will + * actually carry out all tests. */ - public void testGetResourcesJARs() throws Exception - { + public void testGetResourcesJARs() throws Exception { final FileSystemManager manager = getManager(); - try - { + try { // hasProvider("file") cannot be used as it triggers default provider URL manager.toFileObject(new File(".")); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { System.out.println("VfsClassLoaderTests no local file provider, skipping."); return; } @@ -130,8 +114,7 @@ public class VfsClassLoaderTests final FileObject testJar = manager.resolveFile(baseDir, "test.jar"); // test setup needs to know about .jar extension - i.e. NestedJarTestCase - if (!manager.canCreateFileSystem(nestedJar)) - { + if (!manager.canCreateFileSystem(nestedJar)) { System.out.println("VfsClassLoaderTests no layered .jar provider, skipping."); return; } @@ -151,8 +134,10 @@ public class VfsClassLoaderTests final URL url1 = urls.nextElement(); final URL url2 = urls.nextElement(); - assertTrue("First resource must refer to nested.jar but was " + url1, url1.toString().endsWith("nested.jar!/META-INF/MANIFEST.MF")); - assertTrue("Second resource must refer to test.jar but was " + url2, url2.toString().endsWith("test.jar!/META-INF/MANIFEST.MF")); + assertTrue("First resource must refer to nested.jar but was " + url1, + url1.toString().endsWith("nested.jar!/META-INF/MANIFEST.MF")); + assertTrue("Second resource must refer to test.jar but was " + url2, + url2.toString().endsWith("test.jar!/META-INF/MANIFEST.MF")); } /** @@ -160,16 +145,12 @@ public class VfsClassLoaderTests * <p> * This test is repeated with various provider configurations but works on local files, only. */ - public void testGetResourcesNoLayerLocal() throws Exception - { + public void testGetResourcesNoLayerLocal() throws Exception { final FileSystemManager manager = getManager(); - try - { + try { // hasProvider("file") cannot be used as it triggers default provider URL manager.toFileObject(new File(".")); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { System.out.println("VfsClassLoaderTests no local file provider, skipping."); return; } @@ -192,15 +173,11 @@ public class VfsClassLoaderTests assertTrue("not pointing to resource " + url1, url1.toString().endsWith("subdir4.jar/file1.txt")); } - /** * Verify the package loaded with class loader. */ - private void verifyPackage(final Package pack, - final boolean sealed) - { - if (getBaseFolder().getFileSystem().hasCapability(Capability.MANIFEST_ATTRIBUTES)) - { + private void verifyPackage(final Package pack, final boolean sealed) { + if (getBaseFolder().getFileSystem().hasCapability(Capability.MANIFEST_ATTRIBUTES)) { assertEquals("ImplTitle", pack.getImplementationTitle()); assertEquals("ImplVendor", pack.getImplementationVendor()); assertEquals("1.1", pack.getImplementationVersion()); @@ -208,9 +185,7 @@ public class VfsClassLoaderTests assertEquals("SpecVendor", pack.getSpecificationVendor()); assertEquals("1.0", pack.getSpecificationVersion()); assertEquals(sealed, pack.isSealed()); - } - else - { + } else { assertNull(pack.getImplementationTitle()); assertNull(pack.getImplementationVendor()); assertNull(pack.getImplementationVersion()); @@ -221,32 +196,24 @@ public class VfsClassLoaderTests } } - /** * Non-Delegating Class Loader. */ - public static class MockClassloader extends ClassLoader - { - MockClassloader() - { + public static class MockClassloader extends ClassLoader { + MockClassloader() { super(null); } /** - * This method will not return any hit to - * VFSClassLoader#testGetResourcesJARs. + * This method will not return any hit to VFSClassLoader#testGetResourcesJARs. */ @Override - public Enumeration<URL> getResources(final String name) - throws IOException - { - return Collections.enumeration(Collections.<URL> emptyList()); + public Enumeration<URL> getResources(final String name) throws IOException { + return Collections.enumeration(Collections.<URL>emptyList()); } @Override - protected Class<?> findClass(final String name) - throws ClassNotFoundException - { + protected Class<?> findClass(final String name) throws ClassNotFoundException { fail("Not intended to be used for class loading."); return null; } Modified: commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTestCase.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTestCase.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTestCase.java Thu Sep 14 19:26:39 2017 @@ -37,69 +37,53 @@ import org.junit.Test; /** * Basic Tests for the FileOperations and FileOperationsProvider API. */ -public class BasicOperationsTestCase -{ +public class BasicOperationsTestCase { /** This FileOperationsProvider is a VfsComponent and records invocations. */ - static class MyFileOperationProviderComp - extends MyFileOprationProviderBase - implements VfsComponent - { + static class MyFileOperationProviderComp extends MyFileOprationProviderBase implements VfsComponent { @Override - public void setLogger(final Log logger) - { + public void setLogger(final Log logger) { assertNotNull("setLogger", logger); ops |= 1; } @Override - public void setContext(final VfsComponentContext context) - { + public void setContext(final VfsComponentContext context) { assertNotNull("setContext", context); ops |= 2; } @Override - public void init() - throws FileSystemException - { + public void init() throws FileSystemException { ops |= 4; } @Override - public void close() - { + public void close() { ops |= 8; } } /** This FileOperationsProvider is no VfsComponent. */ - static class MyFileOperationProviderNoncomp - extends MyFileOprationProviderBase - { + static class MyFileOperationProviderNoncomp extends MyFileOprationProviderBase { } /** - * Base class for different Test Providers. This is also a compile test - * to ensure interface stability. + * Base class for different Test Providers. This is also a compile test to ensure interface stability. */ - static class MyFileOprationProviderBase implements FileOperationProvider - { + static class MyFileOprationProviderBase implements FileOperationProvider { int ops = 0; // bit array to record invocations (poor mans mock) @Override - public void collectOperations(final Collection<Class< ? extends FileOperation>> operationsList, - final FileObject file) - throws FileSystemException - { + public void collectOperations(final Collection<Class<? extends FileOperation>> operationsList, + final FileObject file) throws FileSystemException { assertNotNull("collect operationsList", operationsList); assertNotNull("collect file", file); ops |= 16; } @Override - public FileOperation getOperation(final FileObject file, final Class< ? extends FileOperation> operationClass) - throws FileSystemException - { + public FileOperation getOperation(final FileObject file, final Class<? extends FileOperation> operationClass) + throws FileSystemException { assertNotNull("file object", file); assertNotNull("operationclass", operationClass); ops |= 32; @@ -112,11 +96,11 @@ public class BasicOperationsTestCase /** * JUnit Fixture: Prepare a simple FSM. + * * @throws FileSystemException for runtime problems */ @Before - public void setUp() throws FileSystemException - { + public void setUp() throws FileSystemException { manager = new DefaultFileSystemManager(); final FileProvider fp = new DefaultLocalFileProvider(); manager.addProvider("file", fp); @@ -124,30 +108,29 @@ public class BasicOperationsTestCase } /** - * Ensure FileOperationProviders which are VfsComponents are - * set up and teared down. + * Ensure FileOperationProviders which are VfsComponents are set up and teared down. + * * @throws FileSystemException for runtime problems */ @Test - public void testLifecycleComp() throws FileSystemException - { + public void testLifecycleComp() throws FileSystemException { final MyFileOprationProviderBase myop = new MyFileOperationProviderComp(); - assertEquals(0, myop.ops); + assertEquals(0, myop.ops); manager.addOperationProvider("file", myop); assertEquals(7, myop.ops); manager.close(); assertEquals("close() not called", 15, myop.ops); // VFS-577 - //fixture will close again - } + // fixture will close again + } /** * Ensure you can use FileOperationProvider which is not a VfsComponnt. + * * @throws FileSystemException for runtime problems */ @Test - public void testLifecycleNoncomp() throws FileSystemException - { + public void testLifecycleNoncomp() throws FileSystemException { final MyFileOprationProviderBase myop = new MyFileOperationProviderNoncomp(); manager.addOperationProvider("file", myop); final FileOperationProvider[] ops = manager.getOperationProviders("file"); @@ -158,11 +141,11 @@ public class BasicOperationsTestCase /** * Ensures getOperations calls collect and allows empty response. + * * @throws FileSystemException for runtime problems */ @Test - public void testNotFoundAny() throws FileSystemException - { + public void testNotFoundAny() throws FileSystemException { final MyFileOprationProviderBase myop = new MyFileOperationProviderNoncomp(); manager.addOperationProvider("file", myop); final FileObject fo = manager.toFileObject(new File(".")); @@ -170,18 +153,18 @@ public class BasicOperationsTestCase final FileOperations ops = fo.getFileOperations(); assertNotNull(ops); - final Class< ? extends FileOperation>[] oparray = ops.getOperations(); + final Class<? extends FileOperation>[] oparray = ops.getOperations(); assertSame("no ops should be found", 0, oparray.length); assertSame(16, myop.ops); // collect } /** * Ensure proper response for not found FileOperation. + * * @throws FileSystemException for runtime problems */ @Test - public void testNotFoundOperation() throws FileSystemException - { + public void testNotFoundOperation() throws FileSystemException { final MyFileOprationProviderBase myop = new MyFileOperationProviderNoncomp(); manager.addOperationProvider("file", myop); final FileObject fo = manager.toFileObject(new File(".")); @@ -189,13 +172,10 @@ public class BasicOperationsTestCase final FileOperations ops = fo.getFileOperations(); assertNotNull(ops); - try - { + try { final FileOperation logop = ops.getOperation(VcsLog.class); fail("Must throw but returned " + logop); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { assertEquals("vfs.operation/operation-not-supported.error", e.getCode()); } assertSame(32, myop.ops); // getOperation was called @@ -203,13 +183,12 @@ public class BasicOperationsTestCase /** * JUnit Fixture: Tear Down the FSM. + * * @throws FileSystemException for runtime problems */ @After - public void tearDown() throws FileSystemException - { - if (manager != null) - { + public void tearDown() throws FileSystemException { + if (manager != null) { manager.close(); manager = null; }
