harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r464764 [2/2] - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java: common/org/apache/harmony/auth/tests/javax/security/auth/callback/serialization/ common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/ser...
Date Tue, 17 Oct 2006 01:12:06 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl3Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl3Test.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl3Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl3Test.java
Mon Oct 16 18:12:03 2006
@@ -66,6 +66,7 @@
         super(arg0);
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         if (!initProvs) {
@@ -73,8 +74,8 @@
             initProvs = true;
         }
         if (provs != null) {
-            for (int i = 0; i < provs.length; i++) {
-                Security.removeProvider(provs[i].getName());
+            for (Provider element : provs) {
+                Security.removeProvider(element.getName());
             }
         }
     }
@@ -82,19 +83,20 @@
     protected Provider[] mProv;
 
     private void addProviders() {
-        for (int i = 0; i < mProv.length; i++) {
-            Security.insertProviderAt(mProv[i], 1);
+        for (Provider element : mProv) {
+            Security.insertProviderAt(element, 1);
         }
     }
 
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         if (mProv != null) {
-            for (int i = 0; i < mProv.length; i++) {
-                Security.removeProvider(mProv[i].getName());
+            for (Provider element : mProv) {
+                Security.removeProvider(element.getName());
             }
         }
         if (provs != null) {
@@ -308,12 +310,12 @@
             super();
         }
 
-        public String[] getMechanismNames(Map prop) {
+        public String[] getMechanismNames(Map<String, ?> prop) {
             return new String[] { "NAME-1", "NAME-2", "NAME-3", "NAME-4" };
         }
 
         public SaslClient createSaslClient(String[] mech, String id,
-                String protocol, String srvName, Map prop, CallbackHandler hnd)
+                String protocol, String srvName, Map<String, ?> prop, CallbackHandler
hnd)
                 throws SaslException {
             if (mech == null) {
                 throw new SaslException();
@@ -377,12 +379,14 @@
     }
 
     public static class mySaslClientFactoryExt extends mySaslClientFactory {
-        public String[] getMechanismNames(Map prop) {
+        @Override
+        public String[] getMechanismNames(Map<String, ?> prop) {
             return new String[] { "NAME-5", "NAME-6" };
         }
 
+        @Override
         public SaslClient createSaslClient(String[] mech, String id,
-                String protocol, String srvName, Map prop, CallbackHandler hnd)
+                String protocol, String srvName, Map<String, ?> prop, CallbackHandler
hnd)
                 throws SaslException {
             if (mech == null) {
                 throw new SaslException();
@@ -397,17 +401,17 @@
 
         public void handle(Callback[] callbacks) throws IOException,
                 UnsupportedCallbackException {
-            for (int i = 0; i < callbacks.length; i++) {
-                if (callbacks[i] instanceof NameCallback) {
-                    NameCallback nc = (NameCallback) callbacks[i];
+            for (Callback element : callbacks) {
+                if (element instanceof NameCallback) {
+                    NameCallback nc = (NameCallback) element;
                     nc.setName("Ok");
-                } else if (callbacks[i] instanceof PasswordCallback) {
-                    PasswordCallback pc = (PasswordCallback) callbacks[i];
+                } else if (element instanceof PasswordCallback) {
+                    PasswordCallback pc = (PasswordCallback) element;
                     System.err.print(pc.getPrompt());
                     System.err.flush();
                     pc.setPassword(new char[] { 'O', 'k' });
                 } else {
-                    throw new UnsupportedCallbackException(callbacks[i],
+                    throw new UnsupportedCallbackException(element,
                             "Callback should be NamCallback or PasswordCallback");
                 }
             }
@@ -420,15 +424,15 @@
 
         public void handle(Callback[] callbacks) throws IOException,
                 UnsupportedCallbackException {
-            for (int i = 0; i < callbacks.length; i++) {
-                if (callbacks[i] instanceof TextOutputCallback) {
-                    TextOutputCallback toc = (TextOutputCallback) callbacks[i];
+            for (Callback element : callbacks) {
+                if (element instanceof TextOutputCallback) {
+                    TextOutputCallback toc = (TextOutputCallback) element;
                     if (toc.getMessageType() != TextOutputCallback.INFORMATION) {
                         throw new IOException("Unsupported message type: "
                                 + toc.getMessageType());
                     }
                 } else {
-                    throw new UnsupportedCallbackException(callbacks[i],
+                    throw new UnsupportedCallbackException(element,
                             "Callback should be TextOutputCallback");
                 }
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl4Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl4Test.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl4Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/Sasl4Test.java
Mon Oct 16 18:12:03 2006
@@ -64,6 +64,7 @@
         super(arg0);
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         if (!initProvs) {
@@ -71,8 +72,8 @@
             initProvs = true;
         }
         if (provs != null) {
-            for (int i = 0; i < provs.length; i++) {
-                Security.removeProvider(provs[i].getName());
+            for (Provider element : provs) {
+                Security.removeProvider(element.getName());
             }
         }
     }
@@ -80,19 +81,20 @@
     protected Provider[] mProv;
 
     private void addProviders() {
-        for (int i = 0; i < mProv.length; i++) {
-            Security.insertProviderAt(mProv[i], 1);
+        for (Provider element : mProv) {
+            Security.insertProviderAt(element, 1);
         }
     }
 
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         if (mProv != null) {
-            for (int i = 0; i < mProv.length; i++) {
-                Security.removeProvider(mProv[i].getName());
+            for (Provider element : mProv) {
+                Security.removeProvider(element.getName());
             }
         }
         if (provs != null) {
@@ -306,12 +308,12 @@
             super();
         }
 
-        public String[] getMechanismNames(Map prop) {
+        public String[] getMechanismNames(Map<String, ?> prop) {
             return new String[] { "MECH-1", "MECH-2", "MECH-3", "MECH-4" };
         }
 
         public SaslServer createSaslServer(String mech, String protocol,
-                String srvName, Map prop, CallbackHandler hnd) throws SaslException {
+                String srvName, Map<String, ?> prop, CallbackHandler hnd) throws SaslException
{
             if (mech == null) {
                 throw new SaslException();
             }
@@ -374,12 +376,14 @@
     }
 
     public static class mySaslServerFactoryExt extends mySaslServerFactory {
-        public String[] getMechanismNames(Map prop) {
+        @Override
+        public String[] getMechanismNames(Map<String, ?> prop) {
             return new String[] { "MECH-5", "MECH-6" };
         }
 
+        @Override
         public SaslServer createSaslServer(String mech, String protocol,
-                String srvName, Map prop, CallbackHandler hnd) throws SaslException {
+                String srvName, Map<String, ?> prop, CallbackHandler hnd) throws SaslException
{
             if (mech == null) {
                 throw new SaslException();
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthenticationExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthenticationExceptionTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthenticationExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthenticationExceptionTest.java
Mon Oct 16 18:12:03 2006
@@ -37,6 +37,7 @@
             "New message",
             "Long message for Exception. Long message for Exception. Long message for Exception."
};
 
+    @Override
     protected Object[] getData() {
         String msg = null;
         Exception cause = new Exception(msgs[1]);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthorizeCallbackTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthorizeCallbackTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthorizeCallbackTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/AuthorizeCallbackTest.java
Mon Oct 16 18:12:03 2006
@@ -40,6 +40,7 @@
             "New String",
             "Long stringID. Long stringID. Long stringID. Long stringID. Long stringID. Long
stringID. Long stringID. Long stringID. Long stringID. Long stringID. Long stringID. Long
stringID. Long stringID. Long stringID. Long stringID. Long stringID. Long stringID." };
 
+    @Override
     protected Object[] getData() {
         String msg = null;
         return new Object[] { new AuthorizeCallback(msg, msg),

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmCallbackTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmCallbackTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmCallbackTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmCallbackTest.java
Mon Oct 16 18:12:03 2006
@@ -42,14 +42,15 @@
 
     public static String addText = "This text was set to RealmCallback";
     
+    @Override
     protected Object[] getData() {
         Object [] oo = {
                 new RealmCallback(msgs[0], msgs[1]),
                 new RealmCallback(msgs[1], msgs[0]),
                 new RealmCallback(msgs[1], msgs[1])
         };
-        for (int i = 0; i < oo.length; i++) {
-            ((RealmCallback)oo[i]).setText(addText);
+        for (Object element : oo) {
+            ((RealmCallback)element).setText(addText);
         }
         return oo;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmChoiceCallbackTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmChoiceCallbackTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmChoiceCallbackTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/RealmChoiceCallbackTest.java
Mon Oct 16 18:12:03 2006
@@ -43,6 +43,7 @@
             "t"};
 
     public static final int [] idx = {2, 3};
+    @Override
     protected Object[] getData() {
         Object [] oo = {
                 new RealmChoiceCallback(msgs[0], msgs, 0, true),
@@ -51,9 +52,8 @@
                 new RealmChoiceCallback(msgs[2], msgs, 0, false)
 
         };        
-//       
-        for (int i = 0; i < oo.length; i++) {
-            RealmChoiceCallback rc = (RealmChoiceCallback)oo[i];           
+for (Object element : oo) {
+            RealmChoiceCallback rc = (RealmChoiceCallback)element;           
             if (rc.allowMultipleSelections()) {
                 rc.setSelectedIndexes(idx);
             } else {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/SaslExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/SaslExceptionTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/SaslExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/sasl/serialization/SaslExceptionTest.java
Mon Oct 16 18:12:03 2006
@@ -37,6 +37,7 @@
             "New message",
             "Long message for Exception. Long message for Exception. Long message for Exception."
};
 
+    @Override
     protected Object[] getData() {
         String msg = null;
         Exception cause = new Exception(msgs[1]);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/module/Krb5LoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/module/Krb5LoginModuleTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/module/Krb5LoginModuleTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/module/Krb5LoginModuleTest.java
Mon Oct 16 18:12:03 2006
@@ -50,11 +50,12 @@
     private KrbServer server;
 
     // module options
-    private TreeMap<String, String> options = new TreeMap<String, String>();
+    private final TreeMap<String, String> options = new TreeMap<String, String>();
 
     /**
      * Sets system env. properties and optionaly starts local mock server
      */
+    @Override
     protected void setUp() throws Exception {
 
         // save old system properties
@@ -79,6 +80,7 @@
     /**
      * Shuts down local server and restore system env. properties
      */
+    @Override
     protected void tearDown() throws Exception {
         if (server != null) {
             // shut down local server
@@ -167,6 +169,7 @@
 
         public byte[] respond;
 
+        @Override
         public void run() {
 
             try {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
Mon Oct 16 18:12:03 2006
@@ -42,6 +42,7 @@
         enableAccess = enable;
     }
 
+    @Override
     public void checkPermission(Permission p) {
         if (checkTarget.equals(p)) {
             checkAsserted = true;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
Mon Oct 16 18:12:03 2006
@@ -74,6 +74,7 @@
     }
 
     public class MyProvider extends Provider {
+        private static final long serialVersionUID = 1L;
 
         public MyProvider(String name, String info, String key, String clName) {
             super(name, 1.0, info);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/ietf/jgss/GSSManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/ietf/jgss/GSSManagerTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/ietf/jgss/GSSManagerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/ietf/jgss/GSSManagerTest.java
Mon Oct 16 18:12:03 2006
@@ -80,73 +80,88 @@
 
     public static class TestManager extends GSSManager {
 
+        @Override
         public void addProviderAtEnd(Provider p, Oid mech) throws GSSException {
         }
 
+        @Override
         public void addProviderAtFront(Provider p, Oid mech)
             throws GSSException {
         }
 
+        @Override
         public GSSContext createContext(byte[] interProcessToken)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSContext createContext(GSSCredential myCred)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSContext createContext(GSSName peer, Oid mech,
                                         GSSCredential myCred, int lifetime)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSCredential createCredential(GSSName name, int lifetime,
                                               Oid mech, int usage)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSCredential createCredential(GSSName name, int lifetime,
                                               Oid[] mechs, int usage)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSCredential createCredential(int usage) throws GSSException {
             return null;
         }
 
+        @Override
         public GSSName createName(byte[] name, Oid nameType, Oid mech)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSName createName(byte[] name, Oid nameType)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSName createName(String nameStr, Oid nameType, Oid mech)
             throws GSSException {
             return null;
         }
 
+        @Override
         public GSSName createName(String nameStr, Oid nameType)
             throws GSSException {
             return null;
         }
 
+        @Override
         public Oid[] getMechs() {
             return null;
         }
 
+        @Override
         public Oid[] getMechsForName(Oid nameType) {
             return null;
         }
 
+        @Override
         public Oid[] getNamesForMech(Oid mech) throws GSSException {
             return null;
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/windows/org/apache/harmony/auth/module/NTLoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/windows/org/apache/harmony/auth/module/NTLoginModuleTest.java?view=diff&rev=464764&r1=464763&r2=464764
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/windows/org/apache/harmony/auth/module/NTLoginModuleTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/windows/org/apache/harmony/auth/module/NTLoginModuleTest.java
Mon Oct 16 18:12:03 2006
@@ -23,14 +23,11 @@
 
 import java.util.HashMap;
 import java.util.Map;
-
 import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
-
 import junit.framework.TestCase;
-import org.apache.harmony.auth.module.NTLoginModule;
 
 
 /**
@@ -38,24 +35,14 @@
  */
 public class NTLoginModuleTest extends TestCase {
 
-    /**
-     * Standalone entry point.
-     * @param args
-     */
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(NTLoginModuleTest.class);
-    }
-
     NTLoginModule lm = new NTLoginModule();
 
-    /*
-     * @see TestCase#setUp()
-     */
+    @Override
     protected void setUp() throws Exception {
         Subject subj = new Subject();
         CallbackHandler cbh = new TestCallbackHandler();
-        Map sharedState = new HashMap();
-        Map options = new HashMap();
+        Map<String, Object> sharedState = new HashMap<String, Object>();
+        Map<String, Object> options = new HashMap<String, Object>();
         lm.initialize(subj, cbh, sharedState, options);
     }
 
@@ -72,8 +59,8 @@
         // Need new, non initialized instance of LoginModule
         lm = new NTLoginModule();
         
-        Map shared = new HashMap();
-        Map options = new HashMap();
+        Map<String, Object> shared = new HashMap<String, Object>();
+        Map<String, Object> options = new HashMap<String, Object>();
         CallbackHandler cbh = new TestCallbackHandler();
         // must not accept null for subject
         try {



Mime
View raw message