Search in sources :

Example 1 with DataSerializableFixedID

use of org.apache.geode.internal.DataSerializableFixedID in project geode by apache.

the class DataTypeJUnitTest method testDataSerializableFixedIDByte.

@Test
public void testDataSerializableFixedIDByte() throws IOException {
    DataSerializableFixedID value = new ReplyMessage();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(baos);
    InternalDataSerializer.writeDSFID(value, out);
    byte[] bytes = baos.toByteArray();
    String type = DataType.getDataType(bytes);
    assertEquals("org.apache.geode.internal.DataSerializableFixedID:" + ReplyMessage.class.getName(), type);
}
Also used : DataOutputStream(java.io.DataOutputStream) DataSerializableFixedID(org.apache.geode.internal.DataSerializableFixedID) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ReplyMessage(org.apache.geode.distributed.internal.ReplyMessage) UnitTest(org.apache.geode.test.junit.categories.UnitTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with DataSerializableFixedID

use of org.apache.geode.internal.DataSerializableFixedID in project geode by apache.

the class DataTypeJUnitTest method testDataSerializableFixedIDShort.

@Test
public void testDataSerializableFixedIDShort() throws IOException {
    DataSerializableFixedID value = new ShutdownAllResponse();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(baos);
    InternalDataSerializer.writeDSFID(value, out);
    byte[] bytes = baos.toByteArray();
    String type = DataType.getDataType(bytes);
    assertEquals("org.apache.geode.internal.DataSerializableFixedID:" + ShutdownAllResponse.class.getName(), type);
}
Also used : DataOutputStream(java.io.DataOutputStream) DataSerializableFixedID(org.apache.geode.internal.DataSerializableFixedID) ShutdownAllResponse(org.apache.geode.internal.admin.remote.ShutdownAllResponse) ByteArrayOutputStream(java.io.ByteArrayOutputStream) UnitTest(org.apache.geode.test.junit.categories.UnitTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataOutputStream (java.io.DataOutputStream)2 DataSerializableFixedID (org.apache.geode.internal.DataSerializableFixedID)2 UnitTest (org.apache.geode.test.junit.categories.UnitTest)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 ReplyMessage (org.apache.geode.distributed.internal.ReplyMessage)1 ShutdownAllResponse (org.apache.geode.internal.admin.remote.ShutdownAllResponse)1