add more tests for pipeline execution

This commit is contained in:
Costin Leau
2012-06-25 21:48:27 +03:00
parent 8a6aa7e494
commit d00d7143bd
5 changed files with 46 additions and 4 deletions

View File

@@ -369,6 +369,8 @@ public abstract class AbstractConnectionIntegrationTests {
connection.execute("GET", key2);
List<Object> result = connection.closePipeline();
assertEquals(4, result.size());
System.out.println(result.get(2));
System.out.println(result.get(3));
assertArrayEquals(value1.getBytes(), (byte[]) result.get(2));
assertArrayEquals(value2.getBytes(), (byte[]) result.get(3));
}

View File

@@ -95,4 +95,13 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat
public void exceptionExecuteNativeWithPipeline() throws Exception {
}
@Test(expected = UnsupportedOperationException.class)
public void testExceptionExecuteNativeWithPipeline() throws Exception {
super.testExceptionExecuteNativeWithPipeline();
}
@Test(expected = UnsupportedOperationException.class)
public void testExecuteNativeWithPipeline() throws Exception {
super.testExecuteNativeWithPipeline();
}
}

View File

@@ -15,12 +15,16 @@
*/
package org.springframework.data.redis.connection.rjc;
import static org.junit.Assert.assertEquals;
import java.util.List;
import java.util.UUID;
import org.idevlab.rjc.Session;
import org.junit.Test;
import org.springframework.data.redis.SettingsUtils;
import org.springframework.data.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.rjc.RjcConnectionFactory;
/**
* @author Costin Leau
@@ -52,4 +56,21 @@ public class RjcConnectionIntegrationTests extends AbstractConnectionIntegration
jr.set("foobar", "barfoo");
System.out.println(jr.get("foobar"));
}
// override test to address the encoding issue (the bytes[] in raw format differ)
@Test
public void testExecuteNativeWithPipeline() throws Exception {
String key1 = getClass() + "#ExecuteNativeWithPipeline#1";
String value1 = UUID.randomUUID().toString();
String key2 = getClass() + "#ExecuteNativeWithPipeline#2";
String value2 = UUID.randomUUID().toString();
connection.openPipeline();
connection.execute("SET", key1, value1);
connection.execute("SET", key2, value2);
connection.execute("GET", key1);
connection.execute("GET", key2);
List<Object> result = connection.closePipeline();
assertEquals(4, result.size());
}
}