use of org.apache.dubbo.common.serialize.ObjectInput in project dubbo by alibaba.
the class Hessian2PersonOkTest method test_intArray_withType.
@Test
public void test_intArray_withType() throws Exception {
int[] data = new int[] { 234, 0, -1 };
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(data);
objectOutput.flushBuffer();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
assertArrayEquals(data, (int[]) deserialize.readObject());
try {
deserialize.readObject(int[].class);
fail();
} catch (ArrayIndexOutOfBoundsException e) {
}
// NOTE: Hessian2 throws ArrayIndexOutOfBoundsException instead of IOException, let's live with this.
}
use of org.apache.dubbo.common.serialize.ObjectInput in project dubbo by alibaba.
the class Hessian2PersonOkTest method test_StringArray_withType.
@Test
public void test_StringArray_withType() throws Exception {
String[] data = new String[] { "1", "b" };
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(data);
objectOutput.flushBuffer();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
assertArrayEquals(data, deserialize.readObject(String[].class));
try {
deserialize.readObject(String[].class);
fail();
} catch (ArrayIndexOutOfBoundsException e) {
}
// NOTE: Hessian2 throws ArrayIndexOutOfBoundsException instead of IOException, let's live with this.
}
use of org.apache.dubbo.common.serialize.ObjectInput in project dubbo by alibaba.
the class GsonJsonSerializationTest method testObjectInput.
@Test
public void testObjectInput() throws IOException {
ObjectInput objectInput = gsonJsonSerialization.deserialize(null, mock(InputStream.class));
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(GsonJsonObjectInput.class));
}
use of org.apache.dubbo.common.serialize.ObjectInput in project dubbo by alibaba.
the class FastJsonSerializationTest method testObjectInput.
@Test
public void testObjectInput() throws IOException {
ObjectInput objectInput = fastJsonSerialization.deserialize(null, mock(InputStream.class));
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(FastJsonObjectInput.class));
}
use of org.apache.dubbo.common.serialize.ObjectInput in project dubbo by alibaba.
the class FstSerializationTest method testDeserialize.
@Test
public void testDeserialize() throws IOException {
ObjectInput objectInput = fstSerialization.deserialize(null, mock(InputStream.class));
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(FstObjectInput.class));
}
Aggregations