Search in sources :

Example 1 with ObjectDataInput

use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.

the class MigrationListenerAdapterTest method test_migrationEvent_deserialization.

@Test
public void test_migrationEvent_deserialization() throws IOException {
    final ObjectDataInput input = mock(ObjectDataInput.class);
    when(input.readInt()).thenReturn(0);
    when(input.readObject()).thenReturn(null);
    when(input.readObject()).thenReturn(null);
    when(input.readByte()).thenReturn((byte) 0);
    final MigrationEvent event = new MigrationEvent();
    event.readData(input);
    assertEquals(0, event.getPartitionId());
    assertNull(event.getOldOwner());
    assertNull(event.getNewOwner());
    assertEquals(STARTED, event.getStatus());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) MigrationEvent(com.hazelcast.core.MigrationEvent) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with ObjectDataInput

use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.

the class AccumulatorInfo method readPortable.

@Override
public void readPortable(PortableReader reader) throws IOException {
    mapName = reader.readUTF("mn");
    cacheName = reader.readUTF("cn");
    batchSize = reader.readInt("bas");
    bufferSize = reader.readInt("bus");
    delaySeconds = reader.readLong("ds");
    includeValue = reader.readBoolean("iv");
    publishable = reader.readBoolean("ps");
    coalesce = reader.readBoolean("co");
    populate = reader.readBoolean("po");
    ObjectDataInput input = reader.getRawDataInput();
    predicate = input.readObject();
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Example 3 with ObjectDataInput

use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.

the class ReplicatedMapEntries method readPortable.

@Override
public void readPortable(PortableReader reader) throws IOException {
    int size = reader.readInt("size");
    keys = new ArrayList<Data>(size);
    values = new ArrayList<Data>(size);
    ObjectDataInput in = reader.getRawDataInput();
    for (int i = 0; i < size; i++) {
        keys.add(in.readData());
        values.add(in.readData());
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data) ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Example 4 with ObjectDataInput

use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.

the class ReplicatedMapKeys method readPortable.

@Override
public void readPortable(PortableReader reader) throws IOException {
    int size = reader.readInt("size");
    ObjectDataInput in = reader.getRawDataInput();
    keys = new ArrayList<Data>(size);
    for (int i = 0; i < size; i++) {
        keys.add(in.readData());
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data) ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Example 5 with ObjectDataInput

use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.

the class ReplicatedMapValueCollection method readPortable.

@Override
public void readPortable(PortableReader reader) throws IOException {
    int size = reader.readInt("size");
    ObjectDataInput in = reader.getRawDataInput();
    values = new ArrayList(size);
    for (int i = 0; i < size; i++) {
        values.add(in.readData());
    }
}
Also used : ArrayList(java.util.ArrayList) ObjectDataInput(com.hazelcast.nio.ObjectDataInput)

Aggregations

ObjectDataInput (com.hazelcast.nio.ObjectDataInput)81 Test (org.junit.Test)35 QuickTest (com.hazelcast.test.annotation.QuickTest)32 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)24 BufferObjectDataInput (com.hazelcast.internal.nio.BufferObjectDataInput)17 FieldKind (com.hazelcast.nio.serialization.FieldKind)16 IOException (java.io.IOException)13 ObjectDataOutput (com.hazelcast.nio.ObjectDataOutput)12 Nullable (javax.annotation.Nullable)9 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)7 SerializationConfig (com.hazelcast.config.SerializationConfig)6 StreamSerializer (com.hazelcast.nio.serialization.StreamSerializer)6 Data (com.hazelcast.nio.serialization.Data)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 Data (com.hazelcast.internal.serialization.Data)3 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)3 HeapData (com.hazelcast.internal.serialization.impl.HeapData)3 SerializationService (com.hazelcast.spi.serialization.SerializationService)3 SerializerConfig (com.hazelcast.config.SerializerConfig)2