Message timestamp is now a long (instead of java.util.Date).
This commit is contained in:
@@ -19,7 +19,6 @@ package org.springframework.integration.adapter.event;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -28,7 +27,7 @@ import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.integration.bus.DefaultMessageBus;
|
||||
import org.springframework.integration.bus.MessageBus;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.dispatcher.DirectChannel;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
|
||||
/**
|
||||
@@ -45,7 +44,7 @@ public class ApplicationEventTargetTests {
|
||||
latch.countDown();
|
||||
}
|
||||
};
|
||||
MessageChannel channel = new QueueChannel();
|
||||
MessageChannel channel = new DirectChannel();
|
||||
ApplicationEventTarget adapter = new ApplicationEventTarget();
|
||||
adapter.setApplicationEventPublisher(publisher);
|
||||
MessageBus bus = new DefaultMessageBus();
|
||||
@@ -54,7 +53,6 @@ public class ApplicationEventTargetTests {
|
||||
bus.start();
|
||||
assertEquals(1, latch.getCount());
|
||||
channel.send(new StringMessage("123", "testing"));
|
||||
latch.await(100, TimeUnit.MILLISECONDS);
|
||||
assertEquals(0, latch.getCount());
|
||||
bus.stop();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||
*/
|
||||
public class DefaultMessageHeader implements MessageHeader, Serializable {
|
||||
|
||||
private final Date timestamp = new Date();
|
||||
private final long timestamp = System.currentTimeMillis();
|
||||
|
||||
private volatile Date expiration;
|
||||
|
||||
@@ -51,9 +51,9 @@ public class DefaultMessageHeader implements MessageHeader, Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* Return the creation time of this message.
|
||||
* Return the creation time of this message (in milliseconds).
|
||||
*/
|
||||
public Date getTimestamp() {
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.Set;
|
||||
*/
|
||||
public interface MessageHeader {
|
||||
|
||||
Date getTimestamp();
|
||||
long getTimestamp();
|
||||
|
||||
Date getExpiration();
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class WireTapTests {
|
||||
Message<?> original = mainChannel.receive(0);
|
||||
Message<?> duplicate = secondaryChannel.receive(0);
|
||||
assertTrue("original timestamp should precede duplicate",
|
||||
original.getHeader().getTimestamp().before(duplicate.getHeader().getTimestamp()));
|
||||
original.getHeader().getTimestamp() < duplicate.getHeader().getTimestamp());
|
||||
}
|
||||
|
||||
public void testDuplicateMessageContainsAttribute() {
|
||||
|
||||
Reference in New Issue
Block a user