Package com.hazelcast.test

Examples of com.hazelcast.test.AssertTask


                });
            }

            assertOpenEventually(listenerLatch, 30);

            assertTrueEventually(new AssertTask() {
                @Override
                public void run() throws Exception {
                    assertEquals(0, hz.getClientService().getConnectedClients().size());
                }
            }, 10);
            assertTrueEventually(new AssertTask() {
                @Override
                public void run() throws Exception {
                    assertEquals(0, hz2.getClientService().getConnectedClients().size());
                }
            }, 10);
View Full Code Here


        }
    }

    private void assertClientConnected(ClientService... services) {
        for (final ClientService service : services) {
            assertTrueEventually(new AssertTask() {
                @Override
                public void run() throws Exception {
                    assertEquals(1, service.getConnectedClients().size());
                }
            }, 5);
View Full Code Here

        for (int i = 0; i < count; i++) {
            map.put(i, 2);
        }
        for (int i = 0; i < count; i++) {
            final int index = i;
            assertTrueEventually(new AssertTask() {
                @Override
                public void run() throws Exception {
                    final Integer valueInMap = map.get(index);
                    final Integer valueInStore = (Integer) store.getStore().get(index);
View Full Code Here

        HazelcastInstance h1 = createHazelcastInstance(config);
        final IMap map = h1.getMap("default");

        final int total = 10;

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(TestEventBasedMapStore.STORE_EVENTS.LOAD_ALL_KEYS, testMapStore.getEvents().poll());
            }
        });

        for (int i = 0; i < total; i++) {
            map.put(i, "value" + i);
        }

        sleepSeconds(11);
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(0, map.size());
            }
        });
View Full Code Here

        for (int i = 0; i < populationCount; i++) {
            map.put(i, "value" + i);
        }
        //wait for all store ops.
        assertOpenEventually(testMapStore.storeLatch);
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(0, writeBehindQueueSize(node1, mapName));
            }
        });
View Full Code Here

        HazelcastInstance h2 = nodeFactory.newHazelcastInstance(config);
        IMap<Object, Object> map = h1.getMap("map");
        map.put("key", "value");
        Thread.sleep(2000);
        map.put("key", "value2");
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals("value2", testMapStore.getStore().get("key"));
            }
        });
View Full Code Here

        testMapStore.setLoadAllKeys(false);
        Config config = newConfig(testMapStore, 1);
        HazelcastInstance h1 = createHazelcastInstance(config);
        IMap map = h1.getMap("default");

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(TestEventBasedMapStore.STORE_EVENTS.LOAD_ALL_KEYS, testMapStore.getEvents().poll());
            }
        });

        map.put("1", "value1");

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(TestEventBasedMapStore.STORE_EVENTS.LOAD, testMapStore.getEvents().poll());
            }
        });

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(TestEventBasedMapStore.STORE_EVENTS.STORE, testMapStore.getEvents().poll());
            }
        });

        map.remove("1");

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(TestEventBasedMapStore.STORE_EVENTS.DELETE, testMapStore.getEvents().poll());
            }
        });
View Full Code Here

                .insert("key3", 47);

        HazelcastInstance instance = createHazelcastInstance(newConfig(testMapStore, 0));
        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"));
View Full Code Here

        // shutdown node2.
        node2.getLifecycleService().shutdown();
        // wait store ops. finish.
        mapStore.awaitStores();
        // we should see at least expected store count.
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                int storeOperationCount = mapStore.count.intValue();
                assertTrue("expected : " + expectedStoreCount
                        + ", actual : " + storeOperationCount, expectedStoreCount <= storeOperationCount);
View Full Code Here

        for (int i = 0; i < size2; i++) {
            map.put("key" + i, "value" + i);
        }


        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals("value" + (size1 - 1), testMapStore.getStore().get("key"));
            }
        });
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals("value" + (size2 - 1), testMapStore.getStore().get("key" + (size2 - 1)));
            }
        });
View Full Code Here

TOP

Related Classes of com.hazelcast.test.AssertTask

Copyright © 2018 www.massapicom. 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.