super.tearDown();
}
public void testJMSProperties() throws Exception
{
AMQConnection con = (AMQConnection) getConnection("guest", "guest");
AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
Queue queue =
new AMQQueue(con.getDefaultQueueExchangeName(), new AMQShortString("someQ"), new AMQShortString("someQ"), false,
true);
MessageConsumer consumer = consumerSession.createConsumer(queue);
AMQConnection con2 = (AMQConnection) getConnection("guest", "guest");
Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageProducer producer = producerSession.createProducer(queue);
Destination JMS_REPLY_TO = new AMQQueue(con2, "my.replyto");
// create a test message to send
ObjectMessage sentMsg = new NonQpidObjectMessage(producerSession);
sentMsg.setJMSCorrelationID(JMS_CORR_ID);
sentMsg.setJMSDeliveryMode(JMS_DELIV_MODE);
sentMsg.setJMSType(JMS_TYPE);
sentMsg.setJMSReplyTo(JMS_REPLY_TO);
String JMSXGroupID_VALUE = "group";
sentMsg.setStringProperty("JMSXGroupID", JMSXGroupID_VALUE);
int JMSXGroupSeq_VALUE = 1;
sentMsg.setIntProperty("JMSXGroupSeq", JMSXGroupSeq_VALUE);
try
{
sentMsg.setObjectProperty(NULL_OBJECT_PROPERTY, null);
fail("Null Object Property value set");
}
catch (MessageFormatException mfe)
{
// Check the error message
assertEquals("Incorrect error message", AMQPInvalidClassException.INVALID_OBJECT_MSG + "null", mfe.getMessage());
}
try
{
sentMsg.setObjectProperty(INVALID_OBJECT_PROPERTY, new Exception());
fail("Non primitive Object Property value set");
}
catch (MessageFormatException mfe)
{
// Check the error message
assertEquals("Incorrect error message: " + mfe.getMessage(), AMQPInvalidClassException.INVALID_OBJECT_MSG + Exception.class, mfe.getMessage());
}
// send it
producer.send(sentMsg);
con2.close();
con.start();
// get message and check JMS properties
ObjectMessage rm = (ObjectMessage) consumer.receive(2000);