commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1032416 - in /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons: ./ vfs/impl/test/ vfs/provider/tar/test/ vfs/provider/webdav/test/ vfs/test/
Date Sun, 07 Nov 2010 23:12:04 GMT
Author: sebb
Date: Sun Nov  7 23:12:04 2010
New Revision: 1032416

URL: http://svn.apache.org/viewvc?rev=1032416&view=rev
Log:
Fix up generics

Modified:
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/impl/test/VfsClassLoaderTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractTestSuite.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/FileInfo.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderWriteTests.java
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/VerifyingFileSelector.java

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/AbstractVfsTestCase.java
Sun Nov  7 23:12:04 2010
@@ -50,7 +50,7 @@ public abstract class AbstractVfsTestCas
      * @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)

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/impl/test/VfsClassLoaderTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/impl/test/VfsClassLoaderTests.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/impl/test/VfsClassLoaderTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/impl/test/VfsClassLoaderTests.java
Sun Nov  7 23:12:04 2010
@@ -65,7 +65,7 @@ public class VfsClassLoaderTests
     {
         final VFSClassLoader loader = createClassLoader();
 
-        final Class testClass = loader.loadClass("code.ClassToLoad");
+        final Class<?> testClass = loader.loadClass("code.ClassToLoad");
         final Package pack = testClass.getPackage();
         assertEquals("code", pack.getName());
         verifyPackage(pack, false);
@@ -94,7 +94,7 @@ public class VfsClassLoaderTests
     public void testSealing() throws Exception
     {
         final VFSClassLoader loader = createClassLoader();
-        final Class testClass = loader.loadClass("code.sealed.AnotherClass");
+        final Class<?> testClass = loader.loadClass("code.sealed.AnotherClass");
         final Package pack = testClass.getPackage();
         assertEquals("code.sealed", pack.getName());
         verifyPackage(pack, true);

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/tar/test/LargeTarTestCase.java
Sun Nov  7 23:12:04 2010
@@ -70,11 +70,11 @@ public void setUp() throws Exception {
     FileObject file = manager.resolveFile("tgz:file://" + realFile.getCanonicalPath() + "!/");
 
     assertNotNull(file);
-    List files = Arrays.asList(file.getChildren());
+    List<FileObject> files = Arrays.asList(file.getChildren());
 
     assertNotNull(files);
     assertEquals(1, files.size());
-    FileObject f = (FileObject) files.get(0);
+    FileObject f = files.get(0);
 
     assertTrue("Expected file not found: " + largeFileName + ".txt",
         f.getName().getBaseName().equals(largeFileName + ".txt"));
@@ -105,7 +105,7 @@ public void setUp() throws Exception {
     FileObject file = manager.resolveFile(tarFile);
 
     assertNotNull(file);
-    List files = Arrays.asList(file.getChildren());
+    List<FileObject> files = Arrays.asList(file.getChildren());
 
     assertNotNull(files);
     for(int i=0; i < expectedFiles.length; ++i) {
@@ -120,10 +120,10 @@ public void setUp() throws Exception {
    * @param files
    * @return
    */
-  protected boolean fileExists(String expectedFile, List files) {
-    Iterator iter = files.iterator();
+  protected boolean fileExists(String expectedFile, List<FileObject> files) {
+    Iterator<FileObject> iter = files.iterator();
     while (iter.hasNext()) {
-      FileObject file = (FileObject) iter.next();
+      FileObject file = iter.next();
       if(file.getName().getBaseName().equals(expectedFile)) {
         return true;
       }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/provider/webdav/test/WebdavVersioningTests.java
Sun Nov  7 23:12:04 2010
@@ -56,7 +56,7 @@ public class WebdavVersioningTests exten
         assertFalse(file.isHidden());
         assertTrue(file.isReadable());
         assertTrue(file.isWriteable());
-        Map map = file.getContent().getAttributes();
+        Map<?, ?> map = file.getContent().getAttributes();
         String name = ((URLFileName)file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         if (name != null)
@@ -111,7 +111,7 @@ public class WebdavVersioningTests exten
         assertFalse(file.isHidden());
         assertTrue(file.isReadable());
         assertTrue(file.isWriteable());
-        Map map = file.getContent().getAttributes();
+        Map<?, ?> map = file.getContent().getAttributes();
         String name = ((URLFileName)file.getName()).getUserName();
         assertTrue(map.containsKey(DeltaVConstants.CREATOR_DISPLAYNAME.toString()));
         assertEquals(map.get(DeltaVConstants.CREATOR_DISPLAYNAME.toString()),"testUser");

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractProviderTestCase.java
Sun Nov  7 23:12:04 2010
@@ -378,7 +378,7 @@ public abstract class AbstractProviderTe
         this.addEmptyDir = addEmptyDir;
     }
 
-    protected static Test notConfigured(Class testClass)
+    protected static Test notConfigured(Class<?> testClass)
     {
         return warning(testClass + " is not configured for tests, skipping");
     }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractTestSuite.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractTestSuite.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractTestSuite.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/AbstractTestSuite.java
Sun Nov  7 23:12:04 2010
@@ -109,7 +109,7 @@ public abstract class AbstractTestSuite
      * no-args constructor.  This method creates an instance of the supplied
      * class for each public 'testNnnn' method provided by the class.
      */
-    public void addTests(final Class testClass) throws Exception
+    public void addTests(final Class<?> testClass) throws Exception
     {
         // Verify the class
         if (!AbstractProviderTestCase.class.isAssignableFrom(testClass))
@@ -175,10 +175,11 @@ public abstract class AbstractTestSuite
         assertFalse(readFolder.getName().getPath().equals(FileName.ROOT_PATH));
 
         // Configure the tests
-        final Enumeration tests = testSuite.tests();
+        @SuppressWarnings("unchecked")
+        final Enumeration<Test> tests = testSuite.tests();
         while (tests.hasMoreElements())
         {
-            final Test test = (Test) tests.nextElement();
+            final Test test = tests.nextElement();
             if (test instanceof AbstractProviderTestCase)
             {
                 final AbstractProviderTestCase providerTestCase = (AbstractProviderTestCase)
test;
@@ -323,11 +324,11 @@ public abstract class AbstractTestSuite
 
     private Thread[] diffThreadSnapshot(Thread[] startThreadSnapshot, Thread[] endThreadSnapshot)
     {
-        List diff = new ArrayList(10);
+        List<Thread> diff = new ArrayList<Thread>(10);
 
         nextEnd: for (int iterEnd = 0; iterEnd < endThreadSnapshot.length; iterEnd++)
         {
-            nextStart: for (int iterStart = 0; iterStart < startThreadSnapshot.length;
iterStart++)
+            for (int iterStart = 0; iterStart < startThreadSnapshot.length; iterStart++)
             {
                 if (startThreadSnapshot[iterStart] == endThreadSnapshot[iterEnd])
                 {

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ContentTests.java
Sun Nov  7 23:12:04 2010
@@ -52,9 +52,9 @@ public class ContentTests
     private void assertSameContent(final FileInfo expected,
                                    final FileObject folder) throws Exception
     {
-        for (Iterator iterator = expected.children.values().iterator(); iterator.hasNext();)
+        for (Iterator<FileInfo> iterator = expected.children.values().iterator(); iterator.hasNext();)
         {
-            final FileInfo fileInfo = (FileInfo) iterator.next();
+            final FileInfo fileInfo = iterator.next();
             final FileObject child = folder.resolveFile(fileInfo.baseName, NameScope.CHILD);
 
             assertTrue(child.getName().toString(), child.exists());

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/FileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/FileInfo.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/FileInfo.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/FileInfo.java
Sun Nov  7 23:12:04 2010
@@ -29,7 +29,7 @@ class FileInfo
     String baseName;
     FileType type;
     String content;
-    Map children = new HashMap();
+    Map<String, FileInfo> children = new HashMap<String, FileInfo>();
     FileInfo parent;
 
     public FileInfo(final String name, final FileType type)

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderReadTests.java
Sun Nov  7 23:12:04 2010
@@ -69,16 +69,16 @@ public class ProviderReadTests
         throws Exception
     {
         // Setup the structure
-        final List queueExpected = new ArrayList();
+        final List<FileInfo> queueExpected = new ArrayList<FileInfo>();
         queueExpected.add(expected);
 
-        final List queueActual = new ArrayList();
+        final List<FileObject> queueActual = new ArrayList<FileObject>();
         queueActual.add(folder);
 
         while (queueActual.size() > 0)
         {
-            final FileObject file = (FileObject) queueActual.remove(0);
-            final FileInfo info = (FileInfo) queueExpected.remove(0);
+            final FileObject file = queueActual.remove(0);
+            final FileInfo info = queueExpected.remove(0);
 
             // Check the type is correct
             assertSame(info.type, file.getType());
@@ -118,7 +118,7 @@ public class ProviderReadTests
                 {
                     continue;
                 }
-                final FileInfo childInfo = (FileInfo) info.children.get(childName);
+                final FileInfo childInfo = info.children.get(childName);
 
                 // Make sure the child is expected
                 assertNotNull(childInfo);
@@ -220,12 +220,12 @@ public class ProviderReadTests
         final FileObject[] actualFiles = getReadFolder().findFiles(selector);
 
         // Compare actual and expected list of files
-        final List expectedFiles = selector.finish();
+        final List<FileObject> expectedFiles = selector.finish();
         assertEquals(expectedFiles.size(), actualFiles.length);
         final int count = expectedFiles.size();
         for (int i = 0; i < count; i++)
         {
-            final FileObject expected = (FileObject) expectedFiles.get(i);
+            final FileObject expected = expectedFiles.get(i);
             final FileObject actual = actualFiles[i];
             assertEquals(expected, actual);
         }

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderWriteTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderWriteTests.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderWriteTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/ProviderWriteTests.java
Sun Nov  7 23:12:04 2010
@@ -439,7 +439,7 @@ public class ProviderWriteTests
     public void testListChildren() throws Exception
     {
         FileObject folder = createScratchFolder();
-        HashSet names = new HashSet();
+        HashSet<String> names = new HashSet<String>();
 
         // Make sure the folder is empty
         assertEquals(0, folder.getChildren().length);
@@ -544,7 +544,7 @@ public class ProviderWriteTests
     /**
      * Ensures the names of a set of files match an expected set.
      */
-    private void assertSameFileSet(Set names, FileObject[] files)
+    private void assertSameFileSet(Set<String> names, FileObject[] files)
     {
         // Make sure the sets are the same length
         assertEquals(names.size(), files.length);
@@ -563,7 +563,7 @@ public class ProviderWriteTests
     private static class TestListener implements FileListener
     {
         private final FileObject file;
-        private final ArrayList events = new ArrayList();
+        private final ArrayList<Object> events = new ArrayList<Object>();
         private static final Object CREATE = "create";
         private static final Object DELETE = "delete";
         private static final Object CHANGED = "changed";

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/VerifyingFileSelector.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/VerifyingFileSelector.java?rev=1032416&r1=1032415&r2=1032416&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/VerifyingFileSelector.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs/test/VerifyingFileSelector.java
Sun Nov  7 23:12:04 2010
@@ -40,17 +40,17 @@ public class VerifyingFileSelector
     implements FileSelector
 {
     private final FileInfo rootFile;
-    private final List files = new ArrayList();
+    private final List<FileObject> files = new ArrayList<FileObject>();
 
     private FileInfo currentFolderInfo;
     private FileObject currentFolder;
-    private Set children;
-    private List stack = new ArrayList();
+    private Set<String> children;
+    private List<Set<String>> stack = new ArrayList<Set<String>>();
 
     public VerifyingFileSelector(final FileInfo fileInfo)
     {
         this.rootFile = fileInfo;
-        children = new HashSet();
+        children = new HashSet<String>();
         children.add(rootFile.baseName);
     }
 
@@ -67,7 +67,7 @@ public class VerifyingFileSelector
             assertEquals(0, children.size());
             currentFolder = currentFolder.getParent();
             currentFolderInfo = currentFolderInfo.getParent();
-            children = (Set) stack.remove(0);
+            children = stack.remove(0);
         }
 
         final String baseName = file.getName().getBaseName();
@@ -110,7 +110,7 @@ public class VerifyingFileSelector
 
         // Push the folder
         stack.add(0, children);
-        children = new HashSet(currentFolderInfo.children.keySet());
+        children = new HashSet<String>(currentFolderInfo.children.keySet());
         currentFolder = folder;
 
         return true;
@@ -128,7 +128,7 @@ public class VerifyingFileSelector
         }
         else
         {
-            final FileInfo child = (FileInfo) currentFolderInfo.children.get(baseName);
+            final FileInfo child = currentFolderInfo.children.get(baseName);
             assertNotNull("Could not locate child " + baseName, child);
             return child;
         }
@@ -139,7 +139,7 @@ public class VerifyingFileSelector
      *
      * @return The files in the order they where visited.
      */
-    public List finish()
+    public List<FileObject> finish()
     {
         assertEquals(0, children.size());
         return files;



Mime
View raw message