code cleanup
This commit is contained in:
@@ -116,21 +116,6 @@ public class ShardedJedisPoolTest extends Assert {
|
||||
assertNotSame(j1.getShard("foo"), j2.getShard("foo"));
|
||||
}
|
||||
|
||||
public void checkConnectionsWithNoServers() {
|
||||
shards = new ArrayList<JedisShardInfo>();
|
||||
shards.add(new JedisShardInfo("localhost", 6379, "ssa"));
|
||||
shards.add(new JedisShardInfo("localhost", 6380, "ssa"));
|
||||
Config redisConfig = new Config();
|
||||
redisConfig.testOnBorrow = false; // deactivated for now
|
||||
redisConfig.testOnReturn = true;
|
||||
redisConfig.maxActive = 200; // nro threads + margen de seguridad?
|
||||
redisConfig.minIdle = 200;
|
||||
ShardedJedisPool pool = new ShardedJedisPool(redisConfig, shards);
|
||||
ShardedJedis jedis = pool.getResource();
|
||||
pool.returnResource(jedis);
|
||||
pool.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkFailedJedisServer() {
|
||||
ShardedJedisPool pool = new ShardedJedisPool(new Config(), shards);
|
||||
@@ -182,5 +167,4 @@ public class ShardedJedisPoolTest extends Assert {
|
||||
assertEquals(actual, c1);
|
||||
assertEquals(fails, c2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -264,22 +264,27 @@ public class ShardedJedisTest extends Assert {
|
||||
.toString(i));
|
||||
JedisShardInfo jedisShardInfo2 = sharded2.getShardInfo(Integer
|
||||
.toString(i));
|
||||
assertEquals(shards.indexOf(jedisShardInfo),
|
||||
otherShards.indexOf(jedisShardInfo2));
|
||||
assertEquals(shards.indexOf(jedisShardInfo), otherShards
|
||||
.indexOf(jedisShardInfo2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMasterSlaveShardingConsistencyWithShardNaming() {
|
||||
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>(3);
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT, "HOST1:1234"));
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT + 1,"HOST2:1234"));
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT + 2, "HOST3:1234"));
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT,
|
||||
"HOST1:1234"));
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT + 1,
|
||||
"HOST2:1234"));
|
||||
shards.add(new JedisShardInfo("localhost", Protocol.DEFAULT_PORT + 2,
|
||||
"HOST3:1234"));
|
||||
Sharded<Jedis, JedisShardInfo> sharded = new Sharded<Jedis, JedisShardInfo>(
|
||||
shards, Hashing.MURMUR_HASH);
|
||||
|
||||
List<JedisShardInfo> otherShards = new ArrayList<JedisShardInfo>(3);
|
||||
otherShards.add(new JedisShardInfo("otherhost", Protocol.DEFAULT_PORT, "HOST2:1234"));
|
||||
otherShards.add(new JedisShardInfo("otherhost", Protocol.DEFAULT_PORT,
|
||||
"HOST2:1234"));
|
||||
otherShards.add(new JedisShardInfo("otherhost",
|
||||
Protocol.DEFAULT_PORT + 1, "HOST3:1234"));
|
||||
otherShards.add(new JedisShardInfo("otherhost",
|
||||
@@ -292,11 +297,7 @@ public class ShardedJedisTest extends Assert {
|
||||
.toString(i));
|
||||
JedisShardInfo jedisShardInfo2 = sharded2.getShardInfo(Integer
|
||||
.toString(i));
|
||||
assertEquals(jedisShardInfo.getName(),
|
||||
jedisShardInfo2.getName());
|
||||
assertEquals(jedisShardInfo.getName(), jedisShardInfo2.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user