Skip to content

Commit

Permalink
AWS SDK 2 upgrade: Extend test - spring-atticgh-267
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristine Jetzke committed Feb 17, 2020
1 parent 6c43d08 commit d57364a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,26 @@
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type
type="com.amazonaws.services.sqs.AmazonSQSAsync"/>
type="software.amazon.awssdk.services.sqs.SqsClient"/>
</tool:annotation>
</xsd:appinfo>
<xsd:documentation>
Sets the AmazonSQSAsync that is going to be used by the container
Sets the SQS sync client that is going to be used by the container
to interact with the messaging
(SQS) API.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="amazon-sqs-async" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type
type="software.amazon.awssdk.services.sqs.SqsAsyncClient"/>
</tool:annotation>
</xsd:appinfo>
<xsd:documentation>
Sets the SQS async client that is going to be used by the container
to interact with the messaging
(SQS) API.
</xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public void parseInternal_customSqsClient_shouldProduceContainerWithCustomSqsCli
getClass().getSimpleName() + "-custom-amazon-sqs.xml", getClass()));

// Assert
BeanDefinition sqsAsync = registry.getBeanDefinition("myClient");
BeanDefinition sqs = registry.getBeanDefinition("myClient");
assertThat(sqs).isNotNull();
BeanDefinition sqsAsync = registry.getBeanDefinition("myClientAsync");
assertThat(sqsAsync).isNotNull();

BeanDefinition abstractContainerDefinition = registry
Expand All @@ -146,10 +148,9 @@ public void parseInternal_customSqsClient_shouldProduceContainerWithCustomSqsCli
assertThat(((RuntimeBeanReference) abstractContainerDefinition.getPropertyValues()
.getPropertyValue("amazonSqs").getValue()).getBeanName())
.isEqualTo("myClient");
// TODO SDK2 migration: uncomment and extend test
// assertThat(((RuntimeBeanReference) abstractContainerDefinition.getPropertyValues()
// .getPropertyValue("amazonSqsAsync").getValue()).getBeanName())
// .isEqualTo("myClientAsync");
assertThat(((RuntimeBeanReference) abstractContainerDefinition.getPropertyValues()
.getPropertyValue("amazonSqsAsync").getValue()).getBeanName())
.isEqualTo("myClientAsync");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
http://www.springframework.org/schema/cloud/aws/context
http://www.springframework.org/schema/cloud/aws/context/spring-cloud-aws-context.xsd">

<bean id="myClient" class="software.amazon.awssdk.services.sqs.SqsAsyncClient" factory-method="create"/>
<bean id="myClient" class="software.amazon.awssdk.services.sqs.SqsClient" factory-method="create"/>
<bean id="myClientAsync" class="software.amazon.awssdk.services.sqs.SqsAsyncClient" factory-method="create"/>

<aws-messaging:annotation-driven-queue-listener amazon-sqs="myClient"/>
<aws-messaging:annotation-driven-queue-listener amazon-sqs-async="myClientAsync" amazon-sqs="myClient"/>

<aws-context:context-credentials>
<aws-context:instance-profile-credentials/>
Expand Down

0 comments on commit d57364a

Please sign in to comment.