mirror of
https://github.com/floci-io/floci.git
synced 2026-11-29 00:21:51 -05:00
Fix/sns put timestamp in message envelope (#268)
* Fixes DynamoDB support for adding values to a list for the SET ... ADD query/command * Revert "Fixes DynamoDB support for adding values to a list for the SET ... ADD query/command" * Fixes SNS/SQS enveloped message missing Timestamp in Body field. * Fixes SNS/SQS enveloped message missing Timestamp in Body field.
This commit is contained in:
1 parent
6d5839bec8
commit
2dca523907
2 files changed
+12
-3
No files matched your search
@@ -682,10 +682,12 @@ public class SnsService {
|
||||
Map<String, MessageAttributeValue> messageAttributes,
|
||||
String topicArn, String messageId) {
|
||||
try {
|
||||
String timestamp = DateTimeFormatter.ISO_INSTANT.format(Instant.now());
|
||||
ObjectNode node = objectMapper.createObjectNode();
|
||||
node.put("Type", "Notification");
|
||||
node.put("MessageId", messageId);
|
||||
node.put("TopicArn", topicArn);
|
||||
node.put("Timestamp", timestamp);
|
||||
if (subject != null) {
|
||||
node.put("Subject", subject);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.UUID;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Integration tests for SNS via the query (form-encoded) protocol.
|
||||
@@ -191,7 +192,7 @@ class SnsIntegrationTest {
|
||||
.body(containsString("<MessageId>"));
|
||||
|
||||
// Verify the message arrived in the SQS queue
|
||||
given()
|
||||
String jsonBodyInResponse = given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "ReceiveMessage")
|
||||
.formParam("QueueUrl", sqsQueueUrl)
|
||||
@@ -200,8 +201,14 @@ class SnsIntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("Hello from SNS!"))
|
||||
.body(containsString("Notification"));
|
||||
.log().body()
|
||||
.body(containsString("Hello from SNS!"))
|
||||
.body(containsString("Notification"))
|
||||
.extract().xmlPath().getString(
|
||||
"ReceiveMessageResponse.ReceiveMessageResult.Message.Body");
|
||||
;
|
||||
|
||||
assertTrue(jsonBodyInResponse.contains("\"Timestamp\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user