11package redis .clients .jedis .prefix ;
22
3- import org .junit .BeforeClass ;
43import redis .clients .jedis .HostAndPorts ;
54import redis .clients .jedis .util .prefix .ClusterCommandObjectsWithPrefixedKeys ;
65import redis .clients .jedis .ConnectionPoolConfig ;
76import redis .clients .jedis .DefaultJedisClientConfig ;
87import redis .clients .jedis .HostAndPort ;
98import redis .clients .jedis .Jedis ;
109import redis .clients .jedis .JedisCluster ;
11- import redis .clients .jedis .Protocol ;
1210import redis .clients .jedis .UnifiedJedis ;
13- import redis .clients .jedis .args .ClusterResetType ;
1411import redis .clients .jedis .providers .ClusterConnectionProvider ;
15- import redis .clients .jedis .util .JedisClusterTestUtil ;
1612
1713import java .time .Duration ;
1814import java .util .Collections ;
@@ -22,27 +18,13 @@ public class JedisClusterPrefixedKeysTest extends PrefixedKeysTest {
2218 private static final int DEFAULT_TIMEOUT = 2000 ;
2319 private static final int DEFAULT_REDIRECTIONS = 5 ;
2420 private static final ConnectionPoolConfig DEFAULT_POOL_CONFIG = new ConnectionPoolConfig ();
25- private static final HostAndPort HOST_AND_PORT = HostAndPorts .getClusterServers ().get (0 );
21+ private static final HostAndPort HOST_AND_PORT = HostAndPorts .getStableClusterServers ().get (0 );
2622
27- @ BeforeClass
28- public static void setUpClass () {
29- Jedis jedis = new Jedis (HOST_AND_PORT );
30- jedis .auth ("cluster" );
31- jedis .clusterReset (ClusterResetType .HARD );
32- jedis .flushAll ();
33-
34- int [] slots = new int [Protocol .CLUSTER_HASHSLOTS ];
35-
36- for (int i = 0 ; i < Protocol .CLUSTER_HASHSLOTS ; ++i ) {
37- slots [i ] = i ;
38- }
39-
40- jedis .clusterAddSlots (slots );
41-
42- try {
43- JedisClusterTestUtil .waitForClusterReady (jedis );
44- } catch (InterruptedException e ) {
45- throw new RuntimeException (e );
23+ @ Override
24+ protected void flush () {
25+ try (Jedis jedis = new Jedis (HOST_AND_PORT )) {
26+ jedis .auth ("cluster" );
27+ jedis .flushAll ();
4628 }
4729 }
4830
0 commit comments