From 79d31b232955bedabb42b9ea17255ea0b7d2380b Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 13 Jul 2022 10:52:37 -0400 Subject: [PATCH] Remove ulinkAvailable test for RedisLockRegistry The logic of the test does not reflect the state of the `RedisLockRegistry` around `ulinkAvailable` property: we don't check the Redis version anymore, but try to call `UNLINK` command. Then we reset `ulinkAvailable` to `false` to call regular `DEL` for the rest of `RedisLockRegistry` life The `RedisAvailableRule` marks `testUlink()` as passed even without calling it. We are not going to look into fixing the rule since we are migrating to Testcontainers: https://github.com/spring-projects/spring-integration/issues/3840 --- .../redis/util/RedisLockRegistryTests.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/RedisLockRegistryTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/RedisLockRegistryTests.java index 713121d2fd..57773474d1 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/RedisLockRegistryTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/util/RedisLockRegistryTests.java @@ -18,14 +18,10 @@ package org.springframework.integration.redis.util; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.Queue; import java.util.UUID; import java.util.concurrent.Callable; @@ -53,8 +49,6 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisCallback; -import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.integration.redis.rules.RedisAvailable; import org.springframework.integration.redis.rules.RedisAvailableTests; @@ -797,23 +791,6 @@ public class RedisLockRegistryTests extends RedisAvailableTests { executorService.shutdown(); } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test - public void testUlink() { - RedisOperations ops = mock(RedisOperations.class); - Properties props = new Properties(); - willReturn(props).given(ops).execute(any(RedisCallback.class)); - props.setProperty("redis_version", "3.0.0"); - RedisLockRegistry registry = new RedisLockRegistry(mock(RedisConnectionFactory.class), "foo"); - registry.setRedisLockType(testRedisLockType); - assertThat(TestUtils.getPropertyValue(registry, "ulinkAvailable", Boolean.class)).isFalse(); - props.setProperty("redis_version", "4.0.0"); - registry = new RedisLockRegistry(mock(RedisConnectionFactory.class), "foo"); - registry.setRedisLockType(testRedisLockType); - assertThat(TestUtils.getPropertyValue(registry, "ulinkAvailable", Boolean.class)).isTrue(); - } - private Long getExpire(RedisLockRegistry registry, String lockKey) { StringRedisTemplate template = createTemplate(); String registryKey = TestUtils.getPropertyValue(registry, "registryKey", String.class);