Skip to content

Commit

Permalink
Code clean up
Browse files Browse the repository at this point in the history
Addressing review comments
  • Loading branch information
ggivo committed Nov 26, 2024
1 parent 61bef0c commit fbaf8a1
Show file tree
Hide file tree
Showing 44 changed files with 135 additions and 201 deletions.
4 changes: 1 addition & 3 deletions src/test/java/redis/clients/jedis/ACLJedisPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static io.redis.test.utils.RedisVersionUtil.getRedisVersion;

import java.net.URI;
import java.net.URISyntaxException;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package redis.clients.jedis;

import static org.junit.Assert.*;
import static io.redis.test.utils.RedisVersionUtil.getRedisVersion;

import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.junit.*;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/redis/clients/jedis/ACLJedisTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package redis.clients.jedis;

import static org.junit.Assert.assertEquals;
import static io.redis.test.utils.RedisVersionUtil.getRedisVersion;
import static redis.clients.jedis.util.RedisVersionUtil.getRedisVersion;

import java.net.URISyntaxException;
import org.junit.BeforeClass;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/redis/clients/jedis/JedisClusterTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static redis.clients.jedis.Protocol.CLUSTER_HASHSLOTS;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersion;
import io.redis.test.utils.RedisVersionUtil;
import redis.clients.jedis.util.RedisVersionUtil;
import org.junit.*;
import redis.clients.jedis.util.TlsUtil;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/redis/clients/jedis/SSLACLJedisTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package redis.clients.jedis;

import static io.redis.test.utils.RedisVersionUtil.getRedisVersion;
import static redis.clients.jedis.util.RedisVersionUtil.getRedisVersion;
import static org.junit.Assert.*;
import static redis.clients.jedis.util.TlsUtil.*;

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/redis/clients/jedis/SSLJedisClusterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersion;
import io.redis.test.utils.RedisVersionUtil;
import redis.clients.jedis.util.RedisVersionUtil;
import redis.clients.jedis.util.TlsUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package redis.clients.jedis.commands.commandobjects;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.Rule;
import redis.clients.jedis.HostAndPorts;
import redis.clients.jedis.RedisProtocol;
Expand All @@ -12,9 +12,9 @@
public abstract class CommandObjectsStandaloneTestBase extends CommandObjectsTestBase {

@Rule
public RedisVersionRule versionRule = new RedisVersionRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public RedisVersionRule versionRule = new RedisVersionRule(endpoint);
@Rule
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint);

public CommandObjectsStandaloneTestBase(RedisProtocol protocol) {
super(protocol, HostAndPorts.getRedisEndpoint("standalone0"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Collection;

import io.redis.test.utils.RedisVersion;
import io.redis.test.utils.RedisVersionUtil;
import redis.clients.jedis.util.RedisVersionUtil;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static io.redis.test.utils.RedisVersionUtil.getRedisVersion;
import static redis.clients.jedis.util.RedisVersionUtil.getRedisVersion;

import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import java.util.regex.Pattern;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -43,9 +43,9 @@ public class ClientCommandsTest extends JedisCommandsTestBase {
private Jedis client;

@Rule
public RedisVersionRule versionRule = new RedisVersionRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public RedisVersionRule versionRule = new RedisVersionRule(endpoint);
@Rule
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint);

public ClientCommandsTest(RedisProtocol protocol) {
super(protocol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import java.util.Map;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.util.HashSet;
import java.util.Set;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
import java.util.stream.Collectors;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import redis.clients.jedis.HostAndPorts;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.RedisProtocol;
import redis.clients.jedis.Response;
Expand All @@ -53,10 +52,10 @@
public class HashesCommandsTest extends JedisCommandsTestBase {

@Rule
public RedisVersionRule versionRule = new RedisVersionRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public RedisVersionRule versionRule = new RedisVersionRule(endpoint);

@Rule
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint.getHostAndPort(), endpoint.getClientConfigBuilder().build());
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(endpoint);

final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
final byte[] bbar = { 0x05, 0x06, 0x07, 0x08 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.Collection;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -15,13 +15,11 @@ public abstract class JedisCommandsTestBase {

@Rule
public RedisVersionRule versionRule = new RedisVersionRule(
HostAndPorts.getRedisEndpoint("standalone0").getHostAndPort(),
HostAndPorts.getRedisEndpoint("standalone0").getClientConfigBuilder().build());
HostAndPorts.getRedisEndpoint("standalone0"));

@Rule
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(
HostAndPorts.getRedisEndpoint("standalone0").getHostAndPort(),
HostAndPorts.getRedisEndpoint("standalone0").getClientConfigBuilder().build());
HostAndPorts.getRedisEndpoint("standalone0"));

/**
* Input data for parameterized tests. In principle all subclasses of this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersion;
import io.redis.test.utils.RedisVersionUtil;
import redis.clients.jedis.util.RedisVersionUtil;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersion;
import io.redis.test.utils.RedisVersionUtil;
import redis.clients.jedis.util.RedisVersionUtil;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.util.List;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.RedisVersionRule;
import org.junit.Rule;
import org.junit.Test;

import redis.clients.jedis.Protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import java.util.HashSet;
import java.util.Set;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static org.junit.Assert.assertEquals;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package redis.clients.jedis.commands.unified.cluster;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import java.util.List;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import java.util.Set;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import java.util.List;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import java.util.List;

import io.redis.test.annotations.SinceRedisVersion;
import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.Collection;

import io.redis.test.utils.EnabledOnCommandRule;
import io.redis.test.utils.RedisVersionRule;
import redis.clients.jedis.util.EnabledOnCommandRule;
import redis.clients.jedis.util.RedisVersionRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -31,13 +31,9 @@ public static Collection<Object[]> data() {
protected final RedisProtocol protocol;

@Rule
public RedisVersionRule versionRule = new RedisVersionRule(
PooledCommandsTestHelper.nodeInfo.getHostAndPort(),
PooledCommandsTestHelper.nodeInfo.getClientConfigBuilder().build());
public RedisVersionRule versionRule = new RedisVersionRule(PooledCommandsTestHelper.nodeInfo);
@Rule
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(
HostAndPorts.getStableClusterServers().get(0),
DefaultJedisClientConfig.builder().password("cluster").build());
public EnabledOnCommandRule enabledOnCommandRule = new EnabledOnCommandRule(PooledCommandsTestHelper.nodeInfo);
/**
* The RESP protocol is to be injected by the subclasses, usually via JUnit
* parameterized tests, because most of the subclassed tests are meant to be
Expand Down
Loading

0 comments on commit fbaf8a1

Please sign in to comment.