Search in sources :

Example 1 with DataRecordFactory

use of com.hazelcast.map.impl.record.DataRecordFactory in project hazelcast by hazelcast.

the class LazyEntryViewFromRecordTest method createDefaultEntryView.

/**
     * Returns an entry-view instance populated with default values of fields.
     */
private EntryView createDefaultEntryView() {
    PartitioningStrategy mockPartitioningStrategy = mock(PartitioningStrategy.class);
    MapConfig mapConfig = new MapConfig();
    serializationService = new DefaultSerializationServiceBuilder().build();
    DataRecordFactory dataRecordFactory = new DataRecordFactory(mapConfig, serializationService, mockPartitioningStrategy);
    recordInstance = dataRecordFactory.newRecord(value);
    ((AbstractRecord) recordInstance).setKey(serializationService.toData(key));
    return new LazyEntryViewFromRecord(recordInstance, serializationService);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) PartitioningStrategy(com.hazelcast.core.PartitioningStrategy) AbstractRecord(com.hazelcast.map.impl.record.AbstractRecord) MapConfig(com.hazelcast.config.MapConfig) DataRecordFactory(com.hazelcast.map.impl.record.DataRecordFactory)

Example 2 with DataRecordFactory

use of com.hazelcast.map.impl.record.DataRecordFactory in project hazelcast by hazelcast.

the class LazyEvictableEntryViewTest method createLazyEvictableEntryView.

/**
 * Returns an entry-view instance populated with default values of fields.
 */
private LazyEvictableEntryView createLazyEvictableEntryView() {
    MapConfig mapConfig = new MapConfig();
    mapConfig.setPerEntryStatsEnabled(true);
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    MapContainer mapContainer = mock(MapContainer.class);
    when(mapContainer.getMapConfig()).thenReturn(mapConfig);
    DataRecordFactory recordFactory = new DataRecordFactory(mapContainer, serializationService);
    Data key = serializationService.toData(this.key);
    recordInstance = recordFactory.newRecord(key, value);
    return new LazyEvictableEntryView(key, recordInstance, ExpiryMetadata.NULL, serializationService);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) MapConfig(com.hazelcast.config.MapConfig) DataRecordFactory(com.hazelcast.map.impl.record.DataRecordFactory) MapContainer(com.hazelcast.map.impl.MapContainer)

Aggregations

MapConfig (com.hazelcast.config.MapConfig)2 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)2 DataRecordFactory (com.hazelcast.map.impl.record.DataRecordFactory)2 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)1 Data (com.hazelcast.internal.serialization.Data)1 SerializationService (com.hazelcast.internal.serialization.SerializationService)1 MapContainer (com.hazelcast.map.impl.MapContainer)1 AbstractRecord (com.hazelcast.map.impl.record.AbstractRecord)1