Search in sources :

Example 66 with RecordStore

use of com.hazelcast.map.impl.recordstore.RecordStore in project hazelcast by hazelcast.

the class EntryLoaderSimpleTest method assertInMemory.

private void assertInMemory(HazelcastInstance[] instances, String mapName, String key, String expectedValue) {
    InternalPartitionService partitionService = getPartitionService(instances[0]);
    int partitionId = partitionService.getPartitionId(key);
    Address partitionOwnerAddress = partitionService.getPartitionOwner(partitionId);
    HazelcastInstance owner = getInstance(instances, partitionOwnerAddress);
    InternalSerializationService serializationService = getSerializationService(owner);
    Data keyData = serializationService.toData(key);
    NodeEngineImpl nodeEngine = getNodeEngineImpl(owner);
    MapService mapService = nodeEngine.getService(MapService.SERVICE_NAME);
    RecordStore recordStore = mapService.getMapServiceContext().getPartitionContainer(partitionId).getRecordStore(mapName);
    Record record = recordStore.getRecordOrNull(keyData);
    Object actualValue = record == null ? null : serializationService.toObject(record.getValue());
    assertEquals(expectedValue, actualValue);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.cluster.Address) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) DefaultRecordStore(com.hazelcast.map.impl.recordstore.DefaultRecordStore) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) Data(com.hazelcast.internal.serialization.Data) Record(com.hazelcast.map.impl.record.Record) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) MapService(com.hazelcast.map.impl.MapService)

Aggregations

RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)66 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)21 MapService (com.hazelcast.map.impl.MapService)20 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)12 HazelcastInstance (com.hazelcast.core.HazelcastInstance)10 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)10 Data (com.hazelcast.internal.serialization.Data)9 MapContainer (com.hazelcast.map.impl.MapContainer)8 DefaultRecordStore (com.hazelcast.map.impl.recordstore.DefaultRecordStore)8 Indexes (com.hazelcast.query.impl.Indexes)8 Map (java.util.Map)8 NodeEngine (com.hazelcast.spi.impl.NodeEngine)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 HashMap (java.util.HashMap)7 Test (org.junit.Test)7 MapConfig (com.hazelcast.config.MapConfig)6 IPartitionService (com.hazelcast.internal.partition.IPartitionService)6 Record (com.hazelcast.map.impl.record.Record)6 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)6 ArrayList (java.util.ArrayList)6