Fixing AMQ-664 - making broker assign JMSTimestamp to all incoming stomp messages. Updating unit tests to verify timestamp is received properly via JMS.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@413769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nathan Christopher Mittler 2006-06-12 23:50:16 +00:00
parent e264e6f9d1
commit e9e8fd147d
2 changed files with 7 additions and 0 deletions

View File

@ -81,6 +81,7 @@ class Send implements StompCommand {
msg.setProducerId(format.getProducerId());
msg.setMessageId(format.createMessageId());
msg.setJMSTimestamp(System.currentTimeMillis());
ActiveMQDestination d = DestinationNamer.convert(destination);

View File

@ -155,6 +155,12 @@ public class StompTest extends CombinationTestSupport {
TextMessage message = (TextMessage) consumer.receive(1000);
assertNotNull(message);
assertEquals("Hello World", message.getText());
// Make sure that the timestamp is valid - should
// be very close to the current time.
long tnow = System.currentTimeMillis();
long tmsg = message.getJMSTimestamp();
assertTrue( Math.abs(tnow - tmsg) < 1000 );
}