You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2008/05/20 04:20:38 UTC
svn commit: r658089 - in
/mina/branches/buffer/core/src/test/java/org/apache/mina:
common/IoBufferTest.java util/Bar.java util/Foo.java
Author: trustin
Date: Mon May 19 19:20:37 2008
New Revision: 658089
URL: http://svn.apache.org/viewvc?rev=658089&view=rev
Log:
Merged the changes in trunk
Added:
mina/branches/buffer/core/src/test/java/org/apache/mina/util/Bar.java
- copied unchanged from r658088, mina/trunk/core/src/test/java/org/apache/mina/util/Bar.java
mina/branches/buffer/core/src/test/java/org/apache/mina/util/Foo.java
- copied unchanged from r658088, mina/trunk/core/src/test/java/org/apache/mina/util/Foo.java
Modified:
mina/branches/buffer/core/src/test/java/org/apache/mina/common/IoBufferTest.java
Modified: mina/branches/buffer/core/src/test/java/org/apache/mina/common/IoBufferTest.java
URL: http://svn.apache.org/viewvc/mina/branches/buffer/core/src/test/java/org/apache/mina/common/IoBufferTest.java?rev=658089&r1=658088&r2=658089&view=diff
==============================================================================
--- mina/branches/buffer/core/src/test/java/org/apache/mina/common/IoBufferTest.java (original)
+++ mina/branches/buffer/core/src/test/java/org/apache/mina/common/IoBufferTest.java Mon May 19 19:20:37 2008
@@ -35,6 +35,8 @@
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.mina.util.Bar;
+
/**
* Tests {@link IoBuffer}.
*
@@ -570,6 +572,28 @@
Assert.assertNotSame(o, o2);
}
+ public void testInheritedObjectSerialization() throws Exception {
+ IoBuffer buf = IoBuffer.allocate(16);
+ buf.setAutoExpand(true);
+
+ Bar expected = new Bar();
+ expected.setFooValue(0x12345678);
+ expected.setBarValue(0x90ABCDEF);
+
+ // Test writing an object.
+ buf.putObject(expected);
+
+ // Test reading an object.
+ buf.clear();
+ Bar actual = (Bar) buf.getObject();
+ Assert.assertSame(Bar.class, actual.getClass());
+ Assert.assertEquals(expected.getFooValue(), actual.getFooValue());
+ Assert.assertEquals(expected.getBarValue(), actual.getBarValue());
+
+ // This assertion is just to make sure that deserialization occurred.
+ Assert.assertNotSame(expected, actual);
+ }
+
public void testSweepWithZeros() throws Exception {
IoBuffer buf = IoBuffer.allocate(4);
buf.putInt(0xdeadbeef);