Search in sources :

Example 6 with ClientConnectionRegistration

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

the class ListenerLeakTest method testListListeners.

@Test
public void testListListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    IList<Object> list = client.getList(randomString());
    UUID id = list.addItemListener(mock(ItemListener.class), false);
    Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(list.removeItemListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) ItemListener(com.hazelcast.collection.ItemListener) UUID(java.util.UUID) ClientConnectionRegistration(com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with ClientConnectionRegistration

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

the class ListenerLeakTest method testMultiMapEntryListeners.

@Test
public void testMultiMapEntryListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    MultiMap multiMap = client.getMultiMap(randomString());
    UUID id = multiMap.addEntryListener(mock(EntryListener.class), false);
    Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(multiMap.removeEntryListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) UUID(java.util.UUID) EntryListener(com.hazelcast.core.EntryListener) ClientConnectionRegistration(com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with ClientConnectionRegistration

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

the class ListenerLeakTest method testReplicatedMapListeners.

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

Example 9 with ClientConnectionRegistration

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

the class ListenerLeakTest method testQueueListeners.

@Test
public void testQueueListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    IQueue<Object> queue = client.getQueue(randomString());
    UUID id = queue.addItemListener(mock(ItemListener.class), false);
    Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(queue.removeItemListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) ItemListener(com.hazelcast.collection.ItemListener) UUID(java.util.UUID) ClientConnectionRegistration(com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 10 with ClientConnectionRegistration

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

the class ListenerLeakTest method testSetListeners.

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

Aggregations

ClientConnectionRegistration (com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 Node (com.hazelcast.instance.impl.Node)9 Accessors.getNode (com.hazelcast.test.Accessors.getNode)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 UUID (java.util.UUID)9 Test (org.junit.Test)9 ItemListener (com.hazelcast.collection.ItemListener)3 EntryListener (com.hazelcast.core.EntryListener)2 IMap (com.hazelcast.map.IMap)2 Member (com.hazelcast.cluster.Member)1 DistributedObjectListener (com.hazelcast.core.DistributedObjectListener)1 Connection (com.hazelcast.internal.nio.Connection)1 MapListener (com.hazelcast.map.listener.MapListener)1 MapPartitionLostListener (com.hazelcast.map.listener.MapPartitionLostListener)1 MultiMap (com.hazelcast.multimap.MultiMap)1 MessageListener (com.hazelcast.topic.MessageListener)1