This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch camel-2.22.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.22.x by this push: new 435da6f CAMEL-12820 - SQS: Malformed queue URL due to bad region parsing 435da6f is described below commit 435da6f8e174be57f001b6e33b61498c9da4fceb Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Sep 18 15:16:07 2018 +0200 CAMEL-12820 - SQS: Malformed queue URL due to bad region parsing --- .../apache/camel/component/aws/sqs/SqsEndpoint.java | 2 +- .../aws/sqs/SqsComponentConfigurationTest.java | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java index 4506734..1182f12 100644 --- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java @@ -129,7 +129,7 @@ public class SqsEndpoint extends ScheduledPollEndpoint implements HeaderFilterSt if (configuration.getRegion() != null && configuration.getQueueOwnerAWSAccountId() != null) { String host = configuration.getAmazonAWSHost(); host = FileUtil.stripTrailingSeparator(host); - queueUrl = "https://sqs." + configuration.getRegion() + "." + host + "/" + queueUrl = "https://sqs." + Regions.valueOf(configuration.getRegion()).getName() + "." + host + "/" + configuration.getQueueOwnerAWSAccountId() + "/" + configuration.getQueueName(); } else if (configuration.getQueueOwnerAWSAccountId() != null) { GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(); diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java index 2699482..6b54208 100644 --- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsComponentConfigurationTest.java @@ -68,6 +68,26 @@ public class SqsComponentConfigurationTest extends CamelTestSupport { } @Test + public void createEndpointWithOnlyAccessKeyAndSecretKeyAndRegion() throws Exception { + SqsComponent component = new SqsComponent(context); + SqsEndpoint endpoint = (SqsEndpoint) component.createEndpoint("aws-sqs://MyQueue?accessKey=xxx&secretKey=yyy®ion=US_WEST_1"); + + assertEquals("MyQueue", endpoint.getConfiguration().getQueueName()); + assertEquals("xxx", endpoint.getConfiguration().getAccessKey()); + assertEquals("yyy", endpoint.getConfiguration().getSecretKey()); + assertEquals("US_WEST_1", endpoint.getConfiguration().getRegion()); + assertNull(endpoint.getConfiguration().getAmazonSQSClient()); + assertNull(endpoint.getConfiguration().getAttributeNames()); + assertNull(endpoint.getConfiguration().getMessageAttributeNames()); + assertNull(endpoint.getConfiguration().getDefaultVisibilityTimeout()); + assertNull(endpoint.getConfiguration().getVisibilityTimeout()); + assertNull(endpoint.getConfiguration().getMaximumMessageSize()); + assertNull(endpoint.getConfiguration().getMessageRetentionPeriod()); + assertNull(endpoint.getConfiguration().getPolicy()); + assertNull(endpoint.getConfiguration().getRedrivePolicy()); + } + + @Test public void createEndpointWithMinimalArnConfiguration() throws Exception { AmazonSQSClientMock mock = new AmazonSQSClientMock();