You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/04/13 06:21:30 UTC

[1/2] camel git commit: [CAMEL-11141] Add support for VPC instances

Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 33dd5eb61 -> 4765927aa


[CAMEL-11141] Add support for VPC instances


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f8d7e8a6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f8d7e8a6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f8d7e8a6

Branch: refs/heads/camel-2.18.x
Commit: f8d7e8a657cb546318ca1dddd40b249c73228938
Parents: 33dd5eb
Author: Thomas Diesler <th...@jboss.com>
Authored: Wed Apr 12 18:56:24 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Thu Apr 13 08:14:51 2017 +0200

----------------------------------------------------------------------
 .../camel/component/aws/ec2/EC2Constants.java   |  1 +
 .../camel/component/aws/ec2/EC2Producer.java    | 31 ++++++++------------
 2 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f8d7e8a6/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
index c7dfa65..dd927e5 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Constants.java
@@ -36,4 +36,5 @@ public interface EC2Constants {
     String INSTANCES_CLIENT_TOKEN   = "CamelAwsEC2InstancesClientToken";
     String INSTANCES_PLACEMENT      = "CamelAwsEC2InstancesPlacement";
     String INSTANCES_TAGS           = "CamelAwsEC2InstancesTags";
+    String SUBNET_ID                = "CamelAwsEC2SubnetId";
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/f8d7e8a6/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
index 3c3450c..8053c16 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ec2/EC2Producer.java
@@ -138,15 +138,6 @@ public class EC2Producer extends DefaultProducer {
     private void createAndRunInstance(AmazonEC2Client ec2Client, Exchange exchange) {
         String ami;
         InstanceType instanceType;
-        int minCount;
-        int maxCount;
-        boolean monitoring;
-        String kernelId;
-        boolean ebsOptimized;
-        Collection securityGroups;
-        String keyName;
-        String clientToken;
-        Placement placement;
         RunInstancesRequest request = new RunInstancesRequest();
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.IMAGE_ID))) {
             ami = exchange.getIn().getHeader(EC2Constants.IMAGE_ID, String.class);
@@ -161,45 +152,49 @@ public class EC2Producer extends DefaultProducer {
             throw new IllegalArgumentException("Instance Type must be specified");
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT))) {
-            minCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT, Integer.class);
+            int minCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MIN_COUNT, Integer.class);
             request.withMinCount(minCount);
         } else {
             throw new IllegalArgumentException("Min instances count must be specified");
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT))) {
-            maxCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT, Integer.class);
+            int maxCount = exchange.getIn().getHeader(EC2Constants.INSTANCE_MAX_COUNT, Integer.class);
             request.withMaxCount(maxCount);
         } else {
             throw new IllegalArgumentException("Max instances count must be specified");
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING))) {
-            monitoring = exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING, Boolean.class);
+            boolean monitoring = exchange.getIn().getHeader(EC2Constants.INSTANCE_MONITORING, Boolean.class);
             request.withMonitoring(monitoring);
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID))) {
-            kernelId = exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID, String.class);
+            String kernelId = exchange.getIn().getHeader(EC2Constants.INSTANCE_KERNEL_ID, String.class);
             request.withKernelId(kernelId);
         }       
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED))) {
-            ebsOptimized = exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED, Boolean.class);
+            boolean ebsOptimized = exchange.getIn().getHeader(EC2Constants.INSTANCE_EBS_OPTIMIZED, Boolean.class);
             request.withEbsOptimized(ebsOptimized);
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS))) {
-            securityGroups = exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS, Collection.class);
+            Collection securityGroups = exchange.getIn().getHeader(EC2Constants.INSTANCE_SECURITY_GROUPS, Collection.class);
             request.withSecurityGroups(securityGroups);
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR))) {
-            keyName = exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR, String.class);
+            String keyName = exchange.getIn().getHeader(EC2Constants.INSTANCES_KEY_PAIR, String.class);
             request.withKeyName(keyName);
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN))) {
-            clientToken = exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN, String.class);
+            String clientToken = exchange.getIn().getHeader(EC2Constants.INSTANCES_CLIENT_TOKEN, String.class);
             request.withClientToken(clientToken);
         }
         if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT))) {
-            placement = exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT, Placement.class);
+            Placement placement = exchange.getIn().getHeader(EC2Constants.INSTANCES_PLACEMENT, Placement.class);
             request.withPlacement(placement);
         }
+        if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.SUBNET_ID))) {
+            String subnetId = exchange.getIn().getHeader(EC2Constants.SUBNET_ID, String.class);
+            request.withSubnetId(subnetId);
+        }
         RunInstancesResult result;
         try {
             result = ec2Client.runInstances(request);


[2/2] camel git commit: CAMEL-10997: Fixed test due ObjectHelper.isNotEmpty was changed.

Posted by ac...@apache.org.
CAMEL-10997: Fixed test due ObjectHelper.isNotEmpty was changed.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4765927a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4765927a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4765927a

Branch: refs/heads/camel-2.18.x
Commit: 4765927aae3fddd2482d536ae834983db4bbec4a
Parents: f8d7e8a
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Mar 13 11:09:49 2017 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Thu Apr 13 08:19:46 2017 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4765927a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
index c3db792..07729a8 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
@@ -78,7 +78,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
             ins.setImageId(runInstancesRequest.getImageId());
             ins.setInstanceType(runInstancesRequest.getInstanceType());
             ins.setInstanceId("instance-1");
-            if (ObjectHelper.isNotEmpty(runInstancesRequest.getSecurityGroups()) && ObjectHelper.isNotEmpty(runInstancesRequest.getSecurityGroups())) {
+            if (runInstancesRequest.getSecurityGroups() != null) {
                 if (runInstancesRequest.getSecurityGroups().contains("secgroup-1") && runInstancesRequest.getSecurityGroups().contains("secgroup-2")) {
                     GroupIdentifier id1 = new GroupIdentifier();
                     id1.setGroupId("id-1");