use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class InternalCacheRecordStoreTest method ownerStateShouldBeUpdatedAfterMigration.
/**
* Test for issue: https://github.com/hazelcast/hazelcast/issues/6983
*/
@Test
public void ownerStateShouldBeUpdatedAfterMigration() throws Exception {
HazelcastCacheManager hzCacheManager = (HazelcastCacheManager) cacheManager;
HazelcastInstance instance1 = hzCacheManager.getHazelcastInstance();
Node node1 = TestUtil.getNode(instance1);
NodeEngineImpl nodeEngine1 = node1.getNodeEngine();
InternalPartitionService partitionService1 = nodeEngine1.getPartitionService();
int partitionCount = partitionService1.getPartitionCount();
String cacheName = randomName();
CacheConfig cacheConfig = new CacheConfig().setName(cacheName);
Cache<String, String> cache = cacheManager.createCache(cacheName, cacheConfig);
String fullCacheName = hzCacheManager.getCacheNameWithPrefix(cacheName);
for (int i = 0; i < partitionCount; i++) {
String key = generateKeyForPartition(instance1, i);
cache.put(key, "Value");
}
for (int i = 0; i < partitionCount; i++) {
verifyPrimaryState(node1, fullCacheName, i, true);
}
HazelcastInstance instance2 = getHazelcastInstance();
Node node2 = TestUtil.getNode(instance2);
warmUpPartitions(instance1, instance2);
waitAllForSafeState(instance1, instance2);
for (int i = 0; i < partitionCount; i++) {
boolean ownedByNode1 = partitionService1.isPartitionOwner(i);
if (ownedByNode1) {
verifyPrimaryState(node1, fullCacheName, i, true);
verifyPrimaryState(node2, fullCacheName, i, false);
} else {
verifyPrimaryState(node1, fullCacheName, i, false);
verifyPrimaryState(node2, fullCacheName, i, true);
}
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class AdvancedClusterStateTest method spyTransactionManagerService.
private static TransactionManagerServiceImpl spyTransactionManagerService(HazelcastInstance hz) throws Exception {
NodeEngineImpl nodeEngine = getNode(hz).nodeEngine;
TransactionManagerServiceImpl transactionManagerService = (TransactionManagerServiceImpl) nodeEngine.getTransactionManagerService();
TransactionManagerServiceImpl spiedTransactionManagerService = spy(transactionManagerService);
Field transactionManagerServiceField = NodeEngineImpl.class.getDeclaredField("transactionManagerService");
transactionManagerServiceField.setAccessible(true);
transactionManagerServiceField.set(nodeEngine, spiedTransactionManagerService);
return spiedTransactionManagerService;
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class DiagnosticsLogTest method getDiagnostics.
public Diagnostics getDiagnostics(HazelcastInstance hazelcastInstance) {
Node node = getNode(hazelcastInstance);
NodeEngineImpl nodeEngine = node.nodeEngine;
try {
Field field = NodeEngineImpl.class.getDeclaredField("diagnostics");
field.setAccessible(true);
return (Diagnostics) field.get(nodeEngine);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class ClientMapMetaDataFetcherTest method distortRandomPartitionUuid.
private void distortRandomPartitionUuid(int partition, UUID uuid, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
Invalidator invalidator = mapNearCacheManager.getInvalidator();
MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
metaDataGenerator.setUuid(partition, uuid);
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class InvalidationMetadataDistortionTest method distortRandomPartitionSequence.
private void distortRandomPartitionSequence(String mapName, HazelcastInstance member) {
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
Invalidator invalidator = mapNearCacheManager.getInvalidator();
MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
int partitionCount = partitionService.getPartitionCount();
metaDataGenerator.setCurrentSequence(mapName, getInt(partitionCount), getInt(MAX_VALUE));
}
Aggregations