Allow JedisPool to set a custom client name

This commit is contained in:
Eoin Coffey
2013-09-24 15:32:18 -06:00
committed by Hisham Mardam-Bey
parent bc4d0ed0b6
commit 796f80d9c0
3 changed files with 47 additions and 19 deletions

View File

@@ -117,7 +117,7 @@ public class JedisPoolTest extends Assert {
pool1.returnResource(jedis0);
pool1.destroy();
}
@Test
public void returnBinary() {
JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.host,
@@ -126,7 +126,7 @@ public class JedisPoolTest extends Assert {
pool.returnResource(jedis);
pool.destroy();
}
@Test
public void startWithUrlString() {
Jedis j = new Jedis("localhost", 6380);
@@ -138,7 +138,7 @@ public class JedisPoolTest extends Assert {
assertEquals("PONG", jedis.ping());
assertEquals("bar", jedis.get("foo"));
}
@Test
public void startWithUrl() throws URISyntaxException {
Jedis j = new Jedis("localhost", 6380);
@@ -170,4 +170,18 @@ public class JedisPoolTest extends Assert {
pool.returnResource(jedis1);
pool.destroy();
}
@Test
public void customClientName() {
JedisPool pool0 = new JedisPool(new JedisPoolConfig(), hnp.host,
hnp.port, 2000, "foobared", 0, "my_shiny_client_name");
Jedis jedis = pool0.getResource();
assertEquals("my_shiny_client_name", jedis.clientGetname());
pool0.returnResource(jedis);
pool0.destroy();
}
}