DATAREDIS-525 - Polishing.

Enhance JavaDoc. Improve assertions. Reduce accepted collection-type boundary to Collection for commands that do not enforce a specific order. Add ByteUtil.getBytes(ByteBuffer) utility method. Reformat code. Extend documentation

Fix parameter ambiguity in LettuceConnection.watch().

Original pull request: #229.
This commit is contained in:
Mark Paluch
2016-11-14 17:44:52 +01:00
parent 62b1354e02
commit b172c237e4
46 changed files with 3101 additions and 880 deletions

View File

@@ -25,6 +25,7 @@ import static org.junit.Assert.*;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -32,6 +33,7 @@ import org.junit.Test;
/**
* @author Christoph Strobl
* @author Mark Paluch
*/
public class LettuceReactiveHashCommandsTests extends LettuceReactiveCommandsTestsBase {
@@ -232,13 +234,17 @@ public class LettuceReactiveHashCommandsTests extends LettuceReactiveCommandsTes
* @see DATAREDIS-525
*/
@Test
public void hGetAlllShouldReturnEntriesCorrectly() {
public void hGetAllShouldReturnEntriesCorrectly() {
nativeCommands.hset(KEY_1, FIELD_1, VALUE_1);
nativeCommands.hset(KEY_1, FIELD_2, VALUE_2);
nativeCommands.hset(KEY_1, FIELD_3, VALUE_3);
System.out.println(connection.hashCommands().hGetAll(KEY_1_BBUFFER).block());
}
Map<ByteBuffer, ByteBuffer> expected = new HashMap<>();
expected.put(FIELD_1_BBUFFER, VALUE_1_BBUFFER);
expected.put(FIELD_2_BBUFFER, VALUE_2_BBUFFER);
expected.put(FIELD_3_BBUFFER, VALUE_3_BBUFFER);
assertThat(connection.hashCommands().hGetAll(KEY_1_BBUFFER).block(), is(equalTo(expected)));
}
}

View File

@@ -116,7 +116,7 @@ public class LettuceReactiveSetCommandsTests extends LettuceReactiveCommandsTest
nativeCommands.sadd(KEY_1, VALUE_1, VALUE_2);
nativeCommands.sadd(KEY_2, VALUE_1);
assertThat(connection.setCommands().sMove(KEY_1_BBUFFER, KEY_2_BBUFFER, VALUE_3_BBUFFER).block(), is(false));
assertThat(connection.setCommands().sMove(KEY_1_BBUFFER, KEY_2_BBUFFER, VALUE_3_BBUFFER).block(), is(false));
assertThat(nativeCommands.sismember(KEY_2, VALUE_3), is(false));
}