use of com.hazelcast.map.listener.EntryAddedListener in project hazelcast by hazelcast.
the class EntryEventDataCacheTest method createInvalidationEventRejectingFilter.
private static EventListenerFilter createInvalidationEventRejectingFilter() {
ListenerAdapter listenerAdapter = createListenerAdapter(new EntryAddedListener() {
@Override
public void entryAdded(EntryEvent event) {
}
});
int flags = setAndGetListenerFlags(listenerAdapter);
return new EventListenerFilter(flags, TrueEventFilter.INSTANCE);
}
use of com.hazelcast.map.listener.EntryAddedListener in project hazelcast by hazelcast.
the class QueryCacheIMapEventHandlingTest method testEvent_EXPIRED.
@Test
public void testEvent_EXPIRED() throws Exception {
int key = 1;
int value = 1;
final CountDownLatch latch = new CountDownLatch(1);
queryCache.addEntryListener(new EntryAddedListener() {
@Override
public void entryAdded(EntryEvent event) {
latch.countDown();
}
}, true);
map.put(key, value, 1, SECONDS);
latch.await();
sleepSeconds(1);
// map#get creates EXPIRED event
map.get(key);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(0, queryCache.size());
}
});
}
use of com.hazelcast.map.listener.EntryAddedListener in project hazelcast by hazelcast.
the class ClientQueryCacheEventHandlingTest method testEvent_EXPIRED.
@Test
public void testEvent_EXPIRED() throws Exception {
int key = 1;
int value = 1;
final CountDownLatch latch = new CountDownLatch(1);
queryCache.addEntryListener(new EntryAddedListener() {
@Override
public void entryAdded(EntryEvent event) {
latch.countDown();
}
}, true);
map.put(key, value, 1, SECONDS);
latch.await();
sleepSeconds(1);
// map#get creates EXPIRED event
map.get(key);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(0, queryCache.size());
}
});
}
Aggregations