You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/10/17 01:05:38 UTC

svn commit: r464714 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common: javax/security/auth/ javax/security/auth/kerberos/ javax/security/auth/x500/ org/apache/harmony/auth/internal/ org/apache/harmony/auth/login/

Author: ndbeyer
Date: Mon Oct 16 16:05:37 2006
New Revision: 464714

URL: http://svn.apache.org/viewvc?view=rev&rev=464714
Log:
auth test code cleanup
* add missing annotations
* add generifications, were possible
* other various trivial items

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/AuthPermissionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/DelegationPermissionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/KerberosKeyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrincipalTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrivateCredentialTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigParserTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/AuthPermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/AuthPermissionTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/AuthPermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/AuthPermissionTest.java Mon Oct 16 16:05:37 2006
@@ -31,12 +31,9 @@
 
     private AuthPermission ap;
     private AuthPermission ap1;
-    
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(AuthPermissionTest.class);
-    }
 
    
+    @Override
     protected void setUp() throws Exception {
         ap = new AuthPermission("name");
         ap1 = new AuthPermission("createLoginContext");

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java Mon Oct 16 16:05:37 2006
@@ -32,24 +32,17 @@
 import java.security.Security;
 import java.security.cert.Certificate;
 import java.util.Enumeration;
-
 import junit.framework.TestCase;
-
 import org.apache.harmony.auth.tests.support.SecurityChecker;
 import org.apache.harmony.auth.tests.support.TestUtils;
-
 import tests.support.resource.Support_Resources;
 
-
 /**
  * Tests Policy class
  */
+@SuppressWarnings("deprecation")
 public class PolicyTest extends TestCase {
 
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(PolicyTest.class);
-    }
-
     /**
      * Tests that setPolicy() is properly secured via SecurityManager.
      */
@@ -110,12 +103,12 @@
     }
 
     public static class TestProvider extends Policy {
-
-        public PermissionCollection getPermissions(Subject subject,
-                CodeSource cs) {
+        @Override
+        public PermissionCollection getPermissions(Subject subject, CodeSource cs) {
             return null;
         }
 
+        @Override
         public void refresh() {
         }
     }
@@ -184,7 +177,7 @@
         PermissionCollection c;
         Permission per;
         Subject subject;
-        Enumeration e;
+        
         CodeSource source;
 
         String oldProp = System.getProperty(POLICY_PROP);
@@ -231,9 +224,9 @@
             // add required principal's name
             subject.getPrincipals().add(new MyPrincipal("duke"));
 
-            e = p.getPermissions(subject, null).elements();
+            Enumeration<Permission> e = p.getPermissions(subject, null).elements();
 
-            per = (Permission) e.nextElement();
+            per = e.nextElement();
             assertFalse("Elements: ", e.hasMoreElements());
             assertEquals("Permission: ", per, new FilePermission("/home/duke",
                     "read, write"));
@@ -261,7 +254,7 @@
             subject.getPrincipals().add(new MyPrincipal("dummy"));
 
             e = p.getPermissions(subject, source).elements();
-            per = (Permission) e.nextElement();
+            per = e.nextElement();
             assertFalse("Elements: ", e.hasMoreElements());
             assertEquals("Permission: ", per, new RuntimePermission(
                     "createClassLoader"));
@@ -292,7 +285,7 @@
 
             subject.getPrincipals().add(new OtherPrincipal("other"));
             e = p.getPermissions(subject, null).elements();
-            per = (Permission) e.nextElement();
+            per = e.nextElement();
             assertFalse("Elements: ", e.hasMoreElements());
             assertEquals("Permission: ", per, new AllPermission());
 
@@ -305,8 +298,8 @@
             e = p.getPermissions(subject, null).elements();
 
             Permission[] get = new Permission[2];
-            get[0] = (Permission) e.nextElement();
-            get[1] = (Permission) e.nextElement();
+            get[0] = e.nextElement();
+            get[1] = e.nextElement();
             assertFalse("Elements: ", e.hasMoreElements());
 
             Permission[] set = new Permission[2];
@@ -329,7 +322,7 @@
 
         Permission per;
         Subject subject;
-        Enumeration e;
+        Enumeration<?> e;
 
         String oldProp = System.getProperty(POLICY_PROP);
         try {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java Mon Oct 16 16:05:37 2006
@@ -36,18 +36,14 @@
  */
 public class PrivateCredentialPermissionTest extends TestCase {
 
-    private PrivateCredentialPermission p_that = null;
+    private PrivateCredentialPermission p_that;
 
-    private PrivateCredentialPermission p_this = null;
+    private PrivateCredentialPermission p_this;
 
     String s_that;
 
     String s_this;
 
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(PrivateCredentialPermissionTest.class);
-    }
-
     /**
      * Constructor for PrivateCredentialPermissionTest.
      * 
@@ -647,7 +643,7 @@
 
         MyPrincipal mp = new MyPrincipal("duke");
         MyPrincipal mp1 = new MyPrincipal("nuke");
-        HashSet hash = new HashSet();
+        HashSet<Principal> hash = new HashSet<Principal>();
         hash.add(mp);
         hash.add(mp1);
 
@@ -661,7 +657,7 @@
         assertTrue(p2.implies(p1));
 
         PrivateCredentialPermission p3 = new PrivateCredentialPermission(
-                "java.lang.Object", new HashSet());
+                "java.lang.Object", new HashSet<Principal>());
 
         PrivateCredentialPermission p4 = new PrivateCredentialPermission(
                 "java.lang.Object * \"*\"", "read");
@@ -697,9 +693,9 @@
                 "a b  \"c\"" // two spaces between principal class and name
         };
 
-        for (int i = 0; i < illegalTargetNames.length; i++) {
+        for (String element : illegalTargetNames) {
             try {
-                new PrivateCredentialPermission(illegalTargetNames[i], "read");
+                new PrivateCredentialPermission(element, "read");
                 fail("No expected IllegalArgumentException");
             } catch (IllegalArgumentException e) {
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java Mon Oct 16 16:05:37 2006
@@ -59,51 +59,48 @@
         }
     };
 
-    PrivilegedAction emptyPAction = new PrivilegedAction() {
+    PrivilegedAction<Object> emptyPAction = new PrivilegedAction<Object>() {
         public Object run() {
             return null;
         }
     };
 
-    PrivilegedExceptionAction emptyPEAction = new PrivilegedExceptionAction() {
+    PrivilegedExceptionAction<Object> emptyPEAction = new PrivilegedExceptionAction<Object>
+    () {
         public Object run() {
             return null;
         }
     };
 
-    PrivilegedAction contextPAction = new PrivilegedAction() {
-        public Object run() {
+    PrivilegedAction<AccessControlContext> contextPAction = new PrivilegedAction<AccessControlContext>() {
+        public AccessControlContext run() {
             return AccessController.getContext();
         }
     };
 
-    PrivilegedExceptionAction contextPEAction = new PrivilegedExceptionAction() {
-        public Object run() {
+    PrivilegedExceptionAction<AccessControlContext> contextPEAction = new PrivilegedExceptionAction<AccessControlContext>() {
+        public AccessControlContext run() {
             return AccessController.getContext();
         }
     };
 
-    PrivilegedAction subjectPAction = new PrivilegedAction() {
-        public Object run() {
+    PrivilegedAction<Subject> subjectPAction = new PrivilegedAction<Subject>() {
+        public Subject run() {
             return Subject.getSubject(AccessController.getContext());
         }
     };
 
-    PrivilegedExceptionAction subjectPEAction = new PrivilegedExceptionAction() {
-        public Object run() {
+    PrivilegedExceptionAction<Subject> subjectPEAction = new PrivilegedExceptionAction<Subject>() {
+        public Subject run() {
             return Subject.getSubject(AccessController.getContext());
         }
     };
 
-    private HashSet h1 = new HashSet(); // principals
+    private final HashSet<Principal> h1 = new HashSet<Principal>(); // principals
 
-    private HashSet h2 = new HashSet(); // public credentials
+    private final HashSet<Object> h2 = new HashSet<Object>(); // public credentials
 
-    private HashSet h3 = new HashSet(); // private credentials
-
-    public static void main(String[] args) throws Exception {
-        junit.textui.TestRunner.run(javax.security.auth.SubjectTest.suite());
-    }
+    private final HashSet<Object> h3 = new HashSet<Object>(); // private credentials
 
     public static Test suite() throws Exception {
 
@@ -200,6 +197,7 @@
      * Testing Subject(boolean,Set,Set,Set) constructor
      * Checks NullPointerException if one of passed set is null
      */
+    @SuppressWarnings("unchecked")
     public final void testSubject_3Set_NPE() {
 
         try {
@@ -225,6 +223,7 @@
      * Testing Subject(boolean,Set,Set,Set) constructor.
      * Parameter set contains an invalid element.
      */
+    @SuppressWarnings("unchecked")
     public final void testSubject_3Set_InvalidSet() {
         HashSet hash = new HashSet();
 
@@ -503,6 +502,7 @@
     /**
      * Tests Subject.equals() method
      */
+    @SuppressWarnings("unchecked")
     public final void testEquals() {
 
         // empty sets
@@ -572,6 +572,7 @@
      * 2)public credential set
      * 3)private credential set
      */
+    @SuppressWarnings("unchecked")
     public final void testEquals_VerifyCheckSequence() {
 
         grantMode(); // no permissions
@@ -653,6 +654,7 @@
     /**
      * Tests Subject.get<set>(Class) methods
      */
+    @SuppressWarnings("unchecked")
     public final void testGetSetClass() {
         HashSet hash = new HashSet();
 
@@ -744,12 +746,13 @@
     /**
      * Tests Subject.getSubject() for associated context (2 subjects)
      */
+    @SuppressWarnings("unchecked")
     public final void test_getSubject_NotSameSubject() {
 
         final HashSet hash = new HashSet();
         hash.add(new MyClass1());
 
-        PrivilegedAction action = new PrivilegedAction() {
+        PrivilegedAction<Object> action = new PrivilegedAction<Object>() {
             public Object run() {
 
                 return Subject.doAs(new Subject(false, hash, hash, hash),
@@ -775,7 +778,7 @@
      */
     public final void test_getSubject_PrivilegedAction() {
 
-        PrivilegedAction action = new PrivilegedAction() {
+        PrivilegedAction<Object> action = new PrivilegedAction<Object>() {
             public Object run() {
                 return AccessController.doPrivileged(subjectPAction);
             }
@@ -1429,7 +1432,7 @@
 
     public static class PermissionTest extends SecurityTest {
 
-        private Subject subject = new Subject();
+        private final Subject subject = new Subject();
 
         /*
          * FIXME??? presence of unaccessible element
@@ -1443,11 +1446,11 @@
             Principal privCr1 = new MyClass1();
             Object privCr2 = new Object();
 
-            HashSet hash = new HashSet();
+            HashSet<Object> hash = new HashSet<Object>();
             hash.add(privCr1);
             hash.add(new Object());
 
-            Set set = subject.getPrivateCredentials();
+            Set<Object> set = subject.getPrivateCredentials();
 
             // Adding is not prohibited
             set.add(privCr1);
@@ -1477,7 +1480,7 @@
             }
 
             assertTrue(set.equals(set));
-            assertFalse(set.equals(new HashSet()));
+            assertFalse(set.equals(new HashSet<Object>()));
             try {
                 // set with equal size initiates iteration
                 set.equals(hash);
@@ -1512,7 +1515,7 @@
             }
 
             try {
-                set.retainAll(new HashSet());
+                set.retainAll(new HashSet<Object>());
                 fail("No expected AccessControlException");
             } catch (AccessControlException e) {
                 // PrivateCredentialPermission check goes first
@@ -1552,26 +1555,26 @@
 
             subject.getPrincipals().add(new MyClass1());
 
-            Set set = subject.getPrivateCredentials();
+            Set<Object> set = subject.getPrivateCredentials();
 
             Object obj1 = new Object();
             Object obj2 = new Object();
             Object obj3 = new Object();
 
             set.add(obj1);
-            set.add(new HashSet());
+            set.add(new HashSet<Object>());
             set.add(obj2);
-            set.add(new HashSet());
+            set.add(new HashSet<Object>());
             set.add(obj3);
 
             grantMode(); // no permissions
 
-            HashSet hash = new HashSet();
+            HashSet<Object> hash = new HashSet<Object>();
 
             grantPermission(new PrivateCredentialPermission(
                     "java.lang.Object * \"*\"", "read"));
 
-            Iterator it = set.iterator();
+            Iterator<Object> it = set.iterator();
             while (it.hasNext()) {
                 try {
                     hash.add(it.next());
@@ -1603,7 +1606,7 @@
                 }
 
                 P p = new P();
-                HashSet hash = new HashSet();
+                HashSet<Principal> hash = new HashSet<Principal>();
                 hash.add(p);
 
                 PrivateCredentialPermission p1 = new PrivateCredentialPermission(
@@ -1620,7 +1623,7 @@
             PrivateCredentialPermission p3 = new PrivateCredentialPermission(
                     "java.lang.Object * \"*\"", "read");
             PrivateCredentialPermission p4 = new PrivateCredentialPermission(
-                    "java.lang.Object", new HashSet());
+                    "java.lang.Object", new HashSet<Principal>());
 
             assertTrue(p3.implies(p4));
         }
@@ -1630,10 +1633,10 @@
             Principal p1 = new MyClass1();
             Principal p2 = new MyClass2();
 
-            HashSet hash = new HashSet();
+            HashSet<Principal> hash = new HashSet<Principal>();
             hash.add(p2);
 
-            Set set = subject.getPrivateCredentials();
+            Set<Object> set = subject.getPrivateCredentials();
 
             set.add(new Object());
 
@@ -1642,7 +1645,7 @@
             grantPermission(new AuthPermission("modifyPrincipals"));
             grantPermission(getPermission("java.lang.Object", hash));
 
-            Iterator it = set.iterator();
+            Iterator<Object> it = set.iterator();
             it.next();
 
             subject.getPrincipals().add(p1);
@@ -1679,6 +1682,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void testGetClass() {
 
             HashSet hash = new HashSet();
@@ -1731,10 +1735,10 @@
             subject.getPrivateCredentials(MyClass2.class);
         }
 
-        public PrivateCredentialPermission getPermission(String c, Set p) {
+        public PrivateCredentialPermission getPermission(String c, Set<? extends Principal> p) {
             StringBuffer buf = new StringBuffer(c);
 
-            for (Iterator it = p.iterator(); it.hasNext();) {
+            for (Iterator<? extends Principal> it = p.iterator(); it.hasNext();) {
                 Object o = it.next();
                 buf.append(" ");
                 buf.append(o.getClass().getName());
@@ -1855,15 +1859,7 @@
         }
     }
 
-    /*
-     * 
-     *
-     * 
-     * 
-     * 
-     *  
-     */
-
+    @SuppressWarnings("serial")
     public static class MyClass1 implements Principal, Serializable {
         public String getName() {
             return "MyClass1";
@@ -1876,6 +1872,7 @@
         }
     }
 
+    @SuppressWarnings("serial")
     public static class MyObject implements Serializable {
     }
 
@@ -1919,13 +1916,14 @@
         public static class IteratorReadOnly extends
                 SecurityTest.ReadOnlyIteratorTest {
 
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public IteratorReadOnly() {
                 set = subject.getPrincipals();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
@@ -1939,6 +1937,7 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPrincipals"));
             }
@@ -1971,13 +1970,14 @@
         }
 
         public static class ReadOnlySet extends SecurityTest.ReadOnlySetTest {
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public ReadOnlySet() {
                 set = subject.getPrincipals();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
@@ -1990,6 +1990,7 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPrincipals"));
             }
@@ -2041,6 +2042,7 @@
                 element = principal;
             }
 
+            @Override
             public void testNext_EmptySet_NoSuchElementException() {
 
                 if (testing) {
@@ -2054,6 +2056,7 @@
                 }
             }
 
+            @Override
             public void testNext_NoSuchElementException() {
                 if (testing) {
                     //Unexpected: IndexOutOfBoundsException
@@ -2070,17 +2073,19 @@
         public static class IteratorReadOnly extends
                 SecurityTest.ReadOnlyIteratorTest {
 
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public IteratorReadOnly() {
                 set = subject.getPrivateCredentials();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
 
+            @Override
             public void testNext_EmptySet_NoSuchElementException() {
 
                 if (testing) {
@@ -2094,6 +2099,7 @@
                 }
             }
 
+            @Override
             public void testNext_NoSuchElementException() {
                 if (testing) {
                     //Unexpected: IndexOutOfBoundsException
@@ -2115,10 +2121,12 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPrivateCredentials"));
             }
 
+            @Override
             public void testNext_EmptySet_NoSuchElementException() {
 
                 if (testing) {
@@ -2132,6 +2140,7 @@
                 }
             }
 
+            @Override
             public void testNext_NoSuchElementException() {
                 if (testing) {
                     //Unexpected: IndexOutOfBoundsException
@@ -2162,13 +2171,14 @@
         }
 
         public static class ReadOnlySet extends SecurityTest.ReadOnlySetTest {
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public ReadOnlySet() {
                 set = subject.getPrivateCredentials();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
@@ -2181,6 +2191,7 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPrivateCredentials"));
             }
@@ -2235,13 +2246,14 @@
         public static class IteratorReadOnly extends
                 SecurityTest.ReadOnlyIteratorTest {
 
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public IteratorReadOnly() {
                 set = subject.getPublicCredentials();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
@@ -2255,6 +2267,7 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPublicCredentials"));
             }
@@ -2277,13 +2290,14 @@
         }
 
         public static class ReadOnlySet extends SecurityTest.ReadOnlySetTest {
-            private Subject subject = new Subject();
+            private final Subject subject = new Subject();
 
             public ReadOnlySet() {
                 set = subject.getPublicCredentials();
                 element = principal;
             }
 
+            @Override
             public void setReadOnly() {
                 subject.setReadOnly();
             }
@@ -2296,6 +2310,7 @@
                 element = principal;
             }
 
+            @Override
             public void setSecure() {
                 denyPermission(new AuthPermission("modifyPublicCredentials"));
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/DelegationPermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/DelegationPermissionTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/DelegationPermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/DelegationPermissionTest.java Mon Oct 16 16:05:37 2006
@@ -40,10 +40,6 @@
  */
 public class DelegationPermissionTest extends TestCase {
 
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(DelegationPermissionTest.class);
-    }
-
     /**
      * testing of a correct ctor
      */
@@ -120,6 +116,7 @@
     } 
     
     // testing of the equals method
+    @SuppressWarnings("serial")
     public void testEquals() {
         DelegationPermission dp1 = new DelegationPermission("\"AAA\" \"BBB\"");
         DelegationPermission dp2 = new DelegationPermission("\"AAA\" \"BBB\"");
@@ -189,24 +186,18 @@
     }
 
 	public void testElements() throws Exception {
-	    
         Permission p = new DelegationPermission("\"AAA\" \"BBB\"");
         PermissionCollection pc = p.newPermissionCollection();
-        
-		try {
-			pc.elements().nextElement();
-			fail("expected NoSuchElementException");
-		} catch (NoSuchElementException e) {
-		}
-
-        Enumeration en = pc.elements();
+        try {
+            pc.elements().nextElement();
+            fail("expected NoSuchElementException");
+        } catch (NoSuchElementException e) {
+        }
+        Enumeration<Permission> en = pc.elements();
         assertNotNull(en);
         assertFalse(en.hasMoreElements());
-        
         Permission sp1 = new DelegationPermission("\"DDD\" \"BBB\"");
         Permission sp2 = new DelegationPermission("\"CCC\" \"BBB\"");
-
-        
         pc.add(sp1);
         en = pc.elements();
         assertTrue(en.hasMoreElements());
@@ -214,15 +205,13 @@
         assertFalse(en.hasMoreElements());
         pc.add(sp2);
         en = pc.elements();
-        Collection c = new ArrayList();
-        while (en.hasMoreElements())
-        {
+        Collection<Permission> c = new ArrayList<Permission>();
+        while (en.hasMoreElements()) {
             c.add(en.nextElement());
         }
         assertFalse(en.hasMoreElements());
         assertEquals(2, c.size());
         assertTrue(c.contains(sp1) && c.contains(sp2));
-	  
-	}
+    }
 
  }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/KerberosKeyTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/KerberosKeyTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/KerberosKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/KerberosKeyTest.java Mon Oct 16 16:05:37 2006
@@ -143,15 +143,15 @@
         // TODO add "pianist@EXAMPLE.COM" and "Juri ... @ATHENA.MIT.EDU"
         };
 
-        for (int i = 0; i < testcases.length; i++) {
+        for (Object[] element : testcases) {
             KerberosPrincipal kp = new KerberosPrincipal(
-                    (String) testcases[i][0], 1);
+                    (String) element[0], 1);
 
-            key = new KerberosKey(kp, ((String) testcases[i][1]).toCharArray(),
+            key = new KerberosKey(kp, ((String) element[1]).toCharArray(),
                     "DES");
 
-            assertTrue("Testcase: " + (String) testcases[i][0], Arrays.equals(
-                    (byte[]) testcases[i][2], key.getEncoded()));
+            assertTrue("Testcase: " + (String) element[0], Arrays.equals(
+                    (byte[]) element[2], key.getEncoded()));
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/kerberos/ServicePermissionTest.java Mon Oct 16 16:05:37 2006
@@ -32,16 +32,11 @@
 
 import junit.framework.TestCase;
 
-
-
 /** 
  * Tests ServicePermission class implementation.
  */
 public class ServicePermissionTest extends TestCase {
-    
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(ServicePermissionTest.class);
-    }
+
     
     /**
      * @tests javax.security.auth.kerberos.ServicePermission#ServicePermission(
@@ -235,7 +230,7 @@
 		} catch (NoSuchElementException e) {
 		}
 
-        Enumeration en = pc.elements();
+        Enumeration<Permission> en = pc.elements();
         assertNotNull(en);
         assertFalse(en.hasMoreElements());
         
@@ -251,7 +246,7 @@
         pc.add(sp2);
         pc.add(sp3);
         en = pc.elements();
-        Collection c = new ArrayList();
+        Collection<Permission> c = new ArrayList<Permission>();
         while (en.hasMoreElements())
         {
             c.add(en.nextElement());
@@ -283,8 +278,8 @@
                 "Accept, initiatE" //  first & last upper case
         };
 
-        for (int i = 0; i < validActions.length; i++) {
-            new ServicePermission("*", validActions[i]);
+        for (String element : validActions) {
+            new ServicePermission("*", element);
         }
 
         String[] invalidActions = new String[] { "accept initiate", // space
@@ -295,11 +290,11 @@
                 "accept,", // ','
                 " ,accept" // ','
         };
-        for (int i = 0; i < invalidActions.length; i++) {
+        for (String element : invalidActions) {
             try {
-                new ServicePermission("*", invalidActions[i]);
+                new ServicePermission("*", element);
                 fail("No expected IllegalArgumentException for action: "
-                        + invalidActions[i]);
+                        + element);
             } catch (IllegalArgumentException e) {
             }
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrincipalTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrincipalTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrincipalTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrincipalTest.java Mon Oct 16 16:05:37 2006
@@ -23,12 +23,10 @@
 package javax.security.auth.x500;
 
 import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Locale;
-
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -2055,15 +2053,15 @@
         list.add("CN=,ST=", "CN=,ST=", "CN=, ST="); // empty value for both RDNs
         list.add("CN=;ST=B", "CN=,ST=B", "CN=, ST=B"); // empty value for 1 RDN
         list.add("CN=;ST=", "CN=,ST=", "CN=, ST="); // empty value for both RDNs
-        for (int i = 0; i < RFC2253_SPECIAL.length; i++) {
+        for (String element : RFC2253_SPECIAL) {
             // \special
-            list.add("CN=\\" + RFC2253_SPECIAL[i],
-                    "CN=\\" + RFC2253_SPECIAL[i], "CN=\"" + RFC2253_SPECIAL[i]
+            list.add("CN=\\" + element,
+                    "CN=\\" + element, "CN=\"" + element
                             + "\"");
 
             // A + \special + B
-            list.add("CN=A\\" + RFC2253_SPECIAL[i] + "B", "CN=A\\"
-                    + RFC2253_SPECIAL[i] + "B", "CN=\"A" + RFC2253_SPECIAL[i]
+            list.add("CN=A\\" + element + "B", "CN=A\\"
+                    + element + "B", "CN=\"A" + element
                     + "B\"");
         }
 
@@ -2173,24 +2171,24 @@
         //
         list.add("CN=\"\"", "CN=", "CN="); // empty quoted string
         list.add("CN=\"A\"", "CN=A", "CN=A"); // "A"
-        for (int i = 0; i < RFC2253_SPECIAL.length; i++) {
+        for (String element : RFC2253_SPECIAL) {
             // "special" => \special
-            list.add("CN=\"" + RFC2253_SPECIAL[i] + "\"", "CN=\\"
-                    + RFC2253_SPECIAL[i], "CN=\"" + RFC2253_SPECIAL[i] + "\"");
+            list.add("CN=\"" + element + "\"", "CN=\\"
+                    + element, "CN=\"" + element + "\"");
 
             // "A + special + B" => A + \special + B
-            list.add("CN=\"A" + RFC2253_SPECIAL[i] + "B\"", "CN=A\\"
-                    + RFC2253_SPECIAL[i] + "B", "CN=\"A" + RFC2253_SPECIAL[i]
+            list.add("CN=\"A" + element + "B\"", "CN=A\\"
+                    + element + "B", "CN=\"A" + element
                     + "B\"");
         }
-        for (int i = 0; i < RFC2253_SPECIAL.length; i++) {
+        for (String element : RFC2253_SPECIAL) {
             // "\special" => \special
-            list.add("CN=\"\\" + RFC2253_SPECIAL[i] + "\"", "CN=\\"
-                    + RFC2253_SPECIAL[i], "CN=\"" + RFC2253_SPECIAL[i] + "\"");
+            list.add("CN=\"\\" + element + "\"", "CN=\\"
+                    + element, "CN=\"" + element + "\"");
 
             // "A + \special + B" => A + \special + B
-            list.add("CN=\"A\\" + RFC2253_SPECIAL[i] + "B\"", "CN=A\\"
-                    + RFC2253_SPECIAL[i] + "B", "CN=\"A" + RFC2253_SPECIAL[i]
+            list.add("CN=\"A\\" + element + "B\"", "CN=A\\"
+                    + element + "B", "CN=\"A" + element
                     + "B\"");
         }
         list.add("CN=\"\\\"\"", "CN=\\\"", "CN=\"\\\"\"", null, (byte) 0x02); // "\""
@@ -2242,7 +2240,7 @@
         StringBuffer errorMsg = new StringBuffer();
         for (int i = 0; i < list.size(); i++) {
 
-            Object[] obj = (Object[]) list.get(i);
+            Object[] obj = list.get(i);
 
             String dn = (String) obj[0];
             String rfc2253 = (String) obj[1];
@@ -2298,9 +2296,9 @@
 
                             System.out.println("\nI " + i);
                             byte[] enc = p.getEncoded();
-                            for (int j = 0; j < enc.length; j++) {
+                            for (byte element : enc) {
                                 System.out.print(", 0x"
-                                        + Integer.toHexString(enc[j]));
+                                        + Integer.toHexString(element));
                             }
                         }
                     }
@@ -2388,11 +2386,11 @@
         };
 
         StringBuffer errorMsg = new StringBuffer();
-        for (int i = 0; i < illegalDN.length; i++) {
+        for (String element : illegalDN) {
 
             try {
-                new X500Principal(illegalDN[i]);
-                errorMsg.append("No IllegalArgumentException: '" + illegalDN[i]
+                new X500Principal(element);
+                errorMsg.append("No IllegalArgumentException: '" + element
                         + "'\n");
             } catch (IllegalArgumentException e) {
             }
@@ -2672,7 +2670,7 @@
         StringBuffer errorMsg = new StringBuffer();
         for (int i = 0; i < list.size(); i++) {
 
-            Object[] values = (Object[]) list.get(i);
+            Object[] values = list.get(i);
             byte[] encoded = (byte[]) values[0];
             String rfc2253 = (String) values[1];
             String rfc1179 = (String) values[2];
@@ -2727,7 +2725,8 @@
         }
     }
 
-    public static class TestList extends ArrayList {
+    @SuppressWarnings("serial")
+    public static class TestList extends ArrayList<Object[]> {
         //
         // TODO comment me
         //
@@ -2768,7 +2767,7 @@
         // TODO comment me
         //
 
-        private static byte[] emptyMask = new byte[] { 0x00 };
+        private static final byte[] emptyMask = new byte[] { 0x00 };
 
         public void add(byte[] encoding, String rfc2253, String rfc1779,
                 String canonical) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrivateCredentialTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrivateCredentialTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrivateCredentialTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/x500/X500PrivateCredentialTest.java Mon Oct 16 16:05:37 2006
@@ -40,76 +40,99 @@
 /**
  * Tests implementation of X500PrivateCredential class
  */
+@SuppressWarnings("serial")
 public class X500PrivateCredentialTest extends TestCase {
 
 	X509Certificate cert= new X509Certificate() {
-		public void checkValidity(){}
-		public void checkValidity(Date date){}
-		public int getVersion() {
+		@Override
+        public void checkValidity(){}
+		@Override
+        public void checkValidity(Date date){}
+		@Override
+        public int getVersion() {
 			return 0;
 		}
-		public BigInteger getSerialNumber() {
+		@Override
+        public BigInteger getSerialNumber() {
 			return null;
 		}
-		public Principal getIssuerDN() {
+		@Override
+        public Principal getIssuerDN() {
 			return null;
 		}
-		public Principal getSubjectDN() {
+		@Override
+        public Principal getSubjectDN() {
 			return null;
 		}
-		public Date getNotBefore() {
+		@Override
+        public Date getNotBefore() {
 			return null;
 		}
-		public Date getNotAfter() {
+		@Override
+        public Date getNotAfter() {
 			return null;
 		}
-		public byte[] getTBSCertificate() throws CertificateEncodingException {
+		@Override
+        public byte[] getTBSCertificate() throws CertificateEncodingException {
 			return null;
 		}
-		public byte[] getSignature() {
+		@Override
+        public byte[] getSignature() {
 			return null;
 		}
-		public String getSigAlgName() {
+		@Override
+        public String getSigAlgName() {
 			return null;
 		}
-		public String getSigAlgOID() {
+		@Override
+        public String getSigAlgOID() {
 			return null;
 		}
-		public byte[] getSigAlgParams() {
+		@Override
+        public byte[] getSigAlgParams() {
 			return null;
 		}
-		public boolean[] getIssuerUniqueID() {
+		@Override
+        public boolean[] getIssuerUniqueID() {
 			return null;
 		}
-		public boolean[] getSubjectUniqueID() {
+		@Override
+        public boolean[] getSubjectUniqueID() {
 			return null;
 		}
-		public boolean[] getKeyUsage() {
+		@Override
+        public boolean[] getKeyUsage() {
 			return null;
 		}
-		public int getBasicConstraints() {
+		@Override
+        public int getBasicConstraints() {
 			return 0;
 		}
-		public byte[] getEncoded() throws CertificateEncodingException {
+		@Override
+        public byte[] getEncoded() throws CertificateEncodingException {
 			return null;
 		}
-		public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException {
+		@Override
+        public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException {
 		}
-		public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException {
+		@Override
+        public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException {
 		}
-		public String toString() {
+		@Override
+        public String toString() {
 			return null;
 		}
-		public PublicKey getPublicKey() {
+		@Override
+        public PublicKey getPublicKey() {
 			return null;
 		}
-		public Set getCriticalExtensionOIDs() {
+		public Set<String> getCriticalExtensionOIDs() {
 			return null;
 		}
 		public byte[] getExtensionValue(String oid) {
 			return null;
 		}
-		public Set getNonCriticalExtensionOIDs() {
+		public Set<String> getNonCriticalExtensionOIDs() {
 			return null;
 		}
 		public boolean hasUnsupportedCriticalExtension() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java Mon Oct 16 16:05:37 2006
@@ -28,7 +28,6 @@
 import java.security.Permission;
 import java.security.Permissions;
 import java.security.ProtectionDomain;
-import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
@@ -72,12 +71,14 @@
         denyMode(); //set default mode
     }
 
+    @Override
     protected void runTest() throws Throwable {
         if (System.getSecurityManager() != null) {
             fail("There MUST be no security manager installed!");
         }
 
         SecurityManager sm = new SecurityManager() {
+            @Override
             public void checkPermission(Permission permission) {
                 //System.out.println("P: " + permission);
                 if (mode) { //deny mode
@@ -120,7 +121,7 @@
      * @param permission - permission class for comparing
      */
     public final void assertEquals(AccessControlException exception,
-            Class permission) {
+            Class<? extends Permission> permission) {
         if (!permission.isInstance(exception.getPermission())) {
             fail("No expected " + permission.getName());
         }
@@ -185,6 +186,7 @@
      * Tests iterator interface
      * 
      */
+    @SuppressWarnings("unchecked")
     public static class IteratorTest extends SecurityTest {
 
         /**
@@ -205,6 +207,7 @@
             super(name);
         }
 
+        @Override
         protected void setUp() throws Exception {
             super.setUp();
 
@@ -358,6 +361,7 @@
      * Tests iterator interface for read only set
      * 
      */
+    @SuppressWarnings("unchecked")
     public static class ReadOnlyIteratorTest extends IteratorTest {
 
         public void setReadOnly() {
@@ -368,6 +372,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testHasNext_EmptySet()
          */
+        @Override
         public void testHasNext_EmptySet() {
             setReadOnly();
             super.testHasNext_EmptySet();
@@ -376,6 +381,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testHasNext()
          */
+        @Override
         public void testHasNext() {
 
             set.add(element);
@@ -387,6 +393,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext_EmptySet_NoSuchElementException()
          */
+        @Override
         public void testNext_EmptySet_NoSuchElementException() {
             setReadOnly();
             super.testNext_EmptySet_NoSuchElementException();
@@ -395,6 +402,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext()
          */
+        @Override
         public void testNext() {
 
             set.add(element);
@@ -409,6 +417,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext_NoSuchElementException()
          */
+        @Override
         public void testNext_NoSuchElementException() {
 
             set.add(element);
@@ -429,6 +438,7 @@
          * 
          * Expected: IllegalStateException
          */
+        @Override
         public void testRemove() {
 
             set.add(element);
@@ -447,6 +457,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testRemove_EmptySet_IllegalStateException()
          */
+        @Override
         public void testRemove_EmptySet_IllegalStateException() {
             setReadOnly();
             super.testRemove_EmptySet_IllegalStateException();
@@ -458,6 +469,7 @@
          * 
          * Expected: IllegalStateException
          */
+        @Override
         public void testRemove_IllegalStateException_NoNext() {
 
             set.add(element);
@@ -475,6 +487,7 @@
          * 
          * Expected: IllegalStateException
          */
+        @Override
         public void testRemove_IllegalStateException_2Remove() {
 
             set.add(element);
@@ -495,6 +508,7 @@
      * Tests iterator interface for secure set
      * 
      */
+    @SuppressWarnings("unchecked")
     public static class SecureIteratorTest extends IteratorTest {
 
         public void setSecure() {
@@ -505,6 +519,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testHasNext_EmptySet()
          */
+        @Override
         public void testHasNext_EmptySet() {
             setSecure();
             super.testHasNext_EmptySet();
@@ -513,6 +528,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testHasNext()
          */
+        @Override
         public void testHasNext() {
             set.add(element);
             setSecure();
@@ -523,6 +539,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext_EmptySet_NoSuchElementException()
          */
+        @Override
         public void testNext_EmptySet_NoSuchElementException() {
             setSecure();
             super.testNext_EmptySet_NoSuchElementException();
@@ -531,6 +548,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext_NoSuchElementException()
          */
+        @Override
         public void testNext_NoSuchElementException() {
             set.add(element);
             setSecure();
@@ -548,6 +566,7 @@
         /**
          * @see org.apache.harmony.auth.internal.SecurityTest.IteratorTest#testNext()
          */
+        @Override
         public void testNext() {
             set.add(element);
             setSecure();
@@ -563,6 +582,7 @@
          * 
          * Expected: AccessControlException
          */
+        @Override
         public void testRemove() {
             set.add(element);
             setSecure();
@@ -584,6 +604,7 @@
          * 
          * Expected: AccessControlException instead IllegalStateException for empty set
          */
+        @Override
         public void testRemove_EmptySet_IllegalStateException() {
 
             setSecure();
@@ -600,6 +621,7 @@
          * 
          * Expected: AccessControlException instead IllegalStateException
          */
+        @Override
         public void testRemove_IllegalStateException_NoNext() {
 
             set.add(element);
@@ -618,6 +640,7 @@
          * 
          * Expected: AccessControlException
          */
+        @Override
         public void testRemove_IllegalStateException_2Remove() {
             set.add(element);
 
@@ -634,6 +657,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public static class SetTest extends SecurityTest {
 
         /**
@@ -649,8 +673,9 @@
         /**
          * Is used as collection parameter
          */
-        public HashSet hash = new HashSet();
+        public HashSet<Object> hash = new HashSet<Object>();
 
+        @Override
         protected void setUp() throws Exception {
             super.setUp();
 
@@ -911,6 +936,7 @@
         //TODO test Object[] Set.toArray(Object[] a)
     }
 
+    @SuppressWarnings("unchecked")
     public static class UnsupportedNullTest extends SecurityTest {
 
         /**
@@ -928,6 +954,7 @@
          */
         public HashSet hash = new HashSet();
 
+        @Override
         protected void setUp() throws Exception {
             super.setUp();
 
@@ -1015,6 +1042,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public static class IneligibleElementTest extends SecurityTest {
 
         /**
@@ -1042,6 +1070,7 @@
          */
         public HashSet iHash = new HashSet();
 
+        @Override
         protected void setUp() throws Exception {
             super.setUp();
 
@@ -1166,6 +1195,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public static class ReadOnlySetTest extends SetTest {
 
         public void setReadOnly() {
@@ -1173,6 +1203,7 @@
                     "setReadOnly MUST be implemented in derived class");
         }
 
+        @Override
         public void testAdd_ExistingElement() {
 
             set.add(element);
@@ -1185,6 +1216,7 @@
             }
         }
 
+        @Override
         public void testAdd_NewElement() {
 
             setReadOnly();
@@ -1195,11 +1227,13 @@
             }
         }
 
+        @Override
         public void testAddAll_EmptySet() {
             setReadOnly();
             super.testAddAll_EmptySet();
         }
 
+        @Override
         public void testAddAll_ExistingElement() {
 
             set.add(element);
@@ -1211,6 +1245,7 @@
             }
         }
 
+        @Override
         public void testAddAll_NewElement() {
             setReadOnly();
             try {
@@ -1220,16 +1255,19 @@
             }
         }
 
+        @Override
         public void testAddAll_NullParameter() {
             setReadOnly();
             super.testAddAll_NullParameter();
         }
 
+        @Override
         public void testClear_EmptySet() {
             setReadOnly();
             super.testClear_EmptySet();
         }
 
+        @Override
         public void testClear_NotEmptySet() {
 
             set.add(element);
@@ -1242,60 +1280,71 @@
             }
         }
 
+        @Override
         public void testContains_ExistingElement() {
             set.add(element);
             setReadOnly();
             assertTrue("Set contains element", set.contains(element));
         }
 
+        @Override
         public void testContains_NotExistingElement() {
             setReadOnly();
             super.testContains_NotExistingElement();
         }
 
+        @Override
         public void testContainsAll_EmptySet() {
             setReadOnly();
             super.testContainsAll_EmptySet();
         }
 
+        @Override
         public void testContainsAll_ExistingElement() {
             set.add(element);
             setReadOnly();
             assertTrue("Set contains element", set.containsAll(hash));
         }
 
+        @Override
         public void testContainsAll_NotExistingElement() {
             setReadOnly();
             super.testContainsAll_NotExistingElement();
         }
 
+        @Override
         public void testContainsAll_NullParameter() {
             setReadOnly();
             super.testContainsAll_NullParameter();
         }
 
+        @Override
         public void testIsEmpty_EmptySet() {
             setReadOnly();
             super.testIsEmpty_EmptySet();
         }
 
+        @Override
         public void testIsEmpty_NotEmptySet() {
             set.add(element);
             setReadOnly();
             assertFalse("Set is not empty", set.isEmpty());
         }
 
+        @Override
         public void testIterator_EmptySet() {
             setReadOnly();
             super.testIterator_EmptySet();
         }
 
+        @Override
         public void testIterator_NotEmptySet() {
             set.add(element);
             setReadOnly();
             assertNotNull("Iterator", set.iterator());
         }
 
+        @Override
         public void testRemove_ExistingElement() {
 
             set.add(element);
@@ -1308,16 +1357,19 @@
             }
         }
 
+        @Override
         public void testRemove_NotExistingElement() {
             setReadOnly();
             super.testRemove_NotExistingElement();
         }
 
+        @Override
         public void testRemoveAll_EmptySet() {
             setReadOnly();
             super.testRemoveAll_EmptySet();
         }
 
+        @Override
         public void testRemoveAll_ExistingElement() {
 
             set.add(element);
@@ -1330,6 +1382,7 @@
             }
         }
 
+        @Override
         public void testRemoveAll_NotEmptySet() {
 
             set.add(element);
@@ -1337,16 +1390,19 @@
             set.removeAll(new HashSet());
         }
 
+        @Override
         public void testRemoveAll_NotExistingElement() {
             setReadOnly();
             super.testRemoveAll_NotExistingElement();
         }
 
+        @Override
         public void testRemoveAll_NullParameter_EmptySet() {
             setReadOnly();
             super.testRemoveAll_NullParameter_EmptySet();
         }
 
+        @Override
         public void testRemoveAll_NullParameter_NotEmptySet() {
 
             set.add(element);
@@ -1359,17 +1415,20 @@
             }
         }
 
+        @Override
         public void testRetainAll_EmptySet() {
             setReadOnly();
             super.testRetainAll_EmptySet();
         }
 
+        @Override
         public void testRetainAll_ExistingElement() {
             set.add(element);
             setReadOnly();
             set.retainAll(hash);
         }
 
+        @Override
         public void testRetainAll_NotEmptySet() {
             set.add(element);
             setReadOnly();
@@ -1381,16 +1440,19 @@
             }
         }
 
+        @Override
         public void testRetainAll_NotExistingElement() {
             setReadOnly();
             super.testRetainAll_NotExistingElement();
         }
 
+        @Override
         public void testRetainAll_NullParameter_EmptySet() {
             setReadOnly();
             super.testRetainAll_NullParameter_EmptySet();
         }
 
+        @Override
         public void testRetainAll_NullParameter_NotEmptySet() {
 
             set.add(element);
@@ -1403,11 +1465,13 @@
             }
         }
 
+        @Override
         public void testToArray_EmptySet() {
             setReadOnly();
             super.testToArray_EmptySet();
         }
 
+        @Override
         public void testToArray_Immutability() {
             set.add(element);
             setReadOnly();
@@ -1416,6 +1480,7 @@
             assertTrue("Element", set.toArray()[0] == element);
         }
 
+        @Override
         public void testToArray_NotEmptySet() {
             set.add(element);
             setReadOnly();
@@ -1425,6 +1490,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public static class SecureSetTest extends SetTest {
 
         public void setSecure() {
@@ -1441,6 +1507,7 @@
         //            }
         //        }
 
+        @Override
         public void testAdd_ExistingElement() {
 
             set.add(element);
@@ -1454,6 +1521,7 @@
             }
         }
 
+        @Override
         public void testAdd_NewElement() {
 
             setSecure();
@@ -1465,11 +1533,13 @@
             }
         }
 
+        @Override
         public void testAddAll_EmptySet() {
             setSecure();
             super.testAddAll_EmptySet();
         }
 
+        @Override
         public void testAddAll_ExistingElement() {
 
             set.add(element);
@@ -1483,6 +1553,7 @@
             }
         }
 
+        @Override
         public void testAddAll_NewElement() {
 
             setSecure();
@@ -1494,16 +1565,19 @@
             }
         }
 
+        @Override
         public void testAddAll_NullParameter() {
             setSecure();
             super.testAddAll_NullParameter();
         }
 
+        @Override
         public void testClear_EmptySet() {
             setSecure();
             super.testClear_EmptySet();
         }
 
+        @Override
         public void testClear_NotEmptySet() {
 
             set.add(element);
@@ -1517,60 +1591,71 @@
             }
         }
 
+        @Override
         public void testContains_ExistingElement() {
             set.add(element);
             setSecure();
             assertTrue("Set contains element", set.contains(element));
         }
 
+        @Override
         public void testContains_NotExistingElement() {
             setSecure();
             super.testContains_NotExistingElement();
         }
 
+        @Override
         public void testContainsAll_EmptySet() {
             setSecure();
             super.testContainsAll_EmptySet();
         }
 
+        @Override
         public void testContainsAll_ExistingElement() {
             set.add(element);
             setSecure();
             assertTrue("Set contains element", set.containsAll(hash));
         }
 
+        @Override
         public void testContainsAll_NotExistingElement() {
             setSecure();
             super.testContainsAll_NotExistingElement();
         }
 
+        @Override
         public void testContainsAll_NullParameter() {
             setSecure();
             super.testContainsAll_NullParameter();
         }
 
+        @Override
         public void testIsEmpty_EmptySet() {
             setSecure();
             super.testIsEmpty_EmptySet();
         }
 
+        @Override
         public void testIsEmpty_NotEmptySet() {
             set.add(element);
             setSecure();
             assertFalse("Set is not empty", set.isEmpty());
         }
 
+        @Override
         public void testIterator_EmptySet() {
             setSecure();
             super.testIterator_EmptySet();
         }
 
+        @Override
         public void testIterator_NotEmptySet() {
             set.add(element);
             setSecure();
             assertNotNull("Iterator", set.iterator());
         }
 
+        @Override
         public void testRemove_ExistingElement() {
 
             set.add(element);
@@ -1584,16 +1669,19 @@
             }
         }
 
+        @Override
         public void testRemove_NotExistingElement() {
             setSecure();
             super.testRemove_NotExistingElement();
         }
 
+        @Override
         public void testRemoveAll_EmptySet() {
             setSecure();
             super.testRemoveAll_EmptySet();
         }
 
+        @Override
         public void testRemoveAll_ExistingElement() {
 
             set.add(element);
@@ -1607,6 +1695,7 @@
             }
         }
 
+        @Override
         public void testRemoveAll_NotEmptySet() {
             set.add(element);
             setSecure();
@@ -1615,16 +1704,19 @@
             assertEquals("Size", 1, set.size());
         }
 
+        @Override
         public void testRemoveAll_NotExistingElement() {
             setSecure();
             super.testRemoveAll_NotExistingElement();
         }
 
+        @Override
         public void testRemoveAll_NullParameter_EmptySet() {
             setSecure();
             super.testRemoveAll_NullParameter_EmptySet();
         }
 
+        @Override
         public void testRemoveAll_NullParameter_NotEmptySet() {
 
             set.add(element);
@@ -1637,11 +1729,13 @@
             }
         }
 
+        @Override
         public void testRetainAll_EmptySet() {
             setSecure();
             super.testRetainAll_EmptySet();
         }
 
+        @Override
         public void testRetainAll_ExistingElement() {
             set.add(element);
             setSecure();
@@ -1650,6 +1744,7 @@
             assertEquals("Size", 1, set.size());
         }
 
+        @Override
         public void testRetainAll_NotEmptySet() {
             set.add(element);
             setSecure();
@@ -1662,16 +1757,19 @@
             }
         }
 
+        @Override
         public void testRetainAll_NotExistingElement() {
             setSecure();
             super.testRetainAll_NotExistingElement();
         }
 
+        @Override
         public void testRetainAll_NullParameter_EmptySet() {
             setSecure();
             super.testRetainAll_NullParameter_EmptySet();
         }
 
+        @Override
         public void testRetainAll_NullParameter_NotEmptySet() {
             set.add(element);
             setSecure();
@@ -1683,11 +1781,13 @@
             }
         }
 
+        @Override
         public void testToArray_EmptySet() {
             setSecure();
             super.testToArray_EmptySet();
         }
 
+        @Override
         public void testToArray_Immutability() {
             set.add(element);
             setSecure();
@@ -1696,6 +1796,7 @@
             assertTrue("Element", set.toArray()[0] == element);
         }
 
+        @Override
         public void testToArray_NotEmptySet() {
             set.add(element);
             setSecure();
@@ -1718,10 +1819,11 @@
         public Object obj3;
 
         // Set of objects that are not equal to obj1, obj2, obj3
-        public Vector notEqual;
+        public Vector<Object> notEqual;
 
         // Checks that references to testing objects are different
         // because we are not going to test Object.equals(Object)
+        @Override
         protected void setUp() throws Exception {
             super.setUp();
 
@@ -1755,8 +1857,8 @@
         }
 
         public void testEquals_NotEqual() {
-            for (Enumeration e = notEqual.elements(); e.hasMoreElements();) {
-                assertFalse(obj1.equals(e.nextElement()));
+            for (Object name : notEqual) {
+                assertFalse(obj1.equals(name));
             }
         }
 
@@ -1766,6 +1868,7 @@
         }
     }
     
+    @SuppressWarnings("unchecked")
     public static class SubjectSetObjectTest extends ObjectTest {
 
         public Subject subject = new Subject();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigParserTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigParserTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigParserTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigParserTest.java Mon Oct 16 16:05:37 2006
@@ -29,22 +29,17 @@
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-
 import javax.security.auth.login.AppConfigurationEntry;
-
 import junit.framework.TestCase;
-import org.apache.harmony.auth.login.DefaultConfigurationParser;
 import org.apache.harmony.auth.login.DefaultConfigurationParser.InvalidFormatException;
-
 import tests.support.resource.Support_Resources;
 
 /**
  * Tests parser implementation for default configuration.
  */
-
 public class DefaultConfigParserTest extends TestCase {
 
     static String fconf = Support_Resources
@@ -54,22 +49,10 @@
 
 	URL url;
 	
-	LinkedList entriesList;
-
-	public static void main(String[] args) {
-		junit.textui.TestRunner.run(DefaultConfigParserTest.class);
-	}
-
-	/**
-	 * Constructor for DefaultConfigParserTest.
-	 * 
-	 * @param name
-	 */
-	public DefaultConfigParserTest(String name) {
-		super(name);
-	}
+	List<AppConfigurationEntry> entriesList;
 
-	public void setUp() throws Exception {
+	@Override
+    public void setUp() throws Exception {
 		p = System.getProperties();
 		File f = new File(fconf);
 		try {
@@ -83,25 +66,25 @@
 	 * @throws Exception
 	 */
 	public final void testConfigParser_01() throws Exception {
-			Map config = null;
-			config = DefaultConfigurationParser.configParser(url, p, new HashMap());
-			entriesList = (LinkedList) config.get("Login1");
+			Map<String, List<AppConfigurationEntry>> config = null;
+			config = DefaultConfigurationParser.configParser(url, p, new HashMap<String, List<AppConfigurationEntry>>());
+			entriesList = config.get("Login1");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("other");
+			entriesList = config.get("other");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login2");
+			entriesList = config.get("Login2");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login3");
+			entriesList = config.get("Login3");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login4");
+			entriesList = config.get("Login4");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login5");
+			entriesList = config.get("Login5");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login6");
+			entriesList = config.get("Login6");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login7");
+			entriesList = config.get("Login7");
 			assertNotNull(entriesList);
-			entriesList = (LinkedList) config.get("Login8");
+			entriesList = config.get("Login8");
 			assertNull(entriesList);
 	}
 
@@ -111,16 +94,16 @@
 	 */
 	public final void testConfigParser_02() throws Exception {
 
-			Map config = DefaultConfigurationParser.configParser(url, p, new HashMap());
-			entriesList = (LinkedList) config.get("Login1");
+			Map<String, List<AppConfigurationEntry>> config = DefaultConfigurationParser.configParser(url, p, new HashMap<String, List<AppConfigurationEntry>>());
+			entriesList = config.get("Login1");
 
 			if (entriesList == null || entriesList.size() == 0) {
 			    fail("Unable to read configuration");
 			}
 
-			Iterator i = entriesList.iterator();
+			Iterator<AppConfigurationEntry> i = entriesList.iterator();
 			while (i.hasNext()) {
-				AppConfigurationEntry e = (AppConfigurationEntry) i.next();
+				AppConfigurationEntry e = i.next();
 				assertEquals("com.intel.security.auth.module.LoginModule1", e
 						.getLoginModuleName());
 				assertEquals("LoginModuleControlFlag: required", e
@@ -128,7 +111,7 @@
 				assertEquals(
 						AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
 						e.getControlFlag());
-				Map m = new HashMap();
+				Map<String, String> m = new HashMap<String, String>();
 				m.put("debug1", "true");
 				m.put("test1", "false");
 				assertEquals(m, e.getOptions());
@@ -166,14 +149,14 @@
 			byte[] b = str[i].getBytes();
 			OutputStream os = new FileOutputStream(file);
 
-			for (int j = 0; j < b.length; j++) {
-				os.write(b[j]);
+			for (byte element : b) {
+				os.write(element);
 			}
 
 			os.flush();
 			os.close();
 			try {
-				DefaultConfigurationParser.configParser(file.toURL(), p, new HashMap());
+				DefaultConfigurationParser.configParser(file.toURL(), p, new HashMap<String, List<AppConfigurationEntry>>());
 				fail("no expected InvalidFormatException" + i);
 			} catch (NullPointerException e) {
 				System.out.println(file.getCanonicalPath());

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java?view=diff&rev=464714&r1=464713&r2=464714
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java Mon Oct 16 16:05:37 2006
@@ -54,21 +54,23 @@
 
 	private static File defaultConfFile;
 
-	static AppConfigurationEntry[] ents = null;
+	static AppConfigurationEntry[] ents;
 
 	SecurityManager old = System.getSecurityManager();
 
-	String oldp1 = null;
-	String oldp2 = null;
+	String oldp1;
+	String oldp2;
 
-	public void setUp() throws Exception {
+	@Override
+    public void setUp() throws Exception {
 		createConfFile();
 		
 		oldp1 = Security.getProperty("login.config.url.1");
 		oldp2 = Security.getProperty("login.config.url.2");
 	}
 
-	public void tearDown() throws Exception {
+	@Override
+    public void tearDown() throws Exception {
 		System.setSecurityManager(old);
 
 		TestUtils.setSystemProperty("login.config.url.1", oldp1);
@@ -96,7 +98,7 @@
 			ents = dc.getAppConfigurationEntry("LoginNew");
 			assertNotNull(ents);
 			assertEquals("com.intel.security.auth.module.LoginModule1", ents[0].getLoginModuleName());
-			Map m = new HashMap();
+			Map<String, String> m = new HashMap<String, String>();
 			m.put("debug", "true");
 			m.put("test", "false");
 			assertEquals(m, ents[0].getOptions());
@@ -104,14 +106,14 @@
 
 			ents = dc.getAppConfigurationEntry("Login1");
 			assertNotNull(ents);
-			for (int i = 0; i < ents.length; i++) {
+			for (AppConfigurationEntry element : ents) {
 				assertEquals("com.intel.security.auth.module.LoginModule1",
-						ents[i].getLoginModuleName());
+						element.getLoginModuleName());
 				m.clear();
 				m.put("debug1", "true");
 				m.put("test1", "false");
-				assertEquals(m, ents[i].getOptions());
-				assertEquals("LoginModuleControlFlag: required", ents[i]
+				assertEquals(m, element.getOptions());
+				assertEquals("LoginModuleControlFlag: required", element
 						.getControlFlag().toString());
 			}
 			
@@ -137,15 +139,15 @@
 		assertNotNull(ents);
 		ents = dc.getAppConfigurationEntry("Login1");
 		assertNotNull(ents);
-		Map m = new HashMap();
-		for (int i = 0; i < ents.length; i++) {
+		Map<String, String> m = new HashMap<String, String>();
+		for (AppConfigurationEntry element : ents) {
 			assertEquals("com.intel.security.auth.module.LoginModule1",
-					ents[i].getLoginModuleName());
+					element.getLoginModuleName());
 			m.clear();
 			m.put("debug1", "true");
 			m.put("test1", "false");
-			assertEquals(m, ents[i].getOptions());
-			assertEquals("LoginModuleControlFlag: required", ents[i]
+			assertEquals(m, element.getOptions());
+			assertEquals("LoginModuleControlFlag: required", element
 					.getControlFlag().toString());
 		}
 		
@@ -221,8 +223,8 @@
 		byte[] b = newConfFile.getBytes();
 
 		OutputStream os = new FileOutputStream(defaultConfFile);
-		for (int j = 0; j < b.length; j++) {
-			os.write(b[j]);
+		for (byte element : b) {
+			os.write(element);
 		}
 		os.flush();
 		os.close();
@@ -247,7 +249,8 @@
 			enableAccess = enable;
 		}
 
-		public void checkPermission(Permission p) {
+		@Override
+        public void checkPermission(Permission p) {
 			if (p instanceof AuthPermission && checkTarget.equals(p)) {
 				checkAsserted = true;
 				if (!enableAccess) {