@@ -285,6 +285,68 @@ public void startTLSOptionShouldBeSetCorrectlyOnClient() {
285
285
assertThat (connectionFactory .isStartTls ()).isTrue ();
286
286
}
287
287
288
+ @ Test // DATAREDIS-990
289
+ public void sslShouldBeSetCorrectlyOnSentinelClient () {
290
+
291
+ RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration ("myMaster" ,
292
+ Collections .singleton ("localhost:1234" ));
293
+ LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory (sentinelConfiguration );
294
+ connectionFactory .setClientResources (getSharedClientResources ());
295
+ connectionFactory .setUseSsl (true );
296
+ connectionFactory .afterPropertiesSet ();
297
+ ConnectionFactoryTracker .add (connectionFactory );
298
+
299
+ AbstractRedisClient client = (AbstractRedisClient ) getField (connectionFactory , "client" );
300
+ assertThat (client ).isInstanceOf (RedisClient .class );
301
+
302
+ RedisURI redisUri = (RedisURI ) getField (client , "redisURI" );
303
+
304
+ assertThat (redisUri .isSsl ()).isTrue ();
305
+ assertThat (connectionFactory .isUseSsl ()).isTrue ();
306
+ assertThat (redisUri .isVerifyPeer ()).isTrue ();
307
+ assertThat (connectionFactory .isVerifyPeer ()).isTrue ();
308
+ }
309
+
310
+ @ Test // DATAREDIS-990
311
+ public void verifyPeerOptionShouldBeSetCorrectlyOnSentinelClient () {
312
+
313
+ RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration ("myMaster" ,
314
+ Collections .singleton ("localhost:1234" ));
315
+ LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory (sentinelConfiguration );
316
+ connectionFactory .setClientResources (getSharedClientResources ());
317
+ connectionFactory .setVerifyPeer (false );
318
+ connectionFactory .afterPropertiesSet ();
319
+ ConnectionFactoryTracker .add (connectionFactory );
320
+
321
+ AbstractRedisClient client = (AbstractRedisClient ) getField (connectionFactory , "client" );
322
+ assertThat (client ).isInstanceOf (RedisClient .class );
323
+
324
+ RedisURI redisUri = (RedisURI ) getField (client , "redisURI" );
325
+
326
+ assertThat (redisUri .isVerifyPeer ()).isFalse ();
327
+ assertThat (connectionFactory .isVerifyPeer ()).isFalse ();
328
+ }
329
+
330
+ @ Test // DATAREDIS-990
331
+ public void startTLSOptionShouldBeSetCorrectlyOnSentinelClient () {
332
+
333
+ RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration ("myMaster" ,
334
+ Collections .singleton ("localhost:1234" ));
335
+ LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory (sentinelConfiguration );
336
+ connectionFactory .setClientResources (getSharedClientResources ());
337
+ connectionFactory .setStartTls (true );
338
+ connectionFactory .afterPropertiesSet ();
339
+ ConnectionFactoryTracker .add (connectionFactory );
340
+
341
+ AbstractRedisClient client = (AbstractRedisClient ) getField (connectionFactory , "client" );
342
+ assertThat (client ).isInstanceOf (RedisClient .class );
343
+
344
+ RedisURI redisUri = (RedisURI ) getField (client , "redisURI" );
345
+
346
+ assertThat (redisUri .isStartTls ()).isTrue ();
347
+ assertThat (connectionFactory .isStartTls ()).isTrue ();
348
+ }
349
+
288
350
@ Test // DATAREDIS-537
289
351
public void sslShouldBeSetCorrectlyOnClusterClient () {
290
352
0 commit comments