This is an automated email from the ASF dual-hosted git repository. onichols pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git
commit 944d7969b72cc4aab1a4e5786a34981d389f7c0d Author: Jens Deppe <jde...@pivotal.io> AuthorDate: Sat Jan 23 13:20:44 2021 -0800 GEODE-8865: Create additional dunit and integration tests for Redis HMGET (#5945) (cherry-picked from commit bba1935d98328c7b767adebded577f433e49ba87) --- .../hash/AbstractHashesIntegrationTest.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java index 12d4e56..96493a4 100755 --- a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java +++ b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/hash/AbstractHashesIntegrationTest.java @@ -57,8 +57,12 @@ public abstract class AbstractHashesIntegrationTest implements RedisPortSupplier } @After - public void tearDown() { + public void flushAll() { jedis.flushAll(); + } + + @After + public void tearDown() { jedis.close(); jedis2.close(); } @@ -145,23 +149,19 @@ public abstract class AbstractHashesIntegrationTest implements RedisPortSupplier } @Test - public void testHMGet() { + public void testHMGet_HDel_HGetAll_HVals() { String key = "key"; - Map<String, String> hash = setupHash(10); + Map<String, String> hash = new HashMap<>(); + for (int i = 0; i < 10; i++) { + hash.put("field_" + i, "member_" + i); + } jedis.hmset(key, hash); Set<String> keys = hash.keySet(); - String[] keyArray = keys.toArray(new String[0]); + String[] keyArray = keys.toArray(new String[keys.size()]); List<String> retList = jedis.hmget(key, keyArray); assertThat(retList).containsExactlyInAnyOrderElementsOf(hash.values()); - } - - @Test - public void testHgetall() { - String key = "key"; - Map<String, String> hash = setupHash(10); - jedis.hmset(key, hash); Map<String, String> retMap = jedis.hgetAll(key); @@ -190,14 +190,6 @@ public abstract class AbstractHashesIntegrationTest implements RedisPortSupplier assertThat(jedis.hlen(key)).isEqualTo(0); } - private Map<String, String> setupHash(int entries) { - Map<String, String> hash = new HashMap<>(); - for (int i = 0; i < entries; i++) { - hash.put("field-" + i, "member-" + i); - } - return hash; - } - @Test public void testHMGet_returnNull_forUnknownFields() { String key = "key"; @@ -210,7 +202,7 @@ public abstract class AbstractHashesIntegrationTest implements RedisPortSupplier } @Test - public void testHMGet_givenTooFewArguments() { + public void testHMGet_givenWrongNumberOfArguments() { assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HMGET)) .hasMessage("ERR wrong number of arguments for 'hmget' command"); assertThatThrownBy(() -> jedis.sendCommand(Protocol.Command.HMGET, "1")) @@ -967,4 +959,12 @@ public abstract class AbstractHashesIntegrationTest implements RedisPortSupplier return args; } + + private Map<String, String> setupHash(int entries) { + Map<String, String> hash = new HashMap<>(); + for (int i = 0; i < entries; i++) { + hash.put("field-" + i, "member-" + i); + } + return hash; + } }