storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [2/3] storm git commit: Fixing auto login module tests
Date Thu, 03 Mar 2016 20:25:54 GMT
Fixing auto login module tests


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b8a3af7a
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b8a3af7a
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b8a3af7a

Branch: refs/heads/0.10.x-branch
Commit: b8a3af7a6f0964500942e0c5e4a3960b82ebd289
Parents: 6d61074
Author: Kishor Patil <kpatil@yahoo-inc.com>
Authored: Fri Feb 12 19:08:13 2016 -0600
Committer: Kishor Patil <kpatil@yahoo-inc.com>
Committed: Thu Mar 3 15:26:08 2016 +0000

----------------------------------------------------------------------
 .../security/auth/auto_login_module_test.clj    | 24 ++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/b8a3af7a/storm-core/test/clj/backtype/storm/security/auth/auto_login_module_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/security/auth/auto_login_module_test.clj b/storm-core/test/clj/backtype/storm/security/auth/auto_login_module_test.clj
index 2056509..2b22c69 100644
--- a/storm-core/test/clj/backtype/storm/security/auth/auto_login_module_test.clj
+++ b/storm-core/test/clj/backtype/storm/security/auth/auto_login_module_test.clj
@@ -19,8 +19,12 @@
   (:import [backtype.storm.security.auth.kerberos AutoTGT
             AutoTGTKrb5LoginModule AutoTGTKrb5LoginModuleTest])
   (:import [javax.security.auth Subject Subject])
-  (:import [javax.security.auth.kerberos KerberosTicket])
+  (:import [javax.security.auth.kerberos KerberosTicket KerberosPrincipal])
   (:import [org.mockito Mockito])
+  (:import [java.text SimpleDateFormat])
+  (:import [java.util Date])
+  (:import [java.util Arrays])
+  (:import [java.net InetAddress])
   )
 
 (deftest login-module-no-subj-no-tgt-test
@@ -82,7 +86,23 @@
     (let [login-module (AutoTGTKrb5LoginModuleTest.)
           _ (set! (. login-module client) (Mockito/mock
                                             java.security.Principal))
-          ticket (Mockito/mock KerberosTicket)]
+          endTime (.parse (java.text.SimpleDateFormat. "ddMMyyyy") "31122030")
+          asn1Enc (byte-array 10)
+          _ (Arrays/fill asn1Enc (byte 122))
+          sessionKey (byte-array 10)
+          _ (Arrays/fill sessionKey (byte 123))
+          ticket (KerberosTicket.
+                   asn1Enc
+                   (KerberosPrincipal. "client/localhost@local.com")
+                   (KerberosPrincipal. "server/localhost@local.com")
+                   sessionKey
+                   234
+                   (boolean-array (map even? (range 3 10)))
+                   (Date.)
+                   (Date.)
+                   endTime,
+                   endTime,
+                   (into-array InetAddress [(InetAddress/getByName "localhost")]))]
       (.initialize login-module (Subject.) nil nil nil)
       (.setKerbTicket login-module ticket)
       (is (.login login-module))


Mime
View raw message