From aa7a96d05c2e795e1c0baaf8bb2ab6f0b0c0feec Mon Sep 17 00:00:00 2001 From: Jonathan Leibiusky Date: Mon, 30 Aug 2010 11:12:24 -0300 Subject: [PATCH] Fixed broken constructor. Wasn't setting default protocol --- src/main/java/redis/clients/jedis/JedisPool.java | 1 + .../redis/clients/jedis/tests/JedisPoolTest.java | 14 ++++++++++++++ .../jedis/tests/commands/HashesCommandsTest.java | 2 -- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/redis/clients/jedis/JedisPool.java b/src/main/java/redis/clients/jedis/JedisPool.java index 4ae24c4..02d37d9 100644 --- a/src/main/java/redis/clients/jedis/JedisPool.java +++ b/src/main/java/redis/clients/jedis/JedisPool.java @@ -12,6 +12,7 @@ public class JedisPool extends FixedResourcePool { public JedisPool(String host) { this.host = host; + this.port = Protocol.DEFAULT_PORT; } public JedisPool(String host, int port) { diff --git a/src/test/java/redis/clients/jedis/tests/JedisPoolTest.java b/src/test/java/redis/clients/jedis/tests/JedisPoolTest.java index c870a89..fb1a23a 100644 --- a/src/test/java/redis/clients/jedis/tests/JedisPoolTest.java +++ b/src/test/java/redis/clients/jedis/tests/JedisPoolTest.java @@ -22,4 +22,18 @@ public class JedisPoolTest extends Assert { assertEquals("bar", jedis.get("foo")); pool.returnResource(jedis); } + + @Test + public void checkConnectionWithDefaultPort() throws TimeoutException { + JedisPool pool = new JedisPool("localhost"); + pool.setResourcesNumber(10); + pool.init(); + + Jedis jedis = pool.getResource(200); + jedis.auth("foobared"); + jedis.set("foo", "bar"); + assertEquals("bar", jedis.get("foo")); + pool.returnResource(jedis); + } + } \ No newline at end of file diff --git a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java index 026febe..453f70f 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java @@ -8,8 +8,6 @@ import java.util.Map; import org.junit.Test; -import redis.clients.jedis.Protocol; - public class HashesCommandsTest extends JedisCommandTestBase { @Test public void hset() {