DATAREDIS-287 - 'setBit' should return boolean value.

SetBit now returns the original bit value stored at the offset. The result will also be added in pipeline and transaction mode which means that the final result collection may now contain more entries than in prior versions.

Original Pull Request: #58
This commit is contained in:
Christoph Strobl
2014-03-26 09:03:43 +01:00
committed by Thomas Darimont
parent 2679405e96
commit 2b280e57e8
10 changed files with 101 additions and 32 deletions

View File

@@ -417,22 +417,23 @@ public abstract class AbstractConnectionIntegrationTests {
@Test
public void testBitSet() throws Exception {
String key = "bitset-test";
connection.setBit(key, 0, false);
connection.setBit(key, 1, true);
actual.add(connection.setBit(key, 0, true));
actual.add(connection.setBit(key, 0, false));
actual.add(connection.setBit(key, 1, true));
actual.add(connection.getBit(key, 0));
actual.add(connection.getBit(key, 1));
verifyResults(Arrays.asList(new Object[] { false, true }));
verifyResults(Arrays.asList(new Object[] { false, true, false, false, true }));
}
@Test
@IfProfileValue(name = "redisVersion", value = "2.6")
public void testBitCount() {
String key = "bitset-test";
connection.setBit(key, 0, false);
connection.setBit(key, 1, true);
connection.setBit(key, 2, true);
actual.add(connection.setBit(key, 0, false));
actual.add(connection.setBit(key, 1, true));
actual.add(connection.setBit(key, 2, true));
actual.add(connection.bitCount(key));
verifyResults(new ArrayList<Object>(Collections.singletonList(2l)));
verifyResults(Arrays.asList(new Object[] { false, false, false, 2L }));
}
@Test