You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2010/11/12 10:53:31 UTC

svn commit: r1034318 - in /incubator/deltacloud/trunk: server/lib/deltacloud/base_driver/mock_driver.rb tests/ec2/api.feature tests/ec2/support/elb/ tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709

Author: mfojtik
Date: Fri Nov 12 09:53:31 2010
New Revision: 1034318

URL: http://svn.apache.org/viewvc?rev=1034318&view=rev
Log:
Fixed Cucumber tests for EC2 (LoadBalancers)

Added:
    incubator/deltacloud/trunk/tests/ec2/support/elb/
    incubator/deltacloud/trunk/tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709
Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb
    incubator/deltacloud/trunk/tests/ec2/api.feature

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb?rev=1034318&r1=1034317&r2=1034318&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb Fri Nov 12 09:53:31 2010
@@ -16,6 +16,19 @@ module Mock
     MethodSerializer::Cache::wrap_methods(self, :cache_dir => File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'tests', 'ec2', 'support'))
   end
 
+  class ELB < AWS::ELB::Base
+    include MethodSerializer::Cache
+
+    def self.cached_methods
+      [
+        :describe_load_balancers
+      ]
+    end
+
+    MethodSerializer::Cache::wrap_methods(self, :cache_dir => File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'tests', 'ec2', 'support'))
+
+  end
+
   class EC2 < AWS::EC2::Base
 
     include MethodSerializer::Cache
@@ -44,11 +57,18 @@ Deltacloud::Drivers::EC2::EC2Driver.clas
   alias_method :original_new_client, :new_client
   alias_method :original_s3_client, :s3_client
 
-  def new_client(credentials, opts={})
-    Mock::EC2.new(
-      :access_key_id => credentials.user,
-      :secret_access_key => credentials.password
-    )
+  def new_client(credentials, provider = :ec2)
+    if provider == :elb
+      Mock::ELB.new(
+        :access_key_id => credentials.user,
+        :secret_access_key => credentials.password
+      )
+    else
+      Mock::EC2.new(
+        :access_key_id => credentials.user,
+        :secret_access_key => credentials.password
+      )
+    end
   end
 
   def s3_client(credentials)

Modified: incubator/deltacloud/trunk/tests/ec2/api.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/api.feature?rev=1034318&r1=1034317&r2=1034318&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/api.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/api.feature Fri Nov 12 09:53:31 2010
@@ -22,6 +22,7 @@ Feature: Accessing API entry points
     | hardware_profiles  |
     | storage_snapshots  |
     | storage_volumes    |
+    | load_balancers |
     And this URI should be available in XML, JSON, HTML format
 
   Scenario: Following entry points
@@ -38,6 +39,7 @@ Feature: Accessing API entry points
     | hardware_profiles  |
     | storage_snapshots  |
     | storage_volumes    |
+    | load_balancers |
     And each link should have 'rel' attribute with valid name
     And each link should have 'href' attribute with valid URL
     When client follow this attribute
@@ -50,3 +52,4 @@ Feature: Accessing API entry points
     Then client should get list of features inside 'instances':
     | authentication_key |
     | user_data |
+    | register_to_load_balancer |

Added: incubator/deltacloud/trunk/tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709?rev=1034318&view=auto
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709 (added)
+++ incubator/deltacloud/trunk/tests/ec2/support/elb/describe_load_balancers.da39a3ee5e6b4b0d3255bfef95601890afd80709 Fri Nov 12 09:53:31 2010
@@ -0,0 +1,5 @@
+BAh7CCIgRGVzY3JpYmVMb2FkQmFsYW5jZXJzUmVzdWx0ewYiHUxvYWRCYWxh
+bmNlckRlc2NyaXB0aW9uczAiFVJlc3BvbnNlTWV0YWRhdGF7BiIOUmVxdWVz
+dElkIik3ZjBmZmFiMC1lZTQyLTExZGYtODVmMS1iYjY4MDliY2MxNjgiCnht
+bG5zIj5odHRwOi8vZWxhc3RpY2xvYWRiYWxhbmNpbmcuYW1hem9uYXdzLmNv
+bS9kb2MvMjAwOS0wNS0xNS8=