Merge pull request #111 from ebaxt/master

Monger calls removed com.mongodb.MongoClientOptions$Builder methods
This commit is contained in:
Michael Klishin 2015-07-23 00:53:58 +03:00
commit 6c1489e1ef
2 changed files with 16 additions and 6 deletions

View file

@ -137,7 +137,7 @@
[{:keys [connections-per-host threads-allowed-to-block-for-connection-multiplier [{:keys [connections-per-host threads-allowed-to-block-for-connection-multiplier
max-wait-time connect-timeout socket-timeout socket-keep-alive auto-connect-retry max-auto-connect-retry-time max-wait-time connect-timeout socket-timeout socket-keep-alive auto-connect-retry max-auto-connect-retry-time
description write-concern cursor-finalizer-enabled read-preference description write-concern cursor-finalizer-enabled read-preference
required-replica-set-name] :or [auto-connect-retry true]}] required-replica-set-name]}]
(let [mob (MongoClientOptions$Builder.)] (let [mob (MongoClientOptions$Builder.)]
(when connections-per-host (when connections-per-host
(.connectionsPerHost mob connections-per-host)) (.connectionsPerHost mob connections-per-host))
@ -151,11 +151,6 @@
(.socketTimeout mob socket-timeout)) (.socketTimeout mob socket-timeout))
(when socket-keep-alive (when socket-keep-alive
(.socketKeepAlive mob socket-keep-alive)) (.socketKeepAlive mob socket-keep-alive))
(when auto-connect-retry
(.autoConnectRetry mob auto-connect-retry))
;; deprecated
(when max-auto-connect-retry-time
(.maxAutoConnectRetryTime mob max-auto-connect-retry-time))
(when read-preference (when read-preference
(.readPreference mob read-preference)) (.readPreference mob read-preference))
(when description (when description

View file

@ -55,3 +55,18 @@
dbs (mg/get-db-names conn)] dbs (mg/get-db-names conn)]
(is (not (empty? dbs))) (is (not (empty? dbs)))
(is (dbs "monger-test")))) (is (dbs "monger-test"))))
(deftest monger-options-test
(let [opts {:connections-per-host 1
:threads-allowed-to-block-for-connection-multiplier 1
:max-wait-time 1
:connect-timeout 1
:socket-timeout 1
:socket-keep-alive true
:auto-connect-retry true
:max-auto-connect-retry-time 1
:description "Description"
:write-concern com.mongodb.WriteConcern/JOURNAL_SAFE
:cursor-finalizer-enabled true
:required-replica-set-name "rs"}]
(is (instance? com.mongodb.MongoClientOptions$Builder (mg/mongo-options-builder opts)))))