[jboss-cvs] JBoss Messaging SVN: r3706 - trunk/tests/src/org/jboss/messaging/core/impl/test/unit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 12 09:54:33 EST 2008
Author: jmesnil
Date: 2008-02-12 09:54:33 -0500 (Tue, 12 Feb 2008)
New Revision: 3706
Modified:
trunk/tests/src/org/jboss/messaging/core/impl/test/unit/MessageTest.java
Log:
* added MessageTest.testMarshalling()
Modified: trunk/tests/src/org/jboss/messaging/core/impl/test/unit/MessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/core/impl/test/unit/MessageTest.java 2008-02-12 14:07:49 UTC (rev 3705)
+++ trunk/tests/src/org/jboss/messaging/core/impl/test/unit/MessageTest.java 2008-02-12 14:54:33 UTC (rev 3706)
@@ -21,6 +21,15 @@
*/
package org.jboss.messaging.core.impl.test.unit;
+import static org.jboss.messaging.test.unit.RandomUtil.randomByte;
+import static org.jboss.messaging.test.unit.RandomUtil.randomBytes;
+import static org.jboss.messaging.test.unit.RandomUtil.randomInt;
+import static org.jboss.messaging.test.unit.RandomUtil.randomLong;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -394,4 +403,28 @@
}
+ public void testMarshalling() throws Exception
+ {
+ Message msg = new MessageImpl(randomLong(), randomInt(), true, randomLong(), randomLong(), randomByte(),null, null);
+ msg.setDeliveryCount(randomInt());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ msg.write(new DataOutputStream(baos));
+ baos.flush();
+ byte[] b = baos.toByteArray();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(b);
+ Message unmarshalledMsg = new MessageImpl();
+ unmarshalledMsg.read(new DataInputStream(bais));
+
+ assertEquals(msg, unmarshalledMsg);
+ assertEquals("messageID", msg.getMessageID(), unmarshalledMsg.getMessageID());
+ assertEquals("type", msg.getType(), unmarshalledMsg.getType());
+ assertEquals("durable", msg.isDurable(), unmarshalledMsg.isDurable());
+ assertEquals("expiration", msg.getExpiration(), unmarshalledMsg.getExpiration());
+ assertEquals("timestamp", msg.getTimestamp(), unmarshalledMsg.getTimestamp());
+ assertEquals("priority", msg.getPriority(), unmarshalledMsg.getPriority());
+ assertEquals("deliveryCount", msg.getDeliveryCount(), unmarshalledMsg.getDeliveryCount());
+ }
+
}
More information about the jboss-cvs-commits
mailing list