update tests and fix controller fn to extract the controller brokerid

This commit is contained in:
Paul Ingles 2013-12-15 20:55:05 +00:00
parent ea2992b83b
commit 98a039115b
2 changed files with 13 additions and 3 deletions

View file

@ -14,6 +14,10 @@
#(zk/data z (str "/brokers/ids/" %))) #(zk/data z (str "/brokers/ids/" %)))
(zk/children z "/brokers/ids"))))) (zk/children z "/brokers/ids")))))
(defn- controller-broker-id
[^String zk-data]
(get (read-str zk-data) "brokerid"))
(defn controller (defn controller
"Get leader node" "Get leader node"
[m] [m]
@ -22,7 +26,7 @@
(-> (zk/data z "/controller") (-> (zk/data z "/controller")
:data :data
String. String.
Integer/valueOf))) controller-broker-id)))
(defn topics (defn topics
"Get topics" "Get topics"

View file

@ -10,8 +10,14 @@
(def zk-connect {"zookeeper.connect" "127.0.0.1:2182"}) (def zk-connect {"zookeeper.connect" "127.0.0.1:2182"})
(given (with-test-broker config (given (with-test-broker config
(brokers zk-connect)) (brokers zk-connect))
(expect count 1 (expect count 1))
first {:host "localhost", :jmx_port -1, :port 9999, :version 1}))
(given (with-test-broker config
(first (brokers zk-connect)))
(expect :host "localhost"
:jmx_port -1
:port 9999
:version 1))
(given (with-test-broker config (given (with-test-broker config
(controller zk-connect)) (controller zk-connect))