Search in sources :

Example 11 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class WriteBehindQueueTest method createDelayedEntryList.

private List<DelayedEntry> createDelayedEntryList(int numberOfEntriesToCreate) {
    final List<DelayedEntry> list = new ArrayList<DelayedEntry>(numberOfEntriesToCreate);
    SerializationService ss1 = new DefaultSerializationServiceBuilder().build();
    final long storeTime = Clock.currentTimeMillis();
    for (int i = 0; i < numberOfEntriesToCreate; i++) {
        final DelayedEntry<Data, Object> e = DelayedEntries.createWithoutValue(ss1.toData(i), storeTime, i);
        list.add(e);
    }
    return list;
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) ArrayList(java.util.ArrayList) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) DelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)

Example 12 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder 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 13 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class BinaryCompatibilityTest method createSerializationService.

private SerializationService createSerializationService() {
    SerializationConfig config = new SerializationConfig();
    {
        SerializerConfig serializerConfig = new SerializerConfig();
        serializerConfig.setImplementation(new CustomByteArraySerializer()).setTypeClass(CustomByteArraySerializable.class);
        config.addSerializerConfig(serializerConfig);
    }
    {
        SerializerConfig serializerConfig = new SerializerConfig();
        serializerConfig.setImplementation(new CustomStreamSerializer()).setTypeClass(CustomStreamSerializable.class);
        config.addSerializerConfig(serializerConfig);
    }
    config.setAllowUnsafe(allowUnsafe);
    config.setByteOrder(byteOrder);
    ClassDefinition classDefinition = new ClassDefinitionBuilder(ReferenceObjects.PORTABLE_FACTORY_ID, ReferenceObjects.INNER_PORTABLE_CLASS_ID).addIntField("i").addFloatField("f").build();
    return new DefaultSerializationServiceBuilder().setConfig(config).setVersion(version).addPortableFactory(ReferenceObjects.PORTABLE_FACTORY_ID, new APortableFactory()).addDataSerializableFactory(ReferenceObjects.IDENTIFIED_DATA_SERIALIZABLE_FACTORY_ID, new ADataSerializableFactory()).addClassDefinition(classDefinition).build();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializerConfig(com.hazelcast.config.SerializerConfig) SerializationConfig(com.hazelcast.config.SerializationConfig) ClassDefinition(com.hazelcast.nio.serialization.ClassDefinition) ClassDefinitionBuilder(com.hazelcast.nio.serialization.ClassDefinitionBuilder)

Example 14 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class DefaultPortableReaderPerformanceTest method setup.

@Setup
public void setup() throws Exception {
    ss = new DefaultSerializationServiceBuilder().addPortableFactory(DefaultPortableReaderQuickTest.TestPortableFactory.ID, new DefaultPortableReaderQuickTest.TestPortableFactory()).build();
    Portable primitive = new DefaultPortableReaderTestStructure.PrimitivePortable();
    primitiveReader = reader(primitive);
    reader = reader(PORSCHE);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) Portable(com.hazelcast.nio.serialization.Portable) Setup(org.openjdk.jmh.annotations.Setup)

Example 15 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class PortableTest method testClassDefinitionLookupNativeOrderHeapData.

@Test
public void testClassDefinitionLookupNativeOrderHeapData() throws IOException {
    InternalSerializationService ss = new DefaultSerializationServiceBuilder().setUseNativeByteOrder(true).build();
    testClassDefinitionLookup(ss);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)70 Test (org.junit.Test)56 QuickTest (com.hazelcast.test.annotation.QuickTest)55 SerializationService (com.hazelcast.spi.serialization.SerializationService)46 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)22 ParallelTest (com.hazelcast.test.annotation.ParallelTest)18 HeapData (com.hazelcast.internal.serialization.impl.HeapData)16 Data (com.hazelcast.nio.serialization.Data)15 SerializationConfig (com.hazelcast.config.SerializationConfig)11 SerializationServiceBuilder (com.hazelcast.internal.serialization.SerializationServiceBuilder)6 ArrayList (java.util.ArrayList)6 SerializerConfig (com.hazelcast.config.SerializerConfig)5 Before (org.junit.Before)5 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)4 Config (com.hazelcast.config.Config)3 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)3 ObjectDataInput (com.hazelcast.nio.ObjectDataInput)3 ObjectDataOutput (com.hazelcast.nio.ObjectDataOutput)3 HashMap (java.util.HashMap)3 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)2