use of com.hazelcast.map.impl.MapListenerAdapter in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddEntryListenerWithMapListenerAndPredicate_NullPredicate.
@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithMapListenerAndPredicate_NullPredicate() throws Exception {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addEntryListener(mapListener, predicate, true);
}
use of com.hazelcast.map.impl.MapListenerAdapter in project hazelcast by hazelcast.
the class MapListenerAdapterTest method testMapListenerAdapter_whenEntryExpired.
@Test
public void testMapListenerAdapter_whenEntryExpired() {
String mapName = randomMapName();
Config cfg = new Config();
TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(1);
HazelcastInstance instance = instanceFactory.newHazelcastInstance(cfg);
IMap map = instance.getMap(mapName);
final CountDownLatch expirationLatch = new CountDownLatch(1);
map.addEntryListener(new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
expirationLatch.countDown();
}
}, false);
map.put(1, 1, 100, TimeUnit.MILLISECONDS);
sleepSeconds(1);
// trigger immediate expiration.
map.get(1);
assertOpenEventually(expirationLatch);
}
use of com.hazelcast.map.impl.MapListenerAdapter in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate.
@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate() {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addEntryListener(mapListener, predicate, null, true);
}
use of com.hazelcast.map.impl.MapListenerAdapter in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddLocalEntryListenerWithMapListenerAndPredicate_NullPredicate.
@Test(expected = NullPointerException.class)
public void testAddLocalEntryListenerWithMapListenerAndPredicate_NullPredicate() {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addLocalEntryListener(mapListener, predicate, true);
}
use of com.hazelcast.map.impl.MapListenerAdapter in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddEntryListenerWithMapListenerAndPredicate_NullPredicate.
@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithMapListenerAndPredicate_NullPredicate() {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addEntryListener(mapListener, predicate, true);
}
Aggregations