Package com.hazelcast.core

Examples of com.hazelcast.core.IMap


        assertEquals(size, stats.getHits());
    }

    @Test
    public void testGetAsyncPopulatesNearCache() throws Exception {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_NO_INVALIDATION));

        int size = 1239;
        for (int i = 0; i < size; i++) {
            map.put(i, i);
        }
        //populate near cache
        for (int i = 0; i < size; i++) {
            Future async = map.getAsync(i);
            async.get();
        }
        //generate near cache hits
        for (int i = 0; i < size; i++) {
            map.get(i);
        }
        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertEquals(size, stats.getOwnedEntryCount());
    }
View Full Code Here


        assertEquals(size, stats.getOwnedEntryCount());
    }

    @Test
    public void testRemovedKeyValueNotInNearCache() throws Exception {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_INVALIDATION));

        int size = 1247;
        populateNearCache(map, size);

        for (int i = 0; i < size; i++) {
            map.remove(i);
            assertNull(map.get(i));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testNearCachePopulatedAndHitsGenerated() throws Exception {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_NO_INVALIDATION));

        final int size = 1278;
        for (int i = 0; i < size; i++) {
            map.put(i, i);
            map.get(i)//populate near cache
            map.get(i)//generate near cache hits
        }

        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        System.out.println("stats = " + stats);
        assertEquals(size, stats.getOwnedEntryCount());
        assertEquals(size, stats.getHits());
    }
View Full Code Here

        assertEquals(size, stats.getHits());
    }

    @Test
    public void testNearCachePopulatedAndHitsGenerated2() throws Exception {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_NO_INVALIDATION));

        final int size = 1278;
        populateNearCache(map, size);

        for (int i = 0; i < size; i++) {
            map.get(i)//generate near cache hits
        }

        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        System.out.println("stats = " + stats);
        assertEquals(size, stats.getOwnedEntryCount());
        assertEquals(size, stats.getHits());
    }
View Full Code Here

        assertEquals(size, stats.getHits());
    }

    @Test
    public void testIssue2009() throws Exception {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_INVALIDATION));
        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertNotNull(stats);
    }
View Full Code Here

        assertNotNull(stats);
    }

    @Test
    public void testGetNearCacheStatsBeforePopulation() {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_NO_INVALIDATION));
        final int size = 101;
        for (int i = 0; i < size; i++) {
            map.put(i, i);
        }
        final NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertNotNull(stats);
    }
View Full Code Here

        assertNotNull(stats);
    }

    @Test
    public void testNearCacheMisses() {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_NO_INVALIDATION));

        final int size = 1321;
        for (int i = 0; i < size; i++) {
            map.get("NotThere" + i);
        }
        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertEquals(size, stats.getMisses());
        assertEquals(size, stats.getOwnedEntryCount());
    }
View Full Code Here

        assertEquals(size, stats.getOwnedEntryCount());
    }

    @Test
    public void testNearCacheMisses_whenRepeatedOnSameKey() {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_INVALIDATION));

        final int size = 17;
        for (int i = 0; i < size; i++) {
            map.get("NOT_THERE");
        }

        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertEquals(1, stats.getOwnedEntryCount());
        assertEquals(size, stats.getMisses());
    }
View Full Code Here

        assertEquals(size, stats.getMisses());
    }

    @Test
    public void testMapRemove_WithNearCache() {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_INVALIDATION));

        final int size = 1113;
        populateNearCache(map, size);

        for (int i = 0; i < size; i++) {
            map.remove(i);
        }

        NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
        assertEquals(size, stats.getMisses());
        assertEquals(0, stats.getOwnedEntryCount());
    }
View Full Code Here

        assertEquals(0, stats.getOwnedEntryCount());
    }

    @Test
    public void testNearCacheMaxSize() {
        final IMap map = client.getMap(randomMapName(NEAR_CACHE_WITH_MAX_SIZE));

        populateNearCache(map, MAX_CACHE_SIZE + 1);

        HazelcastTestSupport.assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                final NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
                assertTrue(MAX_CACHE_SIZE > stats.getOwnedEntryCount());
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.IMap

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.