Search in sources :

Example 21 with MapIndexConfig

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

the class QueryCacheConfigBuilderHelper method queryCacheIndexesHandle.

private void queryCacheIndexesHandle(Node n, QueryCacheConfig queryCacheConfig) {
    for (Node indexNode : childElements(n)) {
        if ("index".equals(cleanNodeName(indexNode))) {
            final NamedNodeMap attrs = indexNode.getAttributes();
            boolean ordered = getBooleanValue(getTextContent(attrs.getNamedItem("ordered")));
            String attribute = getTextContent(indexNode);
            queryCacheConfig.addIndexConfig(new MapIndexConfig(attribute, ordered));
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) MapIndexConfig(com.hazelcast.config.MapIndexConfig) Node(org.w3c.dom.Node)

Example 22 with MapIndexConfig

use of com.hazelcast.config.MapIndexConfig 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

MapIndexConfig (com.hazelcast.config.MapIndexConfig)22 Config (com.hazelcast.config.Config)17 MapConfig (com.hazelcast.config.MapConfig)14 QuickTest (com.hazelcast.test.annotation.QuickTest)12 Test (org.junit.Test)12 ParallelTest (com.hazelcast.test.annotation.ParallelTest)10 MapStoreConfig (com.hazelcast.config.MapStoreConfig)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 EntryObject (com.hazelcast.query.EntryObject)3 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2 SampleObjects (com.hazelcast.query.SampleObjects)2 SqlPredicate (com.hazelcast.query.SqlPredicate)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 Collection (java.util.Collection)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 StaticLB (com.hazelcast.client.util.StaticLB)1 ListenerConfig (com.hazelcast.config.ListenerConfig)1 MapAttributeConfig (com.hazelcast.config.MapAttributeConfig)1 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)1