Skip to content

Commit 6ef47bf

Browse files
committed
test: SnsInboundChannelAdapterParserTest
1 parent c58f74e commit 6ef47bf

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

int-aws-support/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ dependencies {
1313

1414
testImplementation "io.github.boolivar:mockito-inline-extension"
1515
testImplementation "software.amazon.awssdk:s3-transfer-manager"
16+
17+
testRuntimeOnly "jakarta.servlet:jakarta.servlet-api"
1618
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package org.springframework.integration.aws.support.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.inbound.SnsInboundChannelAdapter;
10+
import software.amazon.awssdk.services.sns.SnsClient;
11+
12+
import static org.assertj.core.api.Assertions.assertThat;
13+
14+
@ConstructionMock(SnsInboundChannelAdapter.class)
15+
class SnsInboundChannelAdapterParserTest extends ParserTestBase {
16+
17+
@Mock
18+
private SnsClient sns;
19+
20+
@Test
21+
void testAdapter() {
22+
registerBean("sns", sns);
23+
24+
parse("""
25+
<int-aws:sns-inbound-channel-adapter
26+
id="sica"
27+
channel="c"
28+
sns="sns"
29+
path="/path/{uri},/path/*.do"
30+
error-channel="ec"
31+
handle-notification-status="#{true}"
32+
payload-expression="payload.exp"
33+
send-timeout="#{50}"
34+
/>
35+
""");
36+
37+
var adapter = beanFactory.getBean(SnsInboundChannelAdapter.class);
38+
39+
verify(adapter).setBeanName("sica");
40+
verify(adapter).setErrorChannelName("ec");
41+
verify(adapter).setHandleNotificationStatus(true);
42+
verify(adapter).setPayloadExpression(assertArg(e -> assertThat(e.getExpressionString()).isEqualTo("payload.exp")));
43+
verify(adapter).setRequestTimeout(50L);
44+
}
45+
46+
void testAdapter(SnsInboundChannelAdapter mock, Context context) {
47+
assertThat(context.arguments()).asInstanceOf(InstanceOfAssertFactories.LIST)
48+
.contains(sns, new String[] {"/path/{uri}", "/path/*.do"});
49+
}
50+
}

int-aws/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ dependencies {
1616
testImplementation "io.github.boolivar:mockito-inline-extension"
1717

1818
testRuntimeOnly "software.amazon.awssdk:s3-transfer-manager"
19-
testRuntimeOnly "jakarta.servlet:jakarta.servlet-api:6.1.0"
19+
testRuntimeOnly "jakarta.servlet:jakarta.servlet-api"
2020
}

0 commit comments

Comments
 (0)