remove println; move test broker config into a Var

This commit is contained in:
Paul Ingles 2013-06-09 07:43:24 +01:00
parent 76ede151a4
commit 257c25293d
2 changed files with 7 additions and 8 deletions

View file

@ -10,10 +10,12 @@
"serializer.class" "kafka.serializer.DefaultEncoder"
"partitioner.class" "kafka.producer.DefaultPartitioner"})
(def test-broker-config {:zookeeper-port 2182
:kafka-port 9999
:topic "test"})
(deftest test-zookeeper-consumption
(with-test-broker {:zookeeper-port 2182
:kafka-port 9999
:topic "test"}
(with-test-broker test-broker-config
(let [p (producer producer-config)]
(with-resource [c (zk/consumer {"zookeeper.connect" "localhost:2182"
"group.id" "clj-kafka.test.consumer"
@ -31,9 +33,7 @@
(deftest test-simple-consumer
(with-test-broker {:zookeeper-port 2182
:kafka-port 9999
:topic "test"}
(with-test-broker test-broker-config
(let [p (producer producer-config)
c (simp/consumer "localhost" 9999 "simple-consumer")]
(send-message p "test" "Hello, world")

View file

@ -44,8 +44,7 @@
[kafka-server topic]
(let [topic-and-partition (TopicAndPartition. topic 0)]
(while (not (.. kafka-server apis leaderCache keySet (contains topic-and-partition)))
(do (println "Sleeping for metadata propagation")
(Thread/sleep 500)))))
(Thread/sleep 500))))
(defn create-topic
[zk-client topic & {:keys [partitions replicas]