@@ -231,6 +231,76 @@ public void clusterDescriptionWithCompatibleServerShouldBeCompatible() throws Un
231
231
assertTrue (description .isCompatibleWithDriver ());
232
232
}
233
233
234
+ @ Test
235
+ public void testLogicalSessionTimeoutMinutes () {
236
+ ClusterDescription description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
237
+ builder ().state (CONNECTING )
238
+ .address (new ServerAddress ("loc:27017" )).build ()
239
+ ));
240
+ assertEquals (null , description .getLogicalSessionTimeoutMinutes ());
241
+
242
+ description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
243
+ builder ().state (CONNECTED )
244
+ .address (new ServerAddress ("loc:27017" ))
245
+ .build ()
246
+ ));
247
+ assertEquals (null , description .getLogicalSessionTimeoutMinutes ());
248
+
249
+ description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
250
+ builder ().state (CONNECTED )
251
+ .ok (true )
252
+ .address (new ServerAddress ("loc:27017" ))
253
+ .build ()
254
+ ));
255
+ assertEquals (null , description .getLogicalSessionTimeoutMinutes ());
256
+
257
+ description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
258
+ builder ().state (CONNECTED )
259
+ .ok (true )
260
+ .address (new ServerAddress ("loc:27017" ))
261
+ .logicalSessionTimeoutMinutes (5 )
262
+ .build (),
263
+ builder ().state (CONNECTING )
264
+ .address (new ServerAddress ("loc:27018" ))
265
+ .build ()
266
+ ));
267
+ assertEquals (new Integer (5 ), description .getLogicalSessionTimeoutMinutes ());
268
+
269
+ description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
270
+ builder ().state (CONNECTED )
271
+ .ok (true )
272
+ .address (new ServerAddress ("loc:27017" ))
273
+ .logicalSessionTimeoutMinutes (5 )
274
+ .build (),
275
+ builder ().state (CONNECTED )
276
+ .ok (true )
277
+ .address (new ServerAddress ("loc:27018" ))
278
+ .logicalSessionTimeoutMinutes (3 )
279
+ .build (),
280
+ builder ().state (CONNECTING )
281
+ .address (new ServerAddress ("loc:27017" ))
282
+ .build ()
283
+ ));
284
+ assertEquals (new Integer (3 ), description .getLogicalSessionTimeoutMinutes ());
285
+
286
+ description = new ClusterDescription (MULTIPLE , REPLICA_SET , asList (
287
+ builder ().state (CONNECTED )
288
+ .ok (true )
289
+ .address (new ServerAddress ("loc:27017" ))
290
+ .logicalSessionTimeoutMinutes (3 )
291
+ .build (),
292
+ builder ().state (CONNECTED )
293
+ .ok (true )
294
+ .address (new ServerAddress ("loc:27018" ))
295
+ .logicalSessionTimeoutMinutes (5 )
296
+ .build (),
297
+ builder ().state (CONNECTING )
298
+ .address (new ServerAddress ("loc:27017" ))
299
+ .build ()
300
+ ));
301
+ assertEquals (new Integer (3 ), description .getLogicalSessionTimeoutMinutes ());
302
+ }
303
+
234
304
@ Test
235
305
public void testObjectOverrides () throws UnknownHostException {
236
306
ClusterDescription description =
0 commit comments