Added pipeline support

This commit is contained in:
Jonathan Leibiusky
2010-08-05 21:45:21 -03:00
parent 01da80627d
commit 5679597495
7 changed files with 121 additions and 36 deletions

View File

@@ -43,7 +43,7 @@ public class ProtocolTest extends Assert {
public void bulkReply() {
InputStream is = new ByteArrayInputStream("$6\r\nfoobar\r\n".getBytes());
Protocol protocol = new Protocol();
String response = protocol.getBulkReply(new DataInputStream(is));
String response = (String) protocol.read(new DataInputStream(is));
assertEquals("foobar", response);
}
@@ -51,7 +51,7 @@ public class ProtocolTest extends Assert {
public void nullBulkReply() {
InputStream is = new ByteArrayInputStream("$-1\r\n".getBytes());
Protocol protocol = new Protocol();
String response = protocol.getBulkReply(new DataInputStream(is));
String response = (String) protocol.read(new DataInputStream(is));
assertEquals(null, response);
}
@@ -59,7 +59,7 @@ public class ProtocolTest extends Assert {
public void singleLineReply() {
InputStream is = new ByteArrayInputStream("+OK\r\n".getBytes());
Protocol protocol = new Protocol();
String response = protocol.getStatusCodeReply(new DataInputStream(is));
String response = (String) protocol.read(new DataInputStream(is));
assertEquals("OK", response);
}
@@ -67,7 +67,7 @@ public class ProtocolTest extends Assert {
public void integerReply() {
InputStream is = new ByteArrayInputStream(":123\r\n".getBytes());
Protocol protocol = new Protocol();
int response = protocol.getIntegerReply(new DataInputStream(is));
int response = (Integer) protocol.read(new DataInputStream(is));
assertEquals(123, response);
}
@@ -79,7 +79,7 @@ public class ProtocolTest extends Assert {
.getBytes());
Protocol protocol = new Protocol();
List<String> response = (List<String>) (List<?>) protocol
.getMultiBulkReply(new DataInputStream(is));
.read(new DataInputStream(is));
List<String> expected = new ArrayList<String>();
expected.add("foo");
expected.add("bar");
@@ -92,8 +92,8 @@ public class ProtocolTest extends Assert {
"*4\r\n$3\r\nfoo\r\n+OK\r\n:1000\r\n*2\r\n$3\r\nfoo\r\n$3\r\nbar"
.getBytes());
protocol = new Protocol();
List<Object> response2 = protocol
.getMultiBulkReply(new DataInputStream(is));
List<Object> response2 = (List<Object>) protocol
.read(new DataInputStream(is));
List<Object> expected2 = new ArrayList<Object>();
expected2.add("foo");
expected2.add("OK");
@@ -111,8 +111,8 @@ public class ProtocolTest extends Assert {
public void nullMultiBulkReply() {
InputStream is = new ByteArrayInputStream("*-1\r\n".getBytes());
Protocol protocol = new Protocol();
List<String> response = (List<String>) (List<?>) protocol
.getMultiBulkReply(new DataInputStream(is));
List<String> response = (List<String>) protocol
.read(new DataInputStream(is));
assertNull(response);
}
}