[
https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17291761#comment-17291761
]
ASF GitHub Bot commented on GEODE-8864:
---------------------------------------
jhutchison commented on a change in pull request #5954:
URL: https://github.com/apache/geode/pull/5954#discussion_r583778861
##########
File path:
geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHScanIntegrationTest.java
##########
@@ -237,15 +316,40 @@ public void
givenMultipleCounts_returnsAllEntriesWithoutDuplicates() {
String cursor = "0";
do {
- result = (List<Object>) jedis.sendCommand(Protocol.Command.HSCAN,
"colors", cursor, "COUNT",
- "2", "COUNT", "1");
+ result = (List<Object>) jedis.sendCommand(Protocol.Command.HSCAN,
+ "colors",
+ cursor,
+ "COUNT", "2",
+ "COUNT", "1");
+
allEntries.addAll((List<byte[]>) result.get(1));
cursor = new String((byte[]) result.get(0));
} while (!Arrays.equals((byte[]) result.get(0), "0".getBytes()));
assertThat((byte[]) result.get(0)).isEqualTo("0".getBytes());
- assertThat(allEntries).containsExactlyInAnyOrder("1".getBytes(),
"yellow".getBytes(),
- "12".getBytes(), "green".getBytes(), "3".getBytes(),
"grey".getBytes());
+ }
+
+ @Test
+ public void givenCompleteIteration_shouldReturnCursorWithValueOfZero() {
+ Map<String, String> entryMap = new HashMap<>();
+ entryMap.put("1", "yellow");
+ entryMap.put("2", "green");
+ entryMap.put("3", "orange");
+ jedis.hmset("colors", entryMap);
+
+ ScanParams scanParams = new ScanParams();
+ scanParams.count(1);
+ ScanResult<Map.Entry<String, String>> result;
+ List<Map.Entry<String, String>> allEntries = new ArrayList<>();
+ String cursor = "0";
+
+ do {
+ result = jedis.hscan("colors", cursor, scanParams);
+ allEntries.addAll(result.getResult());
+ cursor = result.getCursor();
+ } while (!result.isCompleteIteration());
+
+ assertThat(result.getCursor()).isEqualTo("0");
}
@Test
Review comment:
This is just cursor value, but I know what you mean. I can change them
to look for the elements.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> finish implementation of Redis HScan Command
> --------------------------------------------
>
> Key: GEODE-8864
> URL: https://issues.apache.org/jira/browse/GEODE-8864
> Project: Geode
> Issue Type: New Feature
> Components: redis
> Reporter: John Hutchison
> Priority: Major
> Labels: pull-request-available
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)