Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*
* @author Costin Leau
* @author Christoph Strobl
* @author Christian Bühler
*/
public class DefaultRedisMap<K, V> implements RedisMap<K, V> {

Expand Down Expand Up @@ -156,19 +157,9 @@ public boolean containsValue(Object value) {
@Override
public Set<java.util.Map.Entry<K, V>> entrySet() {

Set<K> keySet = keySet();
checkResult(keySet);
Collection<V> multiGet = hashOps.multiGet(keySet);

Iterator<K> keys = keySet.iterator();
Iterator<V> values = multiGet.iterator();

Set<Map.Entry<K, V>> entries = new LinkedHashSet<>();
while (keys.hasNext()) {
entries.add(new DefaultRedisMapEntry(keys.next(), values.next()));
}

return entries;
Map<K, V> entries = hashOps.entries();
checkResult(entries);
return entries.entrySet();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
Expand Down Expand Up @@ -62,6 +63,7 @@
* @author Jennifer Hickey
* @author Christoph Strobl
* @author Thomas Darimont
* @author Christian Bühler
*/
@RunWith(Parameterized.class)
public abstract class AbstractRedisMapTests<K, V> {
Expand Down Expand Up @@ -396,6 +398,27 @@ public void testEntrySet() {
assertThat(values, not(hasItem(v2)));
}

@Test // DATAREDIS-803
@IfProfileValue(name = "runLongTests", value = "true")
public void testBigEntrySet() {

Set<Entry<K, V>> entries = map.entrySet();
assertTrue(entries.isEmpty());

for (int j = 0; j < 2; j++) {
Map<K, V> m = new HashMap<>();
for (int i = 0; i < 1024 * 1024 / 2 - 1; i++) {
m.put(getKey(), getValue());
}
map.putAll(m);
}
map.put(getKey(), getValue());

entries = map.entrySet();

assertEquals(1024 * 1024 - 1, entries.size());
}

@Test
public void testPutIfAbsent() {

Expand Down