Merge branch 'master' into srp
This commit is contained in:
@@ -115,6 +115,15 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
assertEquals("PONG", connection.ping());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBitSet() throws Exception {
|
||||
String key = "bitset-test";
|
||||
connection.setBit(key, 0, false);
|
||||
connection.setBit(key, 1, true);
|
||||
assertTrue(!connection.getBit(key, 0));
|
||||
assertTrue(connection.getBit(key, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInfo() throws Exception {
|
||||
Properties info = connection.info();
|
||||
@@ -323,4 +332,12 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
th.start();
|
||||
connection.pSubscribe(listener, expectedPattern);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteNative() throws Exception {
|
||||
connection.execute("ZADD", getClass() + "#testExecuteNative", "0.9090", "item");
|
||||
//connection.execute("PiNg");
|
||||
connection.execute("iNFo");
|
||||
connection.execute("SET ", getClass() + "testSetNative", UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ 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.jredis.JredisConnectionFactory;
|
||||
|
||||
public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrationTests {
|
||||
|
||||
@@ -86,6 +85,10 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat
|
||||
|
||||
@Ignore
|
||||
public void testPubSubWithNamedChannels() {
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testBitSet() throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,16 +15,21 @@
|
||||
*/
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
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;
|
||||
|
||||
@@ -56,4 +61,36 @@ public class TemplateTest {
|
||||
public void testKeys() throws Exception {
|
||||
assertTrue(template.keys("*") != null);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user