Search in sources :

Example 46 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testTopicMessageListener.

@Test
public void testTopicMessageListener() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.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 47 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testDistributedObjectListeners.

@Test
public void testDistributedObjectListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    String id = client.addDistributedObjectListener(mock(DistributedObjectListener.class));
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(client.removeDistributedObjectListener(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) DistributedObjectListener(com.hazelcast.core.DistributedObjectListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 48 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testMapPartitionLostListeners.

@Test
public void testMapPartitionLostListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.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 49 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testListListeners.

@Test
public void testListListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    IList<Object> list = client.getList(randomString());
    String id = list.addItemListener(mock(ItemListener.class), false);
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(list.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 50 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testQueueListeners.

@Test
public void testQueueListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    IQueue<Object> queue = client.getQueue(randomString());
    String id = queue.addItemListener(mock(ItemListener.class), false);
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(queue.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)

Aggregations

Node (com.hazelcast.instance.Node)131 HazelcastInstance (com.hazelcast.core.HazelcastInstance)60 Test (org.junit.Test)50 QuickTest (com.hazelcast.test.annotation.QuickTest)45 ParallelTest (com.hazelcast.test.annotation.ParallelTest)42 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)21 ClientEventRegistration (com.hazelcast.client.spi.impl.listener.ClientEventRegistration)18 Address (com.hazelcast.nio.Address)17 Config (com.hazelcast.config.Config)14 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)13 ILogger (com.hazelcast.logging.ILogger)10 Data (com.hazelcast.nio.serialization.Data)10 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)10 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)9 StringUtil.bytesToString (com.hazelcast.util.StringUtil.bytesToString)8 CountDownLatch (java.util.concurrent.CountDownLatch)8 ClusterService (com.hazelcast.internal.cluster.ClusterService)7 SerializationService (com.hazelcast.spi.serialization.SerializationService)7 ItemListener (com.hazelcast.core.ItemListener)6 Operation (com.hazelcast.spi.Operation)6