Search in sources :

Example 31 with QueryCacheConfig

use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.

the class XmlClientConfigBuilderTest method testQueryCacheFullConfig.

@Test
public void testQueryCacheFullConfig() throws Exception {
    QueryCacheConfig queryCacheConfig = clientConfig.getQueryCacheConfigs().get("map-name").get("query-cache-name");
    EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);
    assertEquals("query-cache-name", queryCacheConfig.getName());
    assertTrue(entryListenerConfig.isIncludeValue());
    assertFalse(entryListenerConfig.isLocal());
    assertEquals("com.hazelcast.examples.EntryListener", entryListenerConfig.getClassName());
    assertTrue(queryCacheConfig.isIncludeValue());
    assertEquals(1, queryCacheConfig.getBatchSize());
    assertEquals(16, queryCacheConfig.getBufferSize());
    assertEquals(0, queryCacheConfig.getDelaySeconds());
    assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
    assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT, queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
    assertEquals(10000, queryCacheConfig.getEvictionConfig().getSize());
    assertEquals(InMemoryFormat.BINARY, queryCacheConfig.getInMemoryFormat());
    assertFalse(queryCacheConfig.isCoalesce());
    assertTrue(queryCacheConfig.isPopulate());
    for (MapIndexConfig mapIndexConfig : queryCacheConfig.getIndexConfigs()) {
        assertEquals("name", mapIndexConfig.getAttribute());
        assertFalse(mapIndexConfig.isOrdered());
    }
    assertEquals("com.hazelcast.examples.ExamplePredicate", queryCacheConfig.getPredicateConfig().getClassName());
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest)

Aggregations

QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)31 MapConfig (com.hazelcast.config.MapConfig)16 Config (com.hazelcast.config.Config)14 QuickTest (com.hazelcast.test.annotation.QuickTest)13 Test (org.junit.Test)13 HazelcastInstance (com.hazelcast.core.HazelcastInstance)12 ParallelTest (com.hazelcast.test.annotation.ParallelTest)10 ClientConfig (com.hazelcast.client.config.ClientConfig)6 SqlPredicate (com.hazelcast.query.SqlPredicate)6 PredicateConfig (com.hazelcast.config.PredicateConfig)5 AssertTask (com.hazelcast.test.AssertTask)4 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)4 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)3 EventLostEvent (com.hazelcast.map.EventLostEvent)3 QueryCache (com.hazelcast.map.QueryCache)3 EventLostListener (com.hazelcast.map.listener.EventLostListener)3 Employee (com.hazelcast.mapreduce.helpers.Employee)3 Before (org.junit.Before)3 EvictionConfig (com.hazelcast.config.EvictionConfig)2 NearCacheConfig (com.hazelcast.config.NearCacheConfig)2