deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [6/7] git commit: Client: Moved all tests to tests directory
Date Fri, 10 Aug 2012 07:37:45 GMT
Client: Moved all tests to tests directory

* Removed obsoleted fixtures. They are provided by deltacloud-core


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

Branch: refs/heads/master
Commit: 68e0eb09cf5441c46a8181453cb3fee88b9c0f71
Parents: 5b15483
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Aug 8 14:47:43 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Aug 10 09:38:20 2012 +0200

----------------------------------------------------------------------
 client/specs/.gitignore                           |    1 -
 client/specs/buckets_spec.rb                      |  148 -----------
 client/specs/content_spec.rb                      |  137 ----------
 client/specs/errors_spec.rb                       |   59 -----
 client/specs/fixtures/images/img1.yml             |    4 -
 client/specs/fixtures/images/img2.yml             |    4 -
 client/specs/fixtures/images/img3.yml             |    4 -
 client/specs/fixtures/instances/inst0.yml         |   16 --
 client/specs/fixtures/instances/inst1.yml         |    9 -
 client/specs/fixtures/instances/inst2.yml         |    9 -
 client/specs/fixtures/storage_snapshots/snap1.yml |    4 -
 client/specs/fixtures/storage_snapshots/snap2.yml |    4 -
 client/specs/fixtures/storage_snapshots/snap3.yml |    4 -
 client/specs/fixtures/storage_volumes/vol1.yml    |    7 -
 client/specs/fixtures/storage_volumes/vol2.yml    |    7 -
 client/specs/fixtures/storage_volumes/vol3.yml    |    7 -
 client/specs/hardware_profiles_spec.rb            |   80 ------
 client/specs/images_spec.rb                       |  107 --------
 client/specs/initialization_spec.rb               |   64 -----
 client/specs/instance_states_spec.rb              |   80 ------
 client/specs/instances_spec.rb                    |  210 ----------------
 client/specs/keys_spec.rb                         |   97 -------
 client/specs/realms_spec.rb                       |   66 -----
 client/specs/shared/resources.rb                  |   30 ---
 client/specs/spec_helper.rb                       |   53 ----
 client/specs/storage_snapshot_spec.rb             |   81 ------
 client/specs/storage_volume_spec.rb               |   91 -------
 client/tests/buckets_test.rb                      |  148 +++++++++++
 client/tests/client_test.rb                       |   64 +++++
 client/tests/content_negotiation_tests.rb         |  137 ++++++++++
 client/tests/errors_test.rb                       |   59 +++++
 client/tests/hardware_profiles_test.rb            |   80 ++++++
 client/tests/images_test.rb                       |  107 ++++++++
 client/tests/instance_states_test.rb              |   80 ++++++
 client/tests/instances_test.rb                    |  210 ++++++++++++++++
 client/tests/keys_tests.rb                        |   97 +++++++
 client/tests/realms_test.rb                       |   66 +++++
 client/tests/storage_snapshot_test.rb             |   81 ++++++
 client/tests/storage_volume_test.rb               |   91 +++++++
 39 files changed, 1220 insertions(+), 1383 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/.gitignore
----------------------------------------------------------------------
diff --git a/client/specs/.gitignore b/client/specs/.gitignore
deleted file mode 100644
index 1269488..0000000
--- a/client/specs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-data

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/buckets_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/buckets_spec.rb b/client/specs/buckets_spec.rb
deleted file mode 100644
index b897e0c..0000000
--- a/client/specs/buckets_spec.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-describe "buckets" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all buckets" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        buckets = client.buckets
-        buckets.should_not be_empty
-        buckets.each do |bucket|
-          bucket.uri.should_not be_nil
-          bucket.uri.should be_a( String )
-          bucket.name.should_not be_nil
-          bucket.name.should be_a(String)
-        end
-      end
-    end
-  end
-
-  it "should allow retrieval of a named bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
-      bucket.uri.should eql(API_URL + "/buckets/bucket1")
-      bucket.size.should eql(3.0)
-      bucket.name.should_not be_nil
-      bucket.name.should be_a(String)
-      blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
-    end
-  end
-
-end
-
-describe "Operations on buckets" do
-
-  it "should allow creation of a new bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_bucket = client.create_bucket({'id' => "my_new_bucket"})
-      new_bucket.should_not be_nil
-      new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
-      new_bucket.name.should_not be_nil
-      new_bucket.name.should be_a(String)
-      new_bucket.name.should eql("my_new_bucket")
-    end
-  end
-
-  it "should allow deletion of an existing bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_bucket = client.bucket("my_new_bucket")
-      new_bucket.should_not be_nil
-      new_bucket.name.should eql("my_new_bucket")
-      lambda{
-              client.destroy_bucket({'id' => "my_new_bucket"})
-            }.should_not raise_error
-    end
-  end
-
-  it "should throw error if you delete a non existing bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_bucket({'id' => "i_dont_exist"})
-            }.should raise_error
-    end
-  end
-
-end
-
-describe "Blobs" do
-
-  it "should allow retrieval of a bucket's blobs" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
-      blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
-      blob_list.each do |b_id|
-        blob = client.blob({"bucket" => bucket.name, :id => b_id})
-        puts blob.inspect
-        blob.bucket.should_not be_nil
-        blob.bucket.should be_a(String)
-        blob.bucket.should eql(bucket.name)
-        blob.content_length.should_not be_nil
-        blob.content_length.should be_a(Float)
-        blob.content_length.should >= 0
-        blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
-        blob_data.size.to_f.should == blob.content_length
-        blob.last_modified.should_not be_nil
-      end
-    end
-  end
-
-end
-
-describe "Operations on blobs" do
-
-  it "should successfully create a new blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      blob_data = File.new("./blob_data_file", "w+")
-
-      blob_data.write("this is some blob data \n")
-      blob_data.rewind
-      some_new_blob = client.create_blob({:id => "some_new_blob",
-                          'bucket' => "bucket1",
-                          'file_path' => blob_data.path})
-      some_new_blob.should_not be_nil
-      some_new_blob.content_length.should_not be_nil
-      some_new_blob.content_length.should eql(24.0)
-      File.delete(blob_data.path)
-    end
-  end
-
-  it "should allow deletion of an existing blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
-            }.should_not raise_error
-    end
-  end
-
-  it "should throw error if you delete a non existing blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
-            }.should raise_error
-    end
-  end
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/content_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/content_spec.rb b/client/specs/content_spec.rb
deleted file mode 100644
index ffd222c..0000000
--- a/client/specs/content_spec.rb
+++ /dev/null
@@ -1,137 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-def client
-  RestClient::Resource.new(API_URL)
-end
-
-def headers(header)
-  encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
-  { :authorization => "Basic " + encoded_credentials }.merge(header)
-end
-
-describe "return JSON" do
-
-  it 'should return JSON when using application/json, */*' do
-    header_hash = {
-      # FIXME: There is a bug in rack-accept that cause to respond with HTML
-      # to the configuration below.
-      #
-      # 'Accept' => "application/json, */*"
-      'Accept' => "application/json"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
-    end
-  end
-
-  it 'should return JSON when using just application/json' do
-    header_hash = {
-      'Accept' => "application/json"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
-    end
-  end
-
-end
-
-describe "return HTML in different browsers" do
-
-  it "wants XML using format parameter" do
-    client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "raise 406 error on wrong accept" do
-    client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
-      response.code.should == 406
-    end
-  end
-
-  it "wants HTML using format parameter and accept set to XML" do
-    client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-#  FIXME: This return 406 for some reason on GIT sinatra
-#  it "wants a PNG image" do 
-#    client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
-#      response.code.should == 200
-#      response.headers[:content_type].should =~ /^image\/png/
-#    end
-#  end
-
-  it "doesn't have accept header" do
-    client.get('Accept' => '') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "can handle unknown formats" do
-    client.get('Accept' => 'format/unknown') do |response, request, &block|
-      response.code.should == 406
-    end
-  end
-
-  it "wants explicitly XML" do
-    client.get('Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "Internet Explorer" do
-    header_hash = {
-      'Accept' => "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*",
-      'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-  it "Mozilla Firefox" do
-    client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-  it "Opera" do
-    header_hash = { 
-      'Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
-      'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/errors_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/errors_spec.rb b/client/specs/errors_spec.rb
deleted file mode 100644
index 031e3b7..0000000
--- a/client/specs/errors_spec.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-describe "server error handler" do
-
-  it_should_behave_like "all resources"
-
-  it 'should capture HTTP 500 error as DeltacloudError' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
-    end
-  end
-
-  it 'should capture HTTP 502 error as ProviderError' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
-    end
-  end
-
-  it 'should capture HTTP 501 error as NotImplemented' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
-    end
-  end
-
-  it 'should capture HTTP 504 error as ProviderTimeout' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
-    end
-  end
-
-end
-
-describe "client error handler" do
-
-  it 'should capture HTTP 404 error as NotFound' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/images/.gitignore
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/images/.gitignore b/client/specs/fixtures/images/.gitignore
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/images/img1.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/images/img1.yml b/client/specs/fixtures/images/img1.yml
deleted file mode 100644
index 98d8214..0000000
--- a/client/specs/fixtures/images/img1.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: Fedora 10
-:owner_id: fedoraproject
-:architecture: x86_64
-:id: img1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/images/img2.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/images/img2.yml b/client/specs/fixtures/images/img2.yml
deleted file mode 100644
index 4508446..0000000
--- a/client/specs/fixtures/images/img2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: Fedora 10
-:owner_id: fedoraproject
-:architecture: i386
-:id: img2

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/images/img3.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/images/img3.yml b/client/specs/fixtures/images/img3.yml
deleted file mode 100644
index d9e33b0..0000000
--- a/client/specs/fixtures/images/img3.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: JBoss
-:owner_id: mockuser
-:architecture: i386
-:id: img3

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/instances/.gitignore
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/instances/.gitignore b/client/specs/fixtures/instances/.gitignore
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/instances/inst0.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/instances/inst0.yml b/client/specs/fixtures/instances/inst0.yml
deleted file mode 100644
index a5b73be..0000000
--- a/client/specs/fixtures/instances/inst0.yml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-:realm_id: us
-:public_addresses:
-- img1.inst0.public.com
-:state: RUNNING
-:name: "Mock Instance With Profile Change"
-:private_addresses:
-- img1.inst0.private.com
-:image_id: img1
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-large
-  memory: "12288"
-:owner_id: mockuser
-:actions:
-- :reboot
-- :stop

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/instances/inst1.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/instances/inst1.yml b/client/specs/fixtures/instances/inst1.yml
deleted file mode 100644
index 3544d40..0000000
--- a/client/specs/fixtures/instances/inst1.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-:name: MockUserInstance
-:state: RUNNING
-:image_id: img3
-:owner_id: mockuser
-:public_addresses: [ img3.inst1.public.com ]
-:private_addresses: [ img3.inst1.private.com ]
-:realm_id: us
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-small

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/instances/inst2.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/instances/inst2.yml b/client/specs/fixtures/instances/inst2.yml
deleted file mode 100644
index 9a70cb8..0000000
--- a/client/specs/fixtures/instances/inst2.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-:name: AnotherInstance
-:state: RUNNING
-:image_id: img1
-:owner_id: anotheruser
-:public_addresses: [ img1.inst2.public.com ]
-:private_addresses: [ img1.inst2.private.com ]
-:realm_id: us
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-large

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_snapshots/.gitignore
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_snapshots/.gitignore b/client/specs/fixtures/storage_snapshots/.gitignore
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_snapshots/snap1.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_snapshots/snap1.yml b/client/specs/fixtures/storage_snapshots/snap1.yml
deleted file mode 100644
index 180a2c7..0000000
--- a/client/specs/fixtures/storage_snapshots/snap1.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: fedoraproject
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_snapshots/snap2.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_snapshots/snap2.yml b/client/specs/fixtures/storage_snapshots/snap2.yml
deleted file mode 100644
index f68c8ce..0000000
--- a/client/specs/fixtures/storage_snapshots/snap2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: mockuser
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol2

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_snapshots/snap3.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_snapshots/snap3.yml b/client/specs/fixtures/storage_snapshots/snap3.yml
deleted file mode 100644
index f68c8ce..0000000
--- a/client/specs/fixtures/storage_snapshots/snap3.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: mockuser
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol2

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_volumes/.gitignore
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_volumes/.gitignore b/client/specs/fixtures/storage_volumes/.gitignore
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_volumes/vol1.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_volumes/vol1.yml b/client/specs/fixtures/storage_volumes/vol1.yml
deleted file mode 100644
index 54ea706..0000000
--- a/client/specs/fixtures/storage_volumes/vol1.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: fedoraproject
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: AVAILABLE
-:capacity: 1
-:realm_id: us
-:device:
-:instance_id:

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_volumes/vol2.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_volumes/vol2.yml b/client/specs/fixtures/storage_volumes/vol2.yml
deleted file mode 100644
index 4103e80..0000000
--- a/client/specs/fixtures/storage_volumes/vol2.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: mockuser
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: AVAILABLE
-:capacity: 1
-:device:
-:realm_id: us
-:instance_id:

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/fixtures/storage_volumes/vol3.yml
----------------------------------------------------------------------
diff --git a/client/specs/fixtures/storage_volumes/vol3.yml b/client/specs/fixtures/storage_volumes/vol3.yml
deleted file mode 100644
index 9ab2453..0000000
--- a/client/specs/fixtures/storage_volumes/vol3.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: mockuser
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: IN-USE
-:capacity: 1
-:realm_id: us
-:device: /dev/sda1
-:instance_id: inst1

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/hardware_profiles_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/hardware_profiles_spec.rb b/client/specs/hardware_profiles_spec.rb
deleted file mode 100644
index 59bfae0..0000000
--- a/client/specs/hardware_profiles_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-def prop_check(prop, value_class)
-  if prop.present?
-    prop.value.should_not be_nil
-    prop.value.should be_a(value_class)
-  end
-end
-
-describe "hardware_profiles" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all hardware profiles" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        hardware_profiles = client.hardware_profiles
-        hardware_profiles.should_not be_empty
-        hardware_profiles.each do |hwp|
-          hwp.uri.should_not be_nil
-          hwp.uri.should be_a(String)
-          prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
-       end
-      end
-    end
-  end
-
-  it "should allow filtering of hardware_profiles by architecture" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hardware_profiles = client.hardware_profiles( :architecture=>'i386' )
-      hardware_profiles.should_not be_empty
-      hardware_profiles.size.should eql( 2 )
-      hardware_profiles.first.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should allow fetching a hardware_profile by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = client.hardware_profile( 'm1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
-    end
-  end
-
-  it "should allow fetching different hardware_profiles" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    hwp1 = client.hardware_profile( 'm1-small' )
-    hwp2 = client.hardware_profile( 'm1-large' )
-    hwp1.storage.value.should_not eql(hwp2.storage.value)
-    hwp1.memory.value.should_not eql(hwp2.memory.value)
-  end
-
-  it "should allow fetching a hardware_profile by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = client.fetch_hardware_profile( API_URL + '/hardware_profiles/m1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/images_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/images_spec.rb b/client/specs/images_spec.rb
deleted file mode 100644
index 3b209cd..0000000
--- a/client/specs/images_spec.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-describe "images" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all images" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        images = client.images
-        images.should_not be_empty
-        images.size.should eql( 3 )
-        images.each do |image|
-          image.uri.should_not be_nil
-          image.uri.should be_a(String)
-          image.description.should_not be_nil
-          image.description.should be_a(String)
-          image.architecture.should_not be_nil
-          image.architecture.should be_a(String)
-          image.owner_id.should_not be_nil
-          image.owner_id.should be_a(String)
-        end
-      end
-    end
-  end
-
-  it "should allow retrieval of my own images" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      images = client.images( :owner_id=>:self )
-      images.should_not be_empty
-      images.size.should eql( 1 )
-      images.each do |image|
-        image.uri.should_not be_nil
-        image.uri.should be_a(String)
-        image.description.should_not be_nil
-        image.description.should be_a(String)
-        image.architecture.should_not be_nil
-        image.architecture.should be_a(String)
-        image.owner_id.should_not be_nil
-        image.owner_id.should be_a(String)
-      end
-    end
-  end
-
-  it "should allow retrieval of a single image by ID" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      image = client.image( 'img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
-    end
-  end
-
-  it "should allow retrieval of a single image by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      image = client.fetch_image( API_URL + '/images/img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
-    end
-  end
-
-  describe "filtering by architecture" do
-    it "return matching images" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        images = client.images( :architecture=>'x86_64' )
-        images.should_not be_empty
-        images.each do |image|
-          image.architecture.should eql( 'x86_64' )
-        end
-        images = client.images( :architecture=>'i386' )
-        images.should_not be_empty
-        images.each do |image|
-          image.architecture.should eql( 'i386' )
-        end
-      end
-    end
-
-    it "should return an empty array for no matches" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        images = client.images( :architecture=>'8088' )
-        images.should be_empty
-      end
-    end
-  end
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/initialization_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/initialization_spec.rb b/client/specs/initialization_spec.rb
deleted file mode 100644
index b4c1a75..0000000
--- a/client/specs/initialization_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-describe "initializing the client" do
-
-  it "should parse valid API URIs" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.api_host.should eql( API_HOST )
-    client.api_port.should eql( API_PORT.to_i )
-    client.api_path.should eql( API_PATH )
-  end
-
-  it "should discover entry points upon connection" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( "name", "password", entry_point ) do |client|
-        client.entry_points[:hardware_profiles].should eql( "#{API_URL}/hardware_profiles" )
-        client.entry_points[:images].should            eql( "#{API_URL}/images" )
-        client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
-        client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage_volumes" )
-        client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage_snapshots" )
-        client.entry_points[:buckets].should           eql( "#{API_URL}/buckets")
-        client.entry_points[:keys].should              eql( "#{API_URL}/keys")
-      end
-    end
-  end
-
-  it "should provide the current driver name via client" do
-    DeltaCloud.new( "name", "password", API_URL ) do |client|
-      client.driver_name.should eql( 'mock' )
-    end
-  end
-
-  it "should provide the current driver name without client" do
-    DeltaCloud.driver_name( API_URL ).should eql( 'mock' )
-  end
-
-  describe "without a block" do
-    before( :each ) do
-      reload_fixtures
-    end
-    it "should connect without a block" do
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-      client.images.should_not be_nil
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/instance_states_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/instance_states_spec.rb b/client/specs/instance_states_spec.rb
deleted file mode 100644
index c79c273..0000000
--- a/client/specs/instance_states_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-=begin
-Spec::Matchers.define :include_transition do |action,to|
-  match do |transitions|
-    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
-    ! found.nil?
-  end
-end
-=end
-
-describe "instance-states" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of instance-state information" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        instance_states = client.instance_states
-        instance_states.should_not be_nil
-        instance_states.should_not be_empty
-
-        instance_states[0].name.should eql( 'start' )
-        instance_states[0].transitions.size.should eql( 1 )
-        instance_states[0].transitions[0].should_not be_auto
-
-        instance_states[1].name.should eql( 'pending' )
-        instance_states[1].transitions.size.should eql( 1 )
-        instance_states[1].transitions[0].should be_auto
-
-        instance_states[2].name.should eql( 'running' )
-        instance_states[2].transitions.size.should eql( 2 )
-        includes_transition( instance_states[2].transitions, :reboot, :running ).should be_true
-        includes_transition( instance_states[2].transitions, :stop, :stopped ).should be_true
-      end
-    end
-  end
-
-  it "should allow retrieval of a single instance-state blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance_state = client.instance_state( :pending )
-      instance_state.should_not be_nil
-      instance_state.name.should eql( 'pending' )
-      instance_state.transitions.size.should eql( 1 )
-      instance_state.transitions[0].should be_auto
-
-      instance_state = client.instance_state( :running )
-      instance_state.name.should eql( 'running' )
-      instance_state.transitions.size.should eql( 2 )
-      includes_transition( instance_state.transitions, :reboot, :running ).should be_true
-      includes_transition( instance_state.transitions, :stop, :stopped ).should be_true
-    end
-  end
-
-  def includes_transition( transitions, action, to )
-    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
-    ! found.nil?
-  end
-
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/instances_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/instances_spec.rb b/client/specs/instances_spec.rb
deleted file mode 100644
index f7fc7e7..0000000
--- a/client/specs/instances_spec.rb
+++ /dev/null
@@ -1,210 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-describe "instances" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all instances" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        instances = client.instances
-        instances.should_not be_empty
-        instances.each do |instance|
-          instance.uri.should_not be_nil
-          instance.uri.should be_a( String )
-          instance.owner_id.should_not be_nil
-          instance.owner_id.should be_a( String )
-          instance.image.should_not be_nil
-          instance.image.to_s.should match(/DeltaCloud::API::.*::Image/)
-          instance.hardware_profile.should_not be_nil
-          instance.hardware_profile.should be_a( DeltaCloud::API::Base::HardwareProfile )
-          instance.state.should_not be_nil
-          instance.state.should be_a( String )
-          instance.public_addresses.should_not be_nil
-          instance.public_addresses.should_not be_empty
-          instance.public_addresses.should be_a( Array )
-          instance.private_addresses.should_not be_nil
-          instance.private_addresses.should_not be_empty
-          instance.private_addresses.should be_a( Array )
-        end
-      end
-    end
-  end
-
-  it "should allow navigation from instance to image" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instances = client.instances
-      instances.should_not be_empty
-      instance = instances.first
-      instance.image.should_not be_nil
-      instance.image.description.should_not be_nil
-      instance.image.description.should be_a(String)
-    end
-  end
-
-  it "should allow retrieval of a single instance" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.instance( "inst0" )
-      instance.should_not be_nil
-      instance.name.should_not be_nil
-      instance.name.should eql( 'Mock Instance With Profile Change' )
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
-      instance.owner_id.should eql( "mockuser" )
-      instance.public_addresses.first.class.should eql(Hash)
-      instance.public_addresses.first[:type].should eql('hostname')
-      instance.public_addresses.first[:address].should eql('img1.inst0.public.com')
-      instance.image.should_not be_nil
-      instance.image.uri.should eql( API_URL + "/images/img1" )
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.uri.should eql( API_URL + "/hardware_profiles/m1-large" )
-      instance.hardware_profile.memory.value.should eql('10240')
-      instance.hardware_profile.storage.value.should eql('850')
-      instance.state.should eql( "RUNNING" )
-      instance.actions.should_not be_nil
-    end
-  end
-
-  it "should allow creation of new instances with reasonable defaults" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :name=>'TestInstance', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.name.should eql( 'TestInstance' )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific realm" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :realm=>'eu', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'eu' )
-    end
-  end
-
-  it "should allow creation of new instances with specific hardware profile" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1',
-                                         :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific hardware profile overriding memory" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = { :id => 'm1-xlarge', :memory => 32768 }
-      instance = client.create_instance( 'img1', :hardware_profile=> hwp )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.hardware_profile.memory.value.should eql('12288')
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific realm and hardware profile" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :realm=>'eu',
-                                         :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'eu' )
-    end
-  end
-
-  it "should allow fetching of instances by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.instance( 'inst1' )
-      instance.should_not be_nil
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
-    end
-  end
-
-  it "should allow fetching of instances by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.fetch_instance( API_URL + '/instances/inst1' )
-      instance.should_not be_nil
-      instance.uri.should eql( API_URL + '/instances/inst1' )
-      instance.id.should eql( 'inst1' )
-    end
-  end
-
-  describe "performing actions on instances" do
-    it "should allow actions that are valid" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.instance( 'inst1' )
-        instance.should_not be_nil
-        instance.state.should eql( "RUNNING" )
-        instance.uri.should eql( API_URL + '/instances/inst1' )
-        instance.id.should eql( 'inst1' )
-        instance.stop!
-        instance.state.should eql( "STOPPED" )
-        instance.start!
-        instance.state.should eql( "RUNNING" )
-      end
-    end
-
-    it "should not allow actions that are invalid" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.instance( 'inst1' )
-        instance.should_not be_nil
-        unless instance.state.eql?("RUNNING")
-          instance.start!
-        end
-        instance.state.should eql( "RUNNING" )
-        lambda{instance.start!}.should raise_error
-      end
-    end
-
-    it "should not throw exception when destroying an instance" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.create_instance( 'img1',
-                                           :name=>'TestDestroyInstance',
-                                           :hardware_profile => 'm1-xlarge' )
-        instance.stop!
-        lambda {
-          instance.destroy!
-        }.should_not raise_error
-      end
-    end
-  end
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/keys_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/keys_spec.rb b/client/specs/keys_spec.rb
deleted file mode 100644
index fa2ff54..0000000
--- a/client/specs/keys_spec.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-def check_key(the_key, key_name = "")
-  the_key.should_not be_nil
-  the_key.id.should be_a(String)
-  the_key.id.should eql(key_name)
-  the_key.actions.should_not be_nil
-  the_key.actions.size.should eql(1)
-  the_key.actions.first[0].should eql("destroy")
-  the_key.actions.first[1].should eql("#{API_URL}/keys/#{key_name}")
-  the_key.fingerprint.should_not be_nil
-  the_key.fingerprint.should be_a(String)
-  the_key.pem.should_not be_nil
-  the_key.pem.first.should be_a(String)
-end
-
-def create_key_if_necessary(client, key_name)
-  the_key = client.key(key_name)
-  unless the_key
-    client.create_key()
-  end
-end
-
-
-describe "keys" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all keys" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        lambda{
-              client.keys
-              }.should_not raise_error
-      end
-    end
-  end
-end
-
-describe "operations on keys" do
-
-  it "should allow successful creation of a new key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_key = client.create_key({:name => "my_new_key"})
-      check_key(new_key, "my_new_key")
-    end
-  end
-
-  it "should allow retrieval of an existing named key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      key_name = "my_new_key"
-      create_key_if_necessary(client, key_name)
-      the_key = client.key(key_name)
-      check_key(the_key, key_name)
-    end
-  end
-
-  it "should raise error if you create a key with the same name as an existing key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      name = "my_new_key"
-      create_key_if_necessary(client, name)
-      lambda{
-              client.create_key({:name => name})
-            }.should raise_error
-    end
-  end
-
-  it "should allow successful destruction of an existing key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      name = "my_new_key"
-      create_key_if_necessary(client, name)
-      the_key = client.key(name)
-      lambda{
-              the_key.destroy!
-            }.should_not raise_error
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/realms_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/realms_spec.rb b/client/specs/realms_spec.rb
deleted file mode 100644
index 241fb5c..0000000
--- a/client/specs/realms_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'specs/spec_helper'
-
-describe "realms" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all realms" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        realms = client.realms
-        realms.should_not be_empty
-        realms.each do |realm|
-          realm.uri.should_not be_nil
-          realm.uri.should be_a(String)
-          realm.id.should_not be_nil
-          realm.id.should be_a(String)
-          realm.name.should_not be_nil
-          realm.name.should be_a(String)
-        end
-      end
-    end
-  end
-
-
-  it "should allow fetching a realm by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      realm = client.realm( 'us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
-      realm.name.should eql( 'United States' )
-      realm.state.should eql( 'AVAILABLE' )
-      realm = client.realm( 'eu' )
-      realm.should_not be_nil
-      realm.id.should eql( 'eu' )
-      realm.name.should eql( 'Europe' )
-      realm.state.should eql( 'AVAILABLE' )
-    end
-  end
-
-  it "should allow fetching a realm by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      realm = client.fetch_realm( API_URL + '/realms/us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/shared/resources.rb
----------------------------------------------------------------------
diff --git a/client/specs/shared/resources.rb b/client/specs/shared/resources.rb
deleted file mode 100644
index 030c6d9..0000000
--- a/client/specs/shared/resources.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-shared_examples_for "all resources" do
-
-  before(:each) do
-    reload_fixtures
-  end
-
-  after(:each) do
-    #clean_fixtures
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/spec_helper.rb
----------------------------------------------------------------------
diff --git a/client/specs/spec_helper.rb b/client/specs/spec_helper.rb
deleted file mode 100644
index b4cb95c..0000000
--- a/client/specs/spec_helper.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'yaml'
-require 'fileutils'
-
-api_host = ENV['API_HOST']
-( api_host = 'localhost' ) if api_host.nil?
-( api_host = 'localhost' ) if api_host == ''
-
-api_port = ENV['API_PORT']
-( api_port = 3001 ) if api_port.nil?
-( api_port = 3001 ) if api_port == ''
-
-API_HOST = api_host
-API_PORT = api_port
-API_PATH = '/api'
-
-API_URL = "http://#{API_HOST}:#{API_PORT}#{API_PATH}"
-API_URL_REDIRECT = "http://#{API_HOST}:#{API_PORT}"
-API_NAME     = 'mockuser'
-API_PASSWORD = 'mockpassword'
-
-$: << File.dirname( __FILE__ ) + '/../lib'
-require 'deltacloud'
-
-def clean_fixtures
-  FileUtils.rm_rf( File.dirname( __FILE__ ) + '/data' )
-end
-
-def reload_fixtures
-  clean_fixtures
-  FileUtils.cp_r( File.dirname( __FILE__) + '/fixtures', File.dirname( __FILE__ ) + '/data' )
-end
-
-$: << File.dirname( __FILE__ )
-require 'shared/resources'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/storage_snapshot_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/storage_snapshot_spec.rb b/client/specs/storage_snapshot_spec.rb
deleted file mode 100644
index 94f149c..0000000
--- a/client/specs/storage_snapshot_spec.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-describe "storage snapshot" do
-
-  it_should_behave_like "all resources"
-
-  it "allow retrieval of all storage volumes owned by the current user" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_snapshots = client.storage_snapshots
-        storage_snapshots.should_not be_nil
-        storage_snapshots.should_not be_empty
-        ids = storage_snapshots.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'snap2' )
-        ids.should include( 'snap3' )
-      end
-    end
-  end
-
-  it "should allow fetching of storage volume by id" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.storage_snapshot( 'snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
-    end
-  end
-
-  it "should allow fetching of storage volume by URI"  do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
-    end
-  end
-
-  it "should return nil for unknown storage volume by ID" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.storage_snapshot( "bogus" )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-  it "should return nil for unknown storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/specs/storage_volume_spec.rb
----------------------------------------------------------------------
diff --git a/client/specs/storage_volume_spec.rb b/client/specs/storage_volume_spec.rb
deleted file mode 100644
index 8fb153e..0000000
--- a/client/specs/storage_volume_spec.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-require 'specs/spec_helper'
-
-describe "storage volumes" do
-
-  it_should_behave_like "all resources"
-
-  it "allow retrieval of all storage volumes owned by the current user" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_volumes = client.storage_volumes
-        storage_volumes.should_not be_nil
-        storage_volumes.should_not be_empty
-        ids = storage_volumes.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'vol2' )
-        ids.should include( 'vol3' )
-      end
-    end
-  end
-
-  it "should allow fetching of storage volume by id" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.storage_volume( 'vol3' )
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
-      ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should allow fetching of storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
-      storage_volume.should_not be_nil
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
-      ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should raise exception for unknown storage volume by ID" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.storage_volume( 'bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-  it "should raise exception for unknown storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-
-end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/buckets_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/buckets_test.rb b/client/tests/buckets_test.rb
new file mode 100644
index 0000000..b897e0c
--- /dev/null
+++ b/client/tests/buckets_test.rb
@@ -0,0 +1,148 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'specs/spec_helper'
+
+describe "buckets" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all buckets" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        buckets = client.buckets
+        buckets.should_not be_empty
+        buckets.each do |bucket|
+          bucket.uri.should_not be_nil
+          bucket.uri.should be_a( String )
+          bucket.name.should_not be_nil
+          bucket.name.should be_a(String)
+        end
+      end
+    end
+  end
+
+  it "should allow retrieval of a named bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      bucket = client.bucket("bucket1")
+      bucket.should_not be_nil
+      bucket.uri.should eql(API_URL + "/buckets/bucket1")
+      bucket.size.should eql(3.0)
+      bucket.name.should_not be_nil
+      bucket.name.should be_a(String)
+      blob_list = bucket.blob_list.split(", ")
+      blob_list.size.should eql(bucket.size.to_i)
+    end
+  end
+
+end
+
+describe "Operations on buckets" do
+
+  it "should allow creation of a new bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      new_bucket = client.create_bucket({'id' => "my_new_bucket"})
+      new_bucket.should_not be_nil
+      new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
+      new_bucket.name.should_not be_nil
+      new_bucket.name.should be_a(String)
+      new_bucket.name.should eql("my_new_bucket")
+    end
+  end
+
+  it "should allow deletion of an existing bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      new_bucket = client.bucket("my_new_bucket")
+      new_bucket.should_not be_nil
+      new_bucket.name.should eql("my_new_bucket")
+      lambda{
+              client.destroy_bucket({'id' => "my_new_bucket"})
+            }.should_not raise_error
+    end
+  end
+
+  it "should throw error if you delete a non existing bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_bucket({'id' => "i_dont_exist"})
+            }.should raise_error
+    end
+  end
+
+end
+
+describe "Blobs" do
+
+  it "should allow retrieval of a bucket's blobs" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      bucket = client.bucket("bucket1")
+      bucket.should_not be_nil
+      blob_list = bucket.blob_list.split(", ")
+      blob_list.size.should eql(bucket.size.to_i)
+      blob_list.each do |b_id|
+        blob = client.blob({"bucket" => bucket.name, :id => b_id})
+        puts blob.inspect
+        blob.bucket.should_not be_nil
+        blob.bucket.should be_a(String)
+        blob.bucket.should eql(bucket.name)
+        blob.content_length.should_not be_nil
+        blob.content_length.should be_a(Float)
+        blob.content_length.should >= 0
+        blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
+        blob_data.size.to_f.should == blob.content_length
+        blob.last_modified.should_not be_nil
+      end
+    end
+  end
+
+end
+
+describe "Operations on blobs" do
+
+  it "should successfully create a new blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      blob_data = File.new("./blob_data_file", "w+")
+
+      blob_data.write("this is some blob data \n")
+      blob_data.rewind
+      some_new_blob = client.create_blob({:id => "some_new_blob",
+                          'bucket' => "bucket1",
+                          'file_path' => blob_data.path})
+      some_new_blob.should_not be_nil
+      some_new_blob.content_length.should_not be_nil
+      some_new_blob.content_length.should eql(24.0)
+      File.delete(blob_data.path)
+    end
+  end
+
+  it "should allow deletion of an existing blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
+            }.should_not raise_error
+    end
+  end
+
+  it "should throw error if you delete a non existing blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
+            }.should raise_error
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/client_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/client_test.rb b/client/tests/client_test.rb
new file mode 100644
index 0000000..b4c1a75
--- /dev/null
+++ b/client/tests/client_test.rb
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'specs/spec_helper'
+
+describe "initializing the client" do
+
+  it "should parse valid API URIs" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.api_host.should eql( API_HOST )
+    client.api_port.should eql( API_PORT.to_i )
+    client.api_path.should eql( API_PATH )
+  end
+
+  it "should discover entry points upon connection" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( "name", "password", entry_point ) do |client|
+        client.entry_points[:hardware_profiles].should eql( "#{API_URL}/hardware_profiles" )
+        client.entry_points[:images].should            eql( "#{API_URL}/images" )
+        client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
+        client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage_volumes" )
+        client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage_snapshots" )
+        client.entry_points[:buckets].should           eql( "#{API_URL}/buckets")
+        client.entry_points[:keys].should              eql( "#{API_URL}/keys")
+      end
+    end
+  end
+
+  it "should provide the current driver name via client" do
+    DeltaCloud.new( "name", "password", API_URL ) do |client|
+      client.driver_name.should eql( 'mock' )
+    end
+  end
+
+  it "should provide the current driver name without client" do
+    DeltaCloud.driver_name( API_URL ).should eql( 'mock' )
+  end
+
+  describe "without a block" do
+    before( :each ) do
+      reload_fixtures
+    end
+    it "should connect without a block" do
+      client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+      client.images.should_not be_nil
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/content_negotiation_tests.rb
----------------------------------------------------------------------
diff --git a/client/tests/content_negotiation_tests.rb b/client/tests/content_negotiation_tests.rb
new file mode 100644
index 0000000..ffd222c
--- /dev/null
+++ b/client/tests/content_negotiation_tests.rb
@@ -0,0 +1,137 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'specs/spec_helper'
+
+def client
+  RestClient::Resource.new(API_URL)
+end
+
+def headers(header)
+  encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
+  { :authorization => "Basic " + encoded_credentials }.merge(header)
+end
+
+describe "return JSON" do
+
+  it 'should return JSON when using application/json, */*' do
+    header_hash = {
+      # FIXME: There is a bug in rack-accept that cause to respond with HTML
+      # to the configuration below.
+      #
+      # 'Accept' => "application/json, */*"
+      'Accept' => "application/json"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/json/
+    end
+  end
+
+  it 'should return JSON when using just application/json' do
+    header_hash = {
+      'Accept' => "application/json"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/json/
+    end
+  end
+
+end
+
+describe "return HTML in different browsers" do
+
+  it "wants XML using format parameter" do
+    client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "raise 406 error on wrong accept" do
+    client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
+      response.code.should == 406
+    end
+  end
+
+  it "wants HTML using format parameter and accept set to XML" do
+    client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+#  FIXME: This return 406 for some reason on GIT sinatra
+#  it "wants a PNG image" do 
+#    client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
+#      response.code.should == 200
+#      response.headers[:content_type].should =~ /^image\/png/
+#    end
+#  end
+
+  it "doesn't have accept header" do
+    client.get('Accept' => '') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "can handle unknown formats" do
+    client.get('Accept' => 'format/unknown') do |response, request, &block|
+      response.code.should == 406
+    end
+  end
+
+  it "wants explicitly XML" do
+    client.get('Accept' => 'application/xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "Internet Explorer" do
+    header_hash = {
+      'Accept' => "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*",
+      'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+  it "Mozilla Firefox" do
+    client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+  it "Opera" do
+    header_hash = { 
+      'Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
+      'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/errors_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/errors_test.rb b/client/tests/errors_test.rb
new file mode 100644
index 0000000..031e3b7
--- /dev/null
+++ b/client/tests/errors_test.rb
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'specs/spec_helper'
+
+describe "server error handler" do
+
+  it_should_behave_like "all resources"
+
+  it 'should capture HTTP 500 error as DeltacloudError' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
+    end
+  end
+
+  it 'should capture HTTP 502 error as ProviderError' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
+    end
+  end
+
+  it 'should capture HTTP 501 error as NotImplemented' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
+    end
+  end
+
+  it 'should capture HTTP 504 error as ProviderTimeout' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
+    end
+  end
+
+end
+
+describe "client error handler" do
+
+  it 'should capture HTTP 404 error as NotFound' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/hardware_profiles_test.rb b/client/tests/hardware_profiles_test.rb
new file mode 100644
index 0000000..59bfae0
--- /dev/null
+++ b/client/tests/hardware_profiles_test.rb
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+require 'specs/spec_helper'
+
+def prop_check(prop, value_class)
+  if prop.present?
+    prop.value.should_not be_nil
+    prop.value.should be_a(value_class)
+  end
+end
+
+describe "hardware_profiles" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all hardware profiles" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        hardware_profiles = client.hardware_profiles
+        hardware_profiles.should_not be_empty
+        hardware_profiles.each do |hwp|
+          hwp.uri.should_not be_nil
+          hwp.uri.should be_a(String)
+          prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
+       end
+      end
+    end
+  end
+
+  it "should allow filtering of hardware_profiles by architecture" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hardware_profiles = client.hardware_profiles( :architecture=>'i386' )
+      hardware_profiles.should_not be_empty
+      hardware_profiles.size.should eql( 2 )
+      hardware_profiles.first.architecture.value.should eql( 'i386' )
+    end
+  end
+
+  it "should allow fetching a hardware_profile by id" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hwp = client.hardware_profile( 'm1-small' )
+      hwp.should_not be_nil
+      hwp.id.should eql( 'm1-small' )
+    end
+  end
+
+  it "should allow fetching different hardware_profiles" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    hwp1 = client.hardware_profile( 'm1-small' )
+    hwp2 = client.hardware_profile( 'm1-large' )
+    hwp1.storage.value.should_not eql(hwp2.storage.value)
+    hwp1.memory.value.should_not eql(hwp2.memory.value)
+  end
+
+  it "should allow fetching a hardware_profile by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hwp = client.fetch_hardware_profile( API_URL + '/hardware_profiles/m1-small' )
+      hwp.should_not be_nil
+      hwp.id.should eql( 'm1-small' )
+    end
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/68e0eb09/client/tests/images_test.rb
----------------------------------------------------------------------
diff --git a/client/tests/images_test.rb b/client/tests/images_test.rb
new file mode 100644
index 0000000..3b209cd
--- /dev/null
+++ b/client/tests/images_test.rb
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+require 'specs/spec_helper'
+
+describe "images" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all images" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        images = client.images
+        images.should_not be_empty
+        images.size.should eql( 3 )
+        images.each do |image|
+          image.uri.should_not be_nil
+          image.uri.should be_a(String)
+          image.description.should_not be_nil
+          image.description.should be_a(String)
+          image.architecture.should_not be_nil
+          image.architecture.should be_a(String)
+          image.owner_id.should_not be_nil
+          image.owner_id.should be_a(String)
+        end
+      end
+    end
+  end
+
+  it "should allow retrieval of my own images" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      images = client.images( :owner_id=>:self )
+      images.should_not be_empty
+      images.size.should eql( 1 )
+      images.each do |image|
+        image.uri.should_not be_nil
+        image.uri.should be_a(String)
+        image.description.should_not be_nil
+        image.description.should be_a(String)
+        image.architecture.should_not be_nil
+        image.architecture.should be_a(String)
+        image.owner_id.should_not be_nil
+        image.owner_id.should be_a(String)
+      end
+    end
+  end
+
+  it "should allow retrieval of a single image by ID" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      image = client.image( 'img1' )
+      image.should_not be_nil
+      image.uri.should eql( API_URL + '/images/img1' )
+      image.id.should eql( 'img1' )
+      image.architecture.should eql( 'x86_64' )
+    end
+  end
+
+  it "should allow retrieval of a single image by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      image = client.fetch_image( API_URL + '/images/img1' )
+      image.should_not be_nil
+      image.uri.should eql( API_URL + '/images/img1' )
+      image.id.should eql( 'img1' )
+      image.architecture.should eql( 'x86_64' )
+    end
+  end
+
+  describe "filtering by architecture" do
+    it "return matching images" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        images = client.images( :architecture=>'x86_64' )
+        images.should_not be_empty
+        images.each do |image|
+          image.architecture.should eql( 'x86_64' )
+        end
+        images = client.images( :architecture=>'i386' )
+        images.should_not be_empty
+        images.each do |image|
+          image.architecture.should eql( 'i386' )
+        end
+      end
+    end
+
+    it "should return an empty array for no matches" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        images = client.images( :architecture=>'8088' )
+        images.should be_empty
+      end
+    end
+  end
+end


Mime
View raw message