1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[compute|ecloud] fix namespace leftovers

This commit is contained in:
geemus 2011-06-20 15:00:48 -07:00
parent 768fcafaa9
commit 436ad75ad7
24 changed files with 76 additions and 73 deletions

View file

@ -1077,7 +1077,7 @@ module Fog
end
def mock_data
Fog::Ecloud::Compute::Mock.data
Fog::Compute::Ecloud::Mock.data
end
def mock_error(expected, status, body='', headers={})

View file

@ -77,7 +77,7 @@ module Fog
end
def nodes
@nodes ||= Fog::Ecloud::Compute::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
@nodes ||= Fog::Compute::Ecloud::Nodes.new( :connection => connection, :href => href + "/nodeServices" )
end
def backup_service_uri

View file

@ -23,8 +23,11 @@ module Fog
def ips
load_unless_loaded!
Fog::Compute::Ecloud::Compute.new( :connection => connection,
:href => links.detect { |link| link[:name] == "IP Addresses" }[:href] )
connection.ips.new
Fog::Compute::Ecloud::Ips.new(
:connection => connection,
:href => links.detect { |link| link[:name] == "IP Addresses" }[:href]
)
end
def rnat=(new_rnat)

View file

@ -8,7 +8,7 @@ module Fog
undef_method :create
model Fog::Ecloud::Compute::Network
model Fog::Compute::Ecloud::Network
attribute :href

View file

@ -9,7 +9,7 @@ module Fog
attribute :href, :aliases => :Href
model Fog::Ecloud::Compute::PublicIp
model Fog::Compute::Ecloud::PublicIp
#get_request :get_public_ip
#vcloud_type "application/vnd.tmrk.ecloud.publicIp+xml"

View file

@ -49,7 +49,7 @@ module Fog
xml.Id service.object_id
xml.Href service.href
xml.Name service.name
if MockDataClasses::MockBackupInternetService === service
if Fog::Ecloud::MockDataClasses::MockBackupInternetService === service
xml.PublicIpAddress "i:nil" => true
else
xml.PublicIpAddress {
@ -65,8 +65,8 @@ module Fog
xml.Description service.description
xml.RedirectURL service.redirect_url
xml.Monitor "i:nil" => true
xml.IsBackupService MockDataClasses::MockBackupInternetService === service
if MockDataClasses::MockPublicIpInternetService === service && service.backup_service
xml.IsBackupService Fog::Ecloud::MockDataClasses::MockBackupInternetService === service
if Fog::Ecloud::MockDataClasses::MockPublicIpInternetService === service && service.backup_service
xml.BackupService do
xml.Href service.backup_service.href
end

View file

@ -13,7 +13,7 @@ describe 'Ecloud' do
describe "with a service that exists" do
it "should return something when indexed with a configured service" do
pending unless Ecloud.available?
Ecloud[:compute].should_not be_nil
Fog::Compute[:ecloud].should_not be_nil
end
end

View file

@ -1,11 +1,11 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::BackupInternetService", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::BackupInternetService", :type => :mock_tmrk_ecloud_model do
subject { @vcloud.vdcs[0].backup_internet_services[0] }
describe :class do
subject { Fog::Ecloud::Compute::BackupInternetService }
subject { Fog::Compute::Ecloud::BackupInternetService }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :id, :protocol, :enabled, :description, :timeout, :redirect_url, :monitor]) }
@ -13,7 +13,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::BackupInternetService.new() }
subject { Fog::Compute::Ecloud::BackupInternetService.new() }
it { should have_all_attributes_be_nil }
end
@ -23,7 +23,7 @@ if Fog.mocking?
let(:composed_service_data) { @vcloud.vdcs[0].backup_internet_services[0].send(:_compose_service_data) }
it { should be_an_instance_of(Fog::Ecloud::Compute::BackupInternetService) }
it { should be_an_instance_of(Fog::Compute::Ecloud::BackupInternetService) }
its(:href) { should == @mock_backup_service.href }
its(:identity) { should == @mock_backup_service.href }

View file

@ -1,7 +1,7 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::InternetServices", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::InternetServices", :type => :mock_tmrk_ecloud_model do
context "as an attribute of a VDC" do
subject { @vcloud.vdcs[0] }
@ -9,7 +9,7 @@ if Fog.mocking?
describe :class do
subject { @vcloud.vdcs[0].backup_internet_services.class }
its(:model) { should == Fog::Ecloud::Compute::BackupInternetService }
its(:model) { should == Fog::Compute::Ecloud::BackupInternetService }
end
describe :backup_internet_services do
@ -17,7 +17,7 @@ if Fog.mocking?
it { should respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::BackupInternetServices) }
it { should be_an_instance_of(Fog::Compute::Ecloud::BackupInternetServices) }
its(:length) { should == 1 }

View file

@ -1,11 +1,11 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::InternetService", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::InternetService", :type => :mock_tmrk_ecloud_model do
subject { @vcloud.vdcs[0].public_ips[0].internet_services[0] }
describe :class do
subject { Fog::Ecloud::Compute::InternetService }
subject { Fog::Compute::Ecloud::InternetService }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :id, :protocol, :port, :enabled, :description, :public_ip, :timeout, :redirect_url, :monitor, :backup_service_data]) }
@ -13,7 +13,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::InternetService.new() }
subject { Fog::Compute::Ecloud::InternetService.new() }
it { should have_all_attributes_be_nil }
end
@ -29,7 +29,7 @@ if Fog.mocking?
let(:composed_public_ip_data) { @vcloud.vdcs[0].public_ips[0].internet_services[0].send(:_compose_ip_data) }
let(:composed_service_data) { @vcloud.vdcs[0].public_ips[0].internet_services[0].send(:_compose_service_data) }
it { should be_an_instance_of(Fog::Ecloud::Compute::InternetService) }
it { should be_an_instance_of(Fog::Compute::Ecloud::InternetService) }
its(:href) { should == @mock_service.href }
its(:identity) { should == @mock_service.href }

View file

@ -1,7 +1,7 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::InternetServices", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::InternetServices", :type => :mock_tmrk_ecloud_model do
context "as an attribute of a VDC" do
subject { @vcloud.vdcs[0] }
@ -9,7 +9,7 @@ if Fog.mocking?
describe :class do
subject { @vcloud.vdcs[0].internet_services.class }
its(:model) { should == Fog::Ecloud::Compute::InternetService }
its(:model) { should == Fog::Compute::Ecloud::InternetService }
end
describe :internet_services do
@ -17,7 +17,7 @@ if Fog.mocking?
it { should respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::InternetServices) }
it { should be_an_instance_of(Fog::Compute::Ecloud::InternetServices) }
its(:length) { should == 4 }

View file

@ -1,18 +1,18 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Ip", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Ip", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
describe :class do
subject { Fog::Ecloud::Compute::Ip }
subject { Fog::Compute::Ecloud::Ip }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :status, :server, :rnat, :id]) }
end
context "with no uri" do
subject { Fog::Ecloud::Compute::Ip.new() }
subject { Fog::Compute::Ecloud::Ip.new() }
it { should have_all_attributes_be_nil }
end
@ -20,7 +20,7 @@ if Fog.mocking?
context "as a collection member" do
subject { @ip = @vcloud.vdcs[0].networks[0].ips[0] }
it { should be_an_instance_of(Fog::Ecloud::Compute::Ip) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Ip) }
its(:name) { should == @mock_data.network_ip_from_href(@ip.href).name }
its(:status) { should == @mock_data.network_ip_from_href(@ip.href).status }

View file

@ -1,21 +1,21 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Ips", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Ips", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
it { should respond_to(:ips) }
describe :class do
subject { @vcloud.vdcs[0].networks[0].ips.class }
its(:model) { should == Fog::Ecloud::Compute::Ip }
its(:model) { should == Fog::Compute::Ecloud::Ip }
end
describe :ips do
subject { @vcloud.vdcs[0].networks[0].ips.reload }
it { should_not respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::Ips) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Ips) }
its(:length) { should == 252 }

View file

@ -1,11 +1,11 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Network", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Network", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
describe :class do
subject { Fog::Ecloud::Compute::Network }
subject { Fog::Compute::Ecloud::Network }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :features, :links, :type, :gateway, :broadcast, :address, :rnat, :extension_href, :network_type, :vlan, :friendly_name]) }
@ -13,7 +13,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::Network.new() }
subject { Fog::Compute::Ecloud::Network.new() }
it { should have_all_attributes_be_nil }
end
@ -21,7 +21,7 @@ if Fog.mocking?
context "as a collection member" do
subject { @vcloud.vdcs[0].networks[0].reload }
it { should be_an_instance_of(Fog::Ecloud::Compute::Network) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Network) }
its(:href) { should == @mock_network.href }
its(:identity) { should == @mock_network.href }

View file

@ -1,21 +1,21 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Networks", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Networks", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
it { should respond_to(:networks) }
describe :class do
subject { @vcloud.networks.class }
its(:model) { should == Fog::Ecloud::Compute::Network }
its(:model) { should == Fog::Compute::Ecloud::Network }
end
describe :networks do
subject { @vcloud.vdcs[0].networks }
it { should_not respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::Networks) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Networks) }
its(:length) { should == 2 }

View file

@ -1,12 +1,12 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Node", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Node", :type => :mock_tmrk_ecloud_model do
subject { @vcloud.vdcs.first.public_ips.first.internet_services.first.nodes.first }
describe :class do
subject { Fog::Ecloud::Compute::Node }
subject { Fog::Compute::Ecloud::Node }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :ip_address, :description, :name, :port, :enabled, :id]) }
@ -14,7 +14,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::Node.new() }
subject { Fog::Compute::Ecloud::Node.new() }
it { should have_all_attributes_be_nil }
end
@ -22,7 +22,7 @@ if Fog.mocking?
context "as a collection member" do
subject { @vcloud.vdcs.first.public_ips.first.internet_services.first.nodes.first.reload }
it { should be_an_instance_of(Fog::Ecloud::Compute::Node) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Node) }
its(:href) { should == @mock_node.href }
its(:identity) { should == @mock_node.href }

View file

@ -1,7 +1,7 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::InternetServices", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::InternetServices", :type => :mock_tmrk_ecloud_model do
context "as an attribute of an internet_service" do
subject { @vcloud.vdcs.first.public_ips.first.internet_services.first }
@ -9,7 +9,7 @@ if Fog.mocking?
describe :class do
subject { @vcloud.vdcs.first.public_ips.first.internet_services.first.nodes.class }
its(:model) { should == Fog::Ecloud::Compute::Node }
its(:model) { should == Fog::Compute::Ecloud::Node }
end
describe :nodes do
@ -17,7 +17,7 @@ if Fog.mocking?
it { should respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::Nodes) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Nodes) }
its(:length) { should == 3 }

View file

@ -1,11 +1,11 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::PublicIp", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::PublicIp", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
describe :class do
subject { Fog::Ecloud::Compute::PublicIp }
subject { Fog::Compute::Ecloud::PublicIp }
it { should have_identity(:href) }
it { should have_only_these_attributes([:name, :id, :href]) }
@ -13,7 +13,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::PublicIp.new() }
subject { Fog::Compute::Ecloud::PublicIp.new() }
it { should have_all_attributes_be_nil }
end
@ -21,7 +21,7 @@ if Fog.mocking?
context "as a collection member" do
subject { @vcloud.vdcs[0].public_ips[0].reload; @vcloud.vdcs[0].public_ips[0] }
it { should be_an_instance_of(Fog::Ecloud::Compute::PublicIp) }
it { should be_an_instance_of(Fog::Compute::Ecloud::PublicIp) }
its(:href) { should == @mock_public_ip.href }
its(:identity) { should == @mock_public_ip.href }

View file

@ -1,21 +1,21 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::PublicIps", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::PublicIps", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
it { should respond_to(:public_ips) }
describe :class do
subject { @vcloud.public_ips.class }
its(:model) { should == Fog::Ecloud::Compute::PublicIp }
its(:model) { should == Fog::Compute::Ecloud::PublicIp }
end
describe :public_ips do
subject { @vcloud.vdcs[0].public_ips }
it { should_not respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::PublicIps) }
it { should be_an_instance_of(Fog::Compute::Ecloud::PublicIps) }
its(:length) { should == 3 }

View file

@ -1,18 +1,18 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Vdc", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Vdc", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
describe :class do
subject { Fog::Ecloud::Compute::Server }
subject { Fog::Compute::Ecloud::Server }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :type, :name, :status, :network_connections, :os, :virtual_hardware, :storage_size, :links]) }
end
context "with no uri" do
subject { Fog::Ecloud::Compute::Server.new() }
subject { Fog::Compute::Ecloud::Server.new() }
it { should have_all_attributes_be_nil }
end

View file

@ -1,13 +1,13 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Vdc", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Vdc", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
it { should respond_to(:get_vdc) }
describe :class do
subject { Fog::Ecloud::Compute::Vdc }
subject { Fog::Compute::Ecloud::Vdc }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :type, :description, :other_links, :compute_capacity, :storage_capacity, :available_networks,
@ -16,7 +16,7 @@ if Fog.mocking?
context "with no uri" do
subject { Fog::Ecloud::Compute::Vdc.new() }
subject { Fog::Compute::Ecloud::Vdc.new() }
it { should have_all_attributes_be_nil }
end
@ -27,7 +27,7 @@ if Fog.mocking?
its(:href) { should == @mock_vdc.href }
its(:identity) { should == @mock_vdc.href }
its(:name) { should == @mock_vdc.name }
its(:public_ips) { should be_an_instance_of(Fog::Ecloud::Compute::PublicIps) }
its(:public_ips) { should be_an_instance_of(Fog::Compute::Ecloud::PublicIps) }
its(:other_links) { should have(4).items }
its(:resource_entities) { should have(3).items }
its(:available_networks) { should have(2).items }

View file

@ -1,21 +1,21 @@
require 'ecloud/spec_helper'
if Fog.mocking?
describe "Fog::Ecloud::Compute::Vdcs", :type => :mock_tmrk_ecloud_model do
describe "Fog::Compute::Ecloud::Vdcs", :type => :mock_tmrk_ecloud_model do
subject { @vcloud }
it { should respond_to(:vdcs) }
describe :class do
subject { @vcloud.vdcs.class }
its(:model) { should == Fog::Ecloud::Compute::Vdc }
its(:model) { should == Fog::Compute::Ecloud::Vdc }
end
describe :vdcs do
subject { @vcloud.vdcs }
it { should_not respond_to(:create) }
it { should be_an_instance_of(Fog::Ecloud::Compute::Vdcs) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Vdcs) }
its(:length) { should == 2 }

View file

@ -227,8 +227,8 @@ def setup_generic_mock_data
end
def setup_ecloud_mock_data
@base_url = Fog::Ecloud::Compute::Mock.base_url
@mock_data = Fog::Ecloud::Compute::Mock.data
@base_url = Fog::Compute::Ecloud::Mock.base_url
@mock_data = Fog::Compute::Ecloud::Mock.data
setup_generic_mock_data
@mock_vdc_service_collection = @mock_vdc.internet_service_collection
@mock_public_ip_collection = @mock_vdc.public_ip_collection
@ -246,29 +246,29 @@ def setup_ecloud_mock_data
end
def setup_vcloud_mock_data
@base_url = Fog::Ecloud::Compute::Mock.base_url
@mock_data = Fog::Ecloud::Compute::Mock.data
@base_url = Fog::Compute::Ecloud::Mock.base_url
@mock_data = Fog::Compute::Ecloud::Mock.data
setup_generic_mock_data
end
Spec::Runner.configure do |config|
config.after(:all) do
Fog::Ecloud::Compute::Mock.reset
Fog::Compute::Ecloud::Mock.reset
end
config.before(:each, :type => :vcloud_request) do
@vcloud = Fog::Ecloud::Compute.new(Fog.credentials[:vcloud][:ecloud])
@vcloud = Fog::Compute::Ecloud.new(Fog.credentials[:vcloud][:ecloud])
end
config.before(:each, :type => :mock_tmrk_ecloud_request) do
Fog::Ecloud::Compute::Mock.reset
Fog::Compute::Ecloud::Mock.reset
setup_ecloud_mock_data
@vcloud = Fog::Ecloud::Compute.new(:ecloud_username => "foo", :ecloud_password => "bar", :ecloud_versions_uri => "http://fakey.com/api/versions")
@vcloud = Fog::Compute::Ecloud.new(:ecloud_username => "foo", :ecloud_password => "bar", :ecloud_versions_uri => "http://fakey.com/api/versions")
end
config.before(:each, :type => :mock_tmrk_ecloud_model) do
Fog::Ecloud::Compute::Mock.reset
Fog::Compute::Ecloud::Mock.reset
setup_ecloud_mock_data
@vcloud = Fog::Ecloud::Compute.new(:ecloud_username => "foo", :ecloud_password => "bar", :ecloud_versions_uri => "http://fakey.com/api/versions")
@vcloud = Fog::Compute::Ecloud.new(:ecloud_username => "foo", :ecloud_password => "bar", :ecloud_versions_uri => "http://fakey.com/api/versions")
end
end

View file

@ -4,7 +4,7 @@ if Fog.mocking?
describe Fog::Ecloud, :type => :mock_tmrk_ecloud_request do
subject { @vcloud }
it { should be_an_instance_of(Fog::Ecloud::Compute::Mock) }
it { should be_an_instance_of(Fog::Compute::Ecloud::Mock) }
it { should respond_to(:default_organization_uri) }