Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Commit b7b5bec

Browse files
garyrussellMarius Bogoevici
authored andcommitted
XD-3693: Add timestamp to xdHistory Header Entries
JIRA: https://jira.spring.io/browse/XD-3693
1 parent 980d2a6 commit b7b5bec

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

spring-xd-dirt/src/main/java/org/springframework/xd/dirt/plugins/AbstractMessageBusBinderPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
201201
.fromMessage(message)
202202
.setHeader(XdHeaders.XD_HISTORY, history)
203203
.build();
204+
map.put("timestamp", out.getHeaders().getTimestamp());
204205
return out;
205206
}
206207
});

spring-xd-dirt/src/test/java/org/springframework/xd/dirt/stream/AbstractSingleNodeStreamDeploymentIntegrationTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package org.springframework.xd.dirt.stream;
1515

16+
import static org.hamcrest.Matchers.greaterThan;
1617
import static org.hamcrest.Matchers.instanceOf;
1718
import static org.junit.Assert.assertEquals;
1819
import static org.junit.Assert.assertFalse;
@@ -38,7 +39,6 @@
3839
import org.junit.After;
3940
import org.junit.AfterClass;
4041
import org.junit.ClassRule;
41-
import org.junit.Ignore;
4242
import org.junit.Test;
4343
import org.junit.rules.ExternalResource;
4444
import org.slf4j.Logger;
@@ -61,8 +61,8 @@
6161
import org.springframework.xd.dirt.integration.bus.MessageBus;
6262
import org.springframework.xd.dirt.integration.bus.XdHeaders;
6363
import org.springframework.xd.dirt.integration.bus.local.LocalMessageBus;
64-
import org.springframework.xd.dirt.server.singlenode.SingleNodeApplication;
6564
import org.springframework.xd.dirt.server.TestApplicationBootstrap;
65+
import org.springframework.xd.dirt.server.singlenode.SingleNodeApplication;
6666
import org.springframework.xd.dirt.test.SingleNodeIntegrationTestSupport;
6767
import org.springframework.xd.dirt.test.sink.NamedChannelSink;
6868
import org.springframework.xd.dirt.test.sink.SingleNodeNamedChannelSinkFactory;
@@ -329,9 +329,12 @@ public final void testTopicChannel() throws InterruptedException {
329329

330330
final Message<Object> bar1Message = (Message<Object>) bar1sink.receive(10000);
331331
assertNotNull(bar1Message);
332-
Object history = bar1Message.getHeaders().get(XdHeaders.XD_HISTORY);
333-
assertNotNull(history);
334-
assertThat(history, instanceOf(List.class));
332+
Object historyObject = bar1Message.getHeaders().get(XdHeaders.XD_HISTORY);
333+
assertNotNull(historyObject);
334+
assertThat(historyObject, instanceOf(List.class));
335+
List<Map<String, Object>> history = (List<Map<String, Object>>) historyObject;
336+
assertThat(history.size(), greaterThan(0));
337+
assertNotNull(history.get(0).get("timestamp"));
335338
final Object bar1 = bar1Message.getPayload();
336339
final Message<Object> bar2Message = (Message<Object>) bar2sink.receive(10000);
337340
assertNotNull(bar2Message);

0 commit comments

Comments
 (0)