Search in sources :

Example 61 with ObjectDataInput

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

the class AbstractDataStreamIntegrationTest method testUnsignedByte.

@Test
public void testUnsignedByte() throws IOException {
    out.write(0xff);
    out.write(-1);
    out.write(Byte.MAX_VALUE + 1);
    ObjectDataInput in = getDataInputFromOutput();
    assertEquals(0xff, in.readUnsignedByte());
    assertEquals(0xff, in.readUnsignedByte());
    assertEquals(Byte.MAX_VALUE + 1, in.readUnsignedByte());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 62 with ObjectDataInput

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

the class AbstractDataStreamIntegrationTest method testLongArray.

@Test
public void testLongArray() throws IOException {
    long[] arr = new long[] { Long.MIN_VALUE, -1, Long.MAX_VALUE };
    out.writeLongArray(arr);
    ObjectDataInput in = getDataInputFromOutput();
    assertArrayEquals(arr, in.readLongArray());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with ObjectDataInput

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

the class AbstractDataStreamIntegrationTest method testUTFArray.

@Test
public void testUTFArray() throws IOException {
    String s1 = "Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text.";
    String s2 = "簡単なものから複雑なものまで、具体的な例を使って説明しています。本のように最初から順を追って読んでください。";
    String[] arr = new String[] { s1, s2 };
    out.writeUTFArray(arr);
    ObjectDataInput in = getDataInputFromOutput();
    assertArrayEquals(arr, in.readStringArray());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with ObjectDataInput

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

the class AbstractDataStreamIntegrationTest method testChar.

@Test
public void testChar() throws IOException {
    out.writeChar(Character.MIN_VALUE);
    out.writeChar(Character.MAX_VALUE);
    ObjectDataInput in = getDataInputFromOutput();
    assertEquals(Character.MIN_VALUE, in.readChar());
    assertEquals(Character.MAX_VALUE, in.readChar());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with ObjectDataInput

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

the class AbstractDataStreamIntegrationTest method testIntArray.

@Test
public void testIntArray() throws IOException {
    int[] arr = new int[] { Integer.MIN_VALUE, -250, 132, Integer.MAX_VALUE };
    out.writeIntArray(arr);
    ObjectDataInput in = getDataInputFromOutput();
    assertArrayEquals(arr, in.readIntArray());
}
Also used : ObjectDataInput(com.hazelcast.nio.ObjectDataInput) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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