Search in sources :

Example 16 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class MapLockTest method lockStoreShouldBeRemoved_whenMapIsDestroyed.

/**
     * See issue #4888
     */
@Test
public void lockStoreShouldBeRemoved_whenMapIsDestroyed() {
    HazelcastInstance instance = createHazelcastInstance(getConfig());
    IMap<Integer, Integer> map = instance.getMap(randomName());
    for (int i = 0; i < 1000; i++) {
        map.lock(i);
    }
    map.destroy();
    NodeEngineImpl nodeEngine = getNodeEngineImpl(instance);
    LockServiceImpl lockService = nodeEngine.getService(LockService.SERVICE_NAME);
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int i = 0; i < partitionCount; i++) {
        LockStoreContainer lockContainer = lockService.getLockContainer(i);
        assertEquals("LockStores should be empty", 0, lockContainer.getLockStores().size());
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) LockStoreContainer(com.hazelcast.concurrent.lock.LockStoreContainer) NightlyTest(com.hazelcast.test.annotation.NightlyTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class MapMergePolicyQuickTest method getMapServiceContext.

private MapServiceContext getMapServiceContext(HazelcastInstance instance) {
    NodeEngineImpl nodeEngine = HazelcastTestSupport.getNodeEngineImpl(instance);
    MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
    return mapService.getMapServiceContext();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapService(com.hazelcast.map.impl.MapService)

Example 18 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class NearCacheTestSupport method getNearCache.

protected NearCache getNearCache(String mapName, HazelcastInstance instance) {
    NodeEngineImpl nodeEngine = getNode(instance).nodeEngine;
    MapService service = nodeEngine.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = service.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    NearCacheConfig nearCacheConfig = nodeEngine.getConfig().getMapConfig(mapName).getNearCacheConfig();
    return mapNearCacheManager.getOrCreateNearCache(mapName, nearCacheConfig);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 19 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class InvalidationMetadataDistortionTest method distortRandomPartitionUuid.

private void distortRandomPartitionUuid(HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    int partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
    int partitionId = getInt(partitionCount);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setUuid(partitionId, UuidUtil.newSecureUUID());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 20 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class NonStopInvalidatorTest method setUp.

@Before
public void setUp() {
    key = mock(Data.class);
    HazelcastInstance hz = createHazelcastInstance();
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(hz);
    invalidator = new NonStopInvalidator(MapService.SERVICE_NAME, TRUE_FILTER, nodeEngineImpl);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Data(com.hazelcast.nio.serialization.Data) NonStopInvalidator(com.hazelcast.internal.nearcache.impl.invalidation.NonStopInvalidator) Before(org.junit.Before)

Aggregations

NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)112 HazelcastInstance (com.hazelcast.core.HazelcastInstance)39 Test (org.junit.Test)32 ParallelTest (com.hazelcast.test.annotation.ParallelTest)31 QuickTest (com.hazelcast.test.annotation.QuickTest)31 Node (com.hazelcast.instance.Node)21 MapService (com.hazelcast.map.impl.MapService)20 Config (com.hazelcast.config.Config)19 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)19 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)16 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)14 ILogger (com.hazelcast.logging.ILogger)11 AssertTask (com.hazelcast.test.AssertTask)11 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)10 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)10 Address (com.hazelcast.nio.Address)10 Data (com.hazelcast.nio.serialization.Data)10 Before (org.junit.Before)10 Operation (com.hazelcast.spi.Operation)9