Search in sources :

Example 1 with AbstractRecord

use of com.hazelcast.map.impl.record.AbstractRecord 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 AbstractRecord

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

the class IndexTest method testRemoveEnumIndex.

@Test
public void testRemoveEnumIndex() {
    Indexes is = new Indexes(ss, Extractors.empty());
    is.addOrGetIndex("favoriteCity", false);
    Data key = ss.toData(1);
    Data value = ss.toData(new SerializableWithEnum(SerializableWithEnum.City.ISTANBUL));
    is.saveEntryIndex(new QueryEntry(ss, key, value, Extractors.empty()), null);
    assertNotNull(is.getIndex("favoriteCity"));
    Record record = recordFactory.newRecord(value);
    ((AbstractRecord) record).setKey(key);
    is.removeEntryIndex(key, Records.getValueOrCachedValue(record, ss));
    assertEquals(0, is.getIndex("favoriteCity").getRecords(SerializableWithEnum.City.ISTANBUL).size());
}
Also used : AbstractRecord(com.hazelcast.map.impl.record.AbstractRecord) TestUtil.toData(com.hazelcast.instance.TestUtil.toData) Data(com.hazelcast.nio.serialization.Data) AbstractRecord(com.hazelcast.map.impl.record.AbstractRecord) Record(com.hazelcast.map.impl.record.Record) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

AbstractRecord (com.hazelcast.map.impl.record.AbstractRecord)2 MapConfig (com.hazelcast.config.MapConfig)1 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)1 TestUtil.toData (com.hazelcast.instance.TestUtil.toData)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 DataRecordFactory (com.hazelcast.map.impl.record.DataRecordFactory)1 Record (com.hazelcast.map.impl.record.Record)1 Data (com.hazelcast.nio.serialization.Data)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1