use of software.amazon.awssdk.services.sqs.model.Message in project syndesis-qe by syndesisio.
the class SQSValidationSteps method verifyDifferentGroupId.
@Then("verify that all messages in SQS queue {string} have different groupId")
public void verifyDifferentGroupId(String queueName) {
Set<String> seenIds = new HashSet<>();
for (Message message : sqs.getMessages(queueName)) {
assertThat(seenIds).doesNotContain(message.attributes().get(MessageSystemAttributeName.MESSAGE_GROUP_ID));
seenIds.add(message.attributes().get(MessageSystemAttributeName.MESSAGE_GROUP_ID));
}
}
use of software.amazon.awssdk.services.sqs.model.Message in project syndesis-qe by syndesisio.
the class SNSValidationSteps method verifySNSMessage.
@Then("verify that the SQS queue {string} contains notifications related to")
public void verifySNSMessage(String queue, DataTable content) {
final List<Message> messages = sqs.getMessages(queue);
Map<String, String> contentMap = content.asMap(String.class, String.class);
for (Map.Entry<String, String> entry : contentMap.entrySet()) {
assertThat(messages.stream().filter(m -> {
JSONObject messageJson = new JSONObject(m.body());
return messageJson.getString("Subject").equals(entry.getKey()) && messageJson.getString("Message").equals(entry.getValue());
}).findAny()).as("Expected messages were not received").isPresent();
}
}
Aggregations