Skip to content

Commit cf07412

Browse files
committed
test: SnsOutboundChannelAdapterParserTest
1 parent ab34b79 commit cf07412

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

int-aws/src/main/resources/org/springframework/schema/integration/aws/spring-integration-aws.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,11 @@
858858
<attribute name="sns" type="string" use="required">
859859
<annotation>
860860
<documentation><![CDATA[
861-
The 'software.amazon.awssdk.services.sns.SnsClient' bean reference.
861+
The 'software.amazon.awssdk.services.sns.SnsAsyncClient' bean reference.
862862
]]></documentation>
863863
<appinfo>
864864
<tool:annotation kind="ref">
865-
<tool:expected-type type="software.amazon.awssdk.services.sns.SnsClient"/>
865+
<tool:expected-type type="software.amazon.awssdk.services.sns.SnsAsyncClient"/>
866866
</tool:annotation>
867867
</appinfo>
868868
</annotation>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.springframework.integration.aws.config.xml.parsers;
2+
3+
import org.bool.junit.mockito.inline.ConstructionMock;
4+
5+
import org.assertj.core.api.InstanceOfAssertFactories;
6+
import org.junit.jupiter.api.Test;
7+
import org.mockito.Mock;
8+
import org.mockito.MockedConstruction.Context;
9+
import org.springframework.integration.aws.outbound.SnsMessageHandler;
10+
import software.amazon.awssdk.services.sns.SnsAsyncClient;
11+
12+
import static org.assertj.core.api.Assertions.assertThat;
13+
14+
class SnsOutboundChannelAdapterParserTest extends ParserTestBase {
15+
16+
@Mock
17+
private SnsAsyncClient sns;
18+
19+
@ConstructionMock(SnsMessageHandler.class)
20+
@Test
21+
void testHandler() {
22+
registerBean("sns", SnsAsyncClient.class, sns);
23+
24+
var handler = loadBean(SnsMessageHandler.class, """
25+
<int-aws:sns-outbound-channel-adapter
26+
id="snsoca"
27+
channel="c"
28+
sns="sns"
29+
topic-arn="arn"
30+
subject="subj"
31+
message-group-id="groupid"
32+
body-expression="body.exp"
33+
message-deduplication-id-expression="mdi.exp"
34+
order="#{5}"
35+
async="#{true}"
36+
output-channel="out"
37+
send-timeout="#{50}"/>
38+
""");
39+
40+
verify(handler).setTopicArn("arn");
41+
verify(handler).setSubject("subj");
42+
verify(handler).setMessageGroupId("groupid");
43+
verify(handler).setMessageDeduplicationIdExpression(argThat(e -> "mdi.exp".equals(e.getExpressionString())));
44+
verify(handler).setOrder(5);
45+
verify(handler).setOutputChannelName("out");
46+
verify(handler).setSendTimeout(50L);
47+
verify(handler).setAsync(true);
48+
}
49+
50+
void testHandler(SnsMessageHandler mock, Context context) {
51+
assertThat(context.arguments()).asInstanceOf(InstanceOfAssertFactories.LIST)
52+
.contains(sns);
53+
}
54+
}

0 commit comments

Comments
 (0)