You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2012/11/09 20:49:38 UTC
[4/9] git commit: CIMI unit tests: compact the file hierarchy of
tests some
CIMI unit tests: compact the file hierarchy of tests some
We used to keep the model tests in tests/cimi/spec/cimi/models, which was
way deeper than we needed. This patch moves those tests to
tests/cimi/models and the corresponding test data to tests/cimi/data
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/01305cf1
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/01305cf1
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/01305cf1
Branch: refs/heads/master
Commit: 01305cf17179e448618fb17b5da82c73f08c8deb
Parents: 34f0402
Author: David Lutterkort <lu...@redhat.com>
Authored: Wed Oct 10 14:51:13 2012 -0700
Committer: David Lutterkort <lu...@redhat.com>
Committed: Fri Nov 9 11:48:42 2012 -0800
----------------------------------------------------------------------
server/Rakefile | 4 +-
server/tests/cimi/data/container.json | 8 +
server/tests/cimi/data/container.xml | 9 +
server/tests/cimi/data/credential.json | 15 +
server/tests/cimi/data/credential.xml | 10 +
server/tests/cimi/data/machine.json | 26 ++
server/tests/cimi/data/machine.xml | 17 +
server/tests/cimi/data/machine_configuration.json | 18 +
server/tests/cimi/data/machine_configuration.xml | 14 +
server/tests/cimi/data/machine_image.json | 15 +
server/tests/cimi/data/machine_image.xml | 11 +
server/tests/cimi/data/machine_template.json | 31 ++
server/tests/cimi/data/machine_template.xml | 24 ++
server/tests/cimi/data/volume.json | 17 +
server/tests/cimi/data/volume.xml | 12 +
server/tests/cimi/data/volume_configuration.json | 17 +
server/tests/cimi/data/volume_configuration.xml | 12 +
server/tests/cimi/data/volume_image.json | 15 +
server/tests/cimi/data/volume_image.xml | 10 +
server/tests/cimi/data/volume_template.json | 15 +
server/tests/cimi/data/volume_template.xml | 10 +
server/tests/cimi/model/collection_spec.rb | 109 +++++++
server/tests/cimi/model/credential_spec.rb | 35 ++
.../tests/cimi/model/machine_configuration_spec.rb | 31 ++
server/tests/cimi/model/machine_image_spec.rb | 33 ++
server/tests/cimi/model/machine_spec.rb | 32 ++
server/tests/cimi/model/machine_template_spec.rb | 32 ++
server/tests/cimi/model/schema_spec.rb | 245 +++++++++++++++
.../tests/cimi/model/volume_configuration_spec.rb | 34 ++
server/tests/cimi/model/volume_image_spec.rb | 33 ++
server/tests/cimi/model/volume_spec.rb | 32 ++
server/tests/cimi/model/volume_template_spec.rb | 32 ++
server/tests/cimi/spec/cimi/data/container.json | 8 -
server/tests/cimi/spec/cimi/data/container.xml | 9 -
server/tests/cimi/spec/cimi/data/credential.json | 15 -
server/tests/cimi/spec/cimi/data/credential.xml | 10 -
server/tests/cimi/spec/cimi/data/machine.json | 26 --
server/tests/cimi/spec/cimi/data/machine.xml | 17 -
.../cimi/spec/cimi/data/machine_configuration.json | 18 -
.../cimi/spec/cimi/data/machine_configuration.xml | 14 -
.../tests/cimi/spec/cimi/data/machine_image.json | 15 -
server/tests/cimi/spec/cimi/data/machine_image.xml | 11 -
.../cimi/spec/cimi/data/machine_template.json | 31 --
.../tests/cimi/spec/cimi/data/machine_template.xml | 24 --
server/tests/cimi/spec/cimi/data/volume.json | 17 -
server/tests/cimi/spec/cimi/data/volume.xml | 12 -
.../cimi/spec/cimi/data/volume_configuration.json | 17 -
.../cimi/spec/cimi/data/volume_configuration.xml | 12 -
server/tests/cimi/spec/cimi/data/volume_image.json | 15 -
server/tests/cimi/spec/cimi/data/volume_image.xml | 10 -
.../tests/cimi/spec/cimi/data/volume_template.json | 15 -
.../tests/cimi/spec/cimi/data/volume_template.xml | 10 -
.../tests/cimi/spec/cimi/model/collection_spec.rb | 109 -------
.../tests/cimi/spec/cimi/model/credential_spec.rb | 35 --
.../spec/cimi/model/machine_configuration_spec.rb | 31 --
.../cimi/spec/cimi/model/machine_image_spec.rb | 33 --
server/tests/cimi/spec/cimi/model/machine_spec.rb | 32 --
.../cimi/spec/cimi/model/machine_template_spec.rb | 32 --
server/tests/cimi/spec/cimi/model/schema_spec.rb | 245 ---------------
.../spec/cimi/model/volume_configuration_spec.rb | 34 --
.../cimi/spec/cimi/model/volume_image_spec.rb | 33 --
server/tests/cimi/spec/cimi/model/volume_spec.rb | 32 --
.../cimi/spec/cimi/model/volume_template_spec.rb | 32 --
server/tests/cimi/spec/spec_helper.rb | 136 --------
server/tests/cimi/spec_helper.rb | 136 ++++++++
65 files changed, 1092 insertions(+), 1092 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/Rakefile
----------------------------------------------------------------------
diff --git a/server/Rakefile b/server/Rakefile
index 34c126e..4d1323f 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -199,8 +199,8 @@ namespace :test do
t.loader = :testrb
end
t.test_files = FileList[
- 'tests/cimi/spec/cimi/model/*spec.rb', # CIMI frontend serialization API tests
- 'tests/cimi/collections/*test.rb', # CIMI frontend API tests
+ 'tests/cimi/model/*spec.rb', # CIMI frontend serialization API tests
+ 'tests/cimi/collections/*test.rb', # CIMI frontend API tests
]
end
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/container.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/container.json b/server/tests/cimi/data/container.json
new file mode 100644
index 0000000..522c6f2
--- /dev/null
+++ b/server/tests/cimi/data/container.json
@@ -0,0 +1,8 @@
+{ "id": "http://example.com/cimi",
+ "models": {
+ "href": "http://example.com/cimi/models",
+ "count": 2,
+ "id": "http://example.com/cimi/models",
+ "models": [ {"text":"m1"}, {"text":"m2"} ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/container.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/container.xml b/server/tests/cimi/data/container.xml
new file mode 100644
index 0000000..eec6ab7
--- /dev/null
+++ b/server/tests/cimi/data/container.xml
@@ -0,0 +1,9 @@
+<Container xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://example.com/cimi</id>
+ <models href="http://example.com/cimi/models">
+ <id>http://example.com/cimi/models</id>
+ <count>2</count>
+ <Model text="m1" />
+ <Model text="m2" />
+ </models>
+</Container>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/credential.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/credential.json b/server/tests/cimi/data/credential.json
new file mode 100644
index 0000000..1813446
--- /dev/null
+++ b/server/tests/cimi/data/credential.json
@@ -0,0 +1,15 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/Credential",
+ "id": "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" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/credential.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/credential.xml b/server/tests/cimi/data/credential.xml
new file mode 100644
index 0000000..7942ff6
--- /dev/null
+++ b/server/tests/cimi/data/credential.xml
@@ -0,0 +1,10 @@
+<Credential xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/machine_admins/1</id>
+ <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"/>
+</Credential>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine.json b/server/tests/cimi/data/machine.json
new file mode 100644
index 0000000..755d421
--- /dev/null
+++ b/server/tests/cimi/data/machine.json
@@ -0,0 +1,26 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/Machine",
+ "id": "http://cimi.example.org/machines/1",
+ "name": "machine1",
+ "description": "Machine one description",
+ "created": "2011-11-21",
+ "properties": { "owner_id": "mockuser" },
+ "state": "STARTED",
+ "cpu": "4",
+ "memory":12582912,
+ "disks":{"href":"http://cimi.example.org/cimi/machines/1/disks"},
+ "volumes":{"href":"http://cimi.example.org/cimi/machines/1/volumes"},
+ "meters": [
+ { "href": "http://cimi.example.org/meters/1" }
+ ],
+ "operations": [
+ { "rel": "edit",
+ "href": "http://cimi.example.org/machines/1/edit" },
+ { "rel": "delete",
+ "href": "http://cimi.example.org/machines/1/delete" },
+ { "rel": "http://schemas.dmtf.org/cimi/1/action/stop",
+ "href": "http://cimi.example.org/machines/1/stop" },
+ { "rel": "http://schemas.dmtf.org/cimi/1/action/restart",
+ "href": "http://cimi.example.org/machines/1/restart" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine.xml b/server/tests/cimi/data/machine.xml
new file mode 100644
index 0000000..f33c774
--- /dev/null
+++ b/server/tests/cimi/data/machine.xml
@@ -0,0 +1,17 @@
+<Machine xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/machines/1</id>
+ <name>machine1</name>
+ <description>Machine one description</description>
+ <created>2011-11-21</created>
+ <property name="owner_id">mockuser</property>
+ <cpu>4</cpu>
+ <memory>12582912</memory>
+ <disks href="http://cimi.example.org/cimi/machines/1/disks" />
+ <volumes href="http://cimi.example.org/cimi/machines/1/volumes" />
+ <state>STARTED</state>
+ <meter href="http://cimi.example.org/meters/1"/>
+ <operation rel="edit" href="http://cimi.example.org/machines/1/edit"/>
+ <operation rel="delete" href="http://cimi.example.org/machines/1/delete"/>
+ <operation rel="http://schemas.dmtf.org/cimi/1/action/stop" href="http://cimi.example.org/machines/1/stop"/>
+ <operation rel="http://schemas.dmtf.org/cimi/1/action/restart" href="http://cimi.example.org/machines/1/restart"/>
+</Machine>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_configuration.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_configuration.json b/server/tests/cimi/data/machine_configuration.json
new file mode 100644
index 0000000..0ecf095
--- /dev/null
+++ b/server/tests/cimi/data/machine_configuration.json
@@ -0,0 +1,18 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineConfiguration",
+ "id": "http://cimi.example.org/machine_configurations/1",
+ "name": "MachineConfiguration1",
+ "description": "Example MachineConfiguration One",
+ "created": "2011-11-14",
+ "cpu": "2",
+ "memory":1048576,
+ "disks": [
+ {"capacity":1073741824}
+ ],
+ "properties": { "architecture": "i386" },
+ "operations": [
+ { "rel": "edit",
+ "href": "http://cimi.example.org/machine_configurations/1/edit" },
+ { "rel": "delete",
+ "href": "http://cimi.example.org/machine_configurations/1/delete" }]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_configuration.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_configuration.xml b/server/tests/cimi/data/machine_configuration.xml
new file mode 100644
index 0000000..9f451a6
--- /dev/null
+++ b/server/tests/cimi/data/machine_configuration.xml
@@ -0,0 +1,14 @@
+<MachineConfiguration xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/machine_configurations/1</id>
+ <name>MachineConfiguration1</name>
+ <description>Example MachineConfiguration One</description>
+ <created>2011-11-14</created>
+ <property name="architecture">i386</property>
+ <cpu>2</cpu>
+ <memory>1048576</memory>
+ <disk>
+ <capacity>1073741824</capacity>
+ </disk>
+ <operation rel="edit" href="http://cimi.example.org/machine_configurations/1/edit"/>
+ <operation rel="delete" href="http://cimi.example.org/machine_configurations/1/delete"/>
+</MachineConfiguration>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_image.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_image.json b/server/tests/cimi/data/machine_image.json
new file mode 100644
index 0000000..ae83460
--- /dev/null
+++ b/server/tests/cimi/data/machine_image.json
@@ -0,0 +1,15 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineImage",
+ "id": "http://cimi.example.org/machine_images/1",
+ "name": "img1",
+ "description": "Machine Image One",
+ "created": "2011-11-14",
+ "imageLocation": { "href": "nfs://cimi.example.com/images/1.img" },
+ "properties": { "status": "BUILD", "locked": "true" },
+ "operations": [
+ { "rel": "edit",
+ "href": "http://cimi.example.org/machine_images/1/edit" },
+ { "rel": "delete",
+ "href": "http://cimi.example.org/machine_images/1/delete" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_image.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_image.xml b/server/tests/cimi/data/machine_image.xml
new file mode 100644
index 0000000..1f7b46c
--- /dev/null
+++ b/server/tests/cimi/data/machine_image.xml
@@ -0,0 +1,11 @@
+<MachineImage xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/machine_images/1</id>
+ <name>img1</name>
+ <description>Machine Image One</description>
+ <created>2011-11-14</created>
+ <property name="status">BUILD</property>
+ <property name="locked">true</property>
+ <imageLocation href="nfs://cimi.example.com/images/1.img"/>
+ <operation rel="edit" href="http://cimi.example.org/machine_images/1/edit"/>
+ <operation rel="delete" href="http://cimi.example.org/machine_images/1/delete"/>
+</MachineImage>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_template.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_template.json b/server/tests/cimi/data/machine_template.json
new file mode 100644
index 0000000..816541c
--- /dev/null
+++ b/server/tests/cimi/data/machine_template.json
@@ -0,0 +1,31 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineTemplate",
+ "id": "http://cimi.example.org/machine_templates/1",
+ "name": "My First Template",
+ "description": "A template for testing",
+ "created": "2011-11-01",
+ "machineConfig": { "href": "http://cimi.example.org/machine_configs/1" },
+ "machineImage": { "href": "http://cimi.example.org/machine_images/1" },
+ "volumes": [{
+ "href": "http://cimi.example.org/volumes/1",
+ "attachmentPoint": "/dev/sda",
+ "protocol": "nfs"
+ }],
+ "networkInterfaces": [{
+ "vsp": { "href": "http://cimi.example.org/vsps/1" },
+ "hostname": "host.cimi.example.org",
+ "macAddress": "00:11:22:33:44:55",
+ "state": "UP",
+ "protocol": "TCP",
+ "allocation": "static",
+ "address": "192.168.0.17",
+ "defaultGateway": "192.168.0.1",
+ "dns": "192.168.0.1",
+ "maxTransmissionUnit": "1500"
+ }],
+ "operations": [
+ { "rel": "edit",
+ "href": "http://cimi.example.org/machine_templates/1/edit" },
+ { "rel": "delete",
+ "href": "http://cimi.example.org/machine_templates/1/delete" }]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/machine_template.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/machine_template.xml b/server/tests/cimi/data/machine_template.xml
new file mode 100644
index 0000000..fed655c
--- /dev/null
+++ b/server/tests/cimi/data/machine_template.xml
@@ -0,0 +1,24 @@
+<MachineTemplate xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/machine_templates/1</id>
+ <name>My First Template</name>
+ <description>A template for testing</description>
+ <created>2011-11-01</created>
+ <machineConfig href="http://cimi.example.org/machine_configs/1"/>
+ <machineImage href="http://cimi.example.org/machine_images/1"/>
+ <volume href="http://cimi.example.org/volumes/1"
+ attachmentPoint="/dev/sda" protocol="nfs" />
+ <networkInterface>
+ <vsp href="http://cimi.example.org/vsps/1"/>
+ <hostname>host.cimi.example.org</hostname>
+ <macAddress>00:11:22:33:44:55</macAddress>
+ <state>UP</state>
+ <protocol>TCP</protocol>
+ <allocation>static</allocation>
+ <address>192.168.0.17</address>
+ <defaultGateway>192.168.0.1</defaultGateway>
+ <dns>192.168.0.1</dns>
+ <maxTransmissionUnit>1500</maxTransmissionUnit>
+ </networkInterface>
+ <operation rel="edit" href="http://cimi.example.org/machine_templates/1/edit"/>
+ <operation rel="delete" href="http://cimi.example.org/machine_templates/1/delete"/>
+</MachineTemplate>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume.json b/server/tests/cimi/data/volume.json
new file mode 100644
index 0000000..63a05a3
--- /dev/null
+++ b/server/tests/cimi/data/volume.json
@@ -0,0 +1,17 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/Volume",
+ "id": "http://cimi.example.org/volumes/1",
+ "name": "volume1",
+ "description": "Volume One",
+ "created": "2011-11-17",
+ "capacity": { "quantity": "10", "units": "gigabyte" },
+ "bootable": "false",
+ "supportsSnapshots": "false",
+ "guestInterface": "NFS",
+ "operations": [
+ { "rel": "edit",
+ "href": "http://cimi.example.org/volumes/1/edit" },
+ { "rel": "delete",
+ "href": "http://cimi.example.org/volumes/1/delete" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume.xml b/server/tests/cimi/data/volume.xml
new file mode 100644
index 0000000..6178234
--- /dev/null
+++ b/server/tests/cimi/data/volume.xml
@@ -0,0 +1,12 @@
+<Volume xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/volumes/1</id>
+ <name>volume1</name>
+ <description>Volume One</description>
+ <created>2011-11-17</created>
+ <capacity quantity="10" units="gigabyte"/>
+ <bootable>false</bootable>
+ <supportsSnapshots>false</supportsSnapshots>
+ <guestInterface>NFS</guestInterface>
+ <operation rel="edit" href="http://cimi.example.org/volumes/1/edit"/>
+ <operation rel="delete" href="http://cimi.example.org/volumes/1/delete"/>
+</Volume>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_configuration.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_configuration.json b/server/tests/cimi/data/volume_configuration.json
new file mode 100644
index 0000000..ce3ad14
--- /dev/null
+++ b/server/tests/cimi/data/volume_configuration.json
@@ -0,0 +1,17 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeConfiguration",
+ "id": "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" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_configuration.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_configuration.xml b/server/tests/cimi/data/volume_configuration.xml
new file mode 100644
index 0000000..f150700
--- /dev/null
+++ b/server/tests/cimi/data/volume_configuration.xml
@@ -0,0 +1,12 @@
+<VolumeConfiguration xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/volume_configurations/1</id>
+ <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_image.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_image.json b/server/tests/cimi/data/volume_image.json
new file mode 100644
index 0000000..47f52d1
--- /dev/null
+++ b/server/tests/cimi/data/volume_image.json
@@ -0,0 +1,15 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeImage",
+ "id": "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" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_image.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_image.xml b/server/tests/cimi/data/volume_image.xml
new file mode 100644
index 0000000..b3f25f6
--- /dev/null
+++ b/server/tests/cimi/data/volume_image.xml
@@ -0,0 +1,10 @@
+<VolumeImage xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/volume_images/1</id>
+ <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_template.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_template.json b/server/tests/cimi/data/volume_template.json
new file mode 100644
index 0000000..b5e5b05
--- /dev/null
+++ b/server/tests/cimi/data/volume_template.json
@@ -0,0 +1,15 @@
+{
+ "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeTemplate",
+ "id": "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" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/data/volume_template.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/data/volume_template.xml b/server/tests/cimi/data/volume_template.xml
new file mode 100644
index 0000000..b93c5dd
--- /dev/null
+++ b/server/tests/cimi/data/volume_template.xml
@@ -0,0 +1,10 @@
+<VolumeTemplate xmlns="http://schemas.dmtf.org/cimi/1">
+ <id>http://cimi.example.org/volume_templates/1</id>
+ <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/collection_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/collection_spec.rb b/server/tests/cimi/model/collection_spec.rb
new file mode 100644
index 0000000..ed54a44
--- /dev/null
+++ b/server/tests/cimi/model/collection_spec.rb
@@ -0,0 +1,109 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+require 'nokogiri'
+require 'json'
+
+describe "Collection class" do
+
+ BASE_URL = "http://example.com/cimi"
+ COLL_URL = BASE_URL + "/models"
+
+ class Model < CIMI::Model::Base
+ scalar :text
+ end
+
+ class Container < CIMI::Model::Base
+ collection :models, :class => Model
+ end
+
+ before do
+ @models = ["m1", "m2"].map { |s| Model.new(:text => s) }
+ @xml = IO::read(File::join(DATA_DIR, "container.xml"))
+ @json = IO::read(File::join(DATA_DIR, "container.json"))
+ end
+
+ describe "XML serialization" do
+ it "empty collection only has href" do
+ cont = Container.new(:id => BASE_URL)
+ doc = to_dom(cont)
+
+ (doc/"/c:Container/c:models/@href").text.must_equal COLL_URL
+ (doc/"/c:Container/c:models/c:id").size.must_equal 0
+ end
+
+ it "contains count of models" do
+ cont = Container.new(:id => BASE_URL, :models => @models)
+ doc = to_dom(cont)
+
+ (doc/"/c:Container/c:models/c:count").text.must_equal "2"
+ (doc/"/c:Container/c:models/c:Model").size.must_equal 2
+ end
+ end
+
+ describe "JSON serialization" do
+ it "empty collection only has href" do
+ cont = Container.new(:id => BASE_URL)
+ json = to_json(cont)
+
+ json["models"]["href"].must_equal COLL_URL
+ json["models"].keys.must_equal ["href"]
+ end
+
+ it "contains count of models" do
+ cont = Container.new(:id => BASE_URL, :models => @models)
+ json = to_json(cont)
+
+ json["models"]["count"].must_equal 2
+ json["models"]["models"].size.must_equal 2
+ end
+ end
+
+ it "deserializes from XML" do
+ cont = Container.from_xml(@xml)
+ cont.id.must_equal BASE_URL
+ cont.models.count.must_equal "2"
+ cont.models.entries.size.must_equal 2
+ cont.models.entries[0].text.must_equal "m1"
+ cont.models.entries[1].text.must_equal "m2"
+ end
+
+ it "deserializes from JSON" do
+ cont = Container.from_json(@json)
+ cont.id.must_equal BASE_URL
+ # FIXME: This is a very annoying difference between XML and JSON; in XML
+ # all scalars are strings, in JSON, strings that look like integers are
+ # converted to integer objects
+ cont.models.count.must_equal 2
+ cont.models.entries.size.must_equal 2
+ cont.models.entries[0].text.must_equal "m1"
+ cont.models.entries[1].text.must_equal "m2"
+ end
+
+ def to_dom(model)
+ doc = Nokogiri::XML(model.to_xml)
+ doc.root.add_namespace("c", doc.namespaces["xmlns"])
+ doc
+ end
+
+ def to_json(model)
+ JSON.parse(model.to_json)
+ end
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/credential_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/credential_spec.rb b/server/tests/cimi/model/credential_spec.rb
new file mode 100644
index 0000000..5f2df58
--- /dev/null
+++ b/server/tests/cimi/model/credential_spec.rb
@@ -0,0 +1,35 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+if require 'minitest/autorun'
+ require_relative '../spec_helper.rb'
+end
+
+describe "Credential model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "credential.xml"))
+ @json = IO::read(File::join(DATA_DIR, "credential.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::Credential, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/machine_configuration_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_configuration_spec.rb b/server/tests/cimi/model/machine_configuration_spec.rb
new file mode 100644
index 0000000..fbec2d4
--- /dev/null
+++ b/server/tests/cimi/model/machine_configuration_spec.rb
@@ -0,0 +1,31 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "MachineConfiguration model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "machine_configuration.xml"))
+ @json = IO::read(File::join(DATA_DIR, "machine_configuration.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::MachineConfiguration, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/machine_image_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_image_spec.rb b/server/tests/cimi/model/machine_image_spec.rb
new file mode 100644
index 0000000..005f966
--- /dev/null
+++ b/server/tests/cimi/model/machine_image_spec.rb
@@ -0,0 +1,33 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "MachineImage model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "machine_image.xml"))
+ @json = IO::read(File::join(DATA_DIR, "machine_image.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::MachineImage, @xml, @json
+ end
+
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/machine_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_spec.rb b/server/tests/cimi/model/machine_spec.rb
new file mode 100644
index 0000000..aa90cf3
--- /dev/null
+++ b/server/tests/cimi/model/machine_spec.rb
@@ -0,0 +1,32 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Machine model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "machine.xml"))
+ @json = IO::read(File::join(DATA_DIR, "machine.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::Machine, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/machine_template_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_template_spec.rb b/server/tests/cimi/model/machine_template_spec.rb
new file mode 100644
index 0000000..5b0c87a
--- /dev/null
+++ b/server/tests/cimi/model/machine_template_spec.rb
@@ -0,0 +1,32 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "MachineTemplate model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "machine_template.xml"))
+ @json = IO::read(File::join(DATA_DIR, "machine_template.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::MachineTemplate, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/schema_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/schema_spec.rb b/server/tests/cimi/model/schema_spec.rb
new file mode 100644
index 0000000..97b1cee
--- /dev/null
+++ b/server/tests/cimi/model/schema_spec.rb
@@ -0,0 +1,245 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Schema" do
+ before do
+ @schema = CIMI::Model::Schema.new
+ end
+
+ it "does not allow adding attributes after being used for conversion" do
+ @schema.scalar(:before)
+ @schema.from_json({})
+ lambda { @schema.scalar(:after) }.must_raise RuntimeError, 'The schema has already been used to convert objects'
+ end
+
+ describe "scalars" do
+ before(:each) do
+ @schema.scalar(:attr)
+ @schema.text(:camel_hump)
+
+ @schema.attribute_names.must_equal [:attr, :camel_hump]
+ end
+
+ let :sample_xml do
+ parse_xml("<camelHump>bumpy</camelHump>", :keep_root => true)
+ end
+
+ it "should camel case attribute names for JSON" do
+ obj = @schema.from_json("camelHump" => "bumpy")
+ obj.wont_be_nil
+ obj[:camel_hump].must_equal "bumpy"
+
+ json = @schema.to_json(obj)
+ json['camelHump'].must_equal "bumpy"
+ end
+
+ it "should camel case attribute names for XML" do
+ obj = @schema.from_xml(sample_xml)
+
+ obj.wont_be_nil
+ obj[:camel_hump].must_equal "bumpy"
+
+ xml = @schema.to_xml(obj)
+
+ xml['camelHump'].must_equal [{ "content" => "bumpy" }]
+ end
+
+ it "should allow aliasing the XML and JSON name" do
+ @schema.scalar :aliased, :xml_name => "xml", :json_name => "json"
+ obj = @schema.from_xml({"aliased" => "no", "xml" => "yes"}, {})
+ obj[:aliased].must_equal "yes"
+
+ obj = @schema.from_json({"aliased" => "no", "json" => "yes"}, {})
+ obj[:aliased].must_equal "yes"
+ end
+ end
+
+ describe "hrefs" do
+ before do
+ @schema.href(:meter)
+ end
+
+ it "should extract the href attribute from XML" do
+ xml = parse_xml("<meter href='http://example.org/'/>")
+
+ obj = @schema.from_xml(xml)
+ check obj
+ @schema.to_xml(obj).must_equal xml
+ end
+
+ it "should extract the href attribute from JSON" do
+ json = { "meter" => { "href" => "http://example.org/" } }
+
+ obj = @schema.from_json(json)
+ check obj
+ @schema.to_json(obj).must_equal json
+ end
+
+ def check(obj)
+ obj.wont_be_nil
+ obj[:meter].href.must_equal 'http://example.org/'
+ end
+ end
+
+ describe "structs" do
+ before do
+ @schema.struct(:struct, :content => :scalar) do
+ scalar :href
+ end
+ @schema.attribute_names.must_equal [:struct]
+ end
+
+ let(:sample_json) do
+ { "struct" => { "scalar" => "v1", "href" => "http://example.org/" } }
+ end
+
+ let (:sample_xml) do
+ parse_xml("<struct href='http://example.org/'>v1</struct>")
+ end
+
+ let (:sample_xml_no_href) do
+ parse_xml("<struct>v1</struct>")
+ end
+
+ describe "JSON conversion" do
+ it "should convert empty hash" do
+ model = @schema.from_json({ })
+ check_empty_struct model
+ @schema.to_json(model).keys.must_be_empty
+ end
+
+ it "should convert empty body" do
+ model = @schema.from_json({ "struct" => { } })
+ check_empty_struct model
+ @schema.to_json(model).keys.must_be_empty
+ end
+
+ it "should convert values" do
+ model = @schema.from_json(sample_json)
+ check_struct model
+ @schema.to_json(model).must_equal sample_json
+ end
+ end
+
+ describe "XML conversion" do
+ it "should convert empty hash" do
+ model = @schema.from_xml({ })
+ check_empty_struct model
+ @schema.to_xml(model).keys.must_be_empty
+ end
+
+ it "should convert empty body" do
+ model = @schema.from_json({ "struct" => { } })
+ check_empty_struct model
+ @schema.to_xml(model).keys.must_be_empty
+ end
+
+ it "should convert values" do
+ model = @schema.from_xml(sample_xml)
+ check_struct model
+ @schema.to_xml(model).must_equal sample_xml
+ end
+
+ it "should handle missing attributes" do
+ model = @schema.from_xml(sample_xml_no_href)
+ check_struct model, :nil_href => true
+ @schema.to_xml(model).must_equal sample_xml_no_href
+ end
+ end
+
+ def check_struct(obj, opts = {})
+ obj.wont_be_nil
+ obj[:struct].wont_be_nil
+ obj[:struct].scalar.must_equal "v1"
+ if opts[:nil_href]
+ obj[:struct].href.must_be_nil
+ else
+ obj[:struct].href.must_equal "http://example.org/"
+ end
+ end
+
+ def check_empty_struct(obj)
+ obj.wont_be_nil
+ obj[:struct].wont_be_nil
+ obj[:struct].scalar.must_be_nil
+ obj[:struct].href.must_be_nil
+ end
+ end
+
+ describe "arrays" do
+ before do
+ @schema.array(:structs, :content => :scalar) do
+ scalar :href
+ end
+ end
+
+ let(:sample_json) do
+ { "structs" => [{ "scalar" => "v1", "href" => "http://example.org/1" },
+ { "scalar" => "v2", "href" => "http://example.org/2" }] }
+ end
+
+ let (:sample_xml) do
+ parse_xml("<wrapper>
+ <struct href='http://example.org/1'>v1</struct>
+ <struct href='http://example.org/2'>v2</struct>
+</wrapper>", :keep_root => false)
+ end
+
+ it "should convert missing array from JSON" do
+ obj = @schema.from_json({})
+
+ obj.wont_be_nil
+ obj[:structs].must_be_empty
+ @schema.to_json(obj).keys.must_be_empty
+ end
+
+ it "should convert empty array from JSON" do
+ obj = @schema.from_json("structs" => [])
+
+ obj.wont_be_nil
+ obj[:structs].must_be_empty
+ @schema.to_json(obj).keys.must_be_empty
+ end
+
+ it "should convert arrays from JSON" do
+ obj = @schema.from_json(sample_json)
+
+ check_structs(obj)
+ @schema.to_json(obj).must_equal sample_json
+ end
+
+ it "should convert arrays from XML" do
+ obj = @schema.from_xml(sample_xml)
+
+ check_structs(obj)
+ @schema.to_xml(obj).must_equal sample_xml
+ end
+
+ def check_structs(obj)
+ obj.wont_be_nil
+ obj[:structs].size.must_equal 2
+ obj[:structs][0].scalar.must_equal "v1"
+ obj[:structs][0].href.must_equal "http://example.org/1"
+ obj[:structs][1].scalar.must_equal "v2"
+ obj[:structs][1].href.must_equal "http://example.org/2"
+ end
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/volume_configuration_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_configuration_spec.rb b/server/tests/cimi/model/volume_configuration_spec.rb
new file mode 100644
index 0000000..cbbc9d0
--- /dev/null
+++ b/server/tests/cimi/model/volume_configuration_spec.rb
@@ -0,0 +1,34 @@
+
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Volume Configuration model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "volume_configuration.xml"))
+ @json = IO::read(File::join(DATA_DIR, "volume_configuration.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::VolumeConfiguration, @xml, @json
+ end
+
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/volume_image_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_image_spec.rb b/server/tests/cimi/model/volume_image_spec.rb
new file mode 100644
index 0000000..c994b54
--- /dev/null
+++ b/server/tests/cimi/model/volume_image_spec.rb
@@ -0,0 +1,33 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Volume Image model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "volume_image.xml"))
+ @json = IO::read(File::join(DATA_DIR, "volume_image.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::VolumeImage, @xml, @json
+ end
+
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/volume_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_spec.rb b/server/tests/cimi/model/volume_spec.rb
new file mode 100644
index 0000000..e5eebd1
--- /dev/null
+++ b/server/tests/cimi/model/volume_spec.rb
@@ -0,0 +1,32 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Volume model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "volume.xml"))
+ @json = IO::read(File::join(DATA_DIR, "volume.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::Volume, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/model/volume_template_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_template_spec.rb b/server/tests/cimi/model/volume_template_spec.rb
new file mode 100644
index 0000000..c8d04c8
--- /dev/null
+++ b/server/tests/cimi/model/volume_template_spec.rb
@@ -0,0 +1,32 @@
+# 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
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative '../spec_helper.rb' if require 'minitest/autorun'
+
+describe "Volume Template model" do
+
+ before do
+ @xml = IO::read(File::join(DATA_DIR, "volume_template.xml"))
+ @json = IO::read(File::join(DATA_DIR, "volume_template.json"))
+ end
+
+ it "can be constructed from XML and JSON" do
+ should_properly_serialize_model CIMI::Model::VolumeTemplate, @xml, @json
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/container.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/container.json b/server/tests/cimi/spec/cimi/data/container.json
deleted file mode 100644
index 522c6f2..0000000
--- a/server/tests/cimi/spec/cimi/data/container.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{ "id": "http://example.com/cimi",
- "models": {
- "href": "http://example.com/cimi/models",
- "count": 2,
- "id": "http://example.com/cimi/models",
- "models": [ {"text":"m1"}, {"text":"m2"} ]
- }
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/container.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/container.xml b/server/tests/cimi/spec/cimi/data/container.xml
deleted file mode 100644
index eec6ab7..0000000
--- a/server/tests/cimi/spec/cimi/data/container.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<Container xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://example.com/cimi</id>
- <models href="http://example.com/cimi/models">
- <id>http://example.com/cimi/models</id>
- <count>2</count>
- <Model text="m1" />
- <Model text="m2" />
- </models>
-</Container>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/credential.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/credential.json b/server/tests/cimi/spec/cimi/data/credential.json
deleted file mode 100644
index 1813446..0000000
--- a/server/tests/cimi/spec/cimi/data/credential.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/Credential",
- "id": "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" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/credential.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/credential.xml b/server/tests/cimi/spec/cimi/data/credential.xml
deleted file mode 100644
index 7942ff6..0000000
--- a/server/tests/cimi/spec/cimi/data/credential.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<Credential xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/machine_admins/1</id>
- <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"/>
-</Credential>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine.json b/server/tests/cimi/spec/cimi/data/machine.json
deleted file mode 100644
index 755d421..0000000
--- a/server/tests/cimi/spec/cimi/data/machine.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/Machine",
- "id": "http://cimi.example.org/machines/1",
- "name": "machine1",
- "description": "Machine one description",
- "created": "2011-11-21",
- "properties": { "owner_id": "mockuser" },
- "state": "STARTED",
- "cpu": "4",
- "memory":12582912,
- "disks":{"href":"http://cimi.example.org/cimi/machines/1/disks"},
- "volumes":{"href":"http://cimi.example.org/cimi/machines/1/volumes"},
- "meters": [
- { "href": "http://cimi.example.org/meters/1" }
- ],
- "operations": [
- { "rel": "edit",
- "href": "http://cimi.example.org/machines/1/edit" },
- { "rel": "delete",
- "href": "http://cimi.example.org/machines/1/delete" },
- { "rel": "http://schemas.dmtf.org/cimi/1/action/stop",
- "href": "http://cimi.example.org/machines/1/stop" },
- { "rel": "http://schemas.dmtf.org/cimi/1/action/restart",
- "href": "http://cimi.example.org/machines/1/restart" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine.xml b/server/tests/cimi/spec/cimi/data/machine.xml
deleted file mode 100644
index f33c774..0000000
--- a/server/tests/cimi/spec/cimi/data/machine.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<Machine xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/machines/1</id>
- <name>machine1</name>
- <description>Machine one description</description>
- <created>2011-11-21</created>
- <property name="owner_id">mockuser</property>
- <cpu>4</cpu>
- <memory>12582912</memory>
- <disks href="http://cimi.example.org/cimi/machines/1/disks" />
- <volumes href="http://cimi.example.org/cimi/machines/1/volumes" />
- <state>STARTED</state>
- <meter href="http://cimi.example.org/meters/1"/>
- <operation rel="edit" href="http://cimi.example.org/machines/1/edit"/>
- <operation rel="delete" href="http://cimi.example.org/machines/1/delete"/>
- <operation rel="http://schemas.dmtf.org/cimi/1/action/stop" href="http://cimi.example.org/machines/1/stop"/>
- <operation rel="http://schemas.dmtf.org/cimi/1/action/restart" href="http://cimi.example.org/machines/1/restart"/>
-</Machine>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_configuration.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_configuration.json b/server/tests/cimi/spec/cimi/data/machine_configuration.json
deleted file mode 100644
index 0ecf095..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_configuration.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineConfiguration",
- "id": "http://cimi.example.org/machine_configurations/1",
- "name": "MachineConfiguration1",
- "description": "Example MachineConfiguration One",
- "created": "2011-11-14",
- "cpu": "2",
- "memory":1048576,
- "disks": [
- {"capacity":1073741824}
- ],
- "properties": { "architecture": "i386" },
- "operations": [
- { "rel": "edit",
- "href": "http://cimi.example.org/machine_configurations/1/edit" },
- { "rel": "delete",
- "href": "http://cimi.example.org/machine_configurations/1/delete" }]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_configuration.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_configuration.xml b/server/tests/cimi/spec/cimi/data/machine_configuration.xml
deleted file mode 100644
index 9f451a6..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_configuration.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<MachineConfiguration xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/machine_configurations/1</id>
- <name>MachineConfiguration1</name>
- <description>Example MachineConfiguration One</description>
- <created>2011-11-14</created>
- <property name="architecture">i386</property>
- <cpu>2</cpu>
- <memory>1048576</memory>
- <disk>
- <capacity>1073741824</capacity>
- </disk>
- <operation rel="edit" href="http://cimi.example.org/machine_configurations/1/edit"/>
- <operation rel="delete" href="http://cimi.example.org/machine_configurations/1/delete"/>
-</MachineConfiguration>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_image.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_image.json b/server/tests/cimi/spec/cimi/data/machine_image.json
deleted file mode 100644
index ae83460..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_image.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineImage",
- "id": "http://cimi.example.org/machine_images/1",
- "name": "img1",
- "description": "Machine Image One",
- "created": "2011-11-14",
- "imageLocation": { "href": "nfs://cimi.example.com/images/1.img" },
- "properties": { "status": "BUILD", "locked": "true" },
- "operations": [
- { "rel": "edit",
- "href": "http://cimi.example.org/machine_images/1/edit" },
- { "rel": "delete",
- "href": "http://cimi.example.org/machine_images/1/delete" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_image.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_image.xml b/server/tests/cimi/spec/cimi/data/machine_image.xml
deleted file mode 100644
index 1f7b46c..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_image.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<MachineImage xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/machine_images/1</id>
- <name>img1</name>
- <description>Machine Image One</description>
- <created>2011-11-14</created>
- <property name="status">BUILD</property>
- <property name="locked">true</property>
- <imageLocation href="nfs://cimi.example.com/images/1.img"/>
- <operation rel="edit" href="http://cimi.example.org/machine_images/1/edit"/>
- <operation rel="delete" href="http://cimi.example.org/machine_images/1/delete"/>
-</MachineImage>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_template.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_template.json b/server/tests/cimi/spec/cimi/data/machine_template.json
deleted file mode 100644
index 816541c..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_template.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineTemplate",
- "id": "http://cimi.example.org/machine_templates/1",
- "name": "My First Template",
- "description": "A template for testing",
- "created": "2011-11-01",
- "machineConfig": { "href": "http://cimi.example.org/machine_configs/1" },
- "machineImage": { "href": "http://cimi.example.org/machine_images/1" },
- "volumes": [{
- "href": "http://cimi.example.org/volumes/1",
- "attachmentPoint": "/dev/sda",
- "protocol": "nfs"
- }],
- "networkInterfaces": [{
- "vsp": { "href": "http://cimi.example.org/vsps/1" },
- "hostname": "host.cimi.example.org",
- "macAddress": "00:11:22:33:44:55",
- "state": "UP",
- "protocol": "TCP",
- "allocation": "static",
- "address": "192.168.0.17",
- "defaultGateway": "192.168.0.1",
- "dns": "192.168.0.1",
- "maxTransmissionUnit": "1500"
- }],
- "operations": [
- { "rel": "edit",
- "href": "http://cimi.example.org/machine_templates/1/edit" },
- { "rel": "delete",
- "href": "http://cimi.example.org/machine_templates/1/delete" }]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/machine_template.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/machine_template.xml b/server/tests/cimi/spec/cimi/data/machine_template.xml
deleted file mode 100644
index fed655c..0000000
--- a/server/tests/cimi/spec/cimi/data/machine_template.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<MachineTemplate xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/machine_templates/1</id>
- <name>My First Template</name>
- <description>A template for testing</description>
- <created>2011-11-01</created>
- <machineConfig href="http://cimi.example.org/machine_configs/1"/>
- <machineImage href="http://cimi.example.org/machine_images/1"/>
- <volume href="http://cimi.example.org/volumes/1"
- attachmentPoint="/dev/sda" protocol="nfs" />
- <networkInterface>
- <vsp href="http://cimi.example.org/vsps/1"/>
- <hostname>host.cimi.example.org</hostname>
- <macAddress>00:11:22:33:44:55</macAddress>
- <state>UP</state>
- <protocol>TCP</protocol>
- <allocation>static</allocation>
- <address>192.168.0.17</address>
- <defaultGateway>192.168.0.1</defaultGateway>
- <dns>192.168.0.1</dns>
- <maxTransmissionUnit>1500</maxTransmissionUnit>
- </networkInterface>
- <operation rel="edit" href="http://cimi.example.org/machine_templates/1/edit"/>
- <operation rel="delete" href="http://cimi.example.org/machine_templates/1/delete"/>
-</MachineTemplate>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume.json b/server/tests/cimi/spec/cimi/data/volume.json
deleted file mode 100644
index 63a05a3..0000000
--- a/server/tests/cimi/spec/cimi/data/volume.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/Volume",
- "id": "http://cimi.example.org/volumes/1",
- "name": "volume1",
- "description": "Volume One",
- "created": "2011-11-17",
- "capacity": { "quantity": "10", "units": "gigabyte" },
- "bootable": "false",
- "supportsSnapshots": "false",
- "guestInterface": "NFS",
- "operations": [
- { "rel": "edit",
- "href": "http://cimi.example.org/volumes/1/edit" },
- { "rel": "delete",
- "href": "http://cimi.example.org/volumes/1/delete" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume.xml b/server/tests/cimi/spec/cimi/data/volume.xml
deleted file mode 100644
index 6178234..0000000
--- a/server/tests/cimi/spec/cimi/data/volume.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<Volume xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/volumes/1</id>
- <name>volume1</name>
- <description>Volume One</description>
- <created>2011-11-17</created>
- <capacity quantity="10" units="gigabyte"/>
- <bootable>false</bootable>
- <supportsSnapshots>false</supportsSnapshots>
- <guestInterface>NFS</guestInterface>
- <operation rel="edit" href="http://cimi.example.org/volumes/1/edit"/>
- <operation rel="delete" href="http://cimi.example.org/volumes/1/delete"/>
-</Volume>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_configuration.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_configuration.json b/server/tests/cimi/spec/cimi/data/volume_configuration.json
deleted file mode 100644
index ce3ad14..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_configuration.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeConfiguration",
- "id": "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" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_configuration.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_configuration.xml b/server/tests/cimi/spec/cimi/data/volume_configuration.xml
deleted file mode 100644
index f150700..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_configuration.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<VolumeConfiguration xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/volume_configurations/1</id>
- <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_image.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_image.json b/server/tests/cimi/spec/cimi/data/volume_image.json
deleted file mode 100644
index 47f52d1..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_image.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeImage",
- "id": "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" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_image.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_image.xml b/server/tests/cimi/spec/cimi/data/volume_image.xml
deleted file mode 100644
index b3f25f6..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_image.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<VolumeImage xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/volume_images/1</id>
- <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_template.json
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_template.json b/server/tests/cimi/spec/cimi/data/volume_template.json
deleted file mode 100644
index b5e5b05..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_template.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "resourceURI": "http://schemas.dmtf.org/cimi/1/VolumeTemplate",
- "id": "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" }
- ]
-}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/data/volume_template.xml
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/data/volume_template.xml b/server/tests/cimi/spec/cimi/data/volume_template.xml
deleted file mode 100644
index b93c5dd..0000000
--- a/server/tests/cimi/spec/cimi/data/volume_template.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<VolumeTemplate xmlns="http://schemas.dmtf.org/cimi/1">
- <id>http://cimi.example.org/volume_templates/1</id>
- <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>
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/collection_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/collection_spec.rb b/server/tests/cimi/spec/cimi/model/collection_spec.rb
deleted file mode 100644
index a3a43c0..0000000
--- a/server/tests/cimi/spec/cimi/model/collection_spec.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-
-require_relative '../../spec_helper.rb' if require 'minitest/autorun'
-
-require 'nokogiri'
-require 'json'
-
-describe "Collection class" do
-
- BASE_URL = "http://example.com/cimi"
- COLL_URL = BASE_URL + "/models"
-
- class Model < CIMI::Model::Base
- scalar :text
- end
-
- class Container < CIMI::Model::Base
- collection :models, :class => Model
- end
-
- before do
- @models = ["m1", "m2"].map { |s| Model.new(:text => s) }
- @xml = IO::read(File::join(DATA_DIR, "container.xml"))
- @json = IO::read(File::join(DATA_DIR, "container.json"))
- end
-
- describe "XML serialization" do
- it "empty collection only has href" do
- cont = Container.new(:id => BASE_URL)
- doc = to_dom(cont)
-
- (doc/"/c:Container/c:models/@href").text.must_equal COLL_URL
- (doc/"/c:Container/c:models/c:id").size.must_equal 0
- end
-
- it "contains count of models" do
- cont = Container.new(:id => BASE_URL, :models => @models)
- doc = to_dom(cont)
-
- (doc/"/c:Container/c:models/c:count").text.must_equal "2"
- (doc/"/c:Container/c:models/c:Model").size.must_equal 2
- end
- end
-
- describe "JSON serialization" do
- it "empty collection only has href" do
- cont = Container.new(:id => BASE_URL)
- json = to_json(cont)
-
- json["models"]["href"].must_equal COLL_URL
- json["models"].keys.must_equal ["href"]
- end
-
- it "contains count of models" do
- cont = Container.new(:id => BASE_URL, :models => @models)
- json = to_json(cont)
-
- json["models"]["count"].must_equal 2
- json["models"]["models"].size.must_equal 2
- end
- end
-
- it "deserializes from XML" do
- cont = Container.from_xml(@xml)
- cont.id.must_equal BASE_URL
- cont.models.count.must_equal "2"
- cont.models.entries.size.must_equal 2
- cont.models.entries[0].text.must_equal "m1"
- cont.models.entries[1].text.must_equal "m2"
- end
-
- it "deserializes from JSON" do
- cont = Container.from_json(@json)
- cont.id.must_equal BASE_URL
- # FIXME: This is a very annoying difference between XML and JSON; in XML
- # all scalars are strings, in JSON, strings that look like integers are
- # converted to integer objects
- cont.models.count.must_equal 2
- cont.models.entries.size.must_equal 2
- cont.models.entries[0].text.must_equal "m1"
- cont.models.entries[1].text.must_equal "m2"
- end
-
- def to_dom(model)
- doc = Nokogiri::XML(model.to_xml)
- doc.root.add_namespace("c", doc.namespaces["xmlns"])
- doc
- end
-
- def to_json(model)
- JSON.parse(model.to_json)
- end
-end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/credential_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/credential_spec.rb b/server/tests/cimi/spec/cimi/model/credential_spec.rb
deleted file mode 100644
index 8c8cafc..0000000
--- a/server/tests/cimi/spec/cimi/model/credential_spec.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-
-if require 'minitest/autorun'
- require_relative '../../spec_helper.rb'
-end
-
-describe "Credential model" do
-
- before do
- @xml = IO::read(File::join(DATA_DIR, "credential.xml"))
- @json = IO::read(File::join(DATA_DIR, "credential.json"))
- end
-
- it "can be constructed from XML and JSON" do
- should_properly_serialize_model CIMI::Model::Credential, @xml, @json
- end
-
-end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/machine_configuration_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/machine_configuration_spec.rb b/server/tests/cimi/spec/cimi/model/machine_configuration_spec.rb
deleted file mode 100644
index f6011e9..0000000
--- a/server/tests/cimi/spec/cimi/model/machine_configuration_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-require_relative '../../spec_helper.rb' if require 'minitest/autorun'
-
-describe "MachineConfiguration model" do
-
- before do
- @xml = IO::read(File::join(DATA_DIR, "machine_configuration.xml"))
- @json = IO::read(File::join(DATA_DIR, "machine_configuration.json"))
- end
-
- it "can be constructed from XML and JSON" do
- should_properly_serialize_model CIMI::Model::MachineConfiguration, @xml, @json
- end
-
-end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/machine_image_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/machine_image_spec.rb b/server/tests/cimi/spec/cimi/model/machine_image_spec.rb
deleted file mode 100644
index 204f27f..0000000
--- a/server/tests/cimi/spec/cimi/model/machine_image_spec.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-
-require_relative '../../spec_helper.rb' if require 'minitest/autorun'
-
-describe "MachineImage model" do
-
- before do
- @xml = IO::read(File::join(DATA_DIR, "machine_image.xml"))
- @json = IO::read(File::join(DATA_DIR, "machine_image.json"))
- end
-
- it "can be constructed from XML and JSON" do
- should_properly_serialize_model CIMI::Model::MachineImage, @xml, @json
- end
-
-
-end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/machine_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/machine_spec.rb b/server/tests/cimi/spec/cimi/model/machine_spec.rb
deleted file mode 100644
index d2001e2..0000000
--- a/server/tests/cimi/spec/cimi/model/machine_spec.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-
-require_relative '../../spec_helper.rb' if require 'minitest/autorun'
-
-describe "Machine model" do
-
- before do
- @xml = IO::read(File::join(DATA_DIR, "machine.xml"))
- @json = IO::read(File::join(DATA_DIR, "machine.json"))
- end
-
- it "can be constructed from XML and JSON" do
- should_properly_serialize_model CIMI::Model::Machine, @xml, @json
- end
-
-end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/01305cf1/server/tests/cimi/spec/cimi/model/machine_template_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec/cimi/model/machine_template_spec.rb b/server/tests/cimi/spec/cimi/model/machine_template_spec.rb
deleted file mode 100644
index cc2aef6..0000000
--- a/server/tests/cimi/spec/cimi/model/machine_template_spec.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-require 'rubygems'
-require 'require_relative' if RUBY_VERSION < '1.9'
-
-require_relative '../../spec_helper.rb' if require 'minitest/autorun'
-
-describe "MachineTemplate model" do
-
- before do
- @xml = IO::read(File::join(DATA_DIR, "machine_template.xml"))
- @json = IO::read(File::join(DATA_DIR, "machine_template.json"))
- end
-
- it "can be constructed from XML and JSON" do
- should_properly_serialize_model CIMI::Model::MachineTemplate, @xml, @json
- end
-
-end