harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r485740 - /harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
Date Mon, 11 Dec 2006 16:27:34 GMT
Author: smishura
Date: Mon Dec 11 08:27:33 2006
New Revision: 485740

URL: http://svn.apache.org/viewvc?view=rev&rev=485740
Log:
Unit test for KerberosTicket.refresh()

Modified:
    harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java?view=diff&rev=485740&r1=485739&r2=485740
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
Mon Dec 11 08:27:33 2006
@@ -23,6 +23,7 @@
 import java.util.Date;
 
 import javax.crypto.SecretKey;
+import javax.security.auth.RefreshFailedException;
 import javax.security.auth.kerberos.KerberosPrincipal;
 import javax.security.auth.kerberos.KerberosTicket;
 
@@ -420,5 +421,55 @@
             fail("No expected IllegalStateException");
         } catch (IllegalStateException e) {
         }
+    }
+
+    /**
+     * @tests javax.security.auth.kerberos.KerberosTicket#refresh()
+     */
+    public void test_refresh() throws Exception {
+
+        boolean[] myFlags = new boolean[] { true, //reserved
+                true, // forwardable
+                true, // forwarded
+                true, // proxiable
+                true, // proxy
+                true, // may-postdate 
+                true, // postdated
+                true, // invalid
+                true, // renewable: <=== we test this
+                true, // initial
+                true, // pre-authent
+                true // hw-authent 
+        };
+
+        // test: should not renew ticket because renewTill < current time 
+        Date newRenewTill = new Date((new Date()).getTime() - 3600000);
+
+        KerberosTicket krbTicket = new KerberosTicket(ticket, pClient, pServer,
+                sessionKey, KEY_TYPE, myFlags, authTime, startTime, endTime,
+                newRenewTill, // <=== we test this: it is less then current time
+                addesses);
+
+        try {
+            krbTicket.refresh();
+            fail("No expected RefreshFailedException");
+        } catch (RefreshFailedException e) {
+        }
+        
+        // test: should not renew ticket because renewable flag is false
+        newRenewTill = new Date((new Date()).getTime() + 3600000);
+        myFlags[8] = false;
+
+        krbTicket = new KerberosTicket(ticket, pClient, pServer, sessionKey,
+                KEY_TYPE, myFlags, // <=== we test this: it is not renewable
+                authTime, startTime, endTime, newRenewTill, addesses);
+        
+        try {
+            krbTicket.refresh();
+            fail("No expected RefreshFailedException");
+        } catch (RefreshFailedException e) {
+        }
+        
+        // TODO test: ticket refreshing 
     }
 }



Mime
View raw message