test
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
|
||||
class RedisConfigTest
|
||||
{
|
||||
@Test
|
||||
void shouldEnableValidateConnectionForLettuceConnectionFactory()
|
||||
{
|
||||
BeanPostProcessor beanPostProcessor = RedisConfig.lettuceConnectionFactoryBeanPostProcessor();
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(
|
||||
new RedisStandaloneConfiguration("127.0.0.1", 6379));
|
||||
|
||||
beanPostProcessor.postProcessBeforeInitialization(connectionFactory, "redisConnectionFactory");
|
||||
|
||||
assertThat(connectionFactory.getValidateConnection()).isTrue();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user