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/08/24 15:51:50 UTC
[05/50] [abbrv] storm git commit: STORM-166 adding cluster_test for
code-distributor.
STORM-166 adding cluster_test for code-distributor.
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/9cd52c88
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/9cd52c88
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/9cd52c88
Branch: refs/heads/master
Commit: 9cd52c88ec67c1dd4a01370a835a0861dcee2c25
Parents: e05d666
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Fri Dec 19 13:53:34 2014 -0800
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Fri Dec 19 13:53:34 2014 -0800
----------------------------------------------------------------------
storm-core/src/clj/backtype/storm/cluster.clj | 3 +++
storm-core/test/clj/backtype/storm/cluster_test.clj | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/9cd52c88/storm-core/src/clj/backtype/storm/cluster.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/cluster.clj b/storm-core/src/clj/backtype/storm/cluster.clj
index 6078852..2c58510 100644
--- a/storm-core/src/clj/backtype/storm/cluster.clj
+++ b/storm-core/src/clj/backtype/storm/cluster.clj
@@ -142,7 +142,9 @@
(assignment-info [this storm-id callback])
(assignment-info-with-version [this storm-id callback])
(assignment-version [this storm-id callback])
+ ;returns topologyIds under /stormroot/code-distributor
(code-distributor [this callback])
+ ;returns lits of nimbusinfos under /stormroot/code-distributor/storm-id
(code-distributor-info [this storm-id])
(active-storms [this])
(storm-base [this storm-id callback])
@@ -162,6 +164,7 @@
(update-storm! [this storm-id new-elems])
(remove-storm-base! [this storm-id])
(set-assignment! [this storm-id info])
+ ;adds nimbusinfo under /stormroot/code-distributor/storm-id
(setup-code-distributor! [this storm-id info])
(remove-storm! [this storm-id])
(report-error [this storm-id task-id node port error])
http://git-wip-us.apache.org/repos/asf/storm/blob/9cd52c88/storm-core/test/clj/backtype/storm/cluster_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/cluster_test.clj b/storm-core/test/clj/backtype/storm/cluster_test.clj
index 7ed1028..b7630b1 100644
--- a/storm-core/test/clj/backtype/storm/cluster_test.clj
+++ b/storm-core/test/clj/backtype/storm/cluster_test.clj
@@ -14,7 +14,8 @@
;; See the License for the specific language governing permissions and
;; limitations under the License.
(ns backtype.storm.cluster-test
- (:import [java.util Arrays])
+ (:import [java.util Arrays]
+ [backtype.storm.nimbus NimbusInfo])
(:import [backtype.storm.daemon.common Assignment StormBase SupervisorInfo])
(:import [org.apache.zookeeper ZooDefs ZooDefs$Ids])
(:import [org.mockito Mockito])
@@ -170,6 +171,8 @@
(let [state (mk-storm-state zk-port)
assignment1 (Assignment. "/aaa" {} {1 [2 2002 1]} {})
assignment2 (Assignment. "/aaa" {} {1 [2 2002]} {})
+ nimbusInfo1 (NimbusInfo. "nimbus1" 6667 false)
+ nimbusInfo2 (NimbusInfo. "nimbus2" 6667 false)
base1 (StormBase. "/tmp/storm1" 1 {:type :active} 2 {} "")
base2 (StormBase. "/tmp/storm2" 2 {:type :active} 2 {} "")]
(is (= [] (.assignments state nil)))
@@ -201,6 +204,15 @@
(.set-credentials! state "storm1" {"b" "b"} {})
(is (= {"b" "b"} (.credentials state "storm1" nil)))
+ (is (= [] (.code-distributor state nil)))
+ (.setup-code-distributor! state "storm1" nimbusInfo1)
+ (is (= ["storm1"] (.code-distributor state nil)))
+ (is (= [nimbusInfo1] (.code-distributor-info state "storm1")))
+ (.setup-code-distributor! state "storm1" nimbusInfo2)
+ (is (= #{nimbusInfo1 nimbusInfo2} (set (.code-distributor-info state "storm1"))))
+ (.remove-storm! state "storm1")
+ (is (= [] (.code-distributor state nil)))
+
;; TODO add tests for task info and task heartbeat setting and getting
(.disconnect state)
)))