commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1416507 [8/8] - in /commons/proper/vfs/trunk/core/src: main/java/org/apache/commons/vfs2/ main/java/org/apache/commons/vfs2/auth/ main/java/org/apache/commons/vfs2/cache/ main/java/org/apache/commons/vfs2/impl/ main/java/org/apache/commons...
Date Mon, 03 Dec 2012 13:37:52 GMT
Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
Mon Dec  3 13:37:12 2012
@@ -67,7 +67,7 @@ public class ProviderWriteTests
      */
     protected FileObject createScratchFolder() throws Exception
     {
-        FileObject scratchFolder = getWriteFolder();
+        final FileObject scratchFolder = getWriteFolder();
 
         // Make sure the test folder is empty
         scratchFolder.delete(Selectors.EXCLUDE_SELF);
@@ -81,7 +81,7 @@ public class ProviderWriteTests
      */
     public void testFolderCreate() throws Exception
     {
-        FileObject scratchFolder = createScratchFolder();
+        final FileObject scratchFolder = createScratchFolder();
 
         // Create direct child of the test folder
         FileObject folder = scratchFolder.resolveFile("dir1");
@@ -115,7 +115,7 @@ public class ProviderWriteTests
      */
     public void testFileCreate() throws Exception
     {
-        FileObject scratchFolder = createScratchFolder();
+        final FileObject scratchFolder = createScratchFolder();
 
         // Create direct child of the test folder
         FileObject file = scratchFolder.resolveFile("file1.txt");
@@ -169,15 +169,15 @@ public class ProviderWriteTests
      */
     public void testFileCreateMismatched() throws Exception
     {
-        FileObject scratchFolder = createScratchFolder();
+        final FileObject scratchFolder = createScratchFolder();
 
         // Create a test file and folder
-        FileObject file = scratchFolder.resolveFile("dir1/file1.txt");
+        final FileObject file = scratchFolder.resolveFile("dir1/file1.txt");
         file.createFile();
         assertEquals(FileType.FILE, file.getType());
         assertTrue(file.isFile());
 
-        FileObject folder = scratchFolder.resolveFile("dir1/dir2");
+        final FileObject folder = scratchFolder.resolveFile("dir1/dir2");
         folder.createFolder();
         assertEquals(FileType.FOLDER, folder.getType());
         assertTrue(folder.isFolder());
@@ -188,7 +188,7 @@ public class ProviderWriteTests
             folder.createFile();
             fail();
         }
-        catch (FileSystemException exc)
+        catch (final FileSystemException exc)
         {
         }
 
@@ -198,18 +198,18 @@ public class ProviderWriteTests
             file.createFolder();
             fail();
         }
-        catch (FileSystemException exc)
+        catch (final FileSystemException exc)
         {
         }
 
         // Attempt to create a folder as a child of a file
-        FileObject folder2 = file.resolveFile("some-child");
+        final FileObject folder2 = file.resolveFile("some-child");
         try
         {
             folder2.createFolder();
             fail();
         }
-        catch (FileSystemException exc)
+        catch (final FileSystemException exc)
         {
         }
     }
@@ -220,7 +220,7 @@ public class ProviderWriteTests
     public void testDelete() throws Exception
     {
         // Set-up the test structure
-        FileObject folder = createScratchFolder();
+        final FileObject folder = createScratchFolder();
         folder.resolveFile("file1.txt").createFile();
         folder.resolveFile("file%25.txt").createFile();
         folder.resolveFile("emptydir").createFolder();
@@ -247,7 +247,7 @@ public class ProviderWriteTests
 
         // Recursive delete
         file = folder.resolveFile("dir1");
-        FileObject file2 = file.resolveFile("dir2/file2.txt");
+        final FileObject file2 = file.resolveFile("dir2/file2.txt");
         assertTrue(file.exists());
         assertTrue(file2.exists());
         file.deleteAll();
@@ -267,7 +267,7 @@ public class ProviderWriteTests
     public void testDeleteAllDescendents() throws Exception
     {
         // Set-up the test structure
-        FileObject folder = createScratchFolder();
+        final FileObject folder = createScratchFolder();
         folder.resolveFile("file1.txt").createFile();
         folder.resolveFile("file%25.txt").createFile();
         folder.resolveFile("emptydir").createFolder();
@@ -294,7 +294,7 @@ public class ProviderWriteTests
 
         // Recursive delete
         file = folder.resolveFile("dir1");
-        FileObject file2 = file.resolveFile("dir2/file2.txt");
+        final FileObject file2 = file.resolveFile("dir2/file2.txt");
         assertTrue(file.exists());
         assertTrue(file2.exists());
         file.deleteAll();
@@ -405,7 +405,7 @@ public class ProviderWriteTests
         assertSameContent(content, file);
 
         // Make sure we can copy the new file to another file on the same filesystem
-        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
+        final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
         assertTrue(!fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
@@ -438,7 +438,7 @@ public class ProviderWriteTests
         assertSameContent(content, file);
 
         // Make sure we can copy the new file to another file on the same filesystem
-        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
+        final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
         assertTrue(!fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
@@ -477,7 +477,7 @@ public class ProviderWriteTests
         assertSameContent(content, file);
 
         // Make sure we can copy the new file to another file on the same filesystem
-        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
+        final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
         assertTrue(!fileCopy.exists());
         fileCopy.copyFrom(file, Selectors.SELECT_SELF);
 
@@ -499,7 +499,7 @@ public class ProviderWriteTests
      */
     public void testFolderIsHidden() throws Exception
     {
-        FileObject folder = getReadFolderDir1();
+        final FileObject folder = getReadFolderDir1();
         Assert.assertFalse(folder.isHidden());
     }
 
@@ -508,7 +508,7 @@ public class ProviderWriteTests
      */
     public void testFolderIsReadable() throws Exception
     {
-        FileObject folder = getReadFolderDir1();
+        final FileObject folder = getReadFolderDir1();
         Assert.assertTrue(folder.isReadable());
     }
 
@@ -517,7 +517,7 @@ public class ProviderWriteTests
      */
     public void testFolderIsWritable() throws Exception
     {
-        FileObject folder = getWriteFolder().resolveFile("dir1");
+        final FileObject folder = getWriteFolder().resolveFile("dir1");
         Assert.assertTrue(folder.isWriteable());
     }
 
@@ -526,8 +526,8 @@ public class ProviderWriteTests
      */
     public void testListChildren() throws Exception
     {
-        FileObject folder = createScratchFolder();
-        HashSet<String> names = new HashSet<String>();
+        final FileObject folder = createScratchFolder();
+        final HashSet<String> names = new HashSet<String>();
 
         // Make sure the folder is empty
         assertEquals(0, folder.getChildren().length);
@@ -548,7 +548,7 @@ public class ProviderWriteTests
         assertSameFileSet(names, folder.getChildren());
 
         // Create a child file via an output stream
-        OutputStream outstr = folder.resolveFile("file2.txt").getContent().getOutputStream();
+        final OutputStream outstr = folder.resolveFile("file2.txt").getContent().getOutputStream();
         outstr.close();
         names.add("file2.txt");
         assertSameFileSet(names, folder.getChildren());
@@ -576,11 +576,11 @@ public class ProviderWriteTests
     {
         final FileObject baseFile = createScratchFolder();
 
-        FileObject child = baseFile.resolveFile("newfile.txt");
+        final FileObject child = baseFile.resolveFile("newfile.txt");
         assertTrue(!child.exists());
 
-        FileSystem fs = baseFile.getFileSystem();
-        TestListener listener = new TestListener(child);
+        final FileSystem fs = baseFile.getFileSystem();
+        final TestListener listener = new TestListener(child);
         fs.addListener(child, listener);
 
         // Create as a folder
@@ -632,13 +632,13 @@ public class ProviderWriteTests
     /**
      * Ensures the names of a set of files match an expected set.
      */
-    private void assertSameFileSet(Set<String> names, FileObject[] files)
+    private void assertSameFileSet(final Set<String> names, final FileObject[] files)
     {
         // Make sure the sets are the same length
         assertEquals(names.size(), files.length);
 
         // Check for unexpected names
-        for (FileObject file : files)
+        for (final FileObject file : files)
         {
             assertTrue(names.contains(file.getName().getBaseName()));
         }
@@ -673,7 +673,7 @@ public class ProviderWriteTests
             {
                 assertTrue(file.exists());
             }
-            catch (FileSystemException e)
+            catch (final FileSystemException e)
             {
                 fail();
             }
@@ -692,14 +692,14 @@ public class ProviderWriteTests
             {
                 assertTrue(!file.exists());
             }
-            catch (FileSystemException e)
+            catch (final FileSystemException e)
             {
                 fail();
             }
         }
 
         @Override
-        public void fileChanged(FileChangeEvent event) throws Exception
+        public void fileChanged(final FileChangeEvent event) throws Exception
         {
             assertTrue("Unexpected changed event", events.size() > 0);
             assertSame("Expecting a changed event", CHANGED, events.remove(0));
@@ -708,7 +708,7 @@ public class ProviderWriteTests
             {
                 assertTrue(!file.exists());
             }
-            catch (FileSystemException e)
+            catch (final FileSystemException e)
             {
                 fail();
             }
@@ -756,7 +756,7 @@ public class ProviderWriteTests
         assertSameContent(expectedString, fileSource);
 
         // Make sure we can copy the new file to another file on the same filesystem
-        FileObject fileTarget = scratchFolder.resolveFile("file1copy.txt");
+        final FileObject fileTarget = scratchFolder.resolveFile("file1copy.txt");
         assertTrue(!fileTarget.exists());
 
         final FileContent contentSource = fileSource.getContent();
@@ -810,7 +810,7 @@ public class ProviderWriteTests
         assertSameContent(content, file);
 
         // Make sure we can copy the new file to another file on the same file system
-        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
+        final FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
         assertTrue(!fileCopy.exists());
         file.getContent().write(fileCopy);
 

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/UrlTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/UrlTests.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/UrlTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/UrlTests.java
Mon Dec  3 13:37:12 2012
@@ -59,7 +59,7 @@ public class UrlTests
         {
             parentURL = new URL(url, "..");
         }
-        catch (MalformedURLException e)
+        catch (final MalformedURLException e)
         {
             throw e;
         }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/VerifyingFileSelector.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/VerifyingFileSelector.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/VerifyingFileSelector.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/VerifyingFileSelector.java
Mon Dec  3 13:37:12 2012
@@ -43,7 +43,7 @@ public class VerifyingFileSelector
     private FileInfo currentFolderInfo;
     private FileObject currentFolder;
     private Set<String> children;
-    private List<Set<String>> stack = new ArrayList<Set<String>>();
+    private final List<Set<String>> stack = new ArrayList<Set<String>>();
 
     public VerifyingFileSelector(final FileInfo fileInfo)
     {

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/DelegatingFileSystemOptionsBuilderTest.java
Mon Dec  3 13:37:12 2012
@@ -69,8 +69,8 @@ public class DelegatingFileSystemOptions
             "/file2",
         };
 
-        FileSystemOptions opts = new FileSystemOptions();
-        DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);
+        final FileSystemOptions opts = new FileSystemOptions();
+        final DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);
 
         delgate.setConfigString(opts, "http", "proxyHost", "proxy");
         delgate.setConfigString(opts, "http", "proxyPort", "8080");
@@ -81,7 +81,7 @@ public class DelegatingFileSystemOptions
         assertEquals("http.proxyPort", HttpFileSystemConfigBuilder.getInstance().getProxyPort(opts),
8080);
         assertEquals("sftp.userInfo", SftpFileSystemConfigBuilder.getInstance().getUserInfo(opts).getClass(),
TrustEveryoneUserInfo.class);
 
-        File identities[] = SftpFileSystemConfigBuilder.getInstance().getIdentities(opts);
+        final File identities[] = SftpFileSystemConfigBuilder.getInstance().getIdentities(opts);
         assertNotNull("sftp.identities", identities);
         assertEquals("sftp.identities size", identities.length, identityPaths.length);
         for (int iterIdentities = 0; iterIdentities < identities.length; iterIdentities++)
@@ -95,15 +95,15 @@ public class DelegatingFileSystemOptions
     @Test
     public void testDelegatingBad() throws Throwable
     {
-        FileSystemOptions opts = new FileSystemOptions();
-        DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);
+        final FileSystemOptions opts = new FileSystemOptions();
+        final DelegatingFileSystemOptionsBuilder delgate = new DelegatingFileSystemOptionsBuilder(fsm);
 
         try
         {
             delgate.setConfigString(opts, "http", "proxyPort", "wrong_port");
             fail();
         }
-        catch (FileSystemException e)
+        catch (final FileSystemException e)
         {
             assertEquals(e.getCause().getClass(), InvocationTargetException.class);
             assertEquals(((InvocationTargetException) e.getCause()).getTargetException().getClass(),
NumberFormatException.class);
@@ -114,7 +114,7 @@ public class DelegatingFileSystemOptions
             delgate.setConfigClass(opts, "sftp", "userinfo", String.class);
             fail();
         }
-        catch (FileSystemException e)
+        catch (final FileSystemException e)
         {
             assertEquals(e.getCode(), "vfs.provider/config-value-invalid.error");
         }
@@ -128,7 +128,7 @@ public class DelegatingFileSystemOptions
     @Test
     public void testConfiguration() throws Exception
     {
-        for (String scheme : schemes)
+        for (final String scheme : schemes)
         {
             assertTrue("Missing " + scheme + " provider", fsm.hasProvider(scheme));
         }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/EncryptDecryptTest.java
Mon Dec  3 13:37:12 2012
@@ -28,14 +28,14 @@ public class EncryptDecryptTest
     @Test
     public void testEncryptDecrypt() throws Exception
     {
-        String source = "Qryp2!t&tpR59";
-        String expected = "914589F049CE3E8E3BB1A41BEAE12A9C";
+        final String source = "Qryp2!t&tpR59";
+        final String expected = "914589F049CE3E8E3BB1A41BEAE12A9C";
 
-        Cryptor cryptor = CryptorFactory.getCryptor();
-        String encrypted = cryptor.encrypt(source);
+        final Cryptor cryptor = CryptorFactory.getCryptor();
+        final String encrypted = cryptor.encrypt(source);
         assertEquals(expected, encrypted);
 
-        String decrypted = cryptor.decrypt(encrypted);
+        final String decrypted = cryptor.decrypt(encrypted);
         assertEquals(source, decrypted);
 
     }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java?rev=1416507&r1=1416506&r2=1416507&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/util/FreeSocketPortUtil.java
Mon Dec  3 13:37:12 2012
@@ -23,7 +23,7 @@ import java.net.ServerSocket;
 public class FreeSocketPortUtil
 {
 
-    public static void main(String[] args) throws IOException
+    public static void main(final String[] args) throws IOException
     {
         System.out.println(FreeSocketPortUtil.findFreeLocalPort());
     }
@@ -36,7 +36,7 @@ public class FreeSocketPortUtil
      */
     public static int findFreeLocalPort() throws IOException
     {
-        ServerSocket server = new ServerSocket(0);
+        final ServerSocket server = new ServerSocket(0);
         try
         {
             return server.getLocalPort();



Mime
View raw message