use of com.hazelcast.config.EntryListenerConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method testFullQueryCacheConfig.
@Test
public void testFullQueryCacheConfig() throws Exception {
ClientConfig config = client6.getClientConfig();
QueryCacheConfig queryCacheConfig = getQueryCacheConfig(config);
EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);
assertTrue(entryListenerConfig.isIncludeValue());
assertFalse(entryListenerConfig.isLocal());
assertEquals("com.hazelcast.spring.DummyEntryListener", entryListenerConfig.getClassName());
assertFalse(queryCacheConfig.isIncludeValue());
assertEquals("my-query-cache-1", queryCacheConfig.getName());
assertEquals(12, queryCacheConfig.getBatchSize());
assertEquals(33, queryCacheConfig.getBufferSize());
assertEquals(12, queryCacheConfig.getDelaySeconds());
assertEquals(InMemoryFormat.OBJECT, queryCacheConfig.getInMemoryFormat());
assertTrue(queryCacheConfig.isCoalesce());
assertFalse(queryCacheConfig.isPopulate());
assertEquals("__key > 12", queryCacheConfig.getPredicateConfig().getSql());
assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT, queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
assertEquals(111, queryCacheConfig.getEvictionConfig().getSize());
}
use of com.hazelcast.config.EntryListenerConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testFullQueryCacheConfig.
@Test
public void testFullQueryCacheConfig() {
MapConfig mapConfig = config.getMapConfig("map-with-query-cache");
QueryCacheConfig queryCacheConfig = mapConfig.getQueryCacheConfigs().get(0);
EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);
assertTrue(entryListenerConfig.isIncludeValue());
assertFalse(entryListenerConfig.isLocal());
assertEquals("com.hazelcast.spring.DummyEntryListener", entryListenerConfig.getClassName());
assertFalse(queryCacheConfig.isIncludeValue());
assertEquals("my-query-cache-1", queryCacheConfig.getName());
assertEquals(12, queryCacheConfig.getBatchSize());
assertEquals(33, queryCacheConfig.getBufferSize());
assertEquals(12, queryCacheConfig.getDelaySeconds());
assertEquals(InMemoryFormat.OBJECT, queryCacheConfig.getInMemoryFormat());
assertTrue(queryCacheConfig.isCoalesce());
assertFalse(queryCacheConfig.isPopulate());
assertIndexesEqual(queryCacheConfig);
assertEquals("__key > 12", queryCacheConfig.getPredicateConfig().getSql());
assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT, queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
assertEquals(111, queryCacheConfig.getEvictionConfig().getSize());
}
use of com.hazelcast.config.EntryListenerConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testMultimapConfig.
@Test
public void testMultimapConfig() {
MultiMapConfig testMultiMapConfig = config.getMultiMapConfig("testMultimap");
assertEquals(MultiMapConfig.ValueCollectionType.LIST, testMultiMapConfig.getValueCollectionType());
assertEquals(2, testMultiMapConfig.getEntryListenerConfigs().size());
assertFalse(testMultiMapConfig.isBinary());
assertFalse(testMultiMapConfig.isStatisticsEnabled());
for (EntryListenerConfig listener : testMultiMapConfig.getEntryListenerConfigs()) {
if (listener.getClassName() != null) {
assertNull(listener.getImplementation());
assertTrue(listener.isIncludeValue());
assertFalse(listener.isLocal());
} else {
assertNotNull(listener.getImplementation());
assertEquals(entryListener, listener.getImplementation());
assertTrue(listener.isLocal());
assertTrue(listener.isIncludeValue());
}
}
}
use of com.hazelcast.config.EntryListenerConfig in project hazelcast by hazelcast.
the class QueryCacheConfigBuilderHelper method handleEntryListeners.
private void handleEntryListeners(QueryCacheConfig queryCacheConfig, Node childNode) {
for (Node listenerNode : childElements(childNode)) {
if ("entry-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap listenerNodeAttributes = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(listenerNodeAttributes.getNamedItem("include-value")));
boolean local = getBooleanValue(getTextContent(listenerNodeAttributes.getNamedItem("local")));
String listenerClass = getTextContent(listenerNode);
queryCacheConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
}
}
}
use of com.hazelcast.config.EntryListenerConfig in project hazelcast by hazelcast.
the class AbstractQueryCacheConfigurator method setEntryListener.
protected void setEntryListener(String mapName, String cacheName, QueryCacheConfig config) {
for (EntryListenerConfig listenerConfig : config.getEntryListenerConfigs()) {
MapListener listener = getListener(listenerConfig);
if (listener != null) {
EventFilter filter = new EntryEventFilter(listenerConfig.isIncludeValue(), null);
eventService.addListener(mapName, cacheName, listener, filter);
}
}
}
Aggregations