bbrowning-deltacloud-client 0.0.9.7-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ #
2
+ # Copyright (C) 2009 Red Hat, Inc.
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+
19
+
20
+ require 'specs/spec_helper'
21
+
22
+ describe "storage snapshot" do
23
+
24
+ it_should_behave_like "all resources"
25
+
26
+ it "allow retrieval of all storage volumes owned by the current user" do
27
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
28
+ client.connect do |client|
29
+ storage_snapshots = client.storage_snapshots
30
+ storage_snapshots.should_not be_nil
31
+ storage_snapshots.should_not be_empty
32
+ ids = storage_snapshots.collect{|e| e.id}
33
+ ids.size.should eql( 2 )
34
+ ids.should include( 'snap2' )
35
+ ids.should include( 'snap3' )
36
+ end
37
+ end
38
+
39
+ it "should allow fetching of storage volume by id" do
40
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
41
+ client.connect do |client|
42
+ storage_snapshot = client.storage_snapshot( 'snap2' )
43
+ storage_snapshot.should_not be_nil
44
+ storage_snapshot.id.should eql( 'snap2' )
45
+ storage_snapshot.storage_volume.capacity.should eql( 1.0 )
46
+ storage_snapshot.storage_volume.id.should eql( 'vol2' )
47
+ end
48
+ end
49
+
50
+ it "should allow fetching of storage volume by URI" do
51
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
52
+ client.connect do |client|
53
+ storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
54
+ storage_snapshot.should_not be_nil
55
+ storage_snapshot.id.should eql( 'snap2' )
56
+ storage_snapshot.storage_volume.capacity.should eql( 1.0 )
57
+ storage_snapshot.storage_volume.id.should eql( 'vol2' )
58
+ end
59
+ end
60
+
61
+ it "should return nil for unknown storage volume by ID" do
62
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
63
+ client.connect do |client|
64
+ storage_snapshot = client.storage_snapshot( "bogus" )
65
+ storage_snapshot.should be_nil
66
+ end
67
+ end
68
+
69
+ it "should return nil for unknown storage volume by URI" do
70
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
71
+ client.connect do |client|
72
+ storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
73
+ storage_snapshot.should be_nil
74
+ end
75
+ end
76
+
77
+ end
@@ -0,0 +1,89 @@
1
+ #
2
+ # Copyright (C) 2009 Red Hat, Inc.
3
+ #
4
+ # Licensed to the Apache Software Foundation (ASF) under one or more
5
+ # contributor license agreements. See the NOTICE file distributed with
6
+ # this work for additional information regarding copyright ownership. The
7
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance with the
9
+ # License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+
19
+
20
+ require 'specs/spec_helper'
21
+
22
+ describe "storage volumes" do
23
+
24
+ it_should_behave_like "all resources"
25
+
26
+ it "allow retrieval of all storage volumes owned by the current user" do
27
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
28
+ client.connect do |client|
29
+ storage_volumes = client.storage_volumes
30
+ storage_volumes.should_not be_nil
31
+ storage_volumes.should_not be_empty
32
+ ids = storage_volumes.collect{|e| e.id}
33
+ ids.size.should eql( 2 )
34
+ ids.should include( 'vol2' )
35
+ ids.should include( 'vol3' )
36
+ end
37
+ end
38
+
39
+ it "should allow fetching of storage volume by id" do
40
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
41
+ client.connect do |client|
42
+ storage_volume = client.storage_volume( 'vol3' )
43
+ storage_volume.id.should eql( 'vol3' )
44
+ storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
45
+ storage_volume.state.should eql( 'IN-USE' )
46
+ storage_volume.capacity.should eql( 1.0 )
47
+ storage_volume.device.should eql( '/dev/sda1' )
48
+ storage_volume.instance.should_not be_nil
49
+ storage_volume.instance.id.should eql( 'inst1' )
50
+ ip = storage_volume.instance
51
+ ip.hardware_profile.architecture.value.should eql( 'i386' )
52
+ end
53
+ end
54
+
55
+ it "should allow fetching of storage volume by URI" do
56
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
57
+ client.connect do |client|
58
+ storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
59
+ storage_volume.should_not be_nil
60
+ storage_volume.id.should eql( 'vol3' )
61
+ storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
62
+ storage_volume.state.should eql( 'IN-USE' )
63
+ storage_volume.capacity.should eql( 1.0 )
64
+ storage_volume.device.should eql( '/dev/sda1' )
65
+ storage_volume.instance.should_not be_nil
66
+ storage_volume.instance.id.should eql( 'inst1' )
67
+ ip = storage_volume.instance
68
+ ip.hardware_profile.architecture.value.should eql( 'i386' )
69
+ end
70
+ end
71
+
72
+ it "should return nil for unknown storage volume by ID" do
73
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
74
+ client.connect do |client|
75
+ storage_volume = client.storage_volume( 'bogus' )
76
+ storage_volume.should be_nil
77
+ end
78
+ end
79
+
80
+ it "should return nil for unknown storage volume by URI" do
81
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
82
+ client.connect do |client|
83
+ storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
84
+ storage_volume.should be_nil
85
+ end
86
+ end
87
+
88
+
89
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bbrowning-deltacloud-client
3
+ version: !ruby/object:Gem::Version
4
+ hash: 101
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 9
10
+ - 7
11
+ version: 0.0.9.7
12
+ platform: java
13
+ authors:
14
+ - Red Hat, Inc.
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-10-04 00:00:00 -04:00
20
+ default_executable: deltacloudc
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: rest-client
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 1
33
+ - 4
34
+ - 2
35
+ version: 1.4.2
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: nokogiri
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 62196439
47
+ segments:
48
+ - 1
49
+ - 5
50
+ - 0
51
+ - beta
52
+ - 2
53
+ version: 1.5.0.beta.2
54
+ type: :runtime
55
+ version_requirements: *id002
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ prerelease: false
59
+ requirement: &id003 !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 27
65
+ segments:
66
+ - 1
67
+ - 3
68
+ - 0
69
+ version: 1.3.0
70
+ type: :development
71
+ version_requirements: *id003
72
+ description: Deltacloud REST Client for API
73
+ email: deltacloud-users@lists.fedorahosted.org
74
+ executables:
75
+ - deltacloudc
76
+ extensions: []
77
+
78
+ extra_rdoc_files:
79
+ - COPYING
80
+ files:
81
+ - Rakefile
82
+ - lib/deltacloud.rb
83
+ - lib/documentation.rb
84
+ - lib/plain_formatter.rb
85
+ - init.rb
86
+ - bin/deltacloudc
87
+ - specs/fixtures/images/img1.yml
88
+ - specs/fixtures/images/img2.yml
89
+ - specs/fixtures/images/img3.yml
90
+ - specs/fixtures/instances/inst0.yml
91
+ - specs/fixtures/instances/inst1.yml
92
+ - specs/fixtures/instances/inst2.yml
93
+ - specs/fixtures/storage_snapshots/snap1.yml
94
+ - specs/fixtures/storage_snapshots/snap2.yml
95
+ - specs/fixtures/storage_snapshots/snap3.yml
96
+ - specs/fixtures/storage_volumes/vol1.yml
97
+ - specs/fixtures/storage_volumes/vol2.yml
98
+ - specs/fixtures/storage_volumes/vol3.yml
99
+ - specs/hardware_profiles_spec.rb
100
+ - specs/images_spec.rb
101
+ - specs/initialization_spec.rb
102
+ - specs/instance_states_spec.rb
103
+ - specs/instances_spec.rb
104
+ - specs/realms_spec.rb
105
+ - specs/shared/resources.rb
106
+ - specs/spec_helper.rb
107
+ - specs/storage_snapshot_spec.rb
108
+ - specs/storage_volume_spec.rb
109
+ - COPYING
110
+ has_rdoc: true
111
+ homepage: http://www.deltacloud.org
112
+ licenses: []
113
+
114
+ post_install_message:
115
+ rdoc_options: []
116
+
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ requirements: []
138
+
139
+ rubyforge_project:
140
+ rubygems_version: 1.3.7
141
+ signing_key:
142
+ specification_version: 3
143
+ summary: Deltacloud REST Client
144
+ test_files:
145
+ - specs/fixtures/images/img1.yml
146
+ - specs/fixtures/images/img2.yml
147
+ - specs/fixtures/images/img3.yml
148
+ - specs/fixtures/instances/inst0.yml
149
+ - specs/fixtures/instances/inst1.yml
150
+ - specs/fixtures/instances/inst2.yml
151
+ - specs/fixtures/storage_snapshots/snap1.yml
152
+ - specs/fixtures/storage_snapshots/snap2.yml
153
+ - specs/fixtures/storage_snapshots/snap3.yml
154
+ - specs/fixtures/storage_volumes/vol1.yml
155
+ - specs/fixtures/storage_volumes/vol2.yml
156
+ - specs/fixtures/storage_volumes/vol3.yml
157
+ - specs/hardware_profiles_spec.rb
158
+ - specs/images_spec.rb
159
+ - specs/initialization_spec.rb
160
+ - specs/instance_states_spec.rb
161
+ - specs/instances_spec.rb
162
+ - specs/realms_spec.rb
163
+ - specs/shared/resources.rb
164
+ - specs/spec_helper.rb
165
+ - specs/storage_snapshot_spec.rb
166
+ - specs/storage_volume_spec.rb