Search in sources :

Example 21 with ObjectDataOutput

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

the class PartitionLostListenerTest method test_internalPartitionLostEvent_serialization.

@Test
public void test_internalPartitionLostEvent_serialization() throws IOException {
    Address address = new Address();
    PartitionLostEventImpl internalEvent = new PartitionLostEventImpl(1, 2, address);
    ObjectDataOutput output = mock(ObjectDataOutput.class);
    internalEvent.writeData(output);
    verify(output).writeInt(1);
    verify(output).writeInt(2);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) Address(com.hazelcast.cluster.Address) PartitionLostEventImpl(com.hazelcast.internal.partition.PartitionLostEventImpl) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 22 with ObjectDataOutput

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

the class TransferableJobProcessInformation method writePortable.

@Override
public void writePortable(PortableWriter writer) throws IOException {
    writer.writeInt("processedRecords", processedRecords);
    ObjectDataOutput out = writer.getRawDataOutput();
    out.writeObject(partitionStates);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput)

Example 23 with ObjectDataOutput

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

the class PortableCollection method writePortable.

@Override
public void writePortable(PortableWriter writer) throws IOException {
    writer.writeBoolean("l", collection instanceof List);
    if (collection == null) {
        writer.writeInt("s", -1);
        return;
    }
    writer.writeInt("s", collection.size());
    final ObjectDataOutput out = writer.getRawDataOutput();
    for (Data data : collection) {
        out.writeData(data);
    }
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) List(java.util.List) ArrayList(java.util.ArrayList) Data(com.hazelcast.nio.serialization.Data)

Example 24 with ObjectDataOutput

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

the class PortableEntryEvent method writePortable.

@Override
public void writePortable(PortableWriter writer) throws IOException {
    // Map Event and Entry Event is merged to one event, because when cpp client get response
    // from node, it first creates the class then fills the class what comes from wire. Currently
    // it can not handle more than one type response.
    writer.writeInt("e", eventType.getType());
    writer.writeUTF("u", uuid);
    writer.writeInt("n", numberOfAffectedEntries);
    ObjectDataOutput out = writer.getRawDataOutput();
    out.writeData(key);
    out.writeData(value);
    out.writeData(oldValue);
    out.writeData(mergingValue);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput)

Example 25 with ObjectDataOutput

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

the class PortableReadResultSet method writePortable.

@Override
public void writePortable(PortableWriter writer) throws IOException {
    writer.writeInt("readCount", readCount);
    // writing the items
    writer.writeInt("count", items.size());
    ObjectDataOutput rawDataOutput = writer.getRawDataOutput();
    for (Object item : items) {
        rawDataOutput.writeData((Data) item);
    }
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput)

Aggregations

ObjectDataOutput (com.hazelcast.nio.ObjectDataOutput)43 Test (org.junit.Test)15 ObjectDataInput (com.hazelcast.nio.ObjectDataInput)12 QuickTest (com.hazelcast.test.annotation.QuickTest)12 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)7 SerializationConfig (com.hazelcast.config.SerializationConfig)6 StreamSerializer (com.hazelcast.nio.serialization.StreamSerializer)6 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)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 Data (com.hazelcast.nio.serialization.Data)3 SerializationService (com.hazelcast.spi.serialization.SerializationService)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 SerializerConfig (com.hazelcast.config.SerializerConfig)2 DataWriter (com.hazelcast.internal.nio.DataWriter)2 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)2 DataSerializable (com.hazelcast.nio.serialization.DataSerializable)2