improved test to also add JMSDeliveryMode test for AMQ-1904

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@687954 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2008-08-22 05:56:44 +00:00
parent a655335471
commit 9cd9a00dc3
1 changed files with 15 additions and 12 deletions

View File

@ -144,16 +144,18 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
echo("Create QueueView MBean..."); echo("Create QueueView MBean...");
QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true); QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
proxy.purge();
int count = 5; int count = 5;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String body = "message:" + i; String body = "message:" + i;
Map headers = new HashMap(); Map headers = new HashMap();
headers.put("JMSCorrelationID", "MyCorrId"); headers.put("JMSCorrelationID", "MyCorrId");
headers.put("JMSDeliveryMode", Boolean.TRUE); headers.put("JMSDeliveryMode", Boolean.FALSE);
headers.put("JMSXGroupID", "MyGroupID"); headers.put("JMSXGroupID", "MyGroupID");
headers.put("JMSXGroupSeq", 1234); headers.put("JMSXGroupSeq", 1234);
headers.put("JMSPriority", i); headers.put("JMSPriority", i + 1);
headers.put("JMSType", "MyType"); headers.put("JMSType", "MyType");
headers.put("MyHeader", i); headers.put("MyHeader", i);
headers.put("MyStringHeader", "StringHeader" + i); headers.put("MyStringHeader", "StringHeader" + i);
@ -174,11 +176,12 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
echo("Columns: " + cdata.getCompositeType().keySet()); echo("Columns: " + cdata.getCompositeType().keySet());
} }
assertComplexData(cdata, "JMSCorrelationID", "MyCorrId"); assertComplexData(i, cdata, "JMSCorrelationID", "MyCorrId");
assertComplexData(cdata, "JMSPriority", i); assertComplexData(i, cdata, "JMSPriority", i + 1);
assertComplexData(cdata, "JMSType", "MyType"); assertComplexData(i, cdata, "JMSType", "MyType");
assertComplexData(cdata, "JMSCorrelationID", "MyCorrId"); assertComplexData(i, cdata, "JMSCorrelationID", "MyCorrId");
assertComplexData(cdata, "PropertiesText", "{MyStringHeader=StringHeader" + i + ", MyHeader=" + i + "}"); assertComplexData(i, cdata, "JMSDeliveryMode", "NON-PERSISTENT");
assertComplexData(i, cdata, "PropertiesText", "{MyStringHeader=StringHeader" + i + ", MyHeader=" + i + "}");
Map intProperties = CompositeDataHelper.getTabularMap(cdata, CompositeDataConstants.INT_PROPERTIES); Map intProperties = CompositeDataHelper.getTabularMap(cdata, CompositeDataConstants.INT_PROPERTIES);
assertEquals("intProperties size()", 1, intProperties.size()); assertEquals("intProperties size()", 1, intProperties.size());
@ -193,16 +196,16 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
assertEquals("properties.MyHeader", i, properties.get("MyHeader")); assertEquals("properties.MyHeader", i, properties.get("MyHeader"));
assertEquals("properties.MyHeader", "StringHeader" + i, properties.get("MyStringHeader")); assertEquals("properties.MyHeader", "StringHeader" + i, properties.get("MyStringHeader"));
assertComplexData(cdata, "JMSXGroupSeq", 1234); assertComplexData(i, cdata, "JMSXGroupSeq", 1234);
assertComplexData(cdata, "JMSXGroupID", "MyGroupID"); assertComplexData(i, cdata, "JMSXGroupID", "MyGroupID");
assertComplexData(cdata, "Text", "message:" + i); assertComplexData(i, cdata, "Text", "message:" + i);
} }
} }
protected void assertComplexData(CompositeData cdata, String name, Object expected) { protected void assertComplexData(int messageIndex, CompositeData cdata, String name, Object expected) {
Object value = cdata.get(name); Object value = cdata.get(name);
assertEquals("CData field: " + name, expected, value); assertEquals("Message " + messageIndex + " CData field: " + name, expected, value);
} }