camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] 01/02: CAMEL-13044 - Camel-AWS MQ: it is not possible to set Broker "Public accessibility" parameter using createBroker command
Date Thu, 10 Jan 2019 09:23:30 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 997d11c6d934e7d4128e3a2bc4b2d8faca5394fe
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Thu Jan 10 10:10:45 2019 +0100

    CAMEL-13044 - Camel-AWS MQ: it is not possible to set Broker "Public accessibility" parameter
using createBroker command
---
 .../apache/camel/component/aws/mq/MQConstants.java  | 21 +++++++++++----------
 .../apache/camel/component/aws/mq/MQProducer.java   |  7 +++++++
 .../component/aws/mq/MQProducerSpringTest.java      |  1 +
 .../camel/component/aws/mq/MQProducerTest.java      |  1 +
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQConstants.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQConstants.java
index 31ef98f..937d780 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQConstants.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQConstants.java
@@ -21,14 +21,15 @@ package org.apache.camel.component.aws.mq;
  * 
  */
 public interface MQConstants {
-    String OPERATION                = "CamelAwsMQOperation";
-    String MAX_RESULTS              = "CamelAwsMQMaxResults";
-    String BROKER_NAME              = "CamelAwsMQBrokerName";
-    String BROKER_ENGINE            = "CamelAwsMQBrokerEngine";
-    String BROKER_ENGINE_VERSION    = "CamelAwsMQBrokerEngineVersion";
-    String BROKER_ID                = "CamelAwsMQBrokerID";
-    String CONFIGURATION_ID         = "CamelAwsMQConfigurationID";
-    String BROKER_DEPLOYMENT_MODE   = "CamelAwsMQBrokerDeploymentMode";
-    String BROKER_INSTANCE_TYPE     = "CamelAwsMQBrokerInstanceType";
-    String BROKER_USERS             = "CamelAwsMQBrokerUsers";
+    String OPERATION                  = "CamelAwsMQOperation";
+    String MAX_RESULTS                = "CamelAwsMQMaxResults";
+    String BROKER_NAME                = "CamelAwsMQBrokerName";
+    String BROKER_ENGINE              = "CamelAwsMQBrokerEngine";
+    String BROKER_ENGINE_VERSION      = "CamelAwsMQBrokerEngineVersion";
+    String BROKER_ID                  = "CamelAwsMQBrokerID";
+    String CONFIGURATION_ID           = "CamelAwsMQConfigurationID";
+    String BROKER_DEPLOYMENT_MODE     = "CamelAwsMQBrokerDeploymentMode";
+    String BROKER_INSTANCE_TYPE       = "CamelAwsMQBrokerInstanceType";
+    String BROKER_USERS               = "CamelAwsMQBrokerUsers";
+    String BROKER_PUBLICLY_ACCESSIBLE = "CamelAwsMQBrokerPubliclyAccessible";
 }
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQProducer.java
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQProducer.java
index f0cbd2d..a9338c2 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQProducer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/mq/MQProducer.java
@@ -135,6 +135,7 @@ public class MQProducer extends DefaultProducer {
         String brokerEngineVersion;
         String deploymentMode;
         String instanceType;
+        Boolean publiclyAccessible;
         List<User> users;
         CreateBrokerRequest request = new CreateBrokerRequest();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MQConstants.BROKER_NAME)))
{
@@ -173,6 +174,12 @@ public class MQProducer extends DefaultProducer {
         } else {
             throw new IllegalArgumentException("A Users list must be specified");
         }
+        if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MQConstants.BROKER_PUBLICLY_ACCESSIBLE)))
{
+            publiclyAccessible = exchange.getIn().getHeader(MQConstants.BROKER_PUBLICLY_ACCESSIBLE,
Boolean.class);
+            request.withPubliclyAccessible(publiclyAccessible);
+        } else {
+            request.withPubliclyAccessible(false);
+        }
         CreateBrokerResult result;
         try {
             result = mqClient.createBroker(request);
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerSpringTest.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerSpringTest.java
index ec28fc9..8544896 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerSpringTest.java
@@ -76,6 +76,7 @@ public class MQProducerSpringTest extends CamelSpringTestSupport {
                 exchange.getIn().setHeader(MQConstants.BROKER_INSTANCE_TYPE, "mq.t2.micro");
                 exchange.getIn().setHeader(MQConstants.BROKER_ENGINE, EngineType.ACTIVEMQ.name());
                 exchange.getIn().setHeader(MQConstants.BROKER_ENGINE_VERSION, "5.15.6");
+                exchange.getIn().setHeader(MQConstants.BROKER_PUBLICLY_ACCESSIBLE, false);
                 List<User> users = new ArrayList<>();
                 User user = new User();
                 user.setUsername("camel");
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerTest.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerTest.java
index 6f86244..0a1ee25 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/mq/MQProducerTest.java
@@ -76,6 +76,7 @@ public class MQProducerTest extends CamelTestSupport {
                 exchange.getIn().setHeader(MQConstants.BROKER_INSTANCE_TYPE, "mq.t2.micro");
                 exchange.getIn().setHeader(MQConstants.BROKER_ENGINE, EngineType.ACTIVEMQ.name());
                 exchange.getIn().setHeader(MQConstants.BROKER_ENGINE_VERSION, "5.15.6");
+                exchange.getIn().setHeader(MQConstants.BROKER_PUBLICLY_ACCESSIBLE, false);
                 List<User> users = new ArrayList<>();
                 User user = new User();
                 user.setUsername("camel");


Mime
View raw message