Search in sources :

Example 31 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapPartitionLostListenerTest method test_partitionLostListenerInvoked.

@Test
public void test_partitionLostListenerInvoked() {
    List<HazelcastInstance> instances = getCreatedInstancesShuffledAfterWarmedUp(1);
    HazelcastInstance instance = instances.get(0);
    final TestEventCollectingMapPartitionLostListener listener = new TestEventCollectingMapPartitionLostListener(0);
    instance.getMap(getIthMapName(0)).addPartitionLostListener(listener);
    final IPartitionLostEvent internalEvent = new IPartitionLostEvent(1, 0, null);
    MapService mapService = getNode(instance).getNodeEngine().getService(MapService.SERVICE_NAME);
    mapService.onPartitionLost(internalEvent);
    assertEventEventually(listener, internalEvent);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapService(com.hazelcast.map.impl.MapService) IPartitionLostEvent(com.hazelcast.spi.partition.IPartitionLostEvent) QuickTest(com.hazelcast.test.annotation.QuickTest) AbstractPartitionLostListenerTest(com.hazelcast.partition.AbstractPartitionLostListenerTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 32 with MapService

use of com.hazelcast.map.impl.MapService 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));
}
Also used : TestSubscriberContext(com.hazelcast.map.impl.querycache.subscriber.TestSubscriberContext) Node(com.hazelcast.instance.Node) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 33 with MapService

use of com.hazelcast.map.impl.MapService 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));
}
Also used : TestSubscriberContext(com.hazelcast.map.impl.querycache.subscriber.TestSubscriberContext) Node(com.hazelcast.instance.Node) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 34 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class QueryDispatcherTest method before.

@Before
public void before() {
    instance = createHazelcastInstance();
    map = instance.getMap(randomName());
    MapService mapService = getNodeEngineImpl(instance).getService(MapService.SERVICE_NAME);
    queryDispatcher = new QueryDispatcher(mapService.getMapServiceContext());
    partitionId = 100;
    key = generateKeyForPartition(instance, partitionId);
    value = randomString();
    map.put(key, value);
}
Also used : MapService(com.hazelcast.map.impl.MapService) Before(org.junit.Before)

Example 35 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class NodeQueryCacheContextTest method setUp.

@Before
public void setUp() {
    HazelcastInstance hz = createHazelcastInstance();
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(hz);
    MapService mapService = nodeEngineImpl.getService(MapService.SERVICE_NAME);
    context = mapService.getMapServiceContext().getQueryCacheContext();
    partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapService(com.hazelcast.map.impl.MapService) Before(org.junit.Before)

Aggregations

MapService (com.hazelcast.map.impl.MapService)80 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)44 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)13 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)12 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)11 MapContainer (com.hazelcast.map.impl.MapContainer)10 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)10 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)8 Config (com.hazelcast.config.Config)7 Before (org.junit.Before)7 Data (com.hazelcast.nio.serialization.Data)6 Map (java.util.Map)6 Address (com.hazelcast.nio.Address)5 IPartitionLostEvent (com.hazelcast.spi.partition.IPartitionLostEvent)5 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)4