camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [1/2] camel git commit: Camel-AWS EC2 integration tests now cover all the available operations
Date Sun, 21 Jun 2015 13:43:07 GMT
Repository: camel
Updated Branches:
  refs/heads/master 6c2bf43a8 -> d769cba8d


Camel-AWS EC2 integration tests now cover all the available operations


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

Branch: refs/heads/master
Commit: f1c608a3af54bd5687cc2a95336a46d7f6af42fe
Parents: 6c2bf43
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Sun Jun 21 15:30:47 2015 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Sun Jun 21 15:40:59 2015 +0200

----------------------------------------------------------------------
 .../EC2ComponentIntegrationTest.java            | 135 +++++++++++++++++++
 1 file changed, 135 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f1c608a3/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
index 56cf606..9007994 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
@@ -19,12 +19,20 @@ package org.apache.camel.component.aws.ec2.integration;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.amazonaws.services.ec2.model.DescribeInstanceStatusResult;
+import com.amazonaws.services.ec2.model.DescribeInstancesResult;
+import com.amazonaws.services.ec2.model.InstanceStateName;
 import com.amazonaws.services.ec2.model.InstanceType;
+import com.amazonaws.services.ec2.model.MonitorInstancesResult;
+import com.amazonaws.services.ec2.model.MonitoringState;
+import com.amazonaws.services.ec2.model.RunInstancesResult;
+import com.amazonaws.services.ec2.model.UnmonitorInstancesResult;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws.ec2.EC2Constants;
+import org.apache.camel.component.aws.ec2.EC2Operations;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -63,6 +71,22 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
     }
     
     @Test
+    public void ec2CreateAndRunTestWithKeyPair() throws Exception {
+
+        Exchange exchange = template.request("direct:createAndRun", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EC2Constants.OPERATION, EC2Operations.createAndRunInstances);
+                exchange.getIn().setHeader(EC2Constants.IMAGE_ID, "ami-fd65ba94");
+                exchange.getIn().setHeader(EC2Constants.INSTANCE_TYPE, InstanceType.T2Micro);
+                exchange.getIn().setHeader(EC2Constants.INSTANCE_MIN_COUNT, 1);
+                exchange.getIn().setHeader(EC2Constants.INSTANCE_MAX_COUNT, 1);
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_KEY_PAIR, "keypair-1");
+            }
+        });
+    }
+    
+    @Test
     public void stopInstances() {
         
         template.send("direct:stop", new Processor() {
@@ -97,6 +121,107 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
             }
         });
     }
+    
+    @Test
+    public void ec2DescribeInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:describe", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                
+            }
+        });
+
+    }
+    
+    @Test
+    public void ec2DescribeSpecificInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:describe", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Collection l = new ArrayList();
+                l.add("instance-1");
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+            }
+        });
+
+    }
+    
+    @Test
+    public void ec2DescribeInstancesStatusTest() throws Exception {
+
+        Exchange exchange = template.request("direct:describeStatus", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                
+            }
+        });
+
+    }
+    
+    @Test
+    public void ec2DescribeStatusSpecificInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:describeStatus", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Collection l = new ArrayList();
+                l.add("test-1");
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+            }
+        });
+
+    }
+    
+    @Test
+    public void ec2RebootInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:reboot", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Collection l = new ArrayList();
+                l.add("test-1");
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+            }
+        });
+
+    }
+    
+    
+    @Test
+    public void ec2MonitorInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:monitor", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Collection l = new ArrayList();
+                l.add("test-1");
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+            }
+        });
+        
+    }
+    
+    @Test
+    public void ec2UnmonitorInstancesTest() throws Exception {
+
+        Exchange exchange = template.request("direct:unmonitor", new Processor() {
+            
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Collection l = new ArrayList();
+                l.add("test-1");
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+            }
+        });
+    }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
@@ -111,6 +236,16 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
                         .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=startInstances");
                 from("direct:terminate")
                         .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=terminateInstances");
+                from("direct:describe")
+                        .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=describeInstances");
+                from("direct:describeStatus")
+                        .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=describeInstancesStatus");
+                from("direct:reboot")
+                        .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=rebootInstances");
+                from("direct:monitor")
+                        .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=monitorInstances");
+                from("direct:unmonitor")
+                        .to("aws-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=unmonitorInstances");
             }
         };
     }


Mime
View raw message