@@ -131,6 +131,7 @@ class MongoClientURISpecification extends Specification {
131131 + ' heartbeatFrequencyMS=20000&'
132132 + ' retryWrites=true&'
133133 + ' retryReads=true&'
134+ + ' enableOverloadRetargeting=true&'
134135 + ' uuidRepresentation=csharpLegacy&'
135136 + ' appName=app1&'
136137 + ' timeoutMS=10000' )
@@ -158,6 +159,7 @@ class MongoClientURISpecification extends Specification {
158159 options. getHeartbeatFrequency() == 20000
159160 options. getRetryWrites()
160161 options. getRetryReads()
162+ options. getEnableOverloadRetargeting()
161163 options. getUuidRepresentation() == UuidRepresentation . C_SHARP_LEGACY
162164 options. getApplicationName() == ' app1'
163165 }
@@ -178,6 +180,7 @@ class MongoClientURISpecification extends Specification {
178180 ! options. isSslEnabled()
179181 options. getRetryWrites()
180182 options. getRetryReads()
183+ ! options. getEnableOverloadRetargeting()
181184 options. getUuidRepresentation() == UuidRepresentation . UNSPECIFIED
182185 }
183186
@@ -188,6 +191,7 @@ class MongoClientURISpecification extends Specification {
188191 .readPreference(ReadPreference . secondary())
189192 .retryWrites(true )
190193 .retryReads(true )
194+ .enableOverloadRetargeting(true )
191195 .writeConcern(WriteConcern . JOURNALED )
192196 .minConnectionsPerHost(30 )
193197 .connectionsPerHost(500 )
@@ -220,6 +224,7 @@ class MongoClientURISpecification extends Specification {
220224 options. getWriteConcern() == WriteConcern . JOURNALED
221225 options. getRetryWrites()
222226 options. getRetryReads()
227+ options. getEnableOverloadRetargeting()
223228 options. getTimeout() == 10_000
224229 options. getServerSelectionTimeout() == 150
225230 options. getMaxWaitTime() == 200
@@ -314,24 +319,33 @@ class MongoClientURISpecification extends Specification {
314319
315320 def ' should respect MongoClientOptions builder' () {
316321 given :
317- def uri = new MongoClientURI (' mongodb://localhost/' , MongoClientOptions . builder(). connectionsPerHost(200 ))
322+ def uri = new MongoClientURI (' mongodb://localhost/' , MongoClientOptions . builder()
323+ .connectionsPerHost(200 )
324+ .enableOverloadRetargeting(true ))
318325
319326 when :
320327 def options = uri. getOptions()
321328
322329 then :
323330 options. getConnectionsPerHost() == 200
331+ options. getEnableOverloadRetargeting()
324332 }
325333
326334 def ' should override MongoClientOptions builder' () {
327335 given :
328- def uri = new MongoClientURI (' mongodb://localhost/?maxPoolSize=250' , MongoClientOptions . builder(). connectionsPerHost(200 ))
336+ def uri = new MongoClientURI (' mongodb://localhost/?'
337+ + ' maxPoolSize=250'
338+ + ' &enableOverloadRetargeting=false' ,
339+ MongoClientOptions . builder()
340+ .connectionsPerHost(200 )
341+ .enableOverloadRetargeting(true ))
329342
330343 when :
331344 def options = uri. getOptions()
332345
333346 then :
334347 options. getConnectionsPerHost() == 250
348+ ! options. getEnableOverloadRetargeting()
335349 }
336350
337351 def ' should be equal to another MongoClientURI with the same string values' () {
0 commit comments