You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/04/13 23:11:32 UTC

[3/5] storm git commit: Addressed review comments

Addressed review comments


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

Branch: refs/heads/master
Commit: f4e48e5b046b5853d2294061a31587c629458cee
Parents: e2e7c87
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Fri Apr 10 09:27:41 2015 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Fri Apr 10 09:27:41 2015 -0500

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/testing.clj                 | 7 +++++++
 .../test/clj/backtype/storm/security/auth/auth_test.clj       | 4 ++--
 .../test/clj/backtype/storm/security/auth/drpc_auth_test.clj  | 6 +++---
 .../clj/backtype/storm/security/auth/nimbus_auth_test.clj     | 4 ++--
 4 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f4e48e5b/storm-core/src/clj/backtype/storm/testing.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/testing.clj b/storm-core/src/clj/backtype/storm/testing.clj
index 57a1cd3..687dab1 100644
--- a/storm-core/src/clj/backtype/storm/testing.clj
+++ b/storm-core/src/clj/backtype/storm/testing.clj
@@ -203,6 +203,13 @@
        ~@body)
      (log-debug "Condition met " '~condition)))
 
+(defn wait-for-condition
+  ([apredicate]
+    (wait-for-condition TEST-TIMEOUT-MS apredicate))
+  ([timeout-ms apredicate]
+    (while-timeout timeout-ms (not (apredicate))
+      (Time/sleep 100))))
+
 (defn wait-until-cluster-waiting
   "Wait until the cluster is idle. Should be used with time simulation."
   ([cluster-map] (wait-until-cluster-waiting cluster-map TEST-TIMEOUT-MS))

http://git-wip-us.apache.org/repos/asf/storm/blob/f4e48e5b/storm-core/test/clj/backtype/storm/security/auth/auth_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/security/auth/auth_test.clj b/storm-core/test/clj/backtype/storm/security/auth/auth_test.clj
index d83a2c4..ddd5e03 100644
--- a/storm-core/test/clj/backtype/storm/security/auth/auth_test.clj
+++ b/storm-core/test/clj/backtype/storm/security/auth/auth_test.clj
@@ -26,7 +26,7 @@
   (:import [java.net InetAddress])
   (:import [backtype.storm Config])
   (:import [backtype.storm.generated AuthorizationException])
-  (:import [backtype.storm.utils NimbusClient Time])
+  (:import [backtype.storm.utils NimbusClient])
   (:import [backtype.storm.security.auth.authorizer SimpleWhitelistAuthorizer SimpleACLAuthorizer])
   (:import [backtype.storm.security.auth AuthUtils ThriftServer ThriftClient ShellBasedGroupsMapping 
             ReqContext SimpleTransportPlugin KerberosPrincipalToLocal ThriftConnectionType])
@@ -137,7 +137,7 @@
                 ThriftConnectionType/NIMBUS)]
     (.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (.stop server))))
     (.start (Thread. #(.serve server)))
-    (while-timeout 5000 (not (.isServing server)) (Time/sleep 100))
+    (wait-for-condition #(.isServing server))
     server ))
 
 (defmacro with-server [args & body]

http://git-wip-us.apache.org/repos/asf/storm/blob/f4e48e5b/storm-core/test/clj/backtype/storm/security/auth/drpc_auth_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/security/auth/drpc_auth_test.clj b/storm-core/test/clj/backtype/storm/security/auth/drpc_auth_test.clj
index 5b57eb1..b6ede3b 100644
--- a/storm-core/test/clj/backtype/storm/security/auth/drpc_auth_test.clj
+++ b/storm-core/test/clj/backtype/storm/security/auth/drpc_auth_test.clj
@@ -21,7 +21,7 @@
             DistributedRPCInvocations$Processor])
   (:import [backtype.storm Config])
   (:import [backtype.storm.security.auth ReqContext SingleUserPrincipal ThriftServer ThriftConnectionType])
-  (:import [backtype.storm.utils DRPCClient Time])
+  (:import [backtype.storm.utils DRPCClient])
   (:import [backtype.storm.drpc DRPCInvocationsClient])
   (:import [java.util.concurrent TimeUnit])
   (:import [javax.security.auth Subject])
@@ -48,10 +48,10 @@
     (log-message "storm conf:" conf)
     (log-message "Starting DRPC invocation server ...")
     (.start (Thread. #(.serve invoke-server)))
-    (while-timeout 5000 (not (.isServing invoke-server)) (Time/sleep 100))
+    (wait-for-condition #(.isServing invoke-server))
     (log-message "Starting DRPC handler server ...")
     (.start (Thread. #(.serve handler-server)))
-    (while-timeout 5000 (not (.isServing handler-server)) (Time/sleep 100))
+    (wait-for-condition #(.isServing handler-server))
     [handler-server invoke-server]))
 
 (defmacro with-server [args & body]

http://git-wip-us.apache.org/repos/asf/storm/blob/f4e48e5b/storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj b/storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
index b4c7d2e..01c08ea 100644
--- a/storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
+++ b/storm-core/test/clj/backtype/storm/security/auth/nimbus_auth_test.clj
@@ -20,7 +20,7 @@
   (:require [backtype.storm [zookeeper :as zk]])
   (:import [java.nio ByteBuffer])
   (:import [backtype.storm Config])
-  (:import [backtype.storm.utils NimbusClient Time])
+  (:import [backtype.storm.utils NimbusClient])
   (:import [backtype.storm.generated NotAliveException])
   (:import [backtype.storm.security.auth AuthUtils ThriftServer ThriftClient 
                                          ReqContext ThriftConnectionType])
@@ -46,7 +46,7 @@
                                      ThriftConnectionType/NIMBUS)]
     (.addShutdownHook (Runtime/getRuntime) (Thread. (fn [] (.stop nimbus-server))))
     (.start (Thread. #(.serve nimbus-server)))
-    (testing/while-timeout 5000 (not (.isServing nimbus-server)) (Time/sleep 100))
+    (testing/wait-for-condition #(.isServing nimbus-server))
     [cluster-map nimbus-server]))
 
 (defmacro with-test-cluster [args & body]