use of com.hazelcast.instance.Node 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);
}
use of com.hazelcast.instance.Node 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);
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class QueryCacheEventLostListenerTest method setTestSequencer.
private void setTestSequencer(HazelcastInstance instance, int eventCount) {
Node node = getNode(instance);
MapService service = node.getNodeEngine().getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = service.getMapServiceContext();
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestSubscriberContext(queryCacheContext, eventCount, true));
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class QueryCacheIMapEventHandlingTest method executeMergeOperation.
private void executeMergeOperation(HazelcastInstance member, String mapName, int key, int mergedValue) throws Exception {
Node node = getNode(member);
NodeEngineImpl nodeEngine = node.nodeEngine;
OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
SerializationService serializationService = getSerializationService(member);
Data keyData = serializationService.toData(key);
Data valueData = serializationService.toData(mergedValue);
EntryView<Data, Data> entryView = createSimpleEntryView(keyData, valueData, Mockito.mock(Record.class));
MergeOperation mergeOperation = new MergeOperation(mapName, keyData, entryView, new PassThroughMergePolicy());
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
Future<Object> future = operationService.invokeOnPartition(SERVICE_NAME, mergeOperation, partitionId);
future.get();
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class QueryCacheRecoveryUponEventLossTest method setTestSequencer.
private void setTestSequencer(HazelcastInstance instance, int eventCount) {
Node node = getNode(instance);
MapService service = node.getNodeEngine().getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = service.getMapServiceContext();
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestSubscriberContext(queryCacheContext, eventCount, true));
}
Aggregations