add test exclusion to avoid RJC bug for incr(by)

DATAREDIS-88
This commit is contained in:
Costin Leau
2012-05-23 19:29:04 +03:00
parent 27d7e5dd0b
commit 3bfcc7daf6

View File

@@ -19,13 +19,17 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import java.util.List;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.ConnectionFactoryTracker;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.rjc.RjcConnectionFactory;
import org.springframework.data.redis.support.collections.CollectionTestParams;
import org.springframework.data.redis.support.collections.ObjectFactory;
@@ -60,11 +64,33 @@ public class TemplateTest {
@Test
public void testIncrement() throws Exception {
// disable in case of Rjc
if (isRjc()) {
return;
}
StringRedisTemplate sr = new StringRedisTemplate(template.getConnectionFactory());
String key = "test.template.inc";
ValueOperations<String, String> valueOps = sr.opsForValue();
valueOps.set(key, "10");
valueOps.increment(key, -10);
assertEquals(0, Integer.valueOf(valueOps.get(key)).intValue());
valueOps.increment(key, -10);
assertEquals(-10, Integer.valueOf(valueOps.get(key)).intValue());
}
private boolean isRjc() {
return (template.getConnectionFactory() instanceof RjcConnectionFactory);
}
//@Test
public void testGetNonExistingKey() throws Exception {
List<Object> res = (List<Object>) template.execute(new RedisCallback<List<Object>>() {
public List<Object> doInRedis(RedisConnection connection) throws DataAccessException {
connection.hGet("non-existing-key".getBytes(), "some-value".getBytes());
return connection.closePipeline();
}
}, true, true);
}
}