deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1205405 - in /deltacloud/trunk/server: lib/cimi/model.rb lib/cimi/model/volume_image.rb spec/cimi/data/volume_image.json spec/cimi/data/volume_image.xml spec/cimi/model/volume_image_spec.rb
Date Wed, 23 Nov 2011 14:10:23 GMT
Author: marios
Date: Wed Nov 23 14:10:22 2011
New Revision: 1205405

URL: http://svn.apache.org/viewvc?rev=1205405&view=rev
Log:
Adds CIMI Volume Image model+spec/test

Added:
    deltacloud/trunk/server/lib/cimi/model/volume_image.rb
      - copied, changed from r1205404, deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/spec/cimi/data/volume_image.json
    deltacloud/trunk/server/spec/cimi/data/volume_image.xml
    deltacloud/trunk/server/spec/cimi/model/volume_image_spec.rb
      - copied, changed from r1205404, deltacloud/trunk/server/lib/cimi/model.rb
Modified:
    deltacloud/trunk/server/lib/cimi/model.rb

Modified: deltacloud/trunk/server/lib/cimi/model.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model.rb?rev=1205405&r1=1205404&r2=1205405&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Wed Nov 23 14:10:22 2011
@@ -29,3 +29,4 @@ require 'cimi/model/machine'
 require 'cimi/model/volume'
 require 'cimi/model/machine_admin'
 require 'cimi/model/volume_configuration'
+require 'cimi/model/volume_image'

Copied: deltacloud/trunk/server/lib/cimi/model/volume_image.rb (from r1205404, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_image.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_image.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1205404&r2=1205405&rev=1205405&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_image.rb Wed Nov 23 14:10:22 2011
@@ -12,20 +12,9 @@
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 # License for the specific language governing permissions and limitations
 # under the License.
-#
 
-# Declare namespace for CIMI model
-#
-module CIMI
-  module Model; end
+class CIMI::Model::VolumeImage < CIMI::Model::Base
+  href :image_location
+  text :image_data
+  text :bootable
 end
-
-require 'cimi/model/schema'
-require 'cimi/model/base'
-require 'cimi/model/machine_template'
-require 'cimi/model/machine_image'
-require 'cimi/model/machine_configuration'
-require 'cimi/model/machine'
-require 'cimi/model/volume'
-require 'cimi/model/machine_admin'
-require 'cimi/model/volume_configuration'

Added: deltacloud/trunk/server/spec/cimi/data/volume_image.json
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_image.json?rev=1205405&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_image.json (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_image.json Wed Nov 23 14:10:22 2011
@@ -0,0 +1,14 @@
+{
+  "uri": "http://cimi.example.org/volume_images/1",
+  "name": "volume_image_1",
+  "description": "Volume Image One",
+  "created": "2011-11-21",
+  "bootable": "false",
+  "imageLocation":{ "href": "nfs://cimi.example.com/volume_images/vol_image_1.img" },
+  "operations": [
+    { "rel": "edit",
+      "href": "http://cimi.example.org/volume_images/1/edit" },
+    { "rel": "delete",
+      "href": "http://cimi.example.org/volume_images/1/delete" }
+  ]
+}

Added: deltacloud/trunk/server/spec/cimi/data/volume_image.xml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_image.xml?rev=1205405&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_image.xml (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_image.xml Wed Nov 23 14:10:22 2011
@@ -0,0 +1,10 @@
+<VolumeImage xmlns="http://www.dmtf.org/cimi">
+  <uri>http://cimi.example.org/volume_images/1</uri>
+  <name>volume_image_1</name>
+  <description>Volume Image One</description>
+  <created>2011-11-21</created>
+  <bootable>false</bootable>
+  <imageLocation href="nfs://cimi.example.com/volume_images/vol_image_1.img"/>
+  <operation rel="edit" href="http://cimi.example.org/volume_images/1/edit"/>
+  <operation rel="delete" href="http://cimi.example.org/volume_images/1/delete"/>
+</VolumeImage>

Copied: deltacloud/trunk/server/spec/cimi/model/volume_image_spec.rb (from r1205404, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/model/volume_image_spec.rb?p2=deltacloud/trunk/server/spec/cimi/model/volume_image_spec.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1205404&r2=1205405&rev=1205405&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/spec/cimi/model/volume_image_spec.rb Wed Nov 23 14:10:22 2011
@@ -14,18 +14,23 @@
 # under the License.
 #
 
-# Declare namespace for CIMI model
-#
-module CIMI
-  module Model; end
-end
+describe "Volume Image model" do
+
+  before(:all) do
+    @xml = IO::read(File::join(DATA_DIR, "volume_image.xml"))
+    @json = IO::read(File::join(DATA_DIR, "volume_image.json"))
+  end
 
-require 'cimi/model/schema'
-require 'cimi/model/base'
-require 'cimi/model/machine_template'
-require 'cimi/model/machine_image'
-require 'cimi/model/machine_configuration'
-require 'cimi/model/machine'
-require 'cimi/model/volume'
-require 'cimi/model/machine_admin'
-require 'cimi/model/volume_configuration'
+  it "can be constructed from XML" do
+    conf = CIMI::Model::VolumeImage.from_xml(@xml)
+    conf.should_not be_nil
+    should_serialize_from_xml! conf, @xml, @json
+  end
+
+  it "can be constructed from JSON" do
+    conf = CIMI::Model::VolumeImage.from_json(@json)
+    conf.should_not be_nil
+    should_serialize_from_json! conf, @xml, @json
+  end
+
+end



Mime
View raw message