You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:41:18 UTC
svn commit: r962255 - in /incubator/deltacloud/trunk/server: ./ features/
features/step_definitions/ features/support/
Author: lutter
Date: Thu Jul 8 23:41:17 2010
New Revision: 962255
URL: http://svn.apache.org/viewvc?rev=962255&view=rev
Log:
Added Cucumber with RCov for testing
Added:
incubator/deltacloud/trunk/server/features/
incubator/deltacloud/trunk/server/features/flavors.feature
incubator/deltacloud/trunk/server/features/images.feature
incubator/deltacloud/trunk/server/features/instances.feature
incubator/deltacloud/trunk/server/features/realms.feature
incubator/deltacloud/trunk/server/features/step_definitions/
incubator/deltacloud/trunk/server/features/step_definitions/common_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/flavors_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/realms_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/storage_snapshots_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/storage_volumes.rb
incubator/deltacloud/trunk/server/features/storage_snapshots.feature
incubator/deltacloud/trunk/server/features/storage_volumes.feature
incubator/deltacloud/trunk/server/features/support/
incubator/deltacloud/trunk/server/features/support/configuration_mock.rb
incubator/deltacloud/trunk/server/features/support/env.rb
Modified:
incubator/deltacloud/trunk/server/Rakefile
Modified: incubator/deltacloud/trunk/server/Rakefile
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/Rakefile?rev=962255&r1=962254&r2=962255&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/Rakefile (original)
+++ incubator/deltacloud/trunk/server/Rakefile Thu Jul 8 23:41:17 2010
@@ -19,7 +19,9 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'rake'
+require 'cucumber'
require 'rake/testtask'
+require 'cucumber/rake/task'
desc "Run basic unit tests"
Rake::TestTask.new("test") { |t|
@@ -34,3 +36,10 @@ Rake::TestTask.new("test") { |t|
t.verbose = false
t.warning = false
}
+
+
+Cucumber::Rake::Task.new(:features) do |t|
+ t.cucumber_opts = "features --format pretty"
+ t.rcov = true
+end
+
Added: incubator/deltacloud/trunk/server/features/flavors.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/flavors.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/flavors.feature (added)
+++ incubator/deltacloud/trunk/server/features/flavors.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,22 @@
+Feature: Working with flavors
+ In order to work with flavors
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all flavors
+ When I request index operation for flavors collection
+ Then I should see <FLAVOR_COUNT> flavor inside flavors
+
+ Scenario: I want to show flavor details
+ When I request for '<FLAVOR_ID>' flavor
+ Then I should get this flavor
+ And flavor should have valid href parameter
+ And flavor should contain id parameter
+ And flavor should contain architecture parameter
+ And flavor should contain memory parameter
+ And flavor should contain storage parameter
+
+ Scenario: I want filter flavors by architecture
+ When I want flavors with '<FLAVOR_ARCH>' architecture
+ Then I should get only flavors with architecture '<FLAVOR_ARCH>'
Added: incubator/deltacloud/trunk/server/features/images.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/images.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/images.feature (added)
+++ incubator/deltacloud/trunk/server/features/images.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,37 @@
+Feature: Working with images
+ In order to work with images
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all images
+ When I request index operation for images collection
+ Then I in order to see list of images I need to be authorized
+ When I enter correct username and password
+ And I request index operation for images collection
+ Then I should see <IMAGE_COUNT> image inside images
+
+ Scenario: I want to show image details
+ Given I am authorized to show image '<IMAGE_ID>'
+ When I request for '<IMAGE_ID>' image
+ Then I should get this image
+ And image should have valid href parameter
+ And image should contain id parameter
+ And image should contain name parameter
+ And image should contain owner_id parameter
+ And image should contain description parameter
+ And image should contain architecture parameter
+
+ Scenario: I want filter images by owner_id
+ When I want images with '<IMAGE_OWNER>' owner_id
+ Then I should get only images with owner_id '<IMAGE_OWNER>'
+
+ Scenario: I want filter images by architecture
+ When I want images with '<IMAGE_ARCH>' architecture
+ Then I should get only images with architecture '<IMAGE_ARCH>'
+
+ Scenario: I want filter images by architecture
+ When I want images with '<IMAGE_ARCH>' architecture
+ And images with '<IMAGE_OWNER>' owner_id
+ Then I should get only images with architecture '<IMAGE_ARCH>'
+ And this images should also have owner_id '<IMAGE_OWNER>'
Added: incubator/deltacloud/trunk/server/features/instances.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/instances.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/instances.feature (added)
+++ incubator/deltacloud/trunk/server/features/instances.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,98 @@
+Feature: Managing instances
+ In order to manage instances
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all instances
+ Given I am authorized to list instances
+ When I request index operation for instances collection
+ # FIXME: Add starting number here
+ Then I should see some instance inside instances
+
+ Scenario: I want to create a new instance
+ Given I am authorized to create instance
+ When I request create new instance with:
+ | name | <INSTANCE_1_NAME> |
+ | image_id | <INSTANCE_IMAGE_ID> |
+ Then I should request this instance
+ And this instance should be 'RUNNING'
+ And this instance should have name '<INSTANCE_1_NAME>'
+ And this instance should be image '<INSTANCE_IMAGE_ID>'
+
+ Scenario: I want to create a new instance using realm
+ Given I am authorized to create instance
+ When I request create new instance with:
+ | name | <INSTANCE_2_NAME> |
+ | image_id | <INSTANCE_IMAGE_ID> |
+ | realm | <INSTANCE_REALM> |
+ Then I should request this instance
+ And this instance should be 'RUNNING'
+ And this instance should have name '<INSTANCE_2_NAME>'
+ And this instance should be image '<INSTANCE_IMAGE_ID>'
+ And this instance should have realm '<INSTANCE_REALM>'
+
+ Scenario: I want to show instance details
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ When I request for '<INSTANCE_1_ID>' instance
+ Then I should get this instance
+ And instance should contain id parameter
+ And instance should contain name parameter
+ And instance should contain owner_id parameter
+ And instance should contain state parameter
+ And instance state should be RUNNING
+ When instance state is RUNNING
+ Then instance should have one public address
+ And instance should have one private address
+ When instance state is RUNNING
+ Then instance should include link to 'reboot' action
+ And instance should include link to 'stop' action
+
+ Scenario: I want to get instance image
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance image
+ Then I could follow image href attribute
+ And this attribute should point me to valid image
+
+ Scenario: I want to get instance flavor
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance flavor
+ Then I could follow flavor href attribute
+ And this attribute should point me to valid flavor
+
+ Scenario: I want to get instance realm
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance realm
+ Then I could follow realm href attribute
+ And this attribute should point me to valid realm
+
+ Scenario: I want to stop instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow stop action in actions
+ And this instance state should be 'STOPPED'
+
+ Scenario: I want to start instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow start action in actions
+ And this instance state should be 'RUNNING'
+
+ Scenario: I want to reboot instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to reboot this instance
+ Then I could follow reboot action in actions
+ And this instance state should be 'RUNNING'
+
+ Scenario: I want to destroy instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow stop action in actions
+ And this instance state should be 'STOPPED'
Added: incubator/deltacloud/trunk/server/features/realms.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/realms.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/realms.feature (added)
+++ incubator/deltacloud/trunk/server/features/realms.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,21 @@
+Feature: Working with realms
+ In order to work with realms
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all realms
+ When I request index operation for realms collection
+ Then I should see <REALM_COUNT> realm inside realms
+
+ Scenario: I want to show realm details
+ When I request for '<REALM_ID>' realm
+ Then I should get this realm
+ And realm should have valid href parameter
+ And realm should contain id parameter
+ And realm should contain name parameter
+ And realm should contain state parameter
+
+ Scenario: I want filter realms by state
+ When I want realms with '<REALM_STATE>' state
+ Then I should get only realms with state '<REALM_STATE>'
Added: incubator/deltacloud/trunk/server/features/step_definitions/common_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/common_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/common_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/common_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,101 @@
+require 'nokogiri'
+
+When /^I want to get (HTML|XML)$/ do |format|
+ case format.downcase
+ when 'xml':
+ header 'Accept', 'application/xml'
+ end
+end
+
+When /^I request (.+) operation for (.+) collection$/ do |operation, collection|
+ operation = '/'+operation
+ operation = operation.eql?('/index') ? '' : operation
+ collection.tr!(' ', '_')
+ get '/api/'+collection+operation, {}
+end
+
+Then /^I should see ([\w\<\>_\-]+) (.+) inside (.+)$/ do |count, model, collection|
+ collection.tr!(' ', '-')
+ model.tr!(' ', '-')
+ if count.eql?('some')
+ Nokogiri::XML(last_response.body).xpath("/#{collection}/#{model}").size.should_not == 0
+ else
+ count = replace_variables(count)
+ Nokogiri::XML(last_response.body).xpath("/#{collection}/#{model}").size.should == count.to_i
+ end
+end
+
+When /^I request for '(.+)' (.+)$/ do |id, model|
+ model.tr!(' ', '_')
+ get '/api/'+model+'s'+'/'+replace_variables(id), {}
+end
+
+Then /^I should get this (.+)$/ do |model|
+ model.tr!(' ', '-')
+ Nokogiri::XML(last_response.body).xpath("/#{model}").size.should == 1
+end
+
+When /^I want (.+) with '(.+)' (.+)$/ do |collection, value, parameter|
+ @params = []
+ @params << [parameter, replace_variables(value)]
+end
+
+When /^images with '(.+)' (.+)$/ do |value, parameter|
+ @params << [parameter, replace_variables(value)]
+end
+
+Then /^I should get only (.+) with (.+) '(.+)'$/ do |collection, parameter, value|
+ params = {}
+ value = replace_variables(value)
+ @params.collect { |param| params[:"#{param[0]}"] = param[1] }
+ get '/api/'+collection, params, {}
+ p = []
+ Nokogiri::XML(last_response.body).xpath("/#{collection}/#{collection.gsub(/s$/, '')}").each do |m|
+ p << m.xpath("#{parameter}").text
+ end
+ p.uniq!
+ p.size.should == 1
+ p.first.should == value
+end
+
+Then /^this (.+) should also have (.+) '(.+)'$/ do |collection, parameter, value|
+ params = {}
+ value = replace_variables(value)
+ @params.collect { |param| params[:"#{param[0]}"] = param[1] }
+ get '/api/'+collection, params, {}
+ p = []
+ Nokogiri::XML(last_response.body).xpath("/#{collection}/#{collection.gsub(/s$/, '')}").each do |m|
+ p << m.xpath("#{parameter}").text
+ end
+ p.uniq!
+ p.size.should == 1
+ p.first.should == value
+end
+
+Then /^I in order to see (list of|this) (.+) I need to be authorized$/ do |t, collection|
+ last_response.body.strip.should == 'Not authorized'
+end
+
+When /^I enter correct username and password$/ do
+ authorize 'mockuser', 'mockpassword'
+end
+
+Given /^I am authorized to show (.+) '(.+)'$/ do |model, id|
+ model.tr!(' ', '_')
+ authorize 'mockuser', 'mockpassword'
+ get '/api/'+model+'s/'+model+'/'+replace_variables(id), {}
+ last_response.body.strip.should_not == 'Not authorized'
+end
+
+Then /^(.+) should contain (.+) parameter$/ do |model, parameter|
+ model.tr!(' ', '-')
+ Nokogiri::XML(last_response.body).xpath("/#{model}/#{parameter}").first.should_not == nil
+ Nokogiri::XML(last_response.body).xpath("/#{model}/#{parameter}").first.text.should_not == ''
+end
+
+Given /^I am authorized to (list) (.+)$/ do |operation, collection|
+ authorize 'mockuser', 'mockpassword'
+ collection.tr!(' ', '_')
+ get '/api/'+collection, {}
+ last_response.body.strip.should_not == 'Not authorized'
+end
Added: incubator/deltacloud/trunk/server/features/step_definitions/flavors_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/flavors_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/flavors_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/flavors_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,5 @@
+Then /^flavor should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/flavor').first[:href]
+ href.should == "http://example.org/api/flavors/#{CONFIG[$DRIVER][:flavor_id]}"
+end
+
Added: incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,6 @@
+
+Then /^image should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/image').first[:href]
+ href.should == "http://example.org/api/images/#{CONFIG[$DRIVER][:image_id]}"
+end
+
Added: incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,87 @@
+Then /^instance state should be (.+)$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should == state
+end
+
+When /^instance state is (.+)$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should == state
+end
+
+Then /^instance should have one (public|private) address$/ do |type|
+ adr = Nokogiri::XML(last_response.body).xpath("/instance/#{type}-addresses/address").first
+ adr.text.to_s.should_not == nil
+ adr.text.to_s.should_not == ''
+end
+
+Then /^instance should include link to '(.+)' action$/ do |action|
+ links = Nokogiri::XML(last_response.body).xpath("/instance/actions/link")
+ actions = []
+ links.each do |link|
+ actions << link[:rel]
+ end
+ actions.include?(action).should == true
+end
+
+When /^I want to get details about instance (.+)$/ do |model|
+end
+
+Then /^I could follow (image|realm|flavor) href attribute$/ do |model|
+ m = Nokogiri::XML(last_response.body).xpath("/instance/#{model}").first
+ model_url = URI.parse(m[:href]).path
+ get model_url, {}
+end
+
+Then /^this attribute should point me to valid (image|realm|flavor)$/ do |model|
+ Nokogiri::XML(last_response.body).xpath("/#{model}").first.name.should == model
+end
+
+When /^I want to (.+) this instance$/ do |action|
+end
+
+Given /^I am authorized to create instance$/ do
+ last_response.body.strip.should_not == 'Not authorized'
+end
+
+Then /^I could follow (.+) action in actions$/ do |action|
+ link = Nokogiri::XML(last_response.body).xpath("/instance/actions/link[@rel='#{action}']").first
+ post URI.parse(link[:href]).path, {}
+end
+
+Then /^this instance state should be '(.+)'$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should == state
+end
+
+When /^I request create new instance with:$/ do |table|
+ params = {}
+ table.raw.map { |a,b| params[:"#{a}"] = replace_variables(b) }
+ post '/api/instances.xml', params
+ @instance_id = Nokogiri::XML(last_response.body).xpath("/instance/id").first.text
+ @instance_id.should_not == nil
+ CONFIG[$DRIVER][:instance_1_id] = @instance_id unless CONFIG[$DRIVER][:instance_1_id]
+end
+
+Then /^I should request this instance$/ do
+ get URI.encode('/api/instances/'+@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance").first.should_not == nil
+end
+
+Then /^this instance should be '(.+)'$/ do |state|
+ get URI.encode('/api/instances/'+@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should == state
+end
+
+Then /^this instance should have name '(.+)'$/ do |name|
+ get URI.encode('/api/instances/'+@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance/name").first.text.should == replace_variables(name)
+end
+
+Then /^this instance should be image '(.+)'$/ do |image|
+ get URI.encode('/api/instances/'+@instance_id), {}
+ get URI.parse(Nokogiri::XML(last_response.body).xpath("/instance/image").first[:href]).path, {}
+ Nokogiri::XML(last_response.body).xpath("/image/id").first.text.should == replace_variables(image)
+end
+
+Then /^this instance should have realm '(.+)'$/ do |realm|
+ get URI.encode('/api/instances/'+@instance_id), {}
+ get URI.parse(Nokogiri::XML(last_response.body).xpath("/instance/realm").first[:href]).path, {}
+ Nokogiri::XML(last_response.body).xpath("/realm/id").first.text.should == replace_variables(realm)
+end
Added: incubator/deltacloud/trunk/server/features/step_definitions/realms_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/realms_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/realms_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/realms_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,4 @@
+Then /^realm should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/realm').first[:href]
+ href.should == "http://example.org/api/realms/#{CONFIG[$DRIVER][:realm_id]}"
+end
Added: incubator/deltacloud/trunk/server/features/step_definitions/storage_snapshots_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/storage_snapshots_steps.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/storage_snapshots_steps.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/storage_snapshots_steps.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,23 @@
+Then /^storage snapshot should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/storage-snapshot').first[:href]
+ href.should == "http://example.org/api/storage_snapshots/snap2"
+end
+
+Then /^storage snapshot should have storage\-volume with valid href attribute$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/storage-snapshot/storage-volume').first[:href]
+ href.should == "http://example.org/api/storage_volumes/vol2"
+end
+
+When /^I want to get details about storage volume$/ do
+ @storage_volume_url=Nokogiri::XML(last_response.body).xpath('/storage-snapshot/storage-volume').first[:href]
+end
+
+Then /^I could follow storage volume href attribute$/ do
+ url=URI.parse(@storage_volume_url)
+ get url.path, {}
+ last_response.should_not == nil
+end
+
+Then /^this attribute should point me to valid storage volume$/ do
+ Nokogiri::XML(last_response.body).xpath("/storage-volume").size.should == 1
+end
Added: incubator/deltacloud/trunk/server/features/step_definitions/storage_volumes.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/step_definitions/storage_volumes.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/storage_volumes.rb (added)
+++ incubator/deltacloud/trunk/server/features/step_definitions/storage_volumes.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,4 @@
+Then /^storage volume should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/storage-volume').first[:href]
+ href.should == "http://example.org/api/storage_volumes/vol2"
+end
Added: incubator/deltacloud/trunk/server/features/storage_snapshots.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/storage_snapshots.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/storage_snapshots.feature (added)
+++ incubator/deltacloud/trunk/server/features/storage_snapshots.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,28 @@
+Feature: Working with storage snapshots
+ In order to work with storage snapshots
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all storage snapshots
+ Given I am authorized to list storage snapshots
+ When I request index operation for storage snapshots collection
+ Then I should see <STORAGE_SNAPSHOT_COUNT> storage snapshot inside storage snapshots
+
+ Scenario: I want to show storage snapshot details
+ Given I am authorized to show storage snapshot '<STORAGE_SNAPSHOT_ID>'
+ When I request for '<STORAGE_SNAPSHOT_ID>' storage snapshot
+ Then I should get this storage snapshot
+ And storage snapshot should have valid href parameter
+ And storage snapshot should contain id parameter
+ And storage snapshot should contain created parameter
+ And storage snapshot should contain state parameter
+ And storage snapshot should have storage-volume with valid href attribute
+ When I want to get details about storage volume
+ Then I could follow storage volume href attribute
+ And this attribute should point me to valid storage volume
+
+ Scenario: I want filter storage snapshots by state
+ Given I am authorized to list storage snapshots
+ When I want storage snapshots with '<STORAGE_SNAPSHOT_STATE>' state
+ Then I should get only realms with state '<STORAGE_SNAPSHOT_STATE>'
Added: incubator/deltacloud/trunk/server/features/storage_volumes.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/storage_volumes.feature?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/storage_volumes.feature (added)
+++ incubator/deltacloud/trunk/server/features/storage_volumes.feature Thu Jul 8 23:41:17 2010
@@ -0,0 +1,27 @@
+Feature: Working with storage volumes
+ In order to work with storage volumes
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all storage volumes
+ Given I am authorized to list storage volumes
+ When I request index operation for storage volumes collection
+ Then I should see <STORAGE_VOLUME_COUNT> storage volume inside storage volumes
+
+ Scenario: I want to show storage volume details
+ Given I am authorized to show storage volume '<STORAGE_VOLUME_ID>'
+ When I request for '<STORAGE_VOLUME_ID>' storage volume
+ Then I should get this storage volume
+ And storage volume should have valid href parameter
+ And storage volume should contain id parameter
+ And storage volume should contain created parameter
+ And storage volume should contain state parameter
+ And storage volume should contain capacity parameter
+ And storage volume should contain device parameter
+ And storage volume should contain instance parameter
+
+ Scenario: I want filter storage volumes by state
+ Given I am authorized to list storage volumes
+ When I want storage volumes with '<STORAGE_VOLUME_STATE>' state
+ Then I should get only realms with state '<STORAGE_VOLUME_STATE>'
Added: incubator/deltacloud/trunk/server/features/support/configuration_mock.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/support/configuration_mock.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/support/configuration_mock.rb (added)
+++ incubator/deltacloud/trunk/server/features/support/configuration_mock.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,26 @@
+CONFIG[:mock] = {
+ :driver_name => 'mock',
+ :realm_id => 'us',
+ :realm_state => 'AVAILABLE',
+ :realm_count => 2,
+ :flavor_id => 'm1-small',
+ :flavor_count => 5,
+ :flavor_arch => 'x86_64',
+ :image_owner => 'fedoraproject',
+ :image_arch => 'i386',
+ :image_id => 'img2',
+ :image_count => 3,
+ :storage_snapshot_id => 'snap2',
+ :storage_snapshot_state => 'AVAILABLE',
+ :storage_snapshot_count => '2',
+ :storage_volume_id => 'vol2',
+ :storage_volume_state => 'AVAILABLE',
+ :storage_volume_count => 2,
+ :instances_count => 180,
+ :instance_1_name => "#{Time.now.to_i} testing instance",
+ :instance_2_name => "#{Time.now.to_i+1} testing instance",
+ :instance_image_id => 'img2',
+ :instance_realm => 'us'
+}
+
+$DRIVER = :mock
Added: incubator/deltacloud/trunk/server/features/support/env.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/features/support/env.rb?rev=962255&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/features/support/env.rb (added)
+++ incubator/deltacloud/trunk/server/features/support/env.rb Thu Jul 8 23:41:17 2010
@@ -0,0 +1,25 @@
+require 'sinatra'
+require 'server'
+require 'rack/test'
+require 'base64'
+
+Sinatra::Application.set :environment, :test
+
+CONFIG = {}
+load 'features/support/configuration_mock.rb'
+
+World do
+ def app
+ @app = Rack::Builder.new do
+ run Sinatra::Application
+ end
+ end
+
+ def replace_variables(str)
+ CONFIG[$DRIVER].each_key.collect { |k| str.gsub!(/\<#{k.to_s.upcase}\>/, "#{CONFIG[$DRIVER][k]}") }
+ return str
+ end
+
+ include Rack::Test::Methods
+end
+