deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1204551 - in /deltacloud/trunk/server: lib/cimi/model.rb lib/cimi/model/machine_admin.rb spec/cimi/data/machine_admin.json spec/cimi/data/machine_admin.xml spec/cimi/model/machine_admin_spec.rb
Date Mon, 21 Nov 2011 15:45:51 GMT
Author: marios
Date: Mon Nov 21 15:45:50 2011
New Revision: 1204551

URL: http://svn.apache.org/viewvc?rev=1204551&view=rev
Log:
Adds CIMI MachineAdmin model and spec/test

Added:
    deltacloud/trunk/server/lib/cimi/model/machine_admin.rb
      - copied, changed from r1204148, deltacloud/trunk/server/lib/cimi/model.rb
    deltacloud/trunk/server/spec/cimi/data/machine_admin.json
    deltacloud/trunk/server/spec/cimi/data/machine_admin.xml
    deltacloud/trunk/server/spec/cimi/model/machine_admin_spec.rb
      - copied, changed from r1204148, 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=1204551&r1=1204550&r2=1204551&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model.rb Mon Nov 21 15:45:50 2011
@@ -26,3 +26,4 @@ require 'cimi/model/machine_template'
 require 'cimi/model/machine_image'
 require 'cimi/model/machine_configuration'
 require 'cimi/model/volume'
+require 'cimi/model/machine_admin'

Copied: deltacloud/trunk/server/lib/cimi/model/machine_admin.rb (from r1204148, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/machine_admin.rb?p2=deltacloud/trunk/server/lib/cimi/model/machine_admin.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1204148&r2=1204551&rev=1204551&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/lib/cimi/model/machine_admin.rb Mon Nov 21 15:45:50 2011
@@ -12,17 +12,15 @@
 # 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
-end
+class CIMI::Model::MachineAdmin < CIMI::Model::Base
+
+  text :username
+  text :password
+  text :key
 
-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/volume'
+  array :operations do
+    scalar :rel, :href
+  end
+
+end

Added: deltacloud/trunk/server/spec/cimi/data/machine_admin.json
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/machine_admin.json?rev=1204551&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/machine_admin.json (added)
+++ deltacloud/trunk/server/spec/cimi/data/machine_admin.json Mon Nov 21 15:45:50 2011
@@ -0,0 +1,14 @@
+{
+  "uri": "http://cimi.example.org/machine_admins/1",
+  "name": "credentials1",
+  "description": "Machine Admin One",
+  "created": "2011-11-16",
+  "username": "mockuser",
+  "password": "mockpassword",
+  "operations": [
+  { "rel": "edit",
+    "href": "http://cimi.example.org/machine_admins/1/edit" },
+  { "rel": "delete",
+    "href": "http://cimi.example.org/machine_admins/1/delete" }
+  ]
+}

Added: deltacloud/trunk/server/spec/cimi/data/machine_admin.xml
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/data/machine_admin.xml?rev=1204551&view=auto
==============================================================================
--- deltacloud/trunk/server/spec/cimi/data/machine_admin.xml (added)
+++ deltacloud/trunk/server/spec/cimi/data/machine_admin.xml Mon Nov 21 15:45:50 2011
@@ -0,0 +1,10 @@
+<MachineAdmin xmlns="http://www.dmtf.org/cimi">
+  <uri>http://cimi.example.org/machine_admins/1</uri>
+  <name>credentials1</name>
+  <description>Machine Admin One</description>
+  <created>2011-11-16</created>
+  <username>mockuser</username>
+  <password>mockpassword</password>
+  <operation rel="edit" href="http://cimi.example.org/machine_admins/1/edit"/>
+  <operation rel="delete" href="http://cimi.example.org/machine_admins/1/delete"/>
+</MachineAdmin>

Copied: deltacloud/trunk/server/spec/cimi/model/machine_admin_spec.rb (from r1204148, deltacloud/trunk/server/lib/cimi/model.rb)
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/cimi/model/machine_admin_spec.rb?p2=deltacloud/trunk/server/spec/cimi/model/machine_admin_spec.rb&p1=deltacloud/trunk/server/lib/cimi/model.rb&r1=1204148&r2=1204551&rev=1204551&view=diff
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model.rb (original)
+++ deltacloud/trunk/server/spec/cimi/model/machine_admin_spec.rb Mon Nov 21 15:45:50 2011
@@ -14,15 +14,25 @@
 # under the License.
 #
 
-# Declare namespace for CIMI model
-#
-module CIMI
-  module Model; end
-end
+describe "MachineAdmin model" do
+
+  before(:all) do
+    @xml = IO::read(File::join(DATA_DIR, "machine_admin.xml"))
+    @json = IO::read(File::join(DATA_DIR, "machine_admin.json"))
+  end
+
+  it "can be constructed from XML" do
+    conf = CIMI::Model::MachineAdmin.from_xml(@xml)
+    conf.should_not be_nil
+    should_serialize_from_xml! conf, @xml, @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/volume'
+  it "can be constructed from JSON" do
+    conf = CIMI::Model::MachineAdmin.from_json(@json)
+    conf.should_not be_nil
+    should_serialize_from_json! conf, @xml, @json
+  end
+
+
+
+end



Mime
View raw message