use of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig in project cachecloud by sohutv.
the class JedisClusterTest method testIfPoolConfigAppliesToClusterPools.
@Test(expected = JedisConnectionException.class)
public void testIfPoolConfigAppliesToClusterPools() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(0);
config.setMaxWaitMillis(2000);
Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
jedisClusterNode.add(new HostAndPort("127.0.0.1", 7379));
JedisCluster jc = new JedisCluster(jedisClusterNode, config);
jc.set("52", "poolTestValue");
}
use of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig in project cachecloud by sohutv.
the class ShardedJedisPoolTest method checkConnections.
@Test
public void checkConnections() {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.destroy();
}
use of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig in project cachecloud by sohutv.
the class ShardedJedisPoolTest method startWithUrl.
@Test
public void startWithUrl() throws URISyntaxException {
Jedis j = new Jedis("localhost", 6380);
j.auth("foobared");
j.set("foo", "bar");
j = new Jedis("localhost", 6379);
j.auth("foobared");
j.set("foo", "bar");
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
shards.add(new JedisShardInfo(new URI("redis://:foobared@localhost:6380")));
shards.add(new JedisShardInfo(new URI("redis://:foobared@localhost:6379")));
GenericObjectPoolConfig redisConfig = new GenericObjectPoolConfig();
ShardedJedisPool pool = new ShardedJedisPool(redisConfig, shards);
Jedis[] jedises = pool.getResource().getAllShards().toArray(new Jedis[2]);
Jedis jedis = jedises[0];
assertEquals("PONG", jedis.ping());
assertEquals("bar", jedis.get("foo"));
jedis = jedises[1];
assertEquals("PONG", jedis.ping());
assertEquals("bar", jedis.get("foo"));
}
use of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig in project cachecloud by sohutv.
the class ShardedJedisPoolTest method checkConnectionWithDefaultPort.
@Test
public void checkConnectionWithDefaultPort() {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.destroy();
}
use of org.apache.tomcat.dbcp.pool2.impl.GenericObjectPoolConfig in project cachecloud by sohutv.
the class ShardedJedisPoolTest method checkFailedJedisServer.
@Test
public void checkFailedJedisServer() {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.incr("foo");
jedis.close();
pool.destroy();
}
Aggregations