GH-224: Fix SnsBodyBuilder usage in the Doc

Fixes https://github.com/spring-projects/spring-integration-aws/issues/224

* Fix `SnsMessageBuilder` -> `SnsBodyBuilder` in the `SnsMessageHandler.onInit()` comment
for SpEL import registration
* Upgrade to Localstack `2.1.0`
* Rename `SnsMessageBuilderTests` -> `SnsBodyBuilderTests` for consistency of its purpose
This commit is contained in:
abilan
2023-06-05 11:59:55 -04:00
parent 4b004ab59d
commit 31a4dc67f4
4 changed files with 6 additions and 6 deletions

View File

@@ -333,7 +333,7 @@ The Java Config looks like:
public MessageHandler snsMessageHandler() {
SnsMessageHandler handler = new SnsMessageHandler(amazonSns());
adapter.setTopicArn("arn:aws:sns:eu-west:123456789012:test");
String bodyExpression = "SnsBodyBuilder.withDefault(payload).forProtocols(payload.substring(0, 140), 'sms')";
String bodyExpression = "T(SnsBodyBuilder).withDefault(payload).forProtocols(payload.substring(0, 140), 'sms')";
handler.setBodyExpression(spelExpressionParser.parseExpression(bodyExpression));
// message-group ID and deduplication ID are used for FIFO topics

View File

@@ -192,7 +192,7 @@ public class SnsMessageHandler extends AbstractAwsMessageHandler<Map<String, Mes
if (typeLocator instanceof StandardTypeLocator) {
/*
* Register the 'org.springframework.integration.aws.support' package you
* don't need a FQCN for the 'SnsMessageBuilder'.
* don't need a FQCN for the 'SnsBodyBuilder'.
*/
((StandardTypeLocator) typeLocator).registerImport("org.springframework.integration.aws.support");
}

View File

@@ -48,7 +48,7 @@ import software.amazon.awssdk.services.sqs.SqsAsyncClient;
public interface LocalstackContainerTest {
LocalStackContainer LOCAL_STACK_CONTAINER =
new LocalStackContainer(DockerImageName.parse("localstack/localstack:2.0.0"));
new LocalStackContainer(DockerImageName.parse("localstack/localstack:2.1.0"));
@BeforeAll
static void startContainer() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
/**
* @author Artem Bilan
*/
class SnsMessageBuilderTests {
class SnsBodyBuilderTests {
@Test
void testSnsMessageBuilder() {
void testSnsBodyBuilder() {
assertThatIllegalArgumentException()
.isThrownBy(() -> SnsBodyBuilder.withDefault(""))
.withMessageContaining("defaultMessage must not be empty.");