Search in sources :

Example 6 with ClientEventRegistration

use of com.hazelcast.client.spi.impl.listener.ClientEventRegistration in project hazelcast by hazelcast.

the class ListenerLeakTestNonSmartRouting method testTopicMessageListener.

@Test
public void testTopicMessageListener() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    ITopic<Object> topic = client.getTopic(randomString());
    String id = topic.addMessageListener(mock(MessageListener.class));
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(topic.removeMessageListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) MessageListener(com.hazelcast.core.MessageListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with ClientEventRegistration

use of com.hazelcast.client.spi.impl.listener.ClientEventRegistration in project hazelcast by hazelcast.

the class ListenerLeakTestNonSmartRouting method testMapPartitionLostListeners.

@Test
public void testMapPartitionLostListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    IMap map = client.getMap(randomString());
    String id = map.addPartitionLostListener(mock(MapPartitionLostListener.class));
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(map.removePartitionLostListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : IMap(com.hazelcast.core.IMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapPartitionLostListener(com.hazelcast.map.listener.MapPartitionLostListener) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with ClientEventRegistration

use of com.hazelcast.client.spi.impl.listener.ClientEventRegistration in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testSetListeners.

@Test
public void testSetListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    ISet<Object> set = client.getSet(randomString());
    String id = set.addItemListener(mock(ItemListener.class), false);
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(set.removeItemListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) ItemListener(com.hazelcast.core.ItemListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with ClientEventRegistration

use of com.hazelcast.client.spi.impl.listener.ClientEventRegistration in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testMapEntryListeners.

@Test
public void testMapEntryListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    IMap map = client.getMap(randomString());
    String id = map.addEntryListener(mock(MapListener.class), false);
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(map.removeEntryListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : IMap(com.hazelcast.core.IMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapListener(com.hazelcast.map.listener.MapListener) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with ClientEventRegistration

use of com.hazelcast.client.spi.impl.listener.ClientEventRegistration in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testReplicatedMapListeners.

@Test
public void testReplicatedMapListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    ReplicatedMap<Object, Object> replicatedMap = client.getReplicatedMap(randomString());
    String id = replicatedMap.addEntryListener(mock(EntryListener.class));
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(replicatedMap.removeEntryListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) EntryListener(com.hazelcast.core.EntryListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ClientEventRegistration (com.hazelcast.client.spi.impl.listener.ClientEventRegistration)19 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 Node (com.hazelcast.instance.Node)18 ParallelTest (com.hazelcast.test.annotation.ParallelTest)18 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Test (org.junit.Test)18 ItemListener (com.hazelcast.core.ItemListener)6 EntryListener (com.hazelcast.core.EntryListener)4 IMap (com.hazelcast.core.IMap)4 DistributedObjectListener (com.hazelcast.core.DistributedObjectListener)2 MessageListener (com.hazelcast.core.MessageListener)2 MultiMap (com.hazelcast.core.MultiMap)2 MapListener (com.hazelcast.map.listener.MapListener)2 MapPartitionLostListener (com.hazelcast.map.listener.MapPartitionLostListener)2 Member (com.hazelcast.core.Member)1 Connection (com.hazelcast.nio.Connection)1 AssertTask (com.hazelcast.test.AssertTask)1 Collection (java.util.Collection)1