fog-oraclecloud 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/oraclecloud/compute.rb +2 -2
  3. data/lib/fog/oraclecloud/models/java/instance.rb +1 -1
  4. data/lib/fog/oraclecloud/models/soa/instance.rb +77 -13
  5. data/lib/fog/oraclecloud/models/soa/instances.rb +1 -5
  6. data/lib/fog/oraclecloud/models/storage/container.rb +0 -1
  7. data/lib/fog/oraclecloud/requests/compute/delete_orchestration.rb +14 -0
  8. data/lib/fog/oraclecloud/requests/compute/get_orchestration.rb +1 -1
  9. data/lib/fog/oraclecloud/requests/compute/list_orchestrations.rb +12 -0
  10. data/lib/fog/oraclecloud/requests/compute/start_orchestration.rb +17 -0
  11. data/lib/fog/oraclecloud/requests/compute/stop_orchestration.rb +17 -0
  12. data/lib/fog/oraclecloud/requests/database/list_servers.rb +1 -3
  13. data/lib/fog/oraclecloud/requests/soa/create_instance.rb +47 -23
  14. data/lib/fog/oraclecloud/requests/soa/delete_instance.rb +4 -9
  15. data/lib/fog/oraclecloud/requests/soa/get_instance.rb +18 -11
  16. data/lib/fog/oraclecloud/requests/soa/list_instances.rb +13 -0
  17. data/lib/fog/oraclecloud/requests/storage/create_container.rb +21 -1
  18. data/lib/fog/oraclecloud/requests/storage/get_container.rb +39 -0
  19. data/lib/fog/oraclecloud/requests/storage/list_containers.rb +11 -0
  20. data/lib/fog/oraclecloud/soa.rb +25 -8
  21. data/lib/fog/oraclecloud/storage.rb +19 -0
  22. data/lib/fog/oraclecloud/version.rb +1 -1
  23. data/tests/requests/instance_tests.rb +1 -3
  24. data/tests/requests/java_tests.rb +2 -0
  25. data/tests/requests/orchestrations_tests.rb +14 -10
  26. data/tests/requests/soa_tests.rb +40 -27
  27. data/tests/requests/storage_tests.rb +3 -2
  28. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32b8b8181ca0bed560e5723757d0bac2673b6081
4
- data.tar.gz: 1aaf410ec678fd0253c6a9c09601013b5616a854
3
+ metadata.gz: a11352b412e505c91f3fd1de158ef9db2f313fcd
4
+ data.tar.gz: 35d9ba4102908317860f30241269c2540693ab0c
5
5
  SHA512:
6
- metadata.gz: 778a5e2973618d32ea082d203634e641710a574f42149d0878d5285cd736fbcb81dd32183f3f0818b1f69d42d10851b624bbf3444b1abc1ca4a25c1ba8685895
7
- data.tar.gz: 511c3f3598a09467945dd601956bed1f13abe68116bfcf5b8bb8fc10da9a084b8e543889ad03f4e678b6d3806cedfe4f398e4f6148e5806a733733100b6da3b0
6
+ metadata.gz: 0b66f3bcaede8591dc93002757dae47ceea27a138639a63588790065e7979c5b589ccc92ca4614eece50f8ac1a8ddfba0efae5ed35a26d37d38a207a2b4491f4
7
+ data.tar.gz: b586a4be3346e7829c2835e4f26754ac6c4e6eed3924481c2a0ede36943241c26ca001c3a5d3390e56bddf87044eaef2e17cdf961de1aae18960074926949b09
@@ -125,8 +125,8 @@ module Fog
125
125
  }), &block)
126
126
  rescue Excon::Errors::HTTPStatusError => error
127
127
  raise case error
128
- #when Excon::Errors::NotFound
129
- #Fog::Oracle::Java::NotFound.slurp(error)
128
+ when Excon::Errors::NotFound
129
+ Fog::Compute::OracleCloud::NotFound.slurp(error)
130
130
  when Excon::Errors::Conflict
131
131
  data = Fog::JSON.decode(error.response.body)
132
132
  raise Error.new(data['message'])
@@ -179,7 +179,7 @@ module Fog
179
179
  private
180
180
 
181
181
  def create
182
- requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password
182
+ requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password, :admin_username
183
183
 
184
184
  #data = service.create_instance(service_name, cloud_storage_container, cloud_storage_user, cloud_storage_password, dba_name, dba_password, db_servicename, shape, version, vm_public_key,
185
185
  # :level => level,
@@ -4,9 +4,8 @@ module Fog
4
4
  module OracleCloud
5
5
  class SOA
6
6
  class Instance < Fog::Model
7
- identity :service_name
7
+ identity :service_name, :aliases=>'serviceName'
8
8
 
9
- attribute :service_name
10
9
  attribute :service_type
11
10
  attribute :resource_count
12
11
  attribute :status
@@ -18,22 +17,55 @@ module Fog
18
17
  attribute :created_by
19
18
  attribute :service_uri
20
19
  attribute :provisioning_progress
20
+ attribute :db_service_name, :aliases=>'dbServiceName'
21
+ attribute :num_nodes, :aliases=>'managedServerCount'
22
+ attribute :shape
23
+ attribute :version
24
+ attribute :ssh_key, :aliases=>'vmPublicKey'
21
25
 
22
26
  # The following are only used to create an instance and are not returned in the list action
23
- attribute :cloudStorageContainer
24
- attribute :cloudStorageUser
25
- attribute :cloudStoragePassword
27
+ attribute :cloud_storage_container, :aliases=>'cloudStorageContainer'
28
+ attribute :cloud_storage_user, :aliases=>'cloudStorageUser'
29
+ attribute :cloud_storage_pwd, :aliases=>'cloudStoragePassword'
26
30
  attribute :level
27
- attribute :subscriptionType
31
+ attribute :subscription_type, :aliases=>'subscriptionType'
28
32
  attribute :topology
29
- attribute :parameters
33
+ attribute :admin_username, :aliases=>'adminUserName'
34
+ attribute :admin_password, :aliases=>'adminPassword'
35
+ attribute :dba_name, :aliases=>'dbaName'
36
+ attribute :dba_password, :aliases=>'dbaPassword'
37
+ attribute :provision_otd, :aliases=>'provisionOtd'
30
38
 
31
39
  # The following are used to delete an instance and are not returned in the list action
32
- attribute :dba_name
33
40
  attribute :dba_password
34
41
  attribute :force_delete
35
42
  attribute :skip_backup
36
43
 
44
+ def topology=(value)
45
+ if %w(osb soa soaosb b2b mft apim insight).include? value then
46
+ attributes[:topology]=value
47
+ else
48
+ raise ArgumentError, "Invalid topology. Valid values - osb, soa, soaosb, b2b, mft, apim, insight"
49
+ end
50
+ end
51
+
52
+ def num_nodes=(value)
53
+ if value.nil? then value = 1 end
54
+ if [1, 2, 4].include? value.to_i then
55
+ attributes[:num_nodes] = value.to_i
56
+ else
57
+ raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2 or 4"
58
+ end
59
+ end
60
+
61
+ def shape=(value)
62
+ if %w( oc1m oc2m oc3m oc4m oc5m).include? value then
63
+ attributes[:shape]=value
64
+ else
65
+ raise ArgumentError, "Invalid Shape. Valid values - oc1m, oc2m, oc3m, oc4m or oc5m"
66
+ end
67
+ end
68
+
37
69
  def save
38
70
  #identity ? update : create
39
71
  create
@@ -43,6 +75,14 @@ module Fog
43
75
  status == "Running"
44
76
  end
45
77
 
78
+ def stopping?
79
+ status == 'Maintenance' || status == 'Terminating'
80
+ end
81
+
82
+ def stopped?
83
+ status == 'Stopped'
84
+ end
85
+
46
86
  def destroy
47
87
  requires :service_name, :dba_name, :dba_password
48
88
  service.delete_instance(service_name, dba_name, dba_password,
@@ -53,11 +93,35 @@ module Fog
53
93
  private
54
94
 
55
95
  def create
56
- requires :service_name, :topology, :cloudStorageContainer, :cloudStorageUser, :cloudStoragePassword, :parameters
57
- data = service.create_instance(service_name, topology, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, parameters,
58
- :level => level,
59
- :subscriptionType => subscriptionType,
60
- :description => description)
96
+ requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password, :admin_username, :cloud_storage_container, :topology
97
+
98
+ stor_user = cloud_storage_user || service.username
99
+ stor_pwd = cloud_storage_pwd || service.password
100
+
101
+ params = {
102
+ :serviceName => service_name,
103
+ :cloudStorageContainer => cloud_storage_container,
104
+ :cloudStoragePassword => cloud_storage_pwd,
105
+ :cloudStorageUser => cloud_storage_user,
106
+ :description => description,
107
+ :provisionOTD => provision_otd.nil? ? true : provision_otd,
108
+ :subscriptionType => 'MONTHLY',
109
+ :level => 'PAAS',
110
+ :topology => topology
111
+ }
112
+ options = {
113
+ :adminPassword => admin_password,
114
+ :adminUserName => admin_username,
115
+ :dbaName => dba_name,
116
+ :dbaPassword => dba_password,
117
+ :dbServiceName => db_service_name,
118
+ :managedServerCount => num_nodes || 1,
119
+ :shape => shape,
120
+ :VMsPublicKey => ssh_key,
121
+ :version => version
122
+ }
123
+
124
+ data = service.create_instance(params, options)
61
125
  end
62
126
  end
63
127
  end
@@ -13,11 +13,7 @@ module Fog
13
13
  end
14
14
 
15
15
  def get(id)
16
- begin
17
- new(service.get_instance(id).body)
18
- rescue Fog::OracleCloud::SOA::NotFound
19
- nil
20
- end
16
+ new(service.get_instance(id).body)
21
17
  end
22
18
  end
23
19
  end
@@ -19,7 +19,6 @@ module Fog
19
19
  def save
20
20
  requires :name
21
21
  data = service.create_container(name)
22
- pp data
23
22
  merge_attributes(data.headers)
24
23
  end
25
24
 
@@ -17,6 +17,20 @@ module Fog
17
17
  )
18
18
  end
19
19
  end
20
+
21
+ class Mock
22
+ def delete_orchestration (name)
23
+ response = Excon::Response.new
24
+ clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
25
+ if self.data[:orchestrations][clean_name]
26
+ self.data[:orchestrations].delete(clean_name)
27
+ response.status = 204
28
+ response
29
+ else
30
+ raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
31
+ end
32
+ end
33
+ end
20
34
  end
21
35
  end
22
36
  end
@@ -29,7 +29,7 @@ module Fog
29
29
  response.status = 200
30
30
  response.body = instance
31
31
  response
32
- else;
32
+ else
33
33
  raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
34
34
  end
35
35
  end
@@ -11,6 +11,18 @@ module Fog
11
11
  response
12
12
  end
13
13
  end
14
+
15
+ class Mock
16
+ def list_orchestrations
17
+ response = Excon::Response.new
18
+
19
+ orchs = self.data[:orchestrations].values
20
+ response.body = {
21
+ 'result' => orchs
22
+ }
23
+ response
24
+ end
25
+ end
14
26
  end
15
27
  end
16
28
  end
@@ -17,6 +17,23 @@ module Fog
17
17
  )
18
18
  end
19
19
  end
20
+
21
+ class Mock
22
+ def start_orchestration (name)
23
+ response = Excon::Response.new
24
+ clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
25
+
26
+ if self.data[:orchestrations][clean_name]
27
+ self.data[:orchestrations][clean_name]['status'] = 'running'
28
+ instance = self.data[:orchestrations][clean_name]
29
+ response.status = 200
30
+ response.body = instance
31
+ response
32
+ else
33
+ raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
34
+ end
35
+ end
36
+ end
20
37
  end
21
38
  end
22
39
  end
@@ -17,6 +17,23 @@ module Fog
17
17
  )
18
18
  end
19
19
  end
20
+
21
+ class Mock
22
+ def stop_orchestration (name)
23
+ response = Excon::Response.new
24
+ clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
25
+
26
+ if self.data[:orchestrations][clean_name]
27
+ self.data[:orchestrations][clean_name]['status'] = 'stopped'
28
+ instance = self.data[:orchestrations][clean_name]
29
+ response.status = 200
30
+ response.body = instance
31
+ response
32
+ else
33
+ raise Fog::Compute::OracleCloud::NotFound.new("Orchestration #{name} does not exist");
34
+ end
35
+ end
36
+ end
20
37
  end
21
38
  end
22
39
  end
@@ -18,9 +18,7 @@ module Fog
18
18
 
19
19
  servers = self.data[:servers][db_name]
20
20
 
21
- response.body = {
22
- "servers" => servers
23
- }
21
+ response.body = servers
24
22
  response
25
23
  end
26
24
  end
@@ -2,45 +2,69 @@ module Fog
2
2
  module OracleCloud
3
3
  class SOA
4
4
  class Real
5
+ def create_instance(config, options)
6
+ if !config[:cloudStorageContainer].start_with?("/Storage-")
7
+ config[:cloudStorageContainer] = "/Storage-#{@identity_domain}/#{config[:cloudStorageContainer]}"
8
+ end
9
+
10
+ config[:parameters] = options.select{|key, value| [:adminPassword, :adminPort, :adminUserName, :backupVolumeSize, :clusterName, :contentPort, :dbaName, :dbaPassword, :dbServiceName, :deploymentChannelPort, :domainMode, :domainName, :domainPartitionCount, :domainVolumeSize, :edition, :ipReservations, :managedServerCount, :msInitialHeapMB, :msJvmArgs, :msMaxHeapMB, :msMaxPermMB, :msPermMb, :nodeManagerPassword, :nodeManagerPort, :nodeManagerUserName, :overwriteMsJvmArgs, :pdbName, :securedAdminPort, :securedContentPort, :shape, :VMsPublicKey].include?(key)}
11
+ config[:parameters].reject! { |key,value| value.nil?}
12
+ config.reject! { |key,value| value.nil?}
13
+ # Currently only support weblogic
14
+ config[:parameters][:type] = "weblogic"
15
+
16
+ body_data = config
5
17
 
6
- def create_instance(service_name, topology, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, parameters, options={})
7
- body_data = {
8
- 'serviceName' => service_name,
9
- 'topology' => topology,
10
- 'cloudStorageContainer' => cloudStorageContainer,
11
- 'cloudStorageUser' => cloudStorageUser,
12
- 'cloudStoragePassword' => cloudStoragePassword,
13
- 'parameters' => parameters,
14
- 'level' => options[:level],
15
- 'subscriptionType' => options[:subscriptionType],
16
- 'description' => options[:description],
17
- 'sampleAppDeploymentRequests' => options[:sampleAppDeploymentRequests]
18
- }
19
- body_data = body_data.reject {|key, value| value.nil?}
20
18
  request(
21
19
  :method => 'POST',
22
20
  :expects => 202,
23
21
  :path => "/paas/service/soa/api/v1.1/instances/#{@identity_domain}",
24
22
  :body => Fog::JSON.encode(body_data),
25
23
  #:headers => {
26
- # 'Content-Type'=>'application/vnd.com.oracle.oracloud.provisioning.Service+json'
24
+ # 'Content-Type'=>'application/vnd.com.oracle.oracloud.provisioning.Service+json'
27
25
  #}
28
26
  )
29
27
  end
30
-
31
28
  end
32
29
 
33
30
  class Mock
34
- def create_instance(service_name, topology, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, parameters, options={})
35
- response = Excon::Response.new
31
+ def create_instance(config, options)
32
+ response = Excon::Response.new
36
33
 
37
- instance = Fog::OracleCloud::Mock.create_instance(service_name)
38
- self.data[:instances][service_name] = instance
34
+ ip = '192.168.1.1'
35
+ data = {
36
+ 'status' => 'In Progress',
37
+ 'compute_site_name' => 'EM002_Z11',
38
+ 'content_url' => "http://#{ip}",
39
+ 'created_by' => @username,
40
+ 'creation_job_id' => Random.rand(100000),
41
+ 'creation_time'=> Time.now.strftime('%Y-%b-%dT%H:%M:%S'),
42
+ 'last_modified_time'=> Time.now.strftime('%Y-%b-%dT%H:%M:%S'),
43
+ 'service_id' => Random.rand(100000),
44
+ 'service_type' => config[:topology],
45
+ 'service_uri'=>"#{@region_url}/paas/service/dbcs/api/v1.1/instances/#{@identity_domain}/#{config[:serviceName]}",
46
+ }
47
+ .merge(config.select {|key, value| [:serviceName, :description, :level, :subscriptionType].include?(key) })
48
+ .merge(options.select {|key, value| [:shape, :version].include?(key) }).collect{|k,v| [k.to_s, v]}.to_h
39
49
 
40
- response.status = 202
41
- response.headers['Location'] = "https://jaas.oraclecloud.com/paas/service/dbcs/api/v1.1/instances/agriculture/status/create/job/2781084"
50
+ self.data[:instances][config[:serviceName]] = data
51
+ self.data[:created_at][config[:serviceName]] = Time.now
52
+
53
+ server = {
54
+ "name": "#{data['serviceName'][0,8]}_server_1",
55
+ "shape": data['shape'],
56
+ "nodeType": "WLS",
57
+ "isAdmin": true,
58
+ "hostname": ip,
59
+ "status": "Ready",
60
+ "storageAllocated": 74752,
61
+ "creationDate": Time.now.strftime('%Y-%b-%dT%H:%M:%S')
62
+ }
63
+ self.data[:servers][data['serviceName']] = [server]
64
+
65
+ response.status = 202
42
66
  response
43
- end
67
+ end
44
68
  end
45
69
  end
46
70
  end
@@ -22,16 +22,11 @@ module Fog
22
22
  end
23
23
 
24
24
  class Mock
25
- def delete_instance(service_name, dba_name, dba_password, options={})
25
+ def delete_instance(name, dba_name, dba_password, options={})
26
26
  response = Excon::Response.new
27
- # remove from memoreeeez.
28
- self.data[:instances].delete service_name
29
- response.body = {
30
- 'service_name' => service_name,
31
- 'status' => 'Terminating'
32
- }
33
- response.status = 202
34
-
27
+ self.data[:instances][name]['status'] = 'Terminating'
28
+ self.data[:deleted_at][name] = Time.now
29
+ response.status = 204
35
30
  response
36
31
  end
37
32
  end
@@ -14,22 +14,29 @@ module Fog
14
14
  end
15
15
 
16
16
  class Mock
17
- def get_instance(instance_id)
17
+ def get_instance(name)
18
18
  response = Excon::Response.new
19
- if instance_exists? instance_id
19
+ if instance = self.data[:instances][name]
20
+ case instance['status']
21
+ when 'Terminating'
22
+ if Time.now - self.data[:deleted_at][name] >= Fog::Mock.delay
23
+ self.data[:deleted_at].delete(name)
24
+ self.data[:instances].delete(name)
25
+ end
26
+ when 'In Progress'
27
+ if Time.now - self.data[:created_at][name] >= Fog::Mock.delay
28
+ self.data[:instances][name]['status'] = 'Running'
29
+ instance = self.data[:instances][name]
30
+ self.data[:created_at].delete(name)
31
+ end
32
+ end
20
33
  response.status = 200
21
- response.body = self.data[:instances][instance_id]
34
+ response.body = instance
35
+ response
22
36
  else
23
- raise Fog::OracleCloud::SOA::NotFound
37
+ raise Fog::OracleCloud::SOA::NotFound.new("SOA #{name} does not exist");
24
38
  end
25
- response
26
- end
27
-
28
- # Checks if an instance exists
29
- def instance_exists?(instance_id)
30
- self.data[:instances].key? instance_id
31
39
  end
32
-
33
40
  end
34
41
  end
35
42
  end
@@ -11,6 +11,19 @@ module Fog
11
11
  response
12
12
  end
13
13
  end
14
+
15
+ class Mock
16
+ def list_instances
17
+ response = Excon::Response.new
18
+
19
+ instances = self.data[:instances].values
20
+
21
+ response.body = {
22
+ 'services' => instances
23
+ }
24
+ response
25
+ end
26
+ end
14
27
  end
15
28
  end
16
29
  end
@@ -1,3 +1,5 @@
1
+ require 'securerandom'
2
+
1
3
  module Fog
2
4
  module Storage
3
5
  class OracleCloud
@@ -14,7 +16,25 @@ module Fog
14
16
  end
15
17
 
16
18
  class Mock
17
-
19
+ def create_container (name)
20
+ response = Excon::Response.new
21
+
22
+ self.data[:containers][name] = {
23
+ 'name' => name,
24
+ 'count' => 0,
25
+ 'bytes' => 0
26
+ }
27
+ response.status = 201
28
+ response.headers = {
29
+ 'Content-Length' => 0,
30
+ 'X-Container-Bytes-Used' => 0,
31
+ 'X-Container-Object-Count' => 0,
32
+ 'Date'=>Time.now.strftime('%Y-%m-%dT%H:%M:%S'),
33
+ 'X-Timestamp'=>Time.now.to_i,
34
+ 'X-Trans-id'=>SecureRandom.uuid
35
+ }
36
+ response
37
+ end
18
38
  end
19
39
  end
20
40
  end
@@ -19,6 +19,45 @@ module Fog
19
19
  response
20
20
  end
21
21
  end
22
+
23
+ class Mock
24
+ def get_container(name)
25
+ response = Excon::Response.new
26
+
27
+ if container = self.data[:containers][name]
28
+ response.status = 200
29
+ response.body = container
30
+ response
31
+ else;
32
+ raise Fog::Compute::OracleCloud::NotFound.new("Storage Container #{name} does not exist");
33
+ end
34
+ end
35
+
36
+ def get_container_with_objects(name)
37
+ response = Excon::Response.new
38
+
39
+ if container = self.data[:containers][name]
40
+ response.status = 200
41
+ response.body = [{
42
+ "hash": "aea0077f346227c91cd68e955721e262",
43
+ "last_modified": "2016-07-30T03:39:24.477480",
44
+ "bytes": 513,
45
+ "name": "Ausemon/1df0886e-3133-498f-9472-79632485b311/logs/web.1/36322757-7666-429a-87cc-3c320caf8afa/server.out.zip",
46
+ "content_type": "application/zip"
47
+ },
48
+ {
49
+ "hash": "2c35a8adaf8e7a3375e1354264135f94",
50
+ "last_modified": "2016-07-30T12:51:26.124600",
51
+ "bytes": 6524,
52
+ "name": "Ausemon/1df0886e-3133-498f-9472-79632485b311/logs/web.1/6ad56533-791f-4a79-8e5d-bbef854a2b50/server.out.zip",
53
+ "content_type": "application/zip"
54
+ }]
55
+ response
56
+ else;
57
+ raise Fog::Compute::OracleCloud::NotFound.new("Storage Container #{name} does not exist");
58
+ end
59
+ end
60
+ end
22
61
  end
23
62
  end
24
63
  end
@@ -11,6 +11,17 @@ module Fog
11
11
  response
12
12
  end
13
13
  end
14
+
15
+ class Mock
16
+ def list_containers
17
+ response = Excon::Response.new
18
+
19
+ containers = self.data[:containers].values
20
+
21
+ response.body = containers
22
+ response
23
+ end
24
+ end
14
25
  end
15
26
  end
16
27
  end
@@ -60,19 +60,36 @@ module Fog
60
60
  class Mock
61
61
 
62
62
  def initialize(options={})
63
+ @username = options[:oracle_username]
64
+ @password = options[:oracle_password]
65
+ @identity_domain = options[:oracle_domain]
66
+ @region_url = options[:oracle_region] == 'emea' ? 'https://jcs.emea.oraclecloud.com' : 'https://jaas.oraclecloud.com'
67
+ end
63
68
 
69
+ def username
70
+ @username
64
71
  end
65
72
 
66
- def self.data
67
- @data ||= Hash.new do |hash, key|
68
- hash[key] = {
69
- :instances => {}
70
- }
71
- end
73
+ def password
74
+ @password
75
+ end
76
+
77
+
78
+ def self.data
79
+ @data ||= {
80
+ :instances => {},
81
+ :servers => {},
82
+ :deleted_at => {},
83
+ :created_at => {}
84
+ }
85
+ end
86
+
87
+ def self.reset
88
+ @data = nil
72
89
  end
73
90
 
74
- def data
75
- self.class.data[@oracle_username]
91
+ def data
92
+ self.class.data
76
93
  end
77
94
  end
78
95
  end
@@ -73,7 +73,26 @@ module Fog
73
73
  end
74
74
 
75
75
  class Mock
76
+ def initialize(options={})
77
+ @username = options[:oracle_username]
78
+ @password = options[:oracle_password]
79
+ @identity_domain = options[:oracle_domain]
80
+ @api_endpoint = options[:oracle_compute_api]
81
+ end
82
+
83
+ def self.data
84
+ @data ||= {
85
+ :containers => {}
86
+ }
87
+ end
76
88
 
89
+ def self.reset
90
+ @data = nil
91
+ end
92
+
93
+ def data
94
+ self.class.data
95
+ end
77
96
  end
78
97
  end
79
98
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module OracleCloud
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
@@ -36,9 +36,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | instance requests', 'instances') do
36
36
  test "returns an Array" do
37
37
  instances.is_a? Array
38
38
  end
39
- instances.each do |ins|
40
- puts "#{ins.clean_name} - #{ins.state}"
41
- end
39
+
42
40
  test "should return records" do
43
41
  instances.size >= 1
44
42
  end
@@ -9,6 +9,8 @@ Shindo.tests('Fog::Java[oraclecloud] | java requests', 'java') do
9
9
  :dba_name => 'SYS',
10
10
  :dba_password => 'password',
11
11
  :db_service_name => 'TestDB',
12
+ :admin_password => 'Welcome1$',
13
+ :admin_username => 'weblogic',
12
14
  :shape => 'oc3',
13
15
  :version => '12.2.1',
14
16
  :ssh_key => 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlinstanceUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ==',
@@ -1,10 +1,11 @@
1
1
  require 'pp'
2
2
 
3
3
  Shindo.tests('Fog::Compute[oraclecloud] | orchestration requests', 'orchestrations') do
4
-
4
+ orch_name = "OrchestrationTest-#{rand(100)}"
5
+
5
6
  tests("#orchestrations-create", "create") do
6
7
  orchestration = Fog::Compute[:oraclecloud].orchestrations.create(
7
- :name => "OrchestrationTest-#{rand(100)}",
8
+ :name => orch_name,
8
9
  :oplans => [{
9
10
  'label' =>"WebServer",
10
11
  'obj_type' => "launchplan",
@@ -41,7 +42,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | orchestration requests', 'orchestratio
41
42
  }]
42
43
  }
43
44
  orchestration.save()
44
- orchestration.wait_for { ready? }
45
+ #orchestration.wait_for { ready? }
45
46
  test "can update orchestration" do
46
47
  check = Fog::Compute[:oraclecloud].orchestrations.get(orchestration.name)
47
48
  check.oplans.size == 2
@@ -58,10 +59,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | orchestration requests', 'orchestratio
58
59
  orchestration.status == 'stopped'
59
60
  end
60
61
 
61
- orchestration.destroy()
62
- tests("can delete orchestration").raises(Excon::Error::NotFound) do
63
- check = Fog::Compute[:oraclecloud].orchestrations.get(orchestration.name)
64
- end
62
+
65
63
  end
66
64
 
67
65
  tests("#orchestrations-read") do
@@ -69,9 +67,7 @@ Shindo.tests('Fog::Compute[oraclecloud] | orchestration requests', 'orchestratio
69
67
  test "returns an Array" do
70
68
  orchestrations.is_a? Array
71
69
  end
72
- orchestrations.each do |orch|
73
- puts orch.name
74
- end
70
+
75
71
  test "should return keys" do
76
72
  orchestrations.size >= 1
77
73
  end
@@ -84,4 +80,12 @@ Shindo.tests('Fog::Compute[oraclecloud] | orchestration requests', 'orchestratio
84
80
  orchestrations.name.is_a? String
85
81
  end
86
82
  end
83
+
84
+ tests("#orchestrations-delete", "create") do
85
+ orchestration = Fog::Compute[:oraclecloud].orchestrations.get(orch_name)
86
+ orchestration.destroy()
87
+ tests("can delete orchestration").raises(Fog::Compute::OracleCloud::NotFound) do
88
+ check = Fog::Compute[:oraclecloud].orchestrations.get(orchestration.name)
89
+ end
90
+ end
87
91
  end
@@ -2,33 +2,35 @@ require 'pp'
2
2
 
3
3
  Shindo.tests('Fog::Soa[oraclecloud] | SOA requests', 'soa') do
4
4
 
5
- #tests("#java-create", "create") do
6
- # sshkey = Fog::Compute[:oracle].ssh_keys.first.name
7
- # new_instance = Fog::Compute[:oracle].instances.create(
8
- # :name=>'Test123',
9
- # :shape=>'oc3',
10
- # :imagelist=>'/oracle/public/oel_6.4_2GB_v1',
11
- # :label=>'dev-vm',
12
- # :sshkeys=>[sshkey]
13
- # )
14
- # test "can create an instance" do
15
- # new_instance.is_a? Fog::Compute::Oracle::Instance
16
- # end
17
- # test "is being built" do
18
- # new_instance.state != "running"
19
- # end
20
- # new_instance.wait_for { ready? }
21
- #
22
- # test "is built" do
23
- # new_instance.state == 'running'
24
- # end
25
- #
26
- # new_instance.destroy()
27
- # test "can delete instance" do
28
- # check = Fog::Compute[:oracle].instances.get(new_instance.name)
29
- # check.state == 'stopping'
30
- # end
31
- #end
5
+ tests("#soa-create", "create") do
6
+ instance = Fog::OracleCloud[:soa].instances.create(
7
+ :service_name => 'TestSOA',
8
+ :description => 'A new weblogic instance',
9
+ :dba_name => 'SYS',
10
+ :dba_password => 'password',
11
+ :db_service_name => 'TestDB',
12
+ :admin_password => 'Welcome1$',
13
+ :admin_username => 'weblogic',
14
+ :shape => 'oc3m',
15
+ :version => '12.2.1',
16
+ :ssh_key => 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkNNQ4ri2oUW46mBO/4CHMGCOALciumwGvFEMDLGNnlinstanceUSqU4IRrqgj+znLClfb29Oer0devdarM6DilsZVgZ2YbI5ZD5vICR/O9J0c28dArwbtFeIjcV2TCWyj5xKEXF1r+OrJMexHQa0fW1URGrU8QODpJNC/9eCVGcEXddL31xTZYpjoVOCVx66kNa6lSHEVV3T4zaCby9Oe5QI4gZe1+xyxHPNEW5wogwS3dlKSyL2CfBP0aUKOmJ5Nrl8+y0GqJQXdGjZ9FIknmwWueRW/6qPQvZocjOZ8YiPZgAP0RNy6lL+u8mnAazj/mrEdmB5QUzpDAllIr5Tn/xaddZQ==',
17
+ :cloud_storage_container => 'Test123',
18
+ :topology => 'osb'
19
+ )
20
+ test "can create a soa instance" do
21
+ instance.is_a? Fog::OracleCloud::SOA::Instance
22
+ end
23
+
24
+ test "is being built" do
25
+ !instance.ready?
26
+ end
27
+ instance.wait_for { ready? }
28
+
29
+ test "is built" do
30
+ instance.ready?
31
+ end
32
+ end
33
+
32
34
 
33
35
  tests('#soa-read') do
34
36
  instances = Fog::OracleCloud[:soa].instances
@@ -49,4 +51,15 @@ Shindo.tests('Fog::Soa[oraclecloud] | SOA requests', 'soa') do
49
51
  instance.service_name.is_a? String
50
52
  end
51
53
  end
54
+
55
+ tests("#soa-delete", "create") do
56
+ instance = Fog::OracleCloud[:soa].instances.get('TestSOA')
57
+ instance.dba_name = 'Admin',
58
+ instance.dba_password = 'password'
59
+ instance.destroy()
60
+ instance.wait_for { stopping? }
61
+ tests("should actually delete instance").raises(Fog::OracleCloud::SOA::NotFound) do
62
+ instance.wait_for { stopped? }
63
+ end
64
+ end
52
65
  end
@@ -8,7 +8,7 @@ Shindo.tests('Fog::Storage[oraclecloud] | storage requests', 'storage') do
8
8
  container.is_a? Fog::Storage::OracleCloud::Container
9
9
  container.name.is_a? String
10
10
  end
11
-
11
+ pp container
12
12
  check = Fog::Storage[:oraclecloud].containers.get(container.name)
13
13
  test "can get container" do
14
14
  check.name == container.name
@@ -24,6 +24,7 @@ Shindo.tests('Fog::Storage[oraclecloud] | storage requests', 'storage') do
24
24
 
25
25
  tests("#storage-read") do
26
26
  containers = Fog::Storage[:oraclecloud].containers
27
+
27
28
  test "returns an Array" do
28
29
  containers.is_a? Array
29
30
  end
@@ -40,7 +41,7 @@ Shindo.tests('Fog::Storage[oraclecloud] | storage requests', 'storage') do
40
41
  end
41
42
 
42
43
  tests("#object-read") do
43
- objects = Fog::Storage[:oraclecloud].containers[5].objects
44
+ objects = Fog::Storage[:oraclecloud].containers.first.objects
44
45
  test "returns an Array" do
45
46
  objects.is_a? Array
46
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-oraclecloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Nation
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-18 00:00:00.000000000 Z
11
+ date: 2016-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler