Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bugfix: connect-to-first-available parameter order #15

Merged
merged 2 commits into from

2 participants

@tjg

Embarrassing! I also added a missing test which would've caught the bug when calling 1-arg version of connect-to-first-available.

tjg added some commits
@tjg tjg Bugfix: called connect-to-first-available with wrong order of
params. Put settings at end, which may play a little better with ->>
form. Added a missing test to.
7b670de
@tjg tjg Nicer test name. e4631a9
@michaelklishin michaelklishin merged commit 129b70c into michaelklishin:master
@tjg tjg deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2013
  1. @tjg

    Bugfix: called connect-to-first-available with wrong order of

    tjg authored
    params. Put settings at end, which may play a little better with ->>
    form. Added a missing test to.
  2. @tjg

    Nicer test name.

    tjg authored
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 13 deletions.
  1. +1 −1  src/clojure/langohr/core.clj
  2. +19 −12 test/langohr/test/core_test.clj
View
2  src/clojure/langohr/core.clj
@@ -78,7 +78,7 @@
([addresses]
(connect-to-first-available addresses {}))
;; settings
- ([settings addresses]
+ ([addresses settings]
(.newConnection ^ConnectionFactory (create-connection-factory settings)
#^"[Lcom.rabbitmq.client.Address;" (create-address-array addresses))))
View
31 test/langohr/test/core_test.clj
@@ -29,24 +29,31 @@
(is (= 5672 (.getPort conn)))
(is (-> conn .getServerProperties (get "capabilities") (get "publisher_confirms")))))
-(deftest t-connection-to-first-available
+(deftest t-connection-to-first-available-with-default-settings
;; see ./bin/ci/before_script.sh
- (let [conn (connect-to-first-available {
- :vhost "langohr_testbed" :username "langohr" :password "langohr.password"
- :requested-heartbeat 3 :connection-timeout 5 }
- [["127.0.0.1" 0]
- ["127.0.0.1" 5672]])]
+ (let [conn (connect-to-first-available
+ [["127.0.0.1" 0]
+ ["127.0.0.1" 5672]])]
(is (open? conn))
(is (= "127.0.0.1" (-> conn .getAddress .getHostAddress)))
- (is (= 5672 (.getPort conn)))
- (is (= 3 (.getHeartbeat conn)))))
+ (is (= 5672 (.getPort conn)))))
(deftest t-connection-to-first-available-missing-port
;; see ./bin/ci/before_script.sh
- (let [conn (connect-to-first-available {
- :vhost "langohr_testbed" :username "langohr" :password "langohr.password"
- :requested-heartbeat 3 :connection-timeout 5 }
- [["127.0.0.1"]])]
+ (let [conn (connect-to-first-available
+ [["127.0.0.1"]])]
+ (is (open? conn))
+ (is (= "127.0.0.1" (-> conn .getAddress .getHostAddress)))
+ (is (= 5672 (.getPort conn)))))
+
+(deftest t-connection-to-first-available-with-overriden-settings
+ ;; see ./bin/ci/before_script.sh
+ (let [conn (connect-to-first-available
+ [["127.0.0.1" 0]
+ ["127.0.0.1" 5672]]
+ {:vhost "langohr_testbed"
+ :username "langohr" :password "langohr.password"
+ :requested-heartbeat 3 :connection-timeout 5 })]
(is (open? conn))
(is (= "127.0.0.1" (-> conn .getAddress .getHostAddress)))
(is (= 5672 (.getPort conn)))
Something went wrong with that request. Please try again.