DATAREDIS-676 - Polishing.
Set disposal state in LettuceClusterConnection only once. Close resources after tests. Typos, formatting. Original pull request: #266.
This commit is contained in:
@@ -31,6 +31,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.redis.ConnectionFactoryTracker;
|
||||
import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisClusterConnection;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
@@ -38,7 +39,6 @@ import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
|
||||
/**
|
||||
@@ -279,13 +279,18 @@ public class LettuceConnectionFactoryUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-676
|
||||
@Test // DATAREDIS-676
|
||||
public void timeoutShouldBePassedOnToClusterConnection() {
|
||||
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfig);
|
||||
connectionFactory.setShutdownTimeout(0);
|
||||
connectionFactory.setTimeout(2000);
|
||||
connectionFactory.afterPropertiesSet();
|
||||
ConnectionFactoryTracker.add(connectionFactory);
|
||||
|
||||
assertThat((Long) ReflectionTestUtils.getField(connectionFactory.getClusterConnection(), "timeout"), is(equalTo(2000L)));
|
||||
RedisClusterConnection clusterConnection = connectionFactory.getClusterConnection();
|
||||
assertThat((Long) ReflectionTestUtils.getField(clusterConnection, "timeout"), is(equalTo(2000L)));
|
||||
|
||||
clusterConnection.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user