fog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -8
- data/Gemfile.lock +3 -3
- data/bin/fog +2 -10
- data/fog.gemspec +45 -20
- data/lib/fog.rb +2 -1
- data/lib/fog/attributes.rb +48 -8
- data/lib/fog/aws/ec2.rb +5 -2
- data/lib/fog/aws/elb.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
- data/lib/fog/aws/s3.rb +2 -2
- data/lib/fog/aws/simpledb.rb +15 -3
- data/lib/fog/bin.rb +11 -2
- data/lib/fog/bluebox.rb +5 -1
- data/lib/fog/connection.rb +9 -1
- data/lib/fog/credentials.rb +3 -0
- data/lib/fog/new_servers.rb +89 -0
- data/lib/fog/new_servers/bin.rb +30 -0
- data/lib/fog/new_servers/requests/add_server.rb +39 -0
- data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
- data/lib/fog/new_servers/requests/get_server.rb +42 -0
- data/lib/fog/new_servers/requests/list_images.rb +33 -0
- data/lib/fog/new_servers/requests/list_plans.rb +36 -0
- data/lib/fog/new_servers/requests/list_servers.rb +43 -0
- data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
- data/lib/fog/parser.rb +6 -0
- data/lib/fog/rackspace/files.rb +8 -2
- data/lib/fog/rackspace/models/servers/server.rb +5 -0
- data/lib/fog/rackspace/servers.rb +5 -1
- data/lib/fog/service.rb +6 -1
- data/lib/fog/slicehost.rb +5 -1
- data/lib/fog/terremark/ecloud.rb +1 -0
- data/lib/fog/terremark/shared.rb +4 -1
- data/lib/fog/terremark/vcloud.rb +1 -0
- data/lib/fog/vcloud.rb +150 -141
- data/lib/fog/vcloud/bin.rb +2 -2
- data/lib/fog/vcloud/collection.rb +3 -84
- data/lib/fog/vcloud/extension.rb +44 -0
- data/lib/fog/vcloud/generators.rb +33 -0
- data/lib/fog/vcloud/model.rb +5 -38
- data/lib/fog/vcloud/models/vdc.rb +14 -24
- data/lib/fog/vcloud/models/vdcs.rb +13 -8
- data/lib/fog/vcloud/requests/get_network.rb +4 -11
- data/lib/fog/vcloud/requests/get_organization.rb +4 -11
- data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
- data/lib/fog/vcloud/requests/get_versions.rb +4 -13
- data/lib/fog/vcloud/requests/login.rb +4 -4
- data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
- data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
- data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
- data/spec/vcloud/bin_spec.rb +2 -2
- data/spec/vcloud/models/vdc_spec.rb +35 -29
- data/spec/vcloud/requests/get_network_spec.rb +32 -43
- data/spec/vcloud/requests/get_organization_spec.rb +45 -38
- data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
- data/spec/vcloud/requests/get_versions_spec.rb +17 -17
- data/spec/vcloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/spec_helper.rb +137 -46
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
- data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
- data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
- data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/vcloud_spec.rb +9 -8
- metadata +62 -26
- data/lib/fog/vcloud/parser.rb +0 -42
- data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
- data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
- data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
- data/lib/fog/vcloud/parsers/login.rb +0 -36
- data/lib/fog/vcloud/parsers/network.rb +0 -53
- data/lib/fog/vcloud/terremark/all.rb +0 -9
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
- data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
- data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
@@ -18,6 +18,24 @@ describe 'SimpleDB.put_attributes' do
|
|
18
18
|
actual.body['BoxUsage'].should be_a(Float)
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'conditional put should succeed' do
|
22
|
+
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '1' })
|
23
|
+
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
24
|
+
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '3' }, :expect => { 'version' => '2' }, :replace => ['version'])
|
25
|
+
actual.body['RequestId'].should be_a(String)
|
26
|
+
actual.body['BoxUsage'].should be_a(Float)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'conditional put should raise Conflict error' do
|
30
|
+
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :replace => ['version'])
|
31
|
+
actual.body['RequestId'].should be_a(String)
|
32
|
+
actual.body['BoxUsage'].should be_a(Float)
|
33
|
+
|
34
|
+
lambda {
|
35
|
+
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
36
|
+
}.should raise_error(Excon::Errors::Conflict)
|
37
|
+
end
|
38
|
+
|
21
39
|
end
|
22
40
|
describe 'failure' do
|
23
41
|
|
data/spec/vcloud/bin_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe Vcloud do
|
4
4
|
it { should be_initialized }
|
5
5
|
|
6
|
-
it { should have(
|
6
|
+
it { should have(3).services }
|
7
7
|
|
8
8
|
describe "#registered_services" do
|
9
9
|
subject { Vcloud.registered_services }
|
10
10
|
|
11
|
-
it { should == ":ecloud, :vcloud" }
|
11
|
+
it { should == ":ecloud, :etest, :vcloud" }
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "when indexing it like an array" do
|
@@ -1,46 +1,52 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe "Fog::Vcloud::Vdc", :type => :mock_vcloud_model do
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
describe :class do
|
7
|
+
subject { Fog::Vcloud::Vdc }
|
7
8
|
|
8
|
-
|
9
|
+
it { should have_identity :href }
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
it { should have_only_these_attributes [:href, :name, :type, :description, :other_links, :compute_capacity, :storage_capacity, :available_networks,
|
12
|
+
:resource_entities, :enabled, :vm_quota, :nic_quota, :network_quota, :allocation_model] }
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
+
context "with no uri" do
|
15
16
|
|
16
|
-
|
17
|
+
subject { Fog::Vcloud::Vdc.new() }
|
17
18
|
|
18
|
-
|
19
|
-
its(:identity) { should be_nil }
|
20
|
-
end
|
19
|
+
it { should have_all_attributes_be_nil }
|
21
20
|
|
22
|
-
|
23
|
-
subject { @vcloud.vdcs[0] }
|
21
|
+
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
its(:name) { should == @mock_vdc[:name] }
|
28
|
-
its(:other_links) { should have(7).items }
|
29
|
-
its(:resource_entity_links) { should have(3).items }
|
30
|
-
its(:network_links) { should have(2).items }
|
23
|
+
context "as a collection member" do
|
24
|
+
subject { @vcloud.vdcs[0].reload; @vcloud.vdcs[0] }
|
31
25
|
|
32
|
-
|
33
|
-
its(:memory_capacity) { should == Struct::VcloudXCapacity.new('MB',@mock_vdc[:memory][:allocated], nil, @mock_vdc[:memory][:allocated]) }
|
34
|
-
its(:storage_capacity) { should == Struct::VcloudXCapacity.new('MB',@mock_vdc[:storage][:allocated], nil, @mock_vdc[:storage][:allocated]) }
|
26
|
+
it { should be_an_instance_of Fog::Vcloud::Vdc }
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
its(:href) { should == @mock_vdc[:href] }
|
29
|
+
its(:identity) { should == @mock_vdc[:href] }
|
30
|
+
its(:name) { should == @mock_vdc[:name] }
|
31
|
+
its(:other_links) { should have(7).items }
|
32
|
+
its(:resource_entities) { should have(3).items }
|
33
|
+
its(:available_networks) { should have(2).items }
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
its(:compute_capacity) { should be_an_instance_of Hash }
|
36
|
+
its(:compute_capacity) { should == {:Cpu =>
|
37
|
+
{:Units => "Mhz", :Allocated => @mock_vdc[:cpu][:allocated], :Limit => @mock_vdc[:cpu][:allocated]},
|
38
|
+
:Memory =>
|
39
|
+
{:Units => "MB", :Allocated => @mock_vdc[:memory][:allocated], :Limit => @mock_vdc[:memory][:allocated]}} }
|
40
|
+
its(:storage_capacity) { should be_an_instance_of Hash }
|
41
|
+
its(:storage_capacity) { should == {:Limit => @mock_vdc[:storage][:allocated], :Units=>"MB", :Allocated => @mock_vdc[:storage][:allocated]} }
|
43
42
|
|
43
|
+
its(:vm_quota) { should == "0" }
|
44
|
+
its(:nic_quota) { should == "0" }
|
45
|
+
its(:network_quota) { should == "0" }
|
44
46
|
|
47
|
+
its(:enabled) { should == "true" }
|
45
48
|
|
49
|
+
end
|
50
|
+
end
|
51
|
+
else
|
46
52
|
end
|
@@ -1,55 +1,44 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_network }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
describe :get_network, :type => :vcloud_request do
|
10
|
+
context "with a valid network uri" do
|
11
|
+
before { @network = @vcloud.get_network(URI.parse(@mock_network[:href])) }
|
12
|
+
subject { @network }
|
12
13
|
|
13
|
-
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.network+xml" }
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
describe :body do
|
18
|
+
subject { @network.body }
|
17
19
|
|
18
|
-
|
19
|
-
let(:header) { @network.headers["Content-Type"] }
|
20
|
-
specify { header.should == "application/vnd.vmware.vcloud.network+xml" }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe :body do
|
24
|
-
subject { @network.body }
|
25
|
-
|
26
|
-
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
27
|
-
|
28
|
-
its(:configuration) { should be_an_instance_of Struct::VcloudNetworkConfiguration }
|
29
|
-
its(:features) { should be_an_instance_of Array }
|
30
|
-
its(:href) { should == URI.parse("https://fakey.com/api/v0.8/network/31") }
|
31
|
-
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
32
|
-
its(:name) { should == @mock_network[:name] }
|
33
|
-
its(:description) { should == @mock_network[:name] }
|
34
|
-
|
35
|
-
describe :configuration do
|
36
|
-
subject { @network.body.configuration }
|
37
|
-
|
38
|
-
its(:gateway) { should == "1.2.3.1" }
|
39
|
-
its(:netmask) { should == "255.255.255.0" }
|
40
|
-
its(:dns) { should == "8.8.8.8" }
|
41
|
-
end
|
20
|
+
it { should have(9).keys }
|
42
21
|
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
23
|
+
it { should have_key_with_value :type, "application/vnd.vmware.vcloud.network+xml" }
|
24
|
+
it { should have_key_with_value :Features, "" }
|
25
|
+
it { should have_key_with_value :Description, @mock_network[:name] }
|
26
|
+
it { should have_key_with_value :href, @mock_network[:href] }
|
27
|
+
it { should have_key_with_value :name, @mock_network[:name] }
|
28
|
+
it { should have_key_with_value :Configuration, {:Gateway => @mock_network[:gateway],
|
29
|
+
:Netmask => @mock_network[:netmask],
|
30
|
+
:Dns => @mock_network[:dns] } }
|
46
31
|
end
|
47
|
-
|
48
32
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
33
|
+
context "with a network uri that doesn't exist" do
|
34
|
+
subject { lambda { @vcloud.get_network(URI.parse('https://www.fakey.com/api/v0.8/network/999')) } }
|
35
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
36
|
+
end
|
53
37
|
end
|
54
38
|
end
|
39
|
+
else
|
40
|
+
|
41
|
+
describe Fog::Vcloud, :type => :vcloud_request do
|
42
|
+
end
|
43
|
+
|
55
44
|
end
|
@@ -1,46 +1,53 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
5
|
+
subject { @vcloud }
|
6
|
+
|
7
|
+
it { should respond_to :get_organization }
|
8
|
+
|
9
|
+
describe "#get_organization" do
|
10
|
+
context "with a valid organization uri" do
|
11
|
+
before { @organization = @vcloud.get_organization(@vcloud.default_organization_uri) }
|
12
|
+
subject { @organization }
|
13
|
+
|
14
|
+
it_should_behave_like "all responses"
|
15
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.org+xml" }
|
16
|
+
|
17
|
+
describe "#body" do
|
18
|
+
subject { @organization.body }
|
19
|
+
|
20
|
+
|
21
|
+
let(:links) { subject[:Link] }
|
22
|
+
|
23
|
+
it { should have(6).keys }
|
24
|
+
|
25
|
+
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
26
|
+
it { should have_key_with_value :href, @mock_organization[:info][:href] }
|
27
|
+
it { should have_key_with_value :name, @mock_organization[:info][:name] }
|
28
|
+
it { should have_key_with_array :Link, @mock_organization[:vdcs].map { |vdc|
|
29
|
+
[{ :type => "application/vnd.vmware.vcloud.vdc+xml",
|
30
|
+
:href => vdc[:href],
|
31
|
+
:name => vdc[:name],
|
32
|
+
:rel => "down" },
|
33
|
+
{ :type => "application/vnd.vmware.vcloud.catalog+xml",
|
34
|
+
:href => vdc[:href] + "/catalog",
|
35
|
+
:name => vdc[:name] + " Catalog",
|
36
|
+
:rel => "down" },
|
37
|
+
{ :type => "application/vnd.vmware.vcloud.tasksList+xml",
|
38
|
+
:href => vdc[:href] + "/tasksList",
|
39
|
+
:name => vdc[:name] + " Tasks List",
|
40
|
+
:rel => "down" }]
|
41
|
+
}.flatten }
|
42
|
+
|
43
|
+
end
|
21
44
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
27
|
-
|
28
|
-
its(:links) { should have(@mock_organization[:vdcs].length * 3).links }
|
29
|
-
its(:name) { should == @mock_organization[:info][:name] }
|
30
|
-
its(:href) { should == URI.parse(@mock_organization[:info][:href]) }
|
31
|
-
|
32
|
-
let(:link) { subject.links[0] }
|
33
|
-
specify { link.should be_an_instance_of Struct::VcloudLink }
|
34
|
-
specify { link.rel.should == "down" }
|
35
|
-
specify { link.href.should == URI.parse(@mock_vdc[:href]) }
|
36
|
-
specify { link.type.should == "application/vnd.vmware.vcloud.vdc+xml" }
|
37
|
-
specify { link.name.should == @mock_vdc[:name] }
|
45
|
+
context "with an organization uri that doesn't exist" do
|
46
|
+
subject { lambda { @vcloud.get_organization(URI.parse('https://www.fakey.com/api/v0.8/org/999')) } }
|
47
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
38
48
|
end
|
39
49
|
end
|
40
|
-
context "with an organization uri that doesn't exist" do
|
41
|
-
subject { lambda { @vcloud.get_organization(URI.parse('https://www.fakey.com/api/v0.8/org/999')) } }
|
42
|
-
it_should_behave_like "a request for a resource that doesn't exist"
|
43
|
-
end
|
44
50
|
end
|
51
|
+
else
|
45
52
|
end
|
46
53
|
|
@@ -1,53 +1,63 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
3
|
#
|
4
4
|
# WARNING: INCOMPLETE
|
5
5
|
#
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
if Fog.mocking?
|
8
|
+
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
9
|
+
subject { @vcloud }
|
9
10
|
|
10
|
-
|
11
|
+
it { should respond_to :get_vdc }
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
describe :get_vdc, :type => :vcloud_request do
|
14
|
+
context "with a valid vdc uri" do
|
15
|
+
before { @vdc = @vcloud.get_vdc(URI.parse(@mock_vdc[:href])) }
|
16
|
+
subject { @vdc }
|
16
17
|
|
17
|
-
|
18
|
+
it_should_behave_like "all responses"
|
19
|
+
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.vdc+xml" }
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
describe :body do
|
22
|
+
subject { @vdc.body }
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
it { should have(16).items }
|
25
|
+
|
26
|
+
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
27
|
+
|
28
|
+
its(:name) { should == @mock_vdc[:name] }
|
29
|
+
its(:href) { should == @mock_vdc[:href] }
|
30
|
+
its(:VmQuota) { should == "0" }
|
31
|
+
its(:Description) { should == @mock_vdc[:name] + " VDC" }
|
32
|
+
its(:NicQuota) { should == "0" }
|
33
|
+
its(:IsEnabled) { should == "true" }
|
34
|
+
its(:NetworkQuota) { should == "0" }
|
35
|
+
its(:AllocationModel) { should == "AllocationPool" }
|
36
|
+
its(:Link) { should have(7).links }
|
37
|
+
its(:ResourceEntities) { should have(1).resource }
|
26
38
|
|
27
|
-
|
28
|
-
|
39
|
+
let(:resource_entities) { subject[:ResourceEntities][:ResourceEntity] }
|
40
|
+
specify { resource_entities.should have(3).vapps }
|
41
|
+
#FIXME: test for the resources
|
29
42
|
|
30
|
-
|
43
|
+
its(:ComputeCapacity) { should == {:Memory => { :Units => "MB", :Allocated => @mock_vdc[:memory][:allocated], :Limit => @mock_vdc[:memory][:allocated] },
|
44
|
+
:Cpu => { :Units => "Mhz", :Allocated => @mock_vdc[:cpu][:allocated], :Limit => @mock_vdc[:cpu][:allocated] } } }
|
31
45
|
|
32
|
-
|
33
|
-
its(:resource_entities) { should have(3).links }
|
34
|
-
its(:networks) { should have(2).networks }
|
46
|
+
its(:StorageCapacity) { should == {:Units => "MB", :Allocated => @mock_vdc[:storage][:allocated], :Limit => @mock_vdc[:storage][:allocated] } }
|
35
47
|
|
36
|
-
|
37
|
-
|
48
|
+
let(:available_networks) { subject[:AvailableNetworks][:Network] }
|
49
|
+
specify { available_networks.should have(2).networks }
|
50
|
+
#FIXME :test the available networks
|
38
51
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
52
|
+
end
|
53
|
+
end
|
54
|
+
context "with a vdc uri that doesn't exist" do
|
55
|
+
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
56
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
44
57
|
end
|
45
|
-
end
|
46
|
-
context "with a vdc uri that doesn't exist" do
|
47
|
-
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
48
|
-
it_should_behave_like "a request for a resource that doesn't exist"
|
49
58
|
end
|
50
59
|
end
|
60
|
+
else
|
51
61
|
end
|
52
62
|
|
53
63
|
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it { should respond_to :get_versions }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
describe "#get_versions" do
|
10
|
+
before { @versions = @vcloud.get_versions( @vcloud.versions_uri ) }
|
11
|
+
subject { @versions }
|
11
12
|
|
12
|
-
|
13
|
+
it_should_behave_like "all responses"
|
13
14
|
|
14
|
-
|
15
|
+
describe "body" do
|
16
|
+
subject { @versions.body }
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
subject { version }
|
18
|
+
it { should have(4).keys }
|
19
|
+
it_should_behave_like "it has the standard xmlns attributes" # 2 keys
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
its(:version) { should == @mock_version[:version] }
|
23
|
-
|
24
|
-
its(:supported) { should == @mock_version[:supported] }
|
21
|
+
its(:xmlns) { should == "http://www.vmware.com/vcloud/versions" }
|
22
|
+
its(:VersionInfo) { should == { :LoginUrl => @mock_version[:login_url] , :Version => @mock_version[:version] } }
|
25
23
|
|
24
|
+
end
|
26
25
|
end
|
27
26
|
end
|
27
|
+
else
|
28
28
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
-
require 'spec_helper'
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if Fog.mocking?
|
4
|
+
describe Fog::Vcloud, :type => :mock_vcloud_request do
|
5
|
+
subject { @vcloud }
|
5
6
|
|
6
|
-
|
7
|
+
it_should_behave_like "all login requests"
|
8
|
+
end
|
9
|
+
else
|
7
10
|
end
|
8
11
|
|