deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [59/65] [partial] Core: Moved all API tests in server/tests into server/tests/deprecated directory
Date Fri, 20 Jul 2012 09:59:23 GMT
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/fixtures/test_0027_should_allow_to_create_and_destroy_new_instance_using_the_first_available_image_and_first_hardware_profile_pool_3_instance.yml
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/fixtures/test_0027_should_allow_to_create_and_destroy_new_instance_using_the_first_available_image_and_first_hardware_profile_pool_3_instance.yml b/server/tests/deprecated/drivers/ec2/fixtures/test_0027_should_allow_to_create_and_destroy_new_instance_using_the_first_available_image_and_first_hardware_profile_pool_3_instance.yml
new file mode 100644
index 0000000..e6fd210
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/fixtures/test_0027_should_allow_to_create_and_destroy_new_instance_using_the_first_available_image_and_first_hardware_profile_pool_3_instance.yml
@@ -0,0 +1,88 @@
+--- 
+http_interactions: 
+- request: 
+    method: get
+    uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=AKIAIZ63KHGXIWDMBY6Q&Action=DescribeInstances&InstanceId.1=i-79223a1f&Signature=wqUZ+ZzA8XwPXGzzOUM8YFYYZdMzH/7WCa87AczwvHc=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-05-31T10:58:00.000Z&Version=2010-08-31
+    body: 
+      string: ""
+    headers: 
+      User-Agent: 
+      - ""
+      Accept: 
+      - "*/*"
+  response: 
+    status: 
+      code: 200
+      message: OK
+    headers: 
+      Transfer-Encoding: 
+      - chunked
+      Server: 
+      - AmazonEC2
+      Content-Type: 
+      - text/xml;charset=UTF-8
+      Date: 
+      - Thu, 31 May 2012 09:20:07 GMT
+    body: 
+      string: |-
+        <?xml version="1.0" encoding="UTF-8"?>
+        <DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2010-08-31/">
+            <requestId>c942f98a-e6d1-45f6-b376-596fed7b100a</requestId>
+            <reservationSet>
+                <item>
+                    <reservationId>r-d52421b7</reservationId>
+                    <ownerId>293787749884</ownerId>
+                    <groupSet>
+                        <item>
+                            <groupId>default</groupId>
+                        </item>
+                    </groupSet>
+                    <instancesSet>
+                        <item>
+                            <instanceId>i-79223a1f</instanceId>
+                            <imageId>ami-e565ba8c</imageId>
+                            <instanceState>
+                                <code>16</code>
+                                <name>running</name>
+                            </instanceState>
+                            <privateDnsName>ip-10-64-83-211.ec2.internal</privateDnsName>
+                            <dnsName>ec2-23-22-116-76.compute-1.amazonaws.com</dnsName>
+                            <reason/>
+                            <amiLaunchIndex>0</amiLaunchIndex>
+                            <productCodes/>
+                            <instanceType>m1.small</instanceType>
+                            <launchTime>2012-05-31T09:19:32.000Z</launchTime>
+                            <placement>
+                                <availabilityZone>us-east-1a</availabilityZone>
+                                <groupName/>
+                            </placement>
+                            <kernelId>aki-88aa75e1</kernelId>
+                            <monitoring>
+                                <state>disabled</state>
+                            </monitoring>
+                            <privateIpAddress>10.64.83.211</privateIpAddress>
+                            <ipAddress>23.22.116.76</ipAddress>
+                            <architecture>x86_64</architecture>
+                            <rootDeviceType>ebs</rootDeviceType>
+                            <rootDeviceName>/dev/sda1</rootDeviceName>
+                            <blockDeviceMapping>
+                                <item>
+                                    <deviceName>/dev/sda1</deviceName>
+                                    <ebs>
+                                        <volumeId>vol-41c71c2f</volumeId>
+                                        <status>attached</status>
+                                        <attachTime>2012-05-31T09:19:58.000Z</attachTime>
+                                        <deleteOnTermination>true</deleteOnTermination>
+                                    </ebs>
+                                </item>
+                            </blockDeviceMapping>
+                            <virtualizationType>paravirtual</virtualizationType>
+                            <clientToken/>
+                        </item>
+                    </instancesSet>
+                </item>
+            </reservationSet>
+        </DescribeInstancesResponse>
+    http_version: 
+  recorded_at: Thu, 31 May 2012 10:58:00 GMT
+recorded_with: VCR 2.1.1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/hardware_profiles_test.rb b/server/tests/deprecated/drivers/ec2/hardware_profiles_test.rb
new file mode 100644
index 0000000..23d2876
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/hardware_profiles_test.rb
@@ -0,0 +1,224 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/ec2/common'
+
+describe 'Deltacloud API Hardware Profiles' do
+  include Deltacloud::Test
+
+  it 'must advertise have the hardware_profiles collection in API entrypoint' do
+    get root_url
+    (xml_response/'api/link[@rel=hardware_profiles]').wont_be_empty
+  end
+
+  it 'should respond with HTTP_OK when accessing the :hardware_profiles collection with authentication' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    last_response.status.must_equal 200
+  end
+
+  it 'should support the JSON media type' do
+    authenticate
+    header 'Accept', 'application/json'
+    get collection_url(:hardware_profiles)
+    last_response.status.must_equal 200
+    last_response.headers['Content-Type'].must_equal 'application/json'
+  end
+
+  it 'must include the ETag in HTTP headers' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    last_response.headers['ETag'].wont_be_nil
+  end
+
+  it 'must have the "hardware_profiles" element on top level' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    xml_response.root.name.must_equal 'hardware_profiles'
+  end
+
+  it 'must have some "hardware_profile" elements inside "hardware_profiles"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').wont_be_empty
+  end
+
+  it 'must provide the :id attribute for each hardware_profile in collection' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      r[:id].wont_be_nil
+    end
+  end
+
+  it 'must include the :href attribute for each "hardware_profile" element in collection' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      r[:href].wont_be_nil
+    end
+  end
+
+  it 'must use the absolute URL in each :href attribute' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      r[:href].must_match /^http/
+    end
+  end
+
+  it 'must have the URL ending with the :id of the hardware_profile' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      r[:href].must_match /#{r[:id]}$/
+    end
+  end
+
+  it 'must return the list of valid parameters for the :index action' do
+    authenticate
+    options collection_url(:hardware_profiles) + '/index'
+    last_response.headers['Allow'].wont_be_nil
+  end
+
+  it 'must have the "name" element defined for each hardware_profile in collection' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      (r/'name').wont_be_empty
+    end
+  end
+
+  it 'should have the "property" element defined if not the opaque hardware_profile' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').wont_be_empty
+    end
+  end
+
+  it 'must define the :kind attribute for each "property" ' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each { |p| p[:kind].wont_be_nil }
+    end
+  end
+
+  it 'must define the :name attribute for each "property" ' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each { |p| p[:name].wont_be_nil }
+    end
+  end
+
+  it 'must define the :unit attribute for each "property" ' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each { |p| p[:unit].wont_be_nil }
+    end
+  end
+
+  it 'must define the :value attribute for each "property" ' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each { |p| p[:value].wont_be_nil }
+    end
+  end
+
+  it 'must define the "param" element if property kind is not "fixed"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each do |p|
+        next if p[:kind] == 'fixed'
+        (p/'param').wont_be_empty
+        (p/'param').size.must_equal 1
+        (p/'param').first[:href].wont_be_nil
+        (p/'param').first[:href].must_match /^http/
+        (p/'param').first[:method].wont_be_nil
+        (p/'param').first[:name].wont_be_nil
+        (p/'param').first[:operation].wont_be_nil
+      end
+    end
+  end
+
+  it 'must provide the list of valid values when the property is defined as "enum"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each do |p|
+        next if p[:kind] != 'enum'
+        (p/'enum/entry').wont_be_empty
+        (p/'enum/entry').each { |e| e[:value].wont_be_nil }
+      end
+    end
+  end
+
+  it 'must provide the range of valid values when the property is defined as "range"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each do |p|
+        next if p[:kind] != 'range'
+        (p/'range').wont_be_empty
+        (p/'range').size.must_equal 1
+        (p/'range').first[:first].wont_be_nil
+        (p/'range').first[:last].wont_be_nil
+      end
+    end
+  end
+
+  it 'must provide the default value within the range if property defined as "range"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each do |p|
+        next if p[:kind] != 'range'
+        ((p/'range').first[:first].to_i..(p/'range').first[:last].to_i).include?(p[:value].to_i).must_equal true
+      end
+    end
+  end
+
+  it 'must provide the default value that is included in enum list if property defined as "enum"' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      next if r[:id] == 'opaque'
+      (r/'property').each do |p|
+        next if p[:kind] != 'enum'
+        (p/'enum/entry').map { |e| e[:value] }.include?(p[:value]).must_equal true
+      end
+    end
+  end
+
+  it 'must return the full "hardware_profile" when following the URL in hardware_profile element' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      get collection_url(:hardware_profiles) + '/' + r[:id]
+      last_response.status.must_equal 200
+    end
+  end
+
+  it 'must have the "name" element for the hardware_profile and it should match with the one in collection' do
+    authenticate
+    get collection_url(:hardware_profiles)
+    (xml_response/'hardware_profiles/hardware_profile').each do |r|
+      get collection_url(:hardware_profiles) + '/' + r[:id]
+      (xml_response/'name').wont_be_empty
+      (xml_response/'name').first.text.must_equal((r/'name').first.text)
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/images_test.rb b/server/tests/deprecated/drivers/ec2/images_test.rb
new file mode 100644
index 0000000..18652a2
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/images_test.rb
@@ -0,0 +1,230 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/ec2/common'
+
+describe 'Deltacloud API Images' do
+  before do
+    Timecop.freeze(FREEZED_TIME)
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  include Deltacloud::Test
+
+  it 'must advertise have the images collection in API entrypoint' do
+    get root_url
+    (xml_response/'api/link[@rel=images]').wont_be_empty
+  end
+
+  it 'must require authentication to access the "image" collection' do
+    get collection_url(:images)
+    last_response.status.must_equal 401
+  end
+
+  it 'should respond with HTTP_OK when accessing the :images collection with authentication' do
+    authenticate
+    get collection_url(:images)
+    last_response.status.must_equal 200
+  end
+
+  it 'should support the JSON media type' do
+    authenticate
+    header 'Accept', 'application/json'
+    get collection_url(:images)
+    last_response.status.must_equal 200
+    last_response.headers['Content-Type'].must_equal 'application/json'
+  end
+
+  it 'must include the ETag in HTTP headers' do
+    authenticate
+    get collection_url(:images)
+    last_response.headers['ETag'].wont_be_nil
+  end
+
+  it 'must have the "images" element on top level' do
+    authenticate
+    get collection_url(:images)
+    xml_response.root.name.must_equal 'images'
+  end
+
+  it 'must have some "image" elements inside "images"' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+  end
+
+  it 'must provide the :id attribute for each image in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      r[:id].wont_be_nil
+    end
+  end
+
+  it 'must include the :href attribute for each "image" element in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      r[:href].wont_be_nil
+    end
+  end
+
+  it 'must use the absolute URL in each :href attribute' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      r[:href].must_match /^http/
+    end
+  end
+
+  it 'must have the URL ending with the :id of the image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      r[:href].must_match /#{r[:id]}$/
+    end
+  end
+
+  it 'must return the list of valid parameters for the :index action' do
+    authenticate
+    options collection_url(:images) + '/index'
+    last_response.headers['Allow'].wont_be_nil
+  end
+
+  it 'must have the "name" element defined for each image in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      (r/'name').wont_be_empty
+    end
+  end
+
+  it 'must have the "state" element defined for each image in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').each do |r|
+      (r/'state').wont_be_empty
+    end
+  end
+
+  it 'must return the full "image" when following the URL in image element' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      last_response.status.must_equal 200
+    end
+  end
+
+  it 'must have the "name" element for the image and it should match with the one in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'name').wont_be_empty
+      (xml_response/'name').first.text.must_equal((r/'name').first.text)
+    end
+  end
+
+  it 'must have the "name" element for the image and it should match with the one in collection' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'state').wont_be_empty
+      (xml_response/'state').first.text.must_equal((r/'state').first.text)
+    end
+  end
+
+  it 'should have the "owner_id" element for each image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'owner_id').wont_be_empty
+    end
+  end
+
+  it 'should have the "description" element for each image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'description').wont_be_empty
+    end
+  end
+
+  it 'should have the "architecture" element for each image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'architecture').wont_be_empty
+    end
+  end
+
+  it 'should include the list of compatible hardware_profiles for each image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'hardware_profiles/hardware_profile').wont_be_empty
+      (xml_response/'hardware_profiles/hardware_profile').each do |hwp|
+        hwp[:href].wont_be_nil
+        hwp[:href].must_match /^http/
+        hwp[:id].wont_be_nil
+        hwp[:href].must_match /\/#{hwp[:id]}$/
+        hwp[:rel].must_equal 'hardware_profile'
+      end
+    end
+  end
+
+  it 'should advertise the list of actions that can be executed for each image' do
+    authenticate
+    get collection_url(:images)
+    (xml_response/'images/image').wont_be_empty
+    (xml_response/'images/image')[0..10].each do |r|
+      VCR.use_cassette "#{__name__}_image_#{r[:id]}" do
+        get collection_url(:images) + '/' + r[:id]
+      end
+      (xml_response/'actions/link').wont_be_empty
+      (xml_response/'actions/link').each do |l|
+        l[:href].wont_be_nil
+        l[:href].must_match /^http/
+        l[:method].wont_be_nil
+        l[:rel].wont_be_nil
+      end
+    end
+  end
+
+  it 'should give client HTML form to create new image' do
+    authenticate
+    header 'Accept', 'text/html'
+    get collection_url(:images) + '/new'
+    last_response.status.must_equal 200
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/instances_test.rb b/server/tests/deprecated/drivers/ec2/instances_test.rb
new file mode 100644
index 0000000..8f91d5f
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/instances_test.rb
@@ -0,0 +1,356 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/ec2/common'
+
+describe 'Deltacloud API instances' do
+  include Deltacloud::Test
+
+  before do
+    Timecop.freeze(FREEZED_TIME)
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  it 'must advertise have the instances collection in API entrypoint' do
+    get root_url
+    (xml_response/'api/link[@rel=instances]').wont_be_empty
+  end
+
+
+  it 'must require authentication to access the "instance" collection' do
+    get collection_url(:instances)
+    last_response.status.must_equal 401
+  end
+
+  it 'should respond with HTTP_OK when accessing the :instances collection with authentication' do
+    authenticate
+    get collection_url(:instances)
+    last_response.status.must_equal 200
+  end
+
+  it 'should support the JSON media type' do
+    authenticate
+    header 'Accept', 'application/json'
+    get collection_url(:instances)
+    last_response.status.must_equal 200
+    last_response.headers['Content-Type'].must_equal 'application/json'
+  end
+
+  it 'must include the ETag in HTTP headers' do
+    authenticate
+    get collection_url(:instances)
+    last_response.headers['ETag'].wont_be_nil
+  end
+
+  it 'must have the "instances" element on top level' do
+    authenticate
+    get collection_url(:instances)
+    xml_response.root.name.must_equal 'instances'
+  end
+
+  it 'must have some "instance" elements inside "instances"' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').wont_be_empty
+  end
+
+  it 'must provide the :id attribute for each instance in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      r[:id].wont_be_nil
+    end
+  end
+
+  it 'must include the :href attribute for each "instance" element in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      r[:href].wont_be_nil
+    end
+  end
+
+  it 'must use the absolute URL in each :href attribute' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      r[:href].must_match /^http/
+    end
+  end
+
+  it 'must have the URL ending with the :id of the instance' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      r[:href].must_match /#{r[:id]}$/
+    end
+  end
+
+  it 'must return the list of valid parameters for the :index action' do
+    authenticate
+    options collection_url(:instances) + '/index'
+    last_response.headers['Allow'].wont_be_nil
+  end
+
+  it 'must have the "name" element defined for each instance in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      (r/'name').wont_be_empty
+    end
+  end
+
+  it 'must have the "state" element defined for each instance in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      (r/'state').wont_be_empty
+      (r/'state').first.must_match /(RUNNING|STOPPED|PENDING)/
+    end
+  end
+
+
+  it 'must return the full "instance" when following the URL in instance element' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      last_response.status.must_equal 200
+    end
+  end
+
+
+  it 'must have the "name" element for the instance and it should match with the one in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'name').wont_be_empty
+      (xml_response/'name').first.text.must_equal((r/'name').first.text)
+    end
+  end
+
+  it 'must have the "name" element for the instance and it should match with the one in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'state').wont_be_empty
+      (xml_response/'state').first.text.must_equal((r/'state').first.text)
+    end
+  end
+
+  it 'must have the "owner_id" element for the instance and it should match with the one in collection' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'owner_id').wont_be_empty
+      (xml_response/'owner_id').first.text.must_equal((r/'owner_id').first.text)
+    end
+  end
+
+  it 'must link to the realm that was used to during instance creation' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'realm').wont_be_empty
+      (xml_response/'realm').size.must_equal 1
+      (xml_response/'realm').first[:id].wont_be_nil
+      (xml_response/'realm').first[:href].wont_be_nil
+      (xml_response/'realm').first[:href].must_match /\/#{(xml_response/'realm').first[:id]}$/
+    end
+  end
+
+  it 'must link to the image that was used to during instance creation' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'image').wont_be_empty
+      (xml_response/'image').size.must_equal 1
+      (xml_response/'image').first[:id].wont_be_nil
+      (xml_response/'image').first[:href].wont_be_nil
+      (xml_response/'image').first[:href].must_match /\/#{(xml_response/'image').first[:id]}$/
+    end
+  end
+
+  it 'must link to the hardware_profile that was used to during instance creation' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'hardware_profile').wont_be_empty
+      (xml_response/'hardware_profile').size.must_equal 1
+      (xml_response/'hardware_profile').first[:id].wont_be_nil
+      (xml_response/'hardware_profile').first[:href].wont_be_nil
+      (xml_response/'hardware_profile').first[:href].must_match /\/#{(xml_response/'hardware_profile').first[:id]}$/
+    end
+  end
+
+  it 'should advertise the public and private addresses of the instance' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance[@state=RUNNING]').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      puts xml_response
+      (xml_response/'public_addresses').wont_be_empty
+      (xml_response/'public_addresses').size.must_equal 1
+      (xml_response/'public_addresses/address').each do |a|
+        a[:type].wont_be_nil
+        a.text.strip.wont_be_empty
+      end
+      (xml_response/'private_addresses').wont_be_empty
+      (xml_response/'private_addresses').size.must_equal 1
+      (xml_response/'private_addresses/address').each do |a|
+        a[:type].wont_be_nil
+        a.text.strip.wont_be_empty
+      end
+    end
+  end
+
+  it 'should advertise the storage volumes used by the instance' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'storage_volumes').wont_be_empty
+    end
+  end
+
+  it 'should advertise the list of actions that can be executed for each instance' do
+    authenticate
+    get collection_url(:instances)
+    (xml_response/'instances/instance').each do |r|
+      VCR.use_cassette "#{__name__}_instance_#{r[:id]}" do
+        get collection_url(:instances) + '/' + r[:id]
+      end
+      (xml_response/'actions/link').wont_be_empty
+      (xml_response/'actions/link').each do |l|
+        l[:href].wont_be_nil
+        l[:href].must_match /^http/
+        l[:method].wont_be_nil
+        l[:rel].wont_be_nil
+      end
+    end
+  end
+
+  it 'should allow to create and destroy new instance using the  image without realm' do
+    authenticate
+    image_id = 'ami-e565ba8c'
+    VCR.use_cassette "#{__name__}_create_instance" do
+      post collection_url(:instances), { :image_id => image_id }
+    end
+    last_response.status.must_equal 201 # HTTP_CREATED
+    last_response.headers['Location'].wont_be_nil # Location header must be set, pointing to new the instance
+    instance_id = last_response.headers['Location'].split('/').last
+    # Get the instance and check if ID and image is set correctly
+    VCR.use_cassette "#{__name__}_get_instance" do
+      get collection_url(:instances) + '/' + instance_id
+    end
+    last_response.status.must_equal 200 # HTTP_OK
+    (xml_response/'instance').first[:id].must_equal instance_id
+    (xml_response/'instance/image').first[:id].must_equal image_id
+    10.times do |i|
+      VCR.use_cassette "#{__name__}_pool_#{i}_instance" do
+        get collection_url(:instances) + '/' + instance_id
+      end
+      break if (xml_response/'instance/state').text == 'RUNNING'
+      sleep(10)
+    end
+    (xml_response/'instance/state').text.must_equal 'RUNNING'
+    # Delete created instance
+    VCR.use_cassette "#{__name__}_delete_instance" do
+      post collection_url(:instances) + '/' + instance_id + '/stop'
+    end
+    last_response.status.must_equal 202 # HTTP_NO_CONTENT
+  end
+
+  it 'should allow to create and destroy new instance using the image within realm' do
+    authenticate
+    image_id = 'ami-e565ba8c'
+    realm_id = 'us-east-1c'
+    VCR.use_cassette "#{__name__}_create_instance" do
+      post collection_url(:instances), { :image_id => image_id, :realm_id =>  realm_id }
+    end
+    last_response.status.must_equal 201 # HTTP_CREATED
+    last_response.headers['Location'].wont_be_nil # Location header must be set, pointing to new the instance
+    instance_id = last_response.headers['Location'].split('/').last
+    # Get the instance and check if ID and image is set correctly
+    VCR.use_cassette "#{__name__}_get_instance" do
+      get collection_url(:instances) + '/' + instance_id
+    end
+    last_response.status.must_equal 200 # HTTP_OK
+    (xml_response/'instance').first[:id].must_equal instance_id
+    (xml_response/'instance/image').first[:id].must_equal image_id
+    10.times do |i|
+      VCR.use_cassette "#{__name__}_pool_#{i}_instance" do
+        get collection_url(:instances) + '/' + instance_id
+      end
+      break if (xml_response/'instance/state').text == 'RUNNING'
+      sleep(10)
+    end
+    (xml_response/'instance/state').text.must_equal 'RUNNING'
+    (xml_response/'instance/realm').first[:id].must_equal realm_id
+    # Delete created instance
+    VCR.use_cassette "#{__name__}_delete_instance" do
+      post collection_url(:instances) + '/' + instance_id + '/stop'
+    end
+    last_response.status.must_equal 202 # HTTP_NO_CONTENT
+  end
+
+  it 'should allow to create and destroy new instance using the first available image and first hardware_profile' do
+    authenticate
+    image_id = 'ami-e565ba8c'
+    hwp_id = 'm1.small'
+    VCR.use_cassette "#{__name__}_create_instance" do
+      post collection_url(:instances), { :image_id => image_id, :hwp_id =>  hwp_id }
+    end
+    last_response.status.must_equal 201 # HTTP_CREATED
+    last_response.headers['Location'].wont_be_nil # Location header must be set, pointing to new the instance
+    instance_id = last_response.headers['Location'].split('/').last
+    # Get the instance and check if ID and image is set correctly
+    VCR.use_cassette "#{__name__}_get_instance" do
+      get collection_url(:instances) + '/' + instance_id
+    end
+    last_response.status.must_equal 200 # HTTP_OK
+    (xml_response/'instance').first[:id].must_equal instance_id
+    (xml_response/'instance/image').first[:id].must_equal image_id
+    10.times do |i|
+      VCR.use_cassette "#{__name__}_pool_#{i}_instance" do
+        get collection_url(:instances) + '/' + instance_id
+      end
+      break if (xml_response/'instance/state').text == 'RUNNING'
+      sleep(10)
+    end
+    (xml_response/'instance/state').text.must_equal 'RUNNING'
+    (xml_response/'instance/hardware_profile').first[:id].must_equal hwp_id
+    # Delete created instance
+    VCR.use_cassette "#{__name__}_delete_instance" do
+      post collection_url(:instances) + '/' + instance_id + '/stop'
+    end
+    last_response.status.must_equal 202 # HTTP_NO_CONTENT
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/keys_test.rb b/server/tests/deprecated/drivers/ec2/keys_test.rb
new file mode 100644
index 0000000..b499b0c
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/keys_test.rb
@@ -0,0 +1,181 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/ec2/common'
+
+describe 'Deltacloud API Keys' do
+
+  before do
+    Timecop.freeze(FREEZED_TIME)
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  include Deltacloud::Test
+
+  it 'must advertise have the keys collection in API entrypoint' do
+    get root_url
+    (xml_response/'api/link[@rel=keys]').wont_be_empty
+  end
+
+  it 'must require authentication to access the "key" collection' do
+    get collection_url(:keys)
+    last_response.status.must_equal 401
+  end
+
+  it 'should respond with HTTP_OK when accessing the :keys collection with authentication' do
+    authenticate
+    get collection_url(:keys)
+    last_response.status.must_equal 200
+  end
+
+  it 'should support the JSON media type' do
+    authenticate
+    header 'Accept', 'application/json'
+    get collection_url(:keys)
+    last_response.status.must_equal 200
+    last_response.headers['Content-Type'].must_equal 'application/json'
+  end
+
+  it 'must include the ETag in HTTP headers' do
+    authenticate
+    get collection_url(:keys)
+    last_response.headers['ETag'].wont_be_nil
+  end
+
+  it 'must have the "keys" element on top level' do
+    authenticate
+    get collection_url(:keys)
+    xml_response.root.name.must_equal 'keys'
+  end
+
+  it 'must have some "key" elements inside "keys"' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').wont_be_empty
+  end
+
+  it 'must tell the kind of "key" elements inside "keys"' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |k|
+      k[:type].must_match /(key|password)/
+    end
+  end
+
+  it 'must provide the :id attribute for each key in collection' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      r[:id].wont_be_nil
+    end
+  end
+
+  it 'must include the :href attribute for each "key" element in collection' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      r[:href].wont_be_nil
+    end
+  end
+
+  it 'must use the absolute URL in each :href attribute' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      r[:href].must_match /^http/
+    end
+  end
+
+  it 'must have the URL ending with the :id of the key' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      r[:href].must_match /#{r[:id]}$/
+    end
+  end
+
+  it 'must return the list of valid parameters for the :index action' do
+    authenticate
+    options collection_url(:keys) + '/index'
+    last_response.headers['Allow'].wont_be_nil
+  end
+
+  it 'must have the "name" element defined for each key in collection' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      (r/'name').wont_be_empty
+    end
+  end
+
+
+  it 'must return the full "key" when following the URL in key element' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      get collection_url(:keys) + '/' + r[:id]
+      last_response.status.must_equal 200
+    end
+  end
+
+  it 'must have the "name" element for the key and it should match with the one in collection' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      VCR.use_cassette "#{__name__}_key_#{r[:id]}" do
+        get collection_url(:keys) + '/' + r[:id]
+      end
+      (xml_response/'name').wont_be_empty
+      (xml_response/'name').first.text.must_equal((r/'name').first.text)
+    end
+  end
+
+  it 'must have the "name" element for the key and it should match with the one in collection' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      VCR.use_cassette "#{__name__}_key_#{r[:id]}" do
+        get collection_url(:keys) + '/' + r[:id]
+      end
+      (xml_response/'state').wont_be_empty
+      (xml_response/'state').first.text.must_equal((r/'state').first.text)
+    end
+  end
+
+  it 'should advertise the list of actions that can be executed for each key' do
+    authenticate
+    get collection_url(:keys)
+    (xml_response/'keys/key').each do |r|
+      VCR.use_cassette "#{__name__}_key_#{r[:id]}" do
+        get collection_url(:keys) + '/' + r[:id]
+      end
+      (xml_response/'actions/link').wont_be_empty
+      (xml_response/'actions/link').each do |l|
+        l[:href].wont_be_nil
+        l[:href].must_match /^http/
+        l[:method].wont_be_nil
+        l[:rel].wont_be_nil
+      end
+    end
+  end
+
+  it 'should allow to create a new key and then remove it' do
+    authenticate
+    key_name = Time.now.to_i.to_s
+    post collection_url(:keys), {
+      :name => 'test_key_'+key_name
+    }
+    last_response.status.must_equal 201 # HTTP_CREATED
+    VCR.use_cassette "#{__name__}_key_#{key_name}" do
+      get collection_url(:keys) + '/' + 'test_key_'+key_name
+    end
+    last_response.status.must_equal 200 # HTTP_OK
+    VCR.use_cassette "#{__name__}_delete_key_#{key_name}" do
+      delete collection_url(:keys) + '/' + 'test_key_'+key_name
+    end
+    last_response.status.must_equal 204 # HTTP_NO_CONTENT
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/ec2/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/ec2/realms_test.rb b/server/tests/deprecated/drivers/ec2/realms_test.rb
new file mode 100644
index 0000000..a43e0aa
--- /dev/null
+++ b/server/tests/deprecated/drivers/ec2/realms_test.rb
@@ -0,0 +1,146 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/ec2/common'
+
+describe 'Deltacloud API Realms' do
+  before do
+    Timecop.freeze(FREEZED_TIME)
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  include Deltacloud::Test
+
+  it 'must advertise have the realms collection in API entrypoint' do
+    get root_url
+    (xml_response/'api/link[@rel=realms]').wont_be_empty
+  end
+
+  it 'must require authentication to access the "realm" collection' do
+    get collection_url(:realms)
+    last_response.status.must_equal 401
+  end
+
+  it 'should respond with HTTP_OK when accessing the :realms collection with authentication' do
+    authenticate
+    get collection_url(:realms)
+    last_response.status.must_equal 200
+  end
+
+  it 'should support the JSON media type' do
+    authenticate
+    header 'Accept', 'application/json'
+    get collection_url(:realms)
+    last_response.status.must_equal 200
+    last_response.headers['Content-Type'].must_equal 'application/json'
+  end
+
+  it 'must include the ETag in HTTP headers' do
+    authenticate
+    get collection_url(:realms)
+    last_response.headers['ETag'].wont_be_nil
+  end
+
+  it 'must have the "realms" element on top level' do
+    authenticate
+    get collection_url(:realms)
+    xml_response.root.name.must_equal 'realms'
+  end
+
+  it 'must have some "realm" elements inside "realms"' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').wont_be_empty
+  end
+
+  it 'must provide the :id attribute for each realm in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      r[:id].wont_be_nil
+    end
+  end
+
+  it 'must include the :href attribute for each "realm" element in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      r[:href].wont_be_nil
+    end
+  end
+
+  it 'must use the absolute URL in each :href attribute' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      r[:href].must_match /^http/
+    end
+  end
+
+  it 'must have the URL ending with the :id of the realm' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      r[:href].must_match /#{r[:id]}$/
+    end
+  end
+
+  it 'must return the list of valid parameters for the :index action' do
+    authenticate
+    options collection_url(:realms) + '/index'
+    last_response.headers['Allow'].wont_be_nil
+  end
+
+  it 'must have the "name" element defined for each realm in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      (r/'name').wont_be_empty
+    end
+  end
+
+  it 'must have the "state" element defined for each realm in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      (r/'state').wont_be_empty
+    end
+  end
+  it 'must return the full "realm" when following the URL in realm element' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      VCR.use_cassette "#{__name__}_realm_id" do
+        get collection_url(:realms) + '/' + r[:id]
+      end
+      last_response.status.must_equal 200
+    end
+  end
+
+  it 'must have the "name" element for the realm and it should match with the one in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      VCR.use_cassette "#{__name__}_realm_#{r[:id]}" do
+        get collection_url(:realms) + '/' + r[:id]
+      end
+      (xml_response/'name').wont_be_empty
+      (xml_response/'name').first.text.must_equal((r/'name').first.text)
+    end
+  end
+
+  it 'must have the "state" element for the realm and it should match with the one in collection' do
+    authenticate
+    get collection_url(:realms)
+    (xml_response/'realms/realm').each do |r|
+      VCR.use_cassette "#{__name__}_realm_r[:id]" do
+        get collection_url(:realms) + '/' + r[:id]
+      end
+      (xml_response/'state').wont_be_empty
+      (xml_response/'state').first.text.must_equal((r/'state').first.text)
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/fgcp/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/fgcp/api_test.rb b/server/tests/deprecated/drivers/fgcp/api_test.rb
new file mode 100644
index 0000000..2eb399d
--- /dev/null
+++ b/server/tests/deprecated/drivers/fgcp/api_test.rb
@@ -0,0 +1,47 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/common'
+
+module FGCPTest
+
+  class ApiTest < Test::Unit::TestCase
+    include Rack::Test::Methods
+
+    def app
+      Sinatra::Application
+    end
+
+    def test_01_it_returns_entry_points
+      get_auth_url '/api;driver=fgcp/?force_auth=1'
+      (last_xml_response/'/api').first[:driver].should == 'fgcp'
+      (last_xml_response/'/api/link').length.should > 0
+    end
+
+    def test_02_it_has_fgcp_instance_features
+      get_url '/api;driver=fgcp'
+      features = (last_xml_response/'/api/link[@rel="instances"]/feature').collect { |f| f[:name] }
+      features.include?('user_name').should == true
+      features.include?('authentication_password').should == true
+      features.length.should == 2
+    end
+
+    def test_03_it_has_fgcp_image_features
+      get_url '/api;driver=fgcp'
+      features = (last_xml_response/'/api/link[@rel="images"]/feature').collect { |f| f[:name] }
+      features.include?('user_name').should == true
+      features.include?('user_description').should == true
+      features.length.should == 2
+    end
+
+    def test_04_it_has_fgcp_collections
+      get_url '/api;driver=fgcp'
+      collections = (last_xml_response/'/api/link').collect { |f| f[:rel] }
+      collections.include?('instance_states').should == true
+      collections.include?('instances').should == true
+      collections.include?('images').should == true
+      collections.include?('realms').should == true
+      collections.include?('hardware_profiles').should == true
+      collections.length.should == 6
+    end
+
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb b/server/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb
new file mode 100644
index 0000000..623b9c2
--- /dev/null
+++ b/server/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb
@@ -0,0 +1,54 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/common'
+
+module FGCPTest
+
+  class HardwareProfilesTest < Test::Unit::TestCase
+    include Rack::Test::Methods
+
+    def app
+      Sinatra::Application
+    end
+
+    def test_01_it_returns_hardware_profiles
+      get_auth_url '/api;driver=fgcp/hardware_profiles'
+      (last_xml_response/'hardware_profiles/hardware_profile').length.should == 4
+    end
+
+    def test_02_each_hardware_profile_has_a_name
+      get_auth_url '/api;driver=fgcp/hardware_profiles'
+      (last_xml_response/'hardware_profiles/hardware_profile').each do |profile|
+        (profile/'name').text.should_not == nil
+        (profile/'name').text.should_not == ''
+      end
+    end
+
+    def test_03_each_hardware_profile_has_correct_properties
+      get_auth_url '/api;driver=fgcp/hardware_profiles'
+      (last_xml_response/'hardware_profiles/hardware_profile').each do |profile|
+        (profile/'property[@name="architecture"]').first[:value].should == 'x86_64'
+        (profile/'property[@name="memory"]').first[:unit].should == 'MB'
+        (profile/'property[@name="memory"]').first[:kind].should == 'fixed'
+#        (profile/'property[@name="storage"]').first[:unit].should == 'GB'
+#        (profile/'property[@name="storage"]').first[:kind].should == 'fixed'
+      end
+    end
+
+    def test_04_it_returns_single_hardware_profile
+      get_auth_url '/api;driver=fgcp/hardware_profiles/economy'
+      (last_xml_response/'hardware_profile/name').first.text.should == 'economy'
+      (last_xml_response/'hardware_profile/property[@name="architecture"]').first[:value].should == 'x86_64'
+      (last_xml_response/'hardware_profile/property[@name="memory"]').first[:value].should == '1740.8'
+      (last_xml_response/'hardware_profile/property[@name="cpu"]').first[:value].should == '1'
+#      (last_xml_response/'hardware_profile/property[@name="storage"]').first[:value].should == '0'
+    end
+
+    def test_05_it_filter_hardware_profiles
+      get_auth_url '/api;driver=fgcp/hardware_profiles?architecture=i386'
+      (last_xml_response/'hardware_profiles/hardware_profile').length.should == 0
+      get_auth_url '/api;driver=fgcp/hardware_profiles?architecture=x86_64'
+      (last_xml_response/'hardware_profiles/hardware_profile').length.should == 4
+    end
+
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/fgcp/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/fgcp/realms_test.rb b/server/tests/deprecated/drivers/fgcp/realms_test.rb
new file mode 100644
index 0000000..bcb65d4
--- /dev/null
+++ b/server/tests/deprecated/drivers/fgcp/realms_test.rb
@@ -0,0 +1,42 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/common'
+
+module FGCPTest
+
+  class RealmsTest < Test::Unit::TestCase
+    include Rack::Test::Methods
+
+    def app
+      Sinatra::Application
+    end
+
+    def test_01_it_returns_realms
+      get_auth_url '/api;driver=fgcp/realms'
+      (last_xml_response/'realms/realm').length.should > 0
+    end
+
+    def test_02_each_realm_has_a_name
+      get_auth_url '/api;driver=fgcp/realms'
+      (last_xml_response/'realms/realm').each do |profile|
+        (profile/'name').text.should_not == nil
+        (profile/'name').text.should_not == ''
+#        (profile/'name').text.should == 'default'
+      end
+    end
+
+    def test_03_each_realm_is_available
+      get_auth_url '/api;driver=fgcp/realms'
+      (last_xml_response/'realms/realm').each do |profile|
+        (profile/'state').text.should == 'AVAILABLE'
+      end
+    end
+
+#    def test_03_it_returns_single_realm
+#      get_auth_url '/api;driver=fgcp/realms/us'
+#      (last_xml_response/'realm').first[:id].should == 'default'
+#      (last_xml_response/'realm/name').first.text.should == 'default'
+#      (last_xml_response/'realm/state').first.text.should == 'AVAILABLE'
+#    end
+
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/fgcp/setup.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/fgcp/setup.rb b/server/tests/deprecated/drivers/fgcp/setup.rb
new file mode 100644
index 0000000..eea1028
--- /dev/null
+++ b/server/tests/deprecated/drivers/fgcp/setup.rb
@@ -0,0 +1,13 @@
+ENV.delete 'API_VERBOSE'
+ENV['API_DRIVER']   = "fgcp"
+ENV['API_USER']     = 'cert-dir'
+ENV['API_PASSWORD'] = 'secret'
+
+require 'vcr'
+DeltacloudTestCommon::record!
+
+VCR.config do |c|
+  c.cassette_library_dir = "#{File.dirname(__FILE__)}/../../../tests/drivers/fgcp/fixtures/"
+  c.stub_with :webmock
+  c.default_cassette_options = { :record => :new_episodes }
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/google/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/google/api_test.rb b/server/tests/deprecated/drivers/google/api_test.rb
new file mode 100644
index 0000000..aa40151
--- /dev/null
+++ b/server/tests/deprecated/drivers/google/api_test.rb
@@ -0,0 +1,19 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/google/common'
+
+describe 'Deltacloud API' do
+
+  before do
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  include Deltacloud::Test
+
+  eval File.read('tests/minitest_common_api_test.rb')
+
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/google/buckets_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/google/buckets_test.rb b/server/tests/deprecated/drivers/google/buckets_test.rb
new file mode 100644
index 0000000..5980175
--- /dev/null
+++ b/server/tests/deprecated/drivers/google/buckets_test.rb
@@ -0,0 +1,100 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/drivers/google/common'
+
+describe 'Deltacloud API' do
+
+  before do
+    VCR.insert_cassette __name__
+  end
+
+  after do
+    VCR.eject_cassette
+  end
+
+  include Deltacloud::Test
+
+i_suck_and_my_tests_are_order_dependent!
+
+    @@bucket_name_google="#{@@created_bucket_name}googel"
+    @@blob_name_google="#{@@created_blob_name}googel"
+#intentional typos here - bucket names cannot contain 'google'
+#see http://code.google.com/apis/storage/docs/reference/v1/developer-guidev1.html
+  it 'can create a new bucket' do
+    authenticate
+    bucket_name = @@bucket_name_google
+    post collection_url(:buckets), {:name=>bucket_name}
+    last_response.status.must_equal 201
+    bucket = xml_response
+    check_bucket_basics(bucket, "googel")
+    (bucket/'bucket/size').first.text.must_equal "0"
+  end
+
+  it 'can create a new blob with HTTP POST' do
+    authenticate
+    temp_file=File.open(@@created_blob_local_file)
+    params = { 'blob_id' => @@blob_name_google,
+              :meta_params=>"2",
+              :meta_name1=>"Author",
+              :meta_value1=>"deltacloud",
+              :meta_name2=>"foo",
+              :meta_value2=>"bar",
+              'blob_data' => Rack::Test::UploadedFile.new(temp_file.path, "text/html") }
+    post "#{collection_url(:buckets)}/#{@@bucket_name_google}", params
+    last_response.status.must_equal 200
+    blob = xml_response
+    check_blob_basics(blob, "googel")
+  end
+
+  it 'can retrieve named bucket details' do
+    authenticate
+    get "#{collection_url(:buckets)}/#{@@bucket_name_google}"
+    last_response.status.must_equal 200
+    bucket = xml_response
+    check_bucket_basics(bucket, "googel")
+    (bucket/'bucket/size').first.text.must_equal "1" #assuming blob created succesfully right?
+  end
+
+  it 'can retrieve details of a named blob' do
+      authenticate
+      get "#{collection_url(:buckets)}/#{@@bucket_name_google}/#{@@blob_name_google}"
+      last_response.status.must_equal 200
+      blob = xml_response
+      check_blob_basics(blob, "googel")
+      check_blob_metadata(blob, {"author"=>"deltacloud", "foo"=>"bar"})
+  end
+
+  it 'can retrieve named blob metadata' do
+    authenticate
+    head "#{collection_url(:buckets)}/#{@@bucket_name_google}/#{@@blob_name_google}"
+    last_response.status.must_equal 204
+    blob_meta_hash = last_response.headers.inject({}){|result, (k,v)| result[k]=v if k=~/^X-Deltacloud-Blobmeta-/i ; result}
+    blob_meta_hash.gsub_keys(/x-.*meta-/i, "")
+    {"author"=>"deltacloud", "foo"=>"bar"}.must_equal blob_meta_hash
+  end
+
+  it 'can update blob metadata' do
+    authenticate
+    new_meta = {"X-Deltacloud-Blobmeta-author" => "ApacheDeltacloud", "X-Deltacloud-Blobmeta-oof" => "rab"}
+    new_meta.each_pair do |k,v|
+      header k, v
+    end
+    post "#{collection_url(:buckets)}/#{@@bucket_name_google}/#{@@blob_name_google}"
+    last_response.status.must_equal 204
+    new_meta.each_pair do |k,v|
+      last_response.headers[k].must_equal v
+    end
+  end
+
+  it 'can delete blob' do
+    authenticate
+    delete "#{collection_url(:buckets)}/#{@@bucket_name_google}/#{@@blob_name_google}"
+    last_response.status.must_equal 204
+  end
+
+  it 'can delete bucket' do
+    authenticate
+    delete "#{collection_url(:buckets)}/#{@@bucket_name_google}"
+    last_response.status.must_equal 204
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/google/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/google/common.rb b/server/tests/deprecated/drivers/google/common.rb
new file mode 100644
index 0000000..1f6cb29
--- /dev/null
+++ b/server/tests/deprecated/drivers/google/common.rb
@@ -0,0 +1,54 @@
+ENV['API_DRIVER']   = "google"
+ENV['TESTS_API_USERNAME'] = "GOOGXKQLYTEOZTILUBZ5"
+ENV['TESTS_API_PASSWORD'] = "M3pvZUy2ivT78ipQ+u1xv6TkY83q9DUnGXkov3tA"
+
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
+require 'tests/minitest_common'
+
+require 'vcr'
+
+VCR.configure do |c|
+  c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures/"
+  c.hook_into :excon
+  c.default_cassette_options = { :record => :new_episodes}
+end
+
+#the following can probably be moved to somewhere more 'common'
+#once other driver tests start using them (e.g. openstack).
+
+  @@created_bucket_name="testbucki2rpux3wdelme"
+  @@created_blob_name="testblobk1ds91kVdelme"
+  @@created_blob_local_file="#{File.dirname(__FILE__)}/../common_fixtures/deltacloud_blob_test.png"
+
+  def check_bucket_basics(bucket, cloud)
+    (bucket/'bucket/name').first.text.must_equal "#{@@created_bucket_name}#{cloud}"
+    (bucket/'bucket').attribute("id").text.must_equal "#{@@created_bucket_name}#{cloud}"
+    (bucket/'bucket').length.must_be :>, 0
+    (bucket/'bucket/name').first.text.wont_be_nil
+    (bucket/'bucket').attribute("href").text.wont_be_nil
+  end
+
+  def check_blob_basics(blob, cloud)
+    (blob/'blob').length.must_equal 1
+    (blob/'blob').attribute("id").text.wont_be_nil
+    (blob/'blob').attribute("href").text.wont_be_nil
+    (blob/'blob/bucket').text.wont_be_nil
+    (blob/'blob/content_length').text.wont_be_nil
+    (blob/'blob/content_type').text.wont_be_nil
+    (blob/'blob').attribute("id").text.must_equal "#{@@created_blob_name}#{cloud}"
+    (blob/'blob/bucket').text.must_equal "#{@@created_bucket_name}#{cloud}"
+    (blob/'blob/content_length').text.to_i.must_equal File.size(@@created_blob_local_file)
+  end
+
+  def check_blob_metadata(blob, metadata_hash)
+    meta_from_blob = {}
+    #extract metadata from nokogiri blob xml
+    (0.. (((blob/'blob/user_metadata').first).elements.size - 1) ).each do |i|
+      meta_from_blob[(((blob/'blob/user_metadata').first).elements[i].attribute("key").value)] =
+                                  (((blob/'blob/user_metadata').first).elements[i].children[1].text)
+    end
+    #remove any 'x-goog-meta-' prefixes (problem for google blobs and vcr...)
+    meta_from_blob.gsub_keys(/x-.*-meta-/i, "")
+    meta_from_blob.must_equal metadata_hash
+  end
+

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/570a9a04/server/tests/deprecated/drivers/google/fixtures/test_0001_can_create_a_new_bucket.yml
----------------------------------------------------------------------
diff --git a/server/tests/deprecated/drivers/google/fixtures/test_0001_can_create_a_new_bucket.yml b/server/tests/deprecated/drivers/google/fixtures/test_0001_can_create_a_new_bucket.yml
new file mode 100644
index 0000000..ded1e4e
--- /dev/null
+++ b/server/tests/deprecated/drivers/google/fixtures/test_0001_can_create_a_new_bucket.yml
@@ -0,0 +1,36 @@
+--- 
+http_interactions: 
+- request: 
+    method: put
+    uri: https://testbucki2rpux3wdelmegoogel.commondatastorage.googleapis.com/
+    body: 
+      string: ""
+    headers: 
+      Authorization: 
+      - GOOG1 GOOGXKQLYTEOZTILUBZ5:M4K9MWPskNvOyouLnfg2TrwVW4M=
+      Date: 
+      - Thu, 28 Jun 2012 13:51:51 +0000
+  response: 
+    status: 
+      code: 200
+      message: 
+    headers: 
+      Content-Length: 
+      - "0"
+      Server: 
+      - HTTP Upload Server Built on Jun 14 2012 02:12:09 (1339665129)
+      Expires: 
+      - Fri, 01 Jan 1990 00:00:00 GMT
+      Content-Type: 
+      - text/html; charset=UTF-8
+      Pragma: 
+      - no-cache
+      Date: 
+      - Thu, 28 Jun 2012 13:51:52 GMT
+      Cache-Control: 
+      - no-cache, no-store, must-revalidate
+    body: 
+      string: ""
+    http_version: 
+  recorded_at: Thu, 28 Jun 2012 13:51:52 GMT
+recorded_with: VCR 2.2.2


Mime
View raw message