deltacloud-commits mailing list archives

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

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

Added:
    deltacloud/trunk/server/lib/cimi/model/volume_template.rb
      - copied, changed from r1205405, deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/spec/cimi/data/volume_template.json
    deltacloud/trunk/server/spec/cimi/data/volume_template.xml
    deltacloud/trunk/server/spec/cimi/model/volume_template_spec.rb
      - copied, changed from r1205405, 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=1205406&r1=1205405&r2=1205406&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Wed Nov 23 14:10:52 2011
@@ -30,3 +30,4 @@ require 'cimi/model/volume'
 require 'cimi/model/machine_admin'
 require 'cimi/model/volume_configuration'
 require 'cimi/model/volume_image'
+require 'cimi/model/volume_template'

Copied: deltacloud/trunk/server/lib/cimi/model/volume_template.rb (from r1205405, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/volume_template.rb?p2=deltacloud/trunk/server/lib/cimi/model/volume_template.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1205405&r2=1205406&rev=1205406&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/volume_template.rb Wed Nov 23 14:10:52 2011
@@ -12,21 +12,8 @@
 # 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::VolumeTemplate < CIMI::Model::Base
+  href :volume_config
+  href :volume_image
 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'
-require 'cimi/model/volume_image'

Added: deltacloud/trunk/server/spec/cimi/data/volume_template.json
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_template.json?rev=1205406&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_template.json (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_template.json Wed Nov 23 14:10:52 2011
@@ -0,0 +1,14 @@
+{
+  "uri": "http://cimi.example.org/volume_templates/1",
+  "name": "volume_template_1",
+  "description": "Volume Template One",
+  "created": "2011-11-21",
+  "volumeConfig":{ "href": "http://cimi.example.com/volume_configurations/1" },
+  "volumeImage":{ "href": "http://cimi.example.com/volume_images/1" },
+  "operations": [
+    { "rel": "edit",
+      "href": "http://cimi.example.org/volume_templates/1/edit" },
+    { "rel": "delete",
+      "href": "http://cimi.example.org/volume_templates/1/delete" }
+  ]
+}

Added: deltacloud/trunk/server/spec/cimi/data/volume_template.xml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/volume_template.xml?rev=1205406&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/volume_template.xml (added)
+++ deltacloud/trunk/server/spec/cimi/data/volume_template.xml Wed Nov 23 14:10:52 2011
@@ -0,0 +1,10 @@
+<VolumeTemplate xmlns="http://www.dmtf.org/cimi">
+  <uri>http://cimi.example.org/volume_templates/1</uri>
+  <name>volume_template_1</name>
+  <description>Volume Template One</description>
+  <created>2011-11-21</created>
+  <volumeImage href="http://cimi.example.com/volume_images/1"/>
+  <volumeConfig href="http://cimi.example.com/volume_configurations/1"/>
+  <operation rel="edit" href="http://cimi.example.org/volume_templates/1/edit"/>
+  <operation rel="delete" href="http://cimi.example.org/volume_templates/1/delete"/>
+</VolumeTemplate>

Copied: deltacloud/trunk/server/spec/cimi/model/volume_template_spec.rb (from r1205405, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/model/volume_template_spec.rb?p2=deltacloud/trunk/server/spec/cimi/model/volume_template_spec.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1205405&r2=1205406&rev=1205406&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/spec/cimi/model/volume_template_spec.rb Wed Nov 23 14:10:52 2011
@@ -14,19 +14,23 @@
 # under the License.
 #
 
-# Declare namespace for CIMI model
-#
-module CIMI
-  module Model; end
-end
+describe "Volume Template model" do
+
+  before(:all) do
+    @xml = IO::read(File::join(DATA_DIR, "volume_template.xml"))
+    @json = IO::read(File::join(DATA_DIR, "volume_template.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'
-require 'cimi/model/volume_image'
+  it "can be constructed from XML" do
+    conf = CIMI::Model::VolumeTemplate.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::VolumeTemplate.from_json(@json)
+    conf.should_not be_nil
+    should_serialize_from_json! conf, @xml, @json
+  end
+
+end



Mime
View raw message