Package com.hazelcast.core

Examples of com.hazelcast.core.IMap.keySet()



        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                Set expected = map.keySet(Predicates.greaterThan("value", 1));
                assertEquals(3, expected.size());
                assertTrue(expected.contains("key1"));
                assertTrue(expected.contains("key2"));
                assertTrue(expected.contains("key3"));
            }
View Full Code Here


                return true;
            }
        });

        assertEquals(2, map.keySet().size());

        // raise an exception and rollback changes.
        try {
            boolean b2 = h1.executeTransaction(options, new TransactionalTask<Boolean>() {
                public Boolean execute(TransactionalTaskContext context) throws TransactionException {
View Full Code Here

                    final TransactionalMap<Object, Object> txMap = context.getMap("default");

                    txMap.put("5", "5");

                    assertEquals(3, txMap.keySet().size());
                    assertEquals(2, map.keySet().size());

                    throw new DummyUncheckedHazelcastTestException();
                }
            });
        } catch (Exception e) {
View Full Code Here

        } catch (Exception e) {
            if (!(e instanceof DummyUncheckedHazelcastTestException)) {
                throw new RuntimeException(e);
            }
        }
        assertEquals(2, map.keySet().size());
        h1.shutdown();
        h2.shutdown();
    }

    @Test
View Full Code Here

            if (!(e instanceof DummyUncheckedHazelcastTestException)) {
                throw new RuntimeException(e);
            }
        }
        assertEquals(1, map.size());
        assertEquals(1, map.keySet().size());
        assertEquals(0, map.keySet(new SqlPredicate("age <= 10")).size());

        h1.shutdown();
        h2.shutdown();
    }
View Full Code Here

                throw new RuntimeException(e);
            }
        }
        assertEquals(1, map.size());
        assertEquals(1, map.keySet().size());
        assertEquals(0, map.keySet(new SqlPredicate("age <= 10")).size());

        h1.shutdown();
        h2.shutdown();
    }
View Full Code Here

        Config config = newConfig(testMapStore, 0);
        HazelcastInstance instance = createHazelcastInstance(config);
        IMap map = instance.getMap("default");

        Set expected = map.keySet();
        Set actual = mapForStore.keySet();
        assertEquals(expected, actual);
        assertEquals(map.values(), mapForStore.values());
        assertEquals(map.entrySet(), mapForStore.entrySet());
View Full Code Here

        final IMap map = instance.getMap("default");

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                Set result = map.keySet();
                assertTrue(result.contains("key1"));
                assertTrue(result.contains("key2"));
                assertTrue(result.contains("key3"));
            }
        });
View Full Code Here

        assertEquals(2, txMap.values().size());

        context.commitTransaction();

        assertEquals(2, map.size());
        assertEquals(2, map.keySet().size());
        assertEquals(2, map.values().size());
    }

    @Test
    public void testKeysetAndValuesWithPredicates() throws Exception {
View Full Code Here

    public void testBasicPredicate() {
        final IMap map = createMap();
        fillMap(map);
        final Collection collection = map.values(new SqlPredicate("this == value1"));
        assertEquals("value1", collection.iterator().next());
        final Set set = map.keySet(new SqlPredicate("this == value1"));
        assertEquals("key1", set.iterator().next());
        final Set<Map.Entry<String, String>> set1 = map.entrySet(new SqlPredicate("this == value1"));
        assertEquals("key1", set1.iterator().next().getKey());
        assertEquals("value1", set1.iterator().next().getValue());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.