Merge branch 'binaryAPI' of git://github.com/yaourt/jedis

Conflicts:
	src/main/java/redis/clients/jedis/Connection.java
	src/main/java/redis/clients/jedis/Jedis.java
	src/main/java/redis/clients/jedis/ShardedJedis.java
This commit is contained in:
Jonathan Leibiusky
2010-11-15 23:55:57 -03:00
41 changed files with 8489 additions and 2326 deletions

View File

@@ -2,43 +2,85 @@ package redis.clients.jedis.tests.commands;
import java.io.IOException;
import java.net.UnknownHostException;
import junit.framework.Assert;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.tests.HostAndPortUtil;
import redis.clients.jedis.tests.JedisTestBase;
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
public abstract class JedisCommandTestBase extends Assert {
protected static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
public abstract class JedisCommandTestBase extends JedisTestBase {
protected static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
protected Jedis jedis;
protected Jedis jedis;
public JedisCommandTestBase() {
super();
}
public JedisCommandTestBase() {
super();
}
@Before
public void setUp() throws Exception {
jedis = new Jedis(hnp.host, hnp.port, 500);
jedis.connect();
jedis.auth("foobared");
jedis.flushAll();
}
@Before
public void setUp() throws Exception {
jedis = new Jedis(hnp.host, hnp.port, 500);
jedis.connect();
jedis.auth("foobared");
jedis.flushAll();
}
@After
public void tearDown() throws Exception {
jedis.disconnect();
}
@After
public void tearDown() throws Exception {
jedis.disconnect();
}
protected Jedis createJedis() throws UnknownHostException, IOException {
Jedis j = new Jedis(hnp.host, hnp.port);
j.connect();
j.auth("foobared");
j.flushAll();
return j;
}
protected Jedis createJedis() throws UnknownHostException, IOException {
Jedis j = new Jedis(hnp.host, hnp.port);
j.connect();
j.auth("foobared");
j.flushAll();
return j;
}
protected void assertEquals(List<byte[]> expected, List<byte[]> actual) {
assertEquals(expected.size(), actual.size());
for (int n = 0; n < expected.size(); n++) {
assertArrayEquals(expected.get(n), actual.get(n));
}
}
protected void assertEquals(Set<byte[]> expected, Set<byte[]> actual) {
assertEquals(expected.size(), actual.size());
Iterator<byte[]> iterator = expected.iterator();
Iterator<byte[]> iterator2 = actual.iterator();
while (iterator.hasNext() || iterator2.hasNext()) {
assertArrayEquals(iterator.next(), iterator2.next());
}
}
protected boolean arrayContains(List<byte[]> array, byte[] expected) {
for (byte[] a : array) {
try {
assertArrayEquals(a, expected);
return true;
} catch (AssertionError e) {
}
}
return false;
}
protected boolean setContains(Set<byte[]> set, byte[] expected) {
for (byte[] a : set) {
try {
assertArrayEquals(a, expected);
return true;
} catch (AssertionError e) {
}
}
return false;
}
}