camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch camel-2.20.x updated: Fixed CS
Date Fri, 10 Nov 2017 08:09:22 GMT
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
     new 7dde058  Fixed CS
7dde058 is described below

commit 7dde0583a30ca042566c36a477c9dac03d79e8c3
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Fri Nov 10 09:08:52 2017 +0100

    Fixed CS
---
 .../azure/queue/QueueServiceComponent.java         | 30 +++++++++-------
 .../azure/queue/QueueServiceConfiguration.java     | 31 ++++++++--------
 .../azure/queue/QueueServiceProducerTest.java      | 41 ++++++++++------------
 .../src/test/resources/log4j.properties            | 35 +++++++++---------
 4 files changed, 66 insertions(+), 71 deletions(-)

diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceComponent.java
b/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceComponent.java
index 572989c..db2c07a 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceComponent.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceComponent.java
@@ -20,12 +20,13 @@ import java.util.Map;
 
 import com.microsoft.azure.storage.StorageCredentials;
 import com.microsoft.azure.storage.queue.CloudQueue;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
 
 public class QueueServiceComponent extends UriEndpointComponent {
-    
+
     public QueueServiceComponent() {
         super(QueueServiceEndpoint.class);
     }
@@ -40,34 +41,37 @@ public class QueueServiceComponent extends UriEndpointComponent {
 
         String[] parts = null;
         if (remaining != null) {
-            parts = remaining.split("/"); 
+            parts = remaining.split("/");
         }
-        if (parts == null || parts.length < 1) 
+        if (parts == null || parts.length < 1) {
             throw new IllegalArgumentException("The account name must be specified.");
+        }
 
         QueueServiceOperations operation = configuration.getOperation();
-        if (operation != null && operation != QueueServiceOperations.listQueues &&
parts.length < 2) 
+        if (operation != null && operation != QueueServiceOperations.listQueues &&
parts.length < 2) {
             throw new IllegalArgumentException("The queue name must be specified.");
+        }
 
-        if (parts.length > 2) 
+        if (parts.length > 2) {
             throw new IllegalArgumentException("Only the account and queue names must be
specified.");
-        
+        }
+
         configuration.setAccountName(parts[0]);
-        
-        if (parts.length > 1)
+
+        if (parts.length > 1) {
             configuration.setQueueName(parts[1]);
-        
+        }
+
         checkCredentials(configuration);
-        
+
         QueueServiceEndpoint endpoint = new QueueServiceEndpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
         return endpoint;
     }
-    
+
     private void checkCredentials(QueueServiceConfiguration cfg) {
         CloudQueue client = cfg.getAzureQueueClient();
-        StorageCredentials creds = client == null ? cfg.getCredentials() 
-            : client.getServiceClient().getCredentials(); 
+        StorageCredentials creds = client == null ? cfg.getCredentials() : client.getServiceClient().getCredentials();
         if (creds == null) {
             throw new IllegalArgumentException("Credentials must be specified.");
         }
diff --git a/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceConfiguration.java
b/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceConfiguration.java
index 699e013..b674f26 100644
--- a/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceConfiguration.java
+++ b/components/camel-azure/src/main/java/org/apache/camel/component/azure/queue/QueueServiceConfiguration.java
@@ -16,37 +16,36 @@
  */
 package org.apache.camel.component.azure.queue;
 
+import com.microsoft.azure.storage.queue.CloudQueue;
+
 import org.apache.camel.component.azure.common.AbstractConfiguration;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
-
-import com.microsoft.azure.storage.queue.CloudQueue;
-
 @UriParams
 public class QueueServiceConfiguration extends AbstractConfiguration {
 
     private String queueName;
     @UriParam
     private CloudQueue azureQueueClient;
-    
+
     @UriParam(label = "producer", defaultValue = "listQueues")
     private QueueServiceOperations operation = QueueServiceOperations.listQueues;
-    
+
     @UriParam(label = "producer")
     private int messageTimeToLive;
-    
+
     @UriParam(label = "producer")
     private int messageVisibilityDelay;
-    
+
     @UriParam(label = "producer")
     private String queuePrefix;
-    
+
     public String getQueueName() {
         return queueName;
     }
-    
+
     /**
-     * The queue resource name 
+     * The queue resource name
      */
     public void setQueueName(String queueName) {
         this.queueName = queueName;
@@ -57,7 +56,7 @@ public class QueueServiceConfiguration extends AbstractConfiguration {
     }
 
     /**
-     * The queue service client 
+     * The queue service client
      */
     public void setAzureQueueClient(CloudQueue azureQueueClient) {
         this.azureQueueClient = azureQueueClient;
@@ -68,7 +67,7 @@ public class QueueServiceConfiguration extends AbstractConfiguration {
     }
 
     /**
-     * Queue service operation hint to the producer 
+     * Queue service operation hint to the producer
      */
     public void setOperation(QueueServiceOperations operation) {
         this.operation = operation;
@@ -79,7 +78,7 @@ public class QueueServiceConfiguration extends AbstractConfiguration {
     }
 
     /**
-     * Message Time To Live in seconds 
+     * Message Time To Live in seconds
      */
     public void setMessageTimeToLive(int messageTimeToLive) {
         this.messageTimeToLive = messageTimeToLive;
@@ -90,7 +89,7 @@ public class QueueServiceConfiguration extends AbstractConfiguration {
     }
 
     /**
-     * Message Visibility Delay in seconds 
+     * Message Visibility Delay in seconds
      */
     public void setMessageVisibilityDelay(int messageVisibilityDelay) {
         this.messageVisibilityDelay = messageVisibilityDelay;
@@ -101,9 +100,9 @@ public class QueueServiceConfiguration extends AbstractConfiguration {
     }
 
     /**
-     * Set a prefix which can be used for listing the queues 
+     * Set a prefix which can be used for listing the queues
      */
     public void setQueuePrefix(String queuePrefix) {
         this.queuePrefix = queuePrefix;
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceProducerTest.java
b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceProducerTest.java
index bc3107f..2174597c 100644
--- a/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceProducerTest.java
+++ b/components/camel-azure/src/test/java/org/apache/camel/component/azure/queue/QueueServiceProducerTest.java
@@ -23,6 +23,12 @@ import java.util.Properties;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
+import com.microsoft.azure.storage.OperationContext;
+import com.microsoft.azure.storage.StorageCredentials;
+import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
+import com.microsoft.azure.storage.queue.CloudQueue;
+import com.microsoft.azure.storage.queue.CloudQueueMessage;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
@@ -32,12 +38,6 @@ import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
 
-import com.microsoft.azure.storage.OperationContext;
-import com.microsoft.azure.storage.StorageCredentials;
-import com.microsoft.azure.storage.StorageCredentialsAccountAndKey;
-import com.microsoft.azure.storage.queue.CloudQueue;
-import com.microsoft.azure.storage.queue.CloudQueueMessage;
-
 public class QueueServiceProducerTest {
 
     private static final String AZURE_STORAGE_QUEUE = "AZURE_STORAGE_QUEUE";
@@ -49,42 +49,37 @@ public class QueueServiceProducerTest {
         Assume.assumeNotNull("Credentials not null", creds);
 
         OperationContext.setLoggingEnabledByDefault(true);
-        
+
         CamelContext camelctx = createCamelContext(creds);
         camelctx.addRoutes(new RouteBuilder() {
             public void configure() throws Exception {
-                from("direct:createQueue")
-                .to("azure-queue://camelqueue/queue1?credentials=#creds&operation=createQueue");
+                from("direct:createQueue").to("azure-queue://camelqueue/queue1?credentials=#creds&operation=createQueue");
 
-                from("direct:listQueues")
-                .to("azure-queue://camelqueue?credentials=#creds&operation=listQueues");
+                from("direct:listQueues").to("azure-queue://camelqueue?credentials=#creds&operation=listQueues");
 
-                from("direct:deleteQueue")
-                .to("azure-queue://camelqueue/queue1?credentials=#creds&operation=deleteQueue");
+                from("direct:deleteQueue").to("azure-queue://camelqueue/queue1?credentials=#creds&operation=deleteQueue");
 
-                from("direct:addMessage")
-                .to("azure-queue://camelqueue/queue1?credentials=#creds&operation=addMessage");
+                from("direct:addMessage").to("azure-queue://camelqueue/queue1?credentials=#creds&operation=addMessage");
 
-                from("direct:retrieveMessage")
-                .to("azure-queue://camelqueue/queue1?credentials=#creds&operation=retrieveMessage");
+                from("direct:retrieveMessage").to("azure-queue://camelqueue/queue1?credentials=#creds&operation=retrieveMessage");
             }
         });
 
         camelctx.start();
         try {
             ProducerTemplate producer = camelctx.createProducerTemplate();
-            
+
             Iterator<?> it = producer.requestBody("direct:listQueues", null, Iterable.class).iterator();
             Assert.assertFalse("No more queues", it.hasNext());
 
             producer.sendBody("direct:addMessage", "SomeMsg");
-            
+
             it = producer.requestBody("direct:listQueues", null, Iterable.class).iterator();
             Assert.assertTrue("Has queues", it.hasNext());
-            CloudQueue queue = (CloudQueue) it.next();
+            CloudQueue queue = (CloudQueue)it.next();
             Assert.assertEquals("queue1", queue.getName());
             Assert.assertFalse("No more queues", it.hasNext());
-            
+
             try {
                 CloudQueueMessage msg = producer.requestBody("direct:retrieveMessage", null,
CloudQueueMessage.class);
                 Assert.assertNotNull("Retrieve a message", msg);
@@ -92,7 +87,7 @@ public class QueueServiceProducerTest {
             } finally {
                 queue.delete();
             }
-            
+
         } finally {
             camelctx.stop();
         }
@@ -113,4 +108,4 @@ public class QueueServiceProducerTest {
         properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory");
         return new InitialContext(new Hashtable<Object, Object>(properties));
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-azure/src/test/resources/log4j.properties b/components/camel-azure/src/test/resources/log4j.properties
index 6b2698a..c890e97 100644
--- a/components/camel-azure/src/test/resources/log4j.properties
+++ b/components/camel-azure/src/test/resources/log4j.properties
@@ -1,22 +1,19 @@
-###
-# #%L
-# Wildfly Camel :: Testsuite
-# %%
-# Copyright (C) 2013 - 2014 RedHat
-# %%
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#      http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# #L%
-###
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
 
 # Root logger option
 log4j.rootLogger=DEBUG, file, console

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Mime
View raw message