vcloud-core 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +1 -1
  2. data/CHANGELOG.md +12 -0
  3. data/lib/vcloud/core.rb +2 -1
  4. data/lib/vcloud/core/api_interface.rb +35 -0
  5. data/lib/vcloud/core/compute_metadata.rb +1 -1
  6. data/lib/vcloud/core/edge_gateway.rb +2 -2
  7. data/lib/vcloud/core/fog.rb +40 -0
  8. data/lib/vcloud/core/fog/fog_constants.rb +35 -0
  9. data/lib/vcloud/core/fog/login.rb +40 -0
  10. data/lib/vcloud/core/fog/model_interface.rb +41 -0
  11. data/lib/vcloud/core/fog/service_interface.rb +253 -0
  12. data/lib/vcloud/core/login_cli.rb +1 -1
  13. data/lib/vcloud/core/metadata_helper.rb +1 -1
  14. data/lib/vcloud/core/org_vdc_network.rb +3 -3
  15. data/lib/vcloud/core/query_runner.rb +1 -1
  16. data/lib/vcloud/core/vapp.rb +6 -6
  17. data/lib/vcloud/core/vapp_template.rb +1 -1
  18. data/lib/vcloud/core/vdc.rb +1 -1
  19. data/lib/vcloud/core/version.rb +1 -1
  20. data/lib/vcloud/core/vm.rb +9 -9
  21. data/lib/vcloud/fog.rb +2 -39
  22. data/lib/vcloud/temporary_fog_classes.rb +11 -0
  23. data/spec/integration/{fog → core/fog}/login_manual.rb +1 -1
  24. data/spec/integration/{fog → core/fog}/login_spec.rb +13 -9
  25. data/spec/integration/core/vm_spec.rb +1 -1
  26. data/spec/support/integration_helper.rb +1 -1
  27. data/spec/vcloud/core/edge_gateway_spec.rb +1 -1
  28. data/spec/vcloud/{fog → core/fog}/fog_model_interface_spec.rb +2 -2
  29. data/spec/vcloud/{fog → core/fog}/login_spec.rb +4 -4
  30. data/spec/vcloud/core/fog/service_interface_spec.rb +53 -0
  31. data/spec/vcloud/{fog_spec.rb → core/fog_spec.rb} +2 -2
  32. data/spec/vcloud/core/login_cli_spec.rb +6 -6
  33. data/spec/vcloud/core/org_vdc_network_spec.rb +1 -1
  34. data/spec/vcloud/core/query_runner_spec.rb +1 -1
  35. data/spec/vcloud/core/vapp_spec.rb +1 -1
  36. data/spec/vcloud/core/vapp_template_spec.rb +1 -1
  37. data/spec/vcloud/core/vdc_spec.rb +1 -1
  38. data/spec/vcloud/core/vm_spec.rb +1 -1
  39. metadata +22 -21
  40. data/jenkins_integration_tests.sh +0 -5
  41. data/lib/vcloud/fog/content_types.rb +0 -18
  42. data/lib/vcloud/fog/login.rb +0 -38
  43. data/lib/vcloud/fog/model_interface.rb +0 -33
  44. data/lib/vcloud/fog/relation.rb +0 -8
  45. data/lib/vcloud/fog/service_interface.rb +0 -245
  46. data/spec/vcloud/fog/service_interface_spec.rb +0 -51
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Vcloud
4
- module Fog
5
- describe ServiceInterface do
6
-
7
- FOG_SESSION_RESPONSE = {:xmlns => 'http://www.vmware.com/vcloud/v5.1', :xmlns_xsi => 'http://www.w3.org/2001/XMLSchema-instance', :user => 'me@dexample.com', :org => 'my_org', :type => 'application/vnd.vmware.vcloud.session+xml', :href => 'https://example.org/api/session/', :xsi_schemaLocation => 'http://www.vmware.com/vcloud/v5.1 http://example.org/api/v5.1/schema/master.xsd', :Link => [{:rel => 'down', :type => 'application/vnd.vmware.vcloud.orgList+xml', :href => 'https://example.com/api/org/'}, {:rel => 'down', :type => 'application/vnd.vmware.admin.vcloud+xml', :href => 'https://example.com/api/admin/'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.org+xml', :name => 'vdc_name', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.query.queryList+xml', :href => 'https://example.com/api/query'}, {:rel => 'entityResolver', :type => 'application/vnd.vmware.vcloud.entity+xml', :href => 'https://example.com/api/entity/'}, {:rel => 'down:extensibility', :type => 'application/vnd.vmware.vcloud.apiextensibility+xml', :href => 'https://example.com/api/extensibility'}]}
8
- FOG_ORGANIZATION_RESPONSE = {:xmlns => 'http://www.vmware.com/vcloud/v5.1', :xmlns_xsi => 'http://www.w3.org/2001/XMLSchema-instance', :name => 'org_name', :id => 'urn:vcloud:org:0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0', :type => 'application/vnd.vmware.vcloud.org+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0', :xsi_schemaLocation => 'http://www.vmware.com/vcloud/v1.5 http://example.com/api/v1.5/schema/master.xsd', :Link => [{:rel => 'down', :type => 'application/vnd.vmware.vcloud.vdc+xml', :name => 'vdc_name', :href => 'https://example.com/api/vdc/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.tasksList+xml', :href => 'https://example.com/api/tasksList/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.catalog+xml', :name => 'Appliances', :href => 'https://example.com/api/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.controlAccess+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0X/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/controlAccess/'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.catalog+xml', :name => 'Public Catalog', :href => 'https://example.com/api/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.controlAccess+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/controlAccess/'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.catalog+xml', :name => 'walker-ci', :href => 'https://example.com/api/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.controlAccess+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/controlAccess/'}, {:rel => 'controlAccess', :type => 'application/vnd.vmware.vcloud.controlAccess+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/action/controlAccess'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.catalog+xml', :name => 'Images', :href => 'https://example.com/api/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.controlAccess+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/catalog/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/controlAccess/'}, {:rel => 'add', :type => 'application/vnd.vmware.admin.catalog+xml', :href => 'https://example.com/api/admin/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/catalogs'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.orgNetwork+xml', :name => 'walker-ci-network', :href => 'https://example.com/api/network/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.orgNetwork+xml', :name => 'backend', :href => 'https://example.com/api/network/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.supportedSystemsInfo+xml', :href => 'https://example.com/api/supportedSystemsInfo/'}, {:rel => 'down', :type => 'application/vnd.vmware.vcloud.metadata+xml', :href => 'https://example.com/api/org/0a0a0a0-0a0a0-0a0a-0a0a-0a0a0a0a0a0/metadata'}], :Description => 'Added description', :FullName => 'GDS CI Tools', :Tasks => {:Task => []}}
9
-
10
- it 'should raise a exception if named vdc not found in the data returned' do
11
-
12
- fog_facade = double(:FogFacade)
13
- expect(fog_facade).to receive(:session) { FOG_SESSION_RESPONSE }
14
- expect(fog_facade).to receive(:get_organization) { FOG_ORGANIZATION_RESPONSE }
15
-
16
- service_interface = ServiceInterface.new(fog_facade)
17
-
18
- expect { service_interface.vdc('DoesNotExist') }.to raise_exception(RuntimeError, 'vdc DoesNotExist cannot be found')
19
- end
20
-
21
- context 'configure edge gateway' do
22
- before(:each) do
23
- @config = { :Blah => 'TestData' }
24
- @vcloud = double(:vcloud)
25
- expect(::Fog::Compute::VcloudDirector).to receive(:new).and_return(@vcloud)
26
- end
27
-
28
- it "should configure firewall for given edge gateway id" do
29
- task = double(:task)
30
- expect(Vcloud::Core::logger).to receive(:info).with("Updating EdgeGateway 1234")
31
- expect(@vcloud).to receive(:post_configure_edge_gateway_services).with("1234", @config).
32
- and_return(double(:response, :body => task ))
33
- expect(@vcloud).to receive(:process_task).with(task)
34
-
35
- ServiceInterface.new.post_configure_edge_gateway_services "1234", @config
36
- end
37
-
38
-
39
- it "should log and return exceptions without swallowing" do
40
- expect(Vcloud::Core::logger).to receive(:info).with("Updating EdgeGateway 1234")
41
- runtime_error = RuntimeError.new('Test Error')
42
- expect(Vcloud::Core::logger).to receive(:error).with("Could not update EdgeGateway 1234 : #{runtime_error}")
43
- expect(@vcloud).to receive(:post_configure_edge_gateway_services).with("1234", @config).
44
- and_raise(runtime_error)
45
- expect{ ServiceInterface.new.post_configure_edge_gateway_services("1234", @config) }.to raise_error("Test Error")
46
- end
47
- end
48
-
49
- end
50
- end
51
- end