deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1205404 - in /deltacloud/trunk/server: lib/cimi/model.rb lib/cimi/model/volume_configuration.rb spec/cimi/data/volume_configuration.json spec/cimi/data/volume_configuration.xml spec/cimi/model/volume_configuration_spec.rb
Date Wed, 23 Nov 2011 14:09:55 GMT
Author: marios
Date: Wed Nov 23 14:09:53 2011
New Revision: 1205404

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

Added:
    deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb
      - copied, changed from r1204986, deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/spec/cimi/data/volume_configuration.json
    deltacloud/trunk/server/spec/cimi/data/volume_configuration.xml
    deltacloud/trunk/server/spec/cimi/model/volume_configuration_spec.rb
      - copied, changed from r1204986, 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=1205404&r1=1205403&r2=1205404&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Wed Nov 23 14:09:53 2011
@@ -28,3 +28,4 @@ require 'cimi/model/machine_configuratio
 require 'cimi/model/machine'
 require 'cimi/model/volume'
 require 'cimi/model/machine_admin'
+require 'cimi/model/volume_configuration'

Copied: deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb (from r1204986, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1204986&r2=1205404&rev=1205404&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_configuration.rb Wed Nov 23 14:09:53 2011
@@ -12,19 +12,13 @@
 # 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::VolumeConfiguration < CIMI::Model::Base
+  text :format
+  struct :capacity do
+    scalar :quantity
+    scalar :units
+  end
+  text :supports_snapshots
+  text :guest_interface
 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'

Added: deltacloud/trunk/server/spec/cimi/data/volume_configuration.json
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_configuration.json?rev=1205404&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_configuration.json (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_configuration.json Wed Nov 23 14:09:53 2011
@@ -0,0 +1,16 @@
+{
+  "uri": "http://cimi.example.org/volume_configurations/1",
+  "name": "volume_config_1",
+  "description": "Volume Configuration One",
+  "created": "2011-11-21",
+  "format": "ext3",
+  "capacity": { "quantity": "10", "units": "gigabyte" },
+  "supportsSnapshots": "false",
+  "guestInterface": "NFS",
+  "operations": [
+    { "rel": "edit",
+      "href": "http://cimi.example.org/volume_configurations/1/edit" },
+    { "rel": "delete",
+      "href": "http://cimi.example.org/volume_configurations/1/delete" }
+  ]
+}

Added: deltacloud/trunk/server/spec/cimi/data/volume_configuration.xml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_configuration.xml?rev=1205404&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_configuration.xml (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_configuration.xml Wed Nov 23 14:09:53 2011
@@ -0,0 +1,12 @@
+<VolumeConfiguration xmlns="http://www.dmtf.org/cimi">
+  <uri>http://cimi.example.org/volume_configurations/1</uri>
+  <name>volume_config_1</name>
+  <description>Volume Configuration One</description>
+  <created>2011-11-21</created>
+  <capacity quantity="10" units="gigabyte"/>
+  <supportsSnapshots>false</supportsSnapshots>
+  <guestInterface>NFS</guestInterface>
+  <format>ext3</format>
+  <operation rel="edit" href="http://cimi.example.org/volume_configurations/1/edit"/>
+  <operation rel="delete" href="http://cimi.example.org/volume_configurations/1/delete"/>
+</VolumeConfiguration>

Copied: deltacloud/trunk/server/spec/cimi/model/volume_configuration_spec.rb (from r1204986,
deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/model/volume_configuration_spec.rb?p2=deltacloud/trunk/server/spec/cimi/model/volume_configuration_spec.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1204986&r2=1205404&rev=1205404&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/spec/cimi/model/volume_configuration_spec.rb Wed Nov 23 14:09:53
2011
@@ -1,3 +1,4 @@
+
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.  The
@@ -14,17 +15,23 @@
 # under the License.
 #
 
-# Declare namespace for CIMI model
-#
-module CIMI
-  module Model; end
-end
+describe "Volume Configuration model" do
+
+  before(:all) do
+    @xml = IO::read(File::join(DATA_DIR, "volume_configuration.xml"))
+    @json = IO::read(File::join(DATA_DIR, "volume_configuration.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'
+  it "can be constructed from XML" do
+    conf = CIMI::Model::VolumeConfiguration.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::VolumeConfiguration.from_json(@json)
+    conf.should_not be_nil
+    should_serialize_from_json! conf, @xml, @json
+  end
+
+end



Mime
View raw message