Search in sources :

Example 6 with PlanCache

use of com.hazelcast.sql.impl.plan.cache.PlanCache in project hazelcast by hazelcast.

the class PlanCacheTest method testOverflow.

@Test
public void testOverflow() {
    // Fill till full
    int size = 5;
    PlanCache cache = new PlanCache(size);
    for (int i = 0; i < size; i++) {
        PlanKey key = createKey(Integer.toString(i));
        cache.put(key, createPlan(key, PART_MAP_1));
        advanceTime();
    }
    assertEquals(size, cache.size());
    // Overflow happens here
    PlanKey overflowKey = createKey(Integer.toString(size));
    cache.put(overflowKey, createPlan(overflowKey, PART_MAP_1));
    assertEquals(size, cache.size());
    for (int i = 0; i < size; i++) {
        PlanKey key = createKey(Integer.toString(i + 1));
        assertNotNull(cache.get(key));
    }
}
Also used : PlanKey(com.hazelcast.sql.impl.optimizer.PlanKey) PlanCache(com.hazelcast.sql.impl.plan.cache.PlanCache) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

PlanCache (com.hazelcast.sql.impl.plan.cache.PlanCache)6 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 Test (org.junit.Test)5 SqlPlan (com.hazelcast.sql.impl.optimizer.SqlPlan)4 PlanKey (com.hazelcast.sql.impl.optimizer.PlanKey)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 After (org.junit.After)1