Package com.hazelcast.test

Examples of com.hazelcast.test.AssertTask


        final int partitionId = hz1.getPartitionService().getPartition(1).getPartitionId();

        final ICacheRecordStore recordStore1 = cacheServiceHz1.getOrCreateCache("/hz/" + cacheName, partitionId);
        final ICacheRecordStore recordStore2 = cacheServiceHz2.getOrCreateCache("/hz/" + cacheName, partitionId);

        assertTrueEventually(new AssertTask() {
            @Override
            public void run()
                    throws Exception {
                CacheRecord record1 = recordStore1.getRecord(key);
                CacheRecord record2 = recordStore2.getRecord(key);
View Full Code Here


        instances[0].getMultiMap(name).put("key4", "val4");
        instances[0].getMultiMap(name).put("key5", "val5");
        instances[0].getMultiMap(name).put("key6", "val6");
        instances[0].getMultiMap(name).put("key7", "val7");
        instances[0].getMultiMap(name).put("key8", "val8");
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                instances[0].getMultiMap(name).localKeySet().containsAll(keys);
            }
        });
        if (keys.size() != 0) {
            instances[0].getMultiMap(name).remove(keys.iterator().next());
        }
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                instances[0].getMultiMap(name).localKeySet().containsAll(keys);
            }
        });
View Full Code Here

    public void testMemcacheTTL() throws IOException, ExecutionException, InterruptedException {
        final HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
        final MemcachedClient client = getMemcacheClient(instance);
        try {
            client.set(String.valueOf(0), 5, 10).get();
            assertTrueEventually(new AssertTask() {
                @Override
                public void run() throws Exception {
                    assertEquals(null, client.get(String.valueOf(0)));
                }
            });
View Full Code Here

        hz = new TestHazelcastInstanceFactory(1).newHazelcastInstance(config);
        mbs = ManagementFactory.getPlatformMBeanServer();
    }

    public void assertMBeanExistEventually(final String type, final String name) {
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                ObjectName object = getObjectName(type, name);
                try {
                    mbs.getObjectInstance(object);
View Full Code Here

            thread.join();
        }

        System.out.println("All publish threads have completed");

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() {
                for (int topicIndex = 0; topicIndex < TOPIC_COUNT; topicIndex++) {
                    String topicName = getTopicName(topicIndex);
                    long expected = getExpectedCount(topicName);
View Full Code Here

        topic.destroy();

        final TopicService topicService = getNode(instance).nodeEngine.getService(TopicService.SERVICE_NAME);

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() {
                boolean containsStats = topicService.getStatsMap().containsKey(topic.getName());
                assertFalse(containsStats);
            }
View Full Code Here

        for (int i = 0; i < k; i++) {
            HazelcastInstance instance = instances[i];
            instance.getTopic(name).publish(instance.getCluster().getLocalMember());
        }

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() {
                assertEquals(k, count.get());
                assertEquals(k * k, count1.get());
                assertEquals(k, count2.get());
View Full Code Here

            topic.publish(message + "1");
            cp.await();
            topic.removeMessageListener(id);
            topic.publish(message + "2");

            assertTrueEventually(new AssertTask() {
                @Override
                public void run() {
                    assertEquals(1, latch.getCount());
                }
            });
View Full Code Here

    public void testAcquire_whenNoPermits() throws InterruptedException {
        final ISemaphore semaphore = hz.getSemaphore(randomString());
        semaphore.init(0);
        final AcquireThread acquireThread = new AcquireThread(semaphore);
        acquireThread.start();
        assertTrueAllTheTime(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertTrue(acquireThread.isAlive());
                assertEquals(0, semaphore.availablePermits());
            }
View Full Code Here

                }
            }
        }.start();
        semaphore.release();

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(0, semaphore.availablePermits());
            }
        });
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.