Skip to content

Commit 6da8a91

Browse files
author
Derek Dagit
committed
Add test that nimbus methods use correct conf
1 parent eb63cce commit 6da8a91

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

storm-core/test/clj/backtype/storm/nimbus_test.clj

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(ns backtype.storm.nimbus-test
22
(:use [clojure test])
3+
(:require [backtype.storm [util :as util]])
34
(:require [backtype.storm.daemon [nimbus :as nimbus]])
4-
55
(:import [backtype.storm.testing TestWordCounter TestWordSpout TestGlobalCount TestAggregatesCounter])
66
(:import [backtype.storm.scheduler INimbus])
77
(:use [backtype.storm bootstrap testing])
@@ -892,26 +892,32 @@
892892
(testing "getTopologyConf calls check-authorization! with the correct parameters."
893893
(let [expected-operation "getTopologyConf"]
894894
(stubbing [nimbus/check-authorization! nil
895-
nimbus/try-read-storm-conf expected-conf]
895+
nimbus/try-read-storm-conf expected-conf
896+
util/to-json nil]
896897
(try
897898
(.getTopologyConf nimbus "fake-id")
898899
(catch NotAliveException e)
899900
(finally
900901
(verify-first-call-args-for-indices
901-
nimbus/check-authorization!
902-
[1 2 3] expected-name expected-conf expected-operation))))))
902+
nimbus/check-authorization!
903+
[1 2 3] expected-name expected-conf expected-operation)
904+
(verify-first-call-args-for util/to-json expected-conf))))))
903905

904906
(testing "getTopology calls check-authorization! with the correct parameters."
905907
(let [expected-operation "getTopology"]
906908
(stubbing [nimbus/check-authorization! nil
907-
nimbus/try-read-storm-conf expected-conf]
909+
nimbus/try-read-storm-conf expected-conf
910+
nimbus/try-read-storm-topology nil
911+
system-topology! nil]
908912
(try
909913
(.getTopology nimbus "fake-id")
910914
(catch NotAliveException e)
911915
(finally
912916
(verify-first-call-args-for-indices
913-
nimbus/check-authorization!
914-
[1 2 3] expected-name expected-conf expected-operation))))))
917+
nimbus/check-authorization!
918+
[1 2 3] expected-name expected-conf expected-operation)
919+
(verify-first-call-args-for-indices
920+
system-topology! [0] expected-conf))))))
915921

916922
(testing "getUserTopology calls check-authorization with the correct parameters."
917923
(let [expected-operation "getUserTopology"]
@@ -923,8 +929,10 @@
923929
(catch NotAliveException e)
924930
(finally
925931
(verify-first-call-args-for-indices
926-
nimbus/check-authorization!
927-
[1 2 3] expected-name expected-conf expected-operation))))))))))
932+
nimbus/check-authorization!
933+
[1 2 3] expected-name expected-conf expected-operation)
934+
(verify-first-call-args-for-indices
935+
nimbus/try-read-storm-topology [0] expected-conf))))))))))
928936

929937
(deftest test-nimbus-iface-getTopology-methods-throw-correctly
930938
(with-local-cluster [cluster]

0 commit comments

Comments
 (0)