Search in sources :

Example 16 with EntryListenerConfig

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

the class ListenerTest method hazelcastAwareEntryListener_whenConfiguredViaClassName_thenInjectHazelcastInstance.

@Test
public void hazelcastAwareEntryListener_whenConfiguredViaClassName_thenInjectHazelcastInstance() throws InterruptedException {
    EntryListenerConfig listenerConfig = new EntryListenerConfig("com.hazelcast.map.ListenerTest$PingPongListener", false, true);
    hazelcastAwareEntryListener_injectHazelcastInstance(listenerConfig);
}
Also used : EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with EntryListenerConfig

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

the class MultiMapListenerTest method testConfigListenerRegistration.

@Test
public void testConfigListenerRegistration() throws InterruptedException {
    Config config = new Config();
    final String name = "default";
    final CountDownLatch latch = new CountDownLatch(1);
    config.getMultiMapConfig(name).addEntryListenerConfig(new EntryListenerConfig().setImplementation(new EntryAdapter() {

        public void entryAdded(EntryEvent event) {
            latch.countDown();
        }
    }));
    final HazelcastInstance hz = createHazelcastInstance(config);
    hz.getMultiMap(name).put(1, 1);
    assertTrue(latch.await(10, TimeUnit.SECONDS));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MultiMapConfig(com.hazelcast.config.MultiMapConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) Config(com.hazelcast.config.Config) EntryAdapter(com.hazelcast.core.EntryAdapter) EntryEvent(com.hazelcast.core.EntryEvent) CountDownLatch(java.util.concurrent.CountDownLatch) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)17 QuickTest (com.hazelcast.test.annotation.QuickTest)12 Test (org.junit.Test)12 ParallelTest (com.hazelcast.test.annotation.ParallelTest)6 Config (com.hazelcast.config.Config)5 MapConfig (com.hazelcast.config.MapConfig)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)4 EntryAdapter (com.hazelcast.core.EntryAdapter)4 EntryEvent (com.hazelcast.core.EntryEvent)4 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)3 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)3 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 MapIndexConfig (com.hazelcast.config.MapIndexConfig)2 NearCacheConfig (com.hazelcast.config.NearCacheConfig)2 AssertTask (com.hazelcast.test.AssertTask)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 MapAttributeConfig (com.hazelcast.config.MapAttributeConfig)1