Search in sources :

Example 31 with ListenerConfig

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

the class TestReplicatedMapApplicationContext method testReplicatedMapConfig.

@Test
public void testReplicatedMapConfig() {
    ReplicatedMapConfig replicatedMapConfig = instance.getConfig().getReplicatedMapConfig("replicatedMap");
    assertNotNull(replicatedMapConfig);
    assertEquals(3, replicatedMapConfig.getConcurrencyLevel());
    assertEquals("OBJECT", InMemoryFormat.OBJECT.name());
    assertTrue(replicatedMapConfig.isAsyncFillup());
    assertFalse(replicatedMapConfig.isStatisticsEnabled());
    assertEquals(10, replicatedMapConfig.getReplicationDelayMillis());
    List<ListenerConfig> listenerConfigs = replicatedMapConfig.getListenerConfigs();
    assertEquals(1, listenerConfigs.size());
    assertEquals("com.hazelcast.spring.DummyEntryListener", listenerConfigs.get(0).getClassName());
}
Also used : ListenerConfig(com.hazelcast.config.ListenerConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 32 with ListenerConfig

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

the class TestFullApplicationContext method testReplicatedMapConfig.

@Test
public void testReplicatedMapConfig() {
    assertNotNull(config);
    assertEquals(1, config.getReplicatedMapConfigs().size());
    ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig("replicatedMap");
    assertNotNull(replicatedMapConfig);
    assertEquals("replicatedMap", replicatedMapConfig.getName());
    assertEquals(200, replicatedMapConfig.getReplicationDelayMillis());
    assertEquals(16, replicatedMapConfig.getConcurrencyLevel());
    assertEquals(InMemoryFormat.OBJECT, replicatedMapConfig.getInMemoryFormat());
    assertFalse(replicatedMapConfig.isStatisticsEnabled());
    assertFalse(replicatedMapConfig.isAsyncFillup());
    replicatedMapConfig.getListenerConfigs();
    for (ListenerConfig listener : replicatedMapConfig.getListenerConfigs()) {
        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());
        }
    }
}
Also used : EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 33 with ListenerConfig

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

the class TestFullApplicationContext method testConfigListeners.

@Test
public void testConfigListeners() {
    assertNotNull(membershipListener);
    List<ListenerConfig> list = config.getListenerConfigs();
    assertEquals(2, list.size());
    for (ListenerConfig lc : list) {
        if (lc.getClassName() != null) {
            assertNull(lc.getImplementation());
            assertEquals(DummyMembershipListener.class.getName(), lc.getClassName());
        } else {
            assertNotNull(lc.getImplementation());
            assertEquals(membershipListener, lc.getImplementation());
        }
    }
}
Also used : EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 34 with ListenerConfig

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

the class TestFullApplicationContext method testTopicConfig.

@Test
public void testTopicConfig() {
    TopicConfig testTopicConfig = config.getTopicConfig("testTopic");
    assertNotNull(testTopicConfig);
    assertEquals("testTopic", testTopicConfig.getName());
    assertEquals(1, testTopicConfig.getMessageListenerConfigs().size());
    assertEquals(true, testTopicConfig.isGlobalOrderingEnabled());
    assertEquals(false, testTopicConfig.isStatisticsEnabled());
    ListenerConfig listenerConfig = testTopicConfig.getMessageListenerConfigs().get(0);
    assertEquals("com.hazelcast.spring.DummyMessageListener", listenerConfig.getClassName());
}
Also used : EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) TopicConfig(com.hazelcast.config.TopicConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 35 with ListenerConfig

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

the class XmlClientConfigBuilderTest method testLeftovers.

@Test
public void testLeftovers() {
    assertEquals(40, clientConfig.getExecutorPoolSize());
    assertEquals("com.hazelcast.security.UsernamePasswordCredentials", clientConfig.getSecurityConfig().getCredentialsClassname());
    assertEquals(40, clientConfig.getExecutorPoolSize());
    assertEquals("com.hazelcast.client.util.RandomLB", clientConfig.getLoadBalancer().getClass().getName());
    final List<ListenerConfig> listenerConfigs = clientConfig.getListenerConfigs();
    assertEquals(3, listenerConfigs.size());
    assertContains(listenerConfigs, new ListenerConfig("com.hazelcast.examples.MembershipListener"));
    assertContains(listenerConfigs, new ListenerConfig("com.hazelcast.examples.InstanceListener"));
    assertContains(listenerConfigs, new ListenerConfig("com.hazelcast.examples.MigrationListener"));
}
Also used : ListenerConfig(com.hazelcast.config.ListenerConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest)

Aggregations

ListenerConfig (com.hazelcast.config.ListenerConfig)46 Test (org.junit.Test)43 QuickTest (com.hazelcast.test.annotation.QuickTest)40 Config (com.hazelcast.config.Config)30 HazelcastInstance (com.hazelcast.core.HazelcastInstance)30 ParallelTest (com.hazelcast.test.annotation.ParallelTest)29 CountDownLatch (java.util.concurrent.CountDownLatch)22 AssertTask (com.hazelcast.test.AssertTask)11 ClientConfig (com.hazelcast.client.config.ClientConfig)10 NightlyTest (com.hazelcast.test.annotation.NightlyTest)9 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)8 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)7 RingbufferConfig (com.hazelcast.config.RingbufferConfig)6 LifecycleListener (com.hazelcast.core.LifecycleListener)6 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)5 LifecycleEvent (com.hazelcast.core.LifecycleEvent)5 ItemListenerConfig (com.hazelcast.config.ItemListenerConfig)4 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)4 ClientListener (com.hazelcast.core.ClientListener)4 InternalPartition (com.hazelcast.internal.partition.InternalPartition)4