use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class TopicDestroyTest method assertRegistrationSize.
void assertRegistrationSize(int size) {
EventService eventService = getNode(instance).getNodeEngine().getEventService();
Collection<EventRegistration> regs = eventService.getRegistrations(TopicService.SERVICE_NAME, topicName);
assertEquals(size, regs.size());
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class PartitionLostListenerRegistrationTest method assertRegistrationsSizeEventually.
private static void assertRegistrationsSizeEventually(final HazelcastInstance instance, final int expectedSize) {
assertTrueEventually(new AssertTask() {
@Override
public void run() {
assertTrueEventually(new AssertTask() {
@Override
public void run() {
EventService eventService = getNode(instance).getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, PARTITION_LOST_EVENT_TOPIC);
assertEquals(expectedSize, registrations.size());
}
});
}
});
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class EventServiceTest method test_deregistration_whileNewMemberJoining.
@Test
public void test_deregistration_whileNewMemberJoining() throws Exception {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
HazelcastInstance hz1 = factory.newHazelcastInstance(newConfigWithDummyService());
HazelcastInstance hz2 = factory.newHazelcastInstance(newConfigWithDummyService());
EventService eventService = getEventService(hz2);
Set<UUID> registrationIds = new HashSet<UUID>();
Object listener = new Object();
for (int i = 0; i < 500; i++) {
EventRegistration registration = eventService.registerListener(serviceName, topic, listener);
registrationIds.add(registration.getId());
}
Future<HazelcastInstance> future = spawn(() -> factory.newHazelcastInstance(newConfigWithDummyService()));
for (UUID registrationId : registrationIds) {
eventService.deregisterListener(serviceName, topic, registrationId);
}
assertThat(eventService.getRegistrations(serviceName, topic), Matchers.empty());
HazelcastInstance hz3 = future.get();
EventService eventService3 = getEventService(hz3);
assertThat(eventService3.getRegistrations(serviceName, topic), Matchers.empty());
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class EventRegistrationTest method assertEventRegistrations.
private static void assertEventRegistrations(int expected, HazelcastInstance... instances) {
assertTrueEventually(() -> {
for (HazelcastInstance instance : instances) {
Collection<EventRegistration> regs = getNodeEngineImpl(instance).getEventService().getRegistrations(ProxyServiceImpl.SERVICE_NAME, ProxyServiceImpl.SERVICE_NAME);
assertEquals(instance + ": " + regs, expected, regs.size());
}
});
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class BasicClusterStateTest method assertRegistrationsSizeEventually.
private void assertRegistrationsSizeEventually(final HazelcastInstance instance, final String serviceName, final String topic, final int size) {
assertTrueEventually(() -> {
EventService eventService = getNode(instance).getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(serviceName, topic);
assertEquals(size, registrations.size());
});
}
Aggregations