1 18 package org.apache.activemq.command; 19 20 import java.io.IOException ; 21 22 import junit.framework.Test; 23 import junit.textui.TestRunner; 24 25 public class MessageTest extends DataStructureTestSupport { 26 27 public boolean cacheEnabled; 28 29 public static Test suite() { 30 return suite(MessageTest.class); 31 } 32 33 public static void main(String [] args) { 34 TestRunner.run(suite()); 35 } 36 37 public void initCombosForTestActiveMQMessageMarshaling() { 38 addCombinationValues("cacheEnabled", new Object [] { Boolean.TRUE, Boolean.FALSE }); 39 } 40 41 public void testActiveMQMessageMarshaling() throws IOException { 42 ActiveMQMessage message = new ActiveMQMessage(); 43 message.setCommandId((short) 1); 44 message.setOriginalDestination(new ActiveMQQueue("queue")); 45 message.setGroupID("group"); 46 message.setGroupSequence(4); 47 message.setCorrelationId("correlation"); 48 message.setMessageId(new MessageId("c1:1:1", 1)); 49 assertBeanMarshalls(message); 50 } 51 52 public void testActiveMQMessageMarshalingBigMessageId() throws IOException { 53 ActiveMQMessage message = new ActiveMQMessage(); 54 message.setCommandId((short) 1); 55 message.setOriginalDestination(new ActiveMQQueue("queue")); 56 message.setGroupID("group"); 57 message.setGroupSequence(4); 58 message.setCorrelationId("correlation"); 59 message.setMessageId(new MessageId("c1:1:1", Short.MAX_VALUE)); 60 assertBeanMarshalls(message); 61 } 62 63 public void testActiveMQMessageMarshalingBiggerMessageId() throws IOException { 64 ActiveMQMessage message = new ActiveMQMessage(); 65 message.setCommandId((short) 1); 66 message.setOriginalDestination(new ActiveMQQueue("queue")); 67 message.setGroupID("group"); 68 message.setGroupSequence(4); 69 message.setCorrelationId("correlation"); 70 message.setMessageId(new MessageId("c1:1:1", Integer.MAX_VALUE)); 71 assertBeanMarshalls(message); 72 } 73 74 public void testActiveMQMessageMarshalingBiggestMessageId() throws IOException { 75 ActiveMQMessage message = new ActiveMQMessage(); 76 message.setCommandId((short) 1); 77 message.setOriginalDestination(new ActiveMQQueue("queue")); 78 message.setGroupID("group"); 79 message.setGroupSequence(4); 80 message.setCorrelationId("correlation"); 81 message.setMessageId(new MessageId("c1:1:1", Long.MAX_VALUE)); 82 assertBeanMarshalls(message); 83 } 84 85 public void testMessageIdMarshaling() throws IOException { 86 assertBeanMarshalls(new MessageId("c1:1:1", 1)); 87 } 88 89 } 90 | Popular Tags |