Search in sources :

Example 21 with PredicateConfig

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

the class QueryCacheIndexConfigTest method testIndexConfigIsRespected.

@Test
public void testIndexConfigIsRespected() {
    IndexConfig indexConfig = IndexUtils.createTestIndexConfig(IndexType.SORTED, "field");
    final Config config = new Config();
    final MapConfig mapConfig = new MapConfig("map").addQueryCacheConfig(new QueryCacheConfig().setName("query-cache").setPredicateConfig(new PredicateConfig(Predicates.alwaysTrue())).addIndexConfig(indexConfig));
    config.addMapConfig(mapConfig);
    final HazelcastInstance instance = createHazelcastInstance(config);
    final IMap<Object, Object> map = instance.getMap("map");
    final DefaultQueryCache<Object, Object> cache = (DefaultQueryCache<Object, Object>) map.getQueryCache("query-cache");
    assertNotNull(cache.indexes.getIndex(indexConfig.getName()));
    assertTrue(cache.indexes.getIndex(indexConfig.getName()).isOrdered());
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig) PredicateConfig(com.hazelcast.config.PredicateConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) PredicateConfig(com.hazelcast.config.PredicateConfig) MapConfig(com.hazelcast.config.MapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

PredicateConfig (com.hazelcast.config.PredicateConfig)21 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)14 Config (com.hazelcast.config.Config)11 MapConfig (com.hazelcast.config.MapConfig)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 Test (org.junit.Test)7 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 Employee (com.hazelcast.map.impl.querycache.utils.Employee)6 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)5 NearCacheConfig (com.hazelcast.config.NearCacheConfig)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 AttributeConfig (com.hazelcast.config.AttributeConfig)3 IndexConfig (com.hazelcast.config.IndexConfig)3 Before (org.junit.Before)3 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)2 AwsConfig (com.hazelcast.config.AwsConfig)2 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)2 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)2