@Test
 public void testMultiMapRemove() {
   HazelcastClient hClient = getHazelcastClient();
   MultiMap<String, String> map = hClient.getMultiMap("testMultiMapRemove");
   map.put("Hello", "World");
   map.put("Hello", "Europe");
   map.put("Hello", "America");
   map.put("Hello", "Asia");
   map.put("Hello", "Africa");
   map.put("Hello", "Antarctica");
   map.put("Hello", "Australia");
   assertEquals(7, map.size());
   assertEquals(1, map.keySet().size());
   Collection<String> values = map.remove("Hello");
   assertEquals(7, values.size());
   assertEquals(0, map.size());
   assertEquals(0, map.keySet().size());
   map.put("Hello", "World");
   assertEquals(1, map.size());
   assertEquals(1, map.keySet().size());
 }
Пример #2
0
  @Test
  public void testKeySet() {
    final int maxKeys = 23;
    final MultiMap mm = client.getMultiMap(randomString());

    Set expected = new TreeSet();
    for (int key = 0; key < maxKeys; key++) {
      mm.put(key, 1);
      expected.add(key);
    }

    assertEquals(expected, mm.keySet());
  }
 @Test
 public void testMultiMapKeySet() {
   HazelcastClient hClient = getHazelcastClient();
   MultiMap<String, String> map = hClient.getMultiMap("testMultiMapKeySet");
   map.put("Hello", "World");
   map.put("Hello", "Europe");
   map.put("Hello", "America");
   map.put("Hello", "Asia");
   map.put("Hello", "Africa");
   map.put("Hello", "Antarctica");
   map.put("Hello", "Australia");
   Set<String> keys = map.keySet();
   assertEquals(1, keys.size());
 }
 @Test
 public void keySet() throws InterruptedException {
   HazelcastClient hClient = getHazelcastClient();
   MultiMap<String, String> multiMap = hClient.getMultiMap("keySet");
   int count = 100;
   for (int i = 0; i < count; i++) {
     for (int j = 0; j <= i; j++) {
       multiMap.put(String.valueOf(i), String.valueOf(j));
     }
   }
   assertEquals(count * (count + 1) / 2, multiMap.size());
   Set<String> set = multiMap.keySet();
   assertEquals(count, set.size());
   Set<String> s = new HashSet<String>();
   for (int i = 0; i < count; i++) {
     s.add(String.valueOf(i));
   }
   assertEquals(s, set);
 }
Пример #5
0
 @Test
 public void testEmptyKeySet() {
   final MultiMap mm = client.getMultiMap(randomString());
   assertEquals(Collections.EMPTY_SET, mm.keySet());
 }
 @Override
 public Set<K> keySet() {
   return delegate.keySet();
 }