Search in sources :

Example 31 with ObjectDataOutput

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

the class InvalidRawDataPortable method writePortable.

@Override
public void writePortable(PortableWriter writer) throws IOException {
    writer.writeLong("l", l);
    final ObjectDataOutput output = writer.getRawDataOutput();
    output.writeInt(k);
    output.writeUTF(s);
    writer.writeCharArray("c", c);
    output.writeObject(sds);
    writer.writePortable("p", p);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput)

Example 32 with ObjectDataOutput

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

the class DistributedDoubleSummaryStatisticsTest method writeData.

@Test
public void writeData() throws IOException {
    // Given
    DistributedDoubleSummaryStatistics stats = new DistributedDoubleSummaryStatistics();
    stats.accept(1);
    stats.accept(3);
    ObjectDataOutput out = mock(ObjectDataOutput.class);
    // When
    stats.writeData(out);
    // Then
    verify(out).writeLong(stats.getCount());
    verify(out).writeDouble(stats.getSum());
    verify(out).writeDouble(stats.getMin());
    verify(out).writeDouble(stats.getMax());
    verifyNoMoreInteractions(out);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) Test(org.junit.Test)

Example 33 with ObjectDataOutput

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

the class DistributedIntSummaryStatisticsTest method writeData.

@Test
public void writeData() throws IOException {
    // Given
    DistributedIntSummaryStatistics stats = new DistributedIntSummaryStatistics();
    stats.accept(1);
    stats.accept(3);
    ObjectDataOutput out = mock(ObjectDataOutput.class);
    // When
    stats.writeData(out);
    // Then
    verify(out).writeLong(stats.getCount());
    verify(out).writeLong(stats.getSum());
    verify(out).writeInt(stats.getMin());
    verify(out).writeInt(stats.getMax());
    verifyNoMoreInteractions(out);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) Test(org.junit.Test)

Example 34 with ObjectDataOutput

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

the class DistributedLongSummaryStatisticsTest method writeData.

@Test
public void writeData() throws IOException {
    // Given
    DistributedLongSummaryStatistics stats = new DistributedLongSummaryStatistics();
    stats.accept(1);
    stats.accept(3);
    ObjectDataOutput out = mock(ObjectDataOutput.class);
    // When
    stats.writeData(out);
    // Then
    verify(out).writeLong(stats.getCount());
    verify(out).writeLong(stats.getSum());
    verify(out).writeLong(stats.getMin());
    verify(out).writeLong(stats.getMax());
    verifyNoMoreInteractions(out);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) Test(org.junit.Test)

Example 35 with ObjectDataOutput

use of com.hazelcast.nio.ObjectDataOutput in project dolphin-platform by canoo.

the class EventStreamSerializerTests method convertToJson.

private <T extends Serializable> JsonElement convertToJson(DolphinEvent<T> event) throws IOException {
    final EventStreamSerializer streamSerializer = new EventStreamSerializer();
    final ObjectDataOutput output = new ByteObjectDataOutput();
    streamSerializer.write(output, event);
    final byte[] rawOutputData = output.toByteArray();
    final String outputData = new String(rawOutputData);
    return new JsonParser().parse(outputData);
}
Also used : ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) JsonParser(com.google.gson.JsonParser)

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