Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AAB4B10FBB for ; Fri, 16 Aug 2013 07:40:27 +0000 (UTC) Received: (qmail 91688 invoked by uid 500); 16 Aug 2013 07:40:26 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 91568 invoked by uid 500); 16 Aug 2013 07:40:25 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 91553 invoked by uid 99); 16 Aug 2013 07:40:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Aug 2013 07:40:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 71EAE837E06; Fri, 16 Aug 2013 07:40:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Fri, 16 Aug 2013 07:40:23 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: Fixed the CS error of camel-aws Updated Branches: refs/heads/master 2f75b2f1b -> f3285bee4 Fixed the CS error of camel-aws Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cd5ed054 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cd5ed054 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cd5ed054 Branch: refs/heads/master Commit: cd5ed054332136130a6b1f91fad6a983fa13417f Parents: 2f75b2f Author: Willem Jiang Authored: Fri Aug 16 14:55:59 2013 +0800 Committer: Willem Jiang Committed: Fri Aug 16 14:58:33 2013 +0800 ---------------------------------------------------------------------- .../component/aws/sqs/SqsConfiguration.java | 10 +++--- .../camel/component/aws/sqs/SqsEndpoint.java | 32 ++++++++++---------- .../component/aws/sqs/SqsEndpointTest.java | 24 ++++++++------- 3 files changed, 34 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/cd5ed054/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java index 2de6b0f..e306221 100644 --- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java +++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConfiguration.java @@ -180,12 +180,12 @@ public class SqsConfiguration { } public String getQueueOwnerAWSAccountId() { - return queueOwnerAWSAccountId; - } - + return queueOwnerAWSAccountId; + } + public void setQueueOwnerAWSAccountId(String queueOwnerAWSAccountId) { - this.queueOwnerAWSAccountId = queueOwnerAWSAccountId; - } + this.queueOwnerAWSAccountId = queueOwnerAWSAccountId; + } @Override public String toString() { http://git-wip-us.apache.org/repos/asf/camel/blob/cd5ed054/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java ---------------------------------------------------------------------- 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 29bfc47..e43b07f 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 @@ -78,26 +78,26 @@ public class SqsEndpoint extends ScheduledPollEndpoint { @Override protected void doStart() throws Exception { client = getConfiguration().getAmazonSQSClient() != null - ? getConfiguration().getAmazonSQSClient() : getClient(); + ? getConfiguration().getAmazonSQSClient() : getClient(); if (configuration.getQueueOwnerAWSAccountId() != null) { - GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(); - getQueueUrlRequest.setQueueName(configuration.getQueueName()); - getQueueUrlRequest.setQueueOwnerAWSAccountId(configuration.getQueueOwnerAWSAccountId()); - GetQueueUrlResult getQueueUrlResult = client.getQueueUrl(getQueueUrlRequest ); - queueUrl = getQueueUrlResult.getQueueUrl(); + GetQueueUrlRequest getQueueUrlRequest = new GetQueueUrlRequest(); + getQueueUrlRequest.setQueueName(configuration.getQueueName()); + getQueueUrlRequest.setQueueOwnerAWSAccountId(configuration.getQueueOwnerAWSAccountId()); + GetQueueUrlResult getQueueUrlResult = client.getQueueUrl(getQueueUrlRequest); + queueUrl = getQueueUrlResult.getQueueUrl(); } else { - // check whether the queue already exists - ListQueuesResult listQueuesResult = client.listQueues(); - for (String url : listQueuesResult.getQueueUrls()) { - if (url.endsWith("/" + configuration.getQueueName())) { - queueUrl = url; - LOG.trace("Queue available at '{}'.", queueUrl); - break; - } - } + // check whether the queue already exists + ListQueuesResult listQueuesResult = client.listQueues(); + for (String url : listQueuesResult.getQueueUrls()) { + if (url.endsWith("/" + configuration.getQueueName())) { + queueUrl = url; + LOG.trace("Queue available at '{}'.", queueUrl); + break; + } + } } - + if (queueUrl == null) { createQueue(client); } else { http://git-wip-us.apache.org/repos/asf/camel/blob/cd5ed054/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java index 45baf6a..aa08de6 100644 --- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java +++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java @@ -58,16 +58,18 @@ public class SqsEndpointTest { @Test public void doStartWithDifferentQueueOwner() throws Exception { - - EasyMock.expect(amazonSQSClient.getQueueUrl(new GetQueueUrlRequest("test-queue").withQueueOwnerAWSAccountId("111222333"))) - .andReturn(new GetQueueUrlResult().withQueueUrl("https://sqs.us-east-1.amazonaws.com/111222333/test-queue")); - - EasyMock.replay(amazonSQSClient); - - endpoint.getConfiguration().setQueueOwnerAWSAccountId("111222333"); - endpoint.doStart(); - - EasyMock.verify(amazonSQSClient); - + + EasyMock.expect(amazonSQSClient.getQueueUrl(new GetQueueUrlRequest("test-queue") + .withQueueOwnerAWSAccountId("111222333"))) + .andReturn(new GetQueueUrlResult() + .withQueueUrl("https://sqs.us-east-1.amazonaws.com/111222333/test-queue")); + + EasyMock.replay(amazonSQSClient); + + endpoint.getConfiguration().setQueueOwnerAWSAccountId("111222333"); + endpoint.doStart(); + + EasyMock.verify(amazonSQSClient); + } } \ No newline at end of file