From f8afe3860be8a0e58b1e5281d3fc8ae58e4db3cb Mon Sep 17 00:00:00 2001 From: Dmitri Babaev Date: Fri, 8 Apr 2011 22:29:41 +0400 Subject: [PATCH] test json output --- .../jclouds/openstack/nova/_NovaClient.java | 12 +-- .../src/test/resources/test_list_images.json | 58 +++++++++++--- .../resources/test_list_images_detail.json | 80 ++++++++++++++----- 3 files changed, 112 insertions(+), 38 deletions(-) diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/_NovaClient.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/_NovaClient.java index 23f86b6b35..d05515702a 100644 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/_NovaClient.java +++ b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/_NovaClient.java @@ -36,12 +36,12 @@ public class _NovaClient { TemplateOptions options = new TemplateOptions(); //options.authorizePublicKey(""); - Template template = cs.templateBuilder().hardwareId("m1.small").imageId("13").options(options).build(); - /*try { - cs.runNodesWithTag("test", 1, template); - } catch (RunNodesException e) { - e.printStackTrace(); - }*/ + //Template template = cs.templateBuilder().hardwareId("m1.small").imageId("13").options(options).build(); + //try { + // cs.runNodesWithTag("test", 1, template); + //} catch (RunNodesException e) { + // e.printStackTrace(); + //} //System.out.println(cs.listNodes()); //System.out.println(cs.listImages()); diff --git a/sandbox-apis/nova/src/test/resources/test_list_images.json b/sandbox-apis/nova/src/test/resources/test_list_images.json index 0c5cb251ad..5584d7cf83 100644 --- a/sandbox-apis/nova/src/test/resources/test_list_images.json +++ b/sandbox-apis/nova/src/test/resources/test_list_images.json @@ -1,12 +1,46 @@ -{ - "images" : [ - { - "id" : 2, - "name" : "CentOS 5.2" - }, - { - "id" : 743, - "name" : "My Server Backup" - } - ] -} +{ + "images" : { + "values" : [ + { + "id" : 1, + "name" : "CentOS 5.2", + "links": [ + { + "rel" : "self", + "href" : "http://servers.api.openstack.org/v1.1/1234/images/1" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+xml", + "href" : "http://servers.api.openstack.org/1234/images/1" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+json", + "href" : "http://servers.api.openstack.org/1234/images/1" + } + ] + }, + { + "id" : 743, + "name" : "My Server Backup", + "links": [ + { + "rel" : "self", + "href" : "http://servers.api.openstack.org/v1.1/1234/images/743" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+xml", + "href" : "http://servers.api.openstack.org/1234/images/743" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+json", + "href" : "http://servers.api.openstack.org/1234/images/743" + } + ] + } + ] + } +} diff --git a/sandbox-apis/nova/src/test/resources/test_list_images_detail.json b/sandbox-apis/nova/src/test/resources/test_list_images_detail.json index bdafc2ded3..722d1936d8 100644 --- a/sandbox-apis/nova/src/test/resources/test_list_images_detail.json +++ b/sandbox-apis/nova/src/test/resources/test_list_images_detail.json @@ -1,20 +1,60 @@ -{ - "images" : [ - { - "id" : 2, - "name" : "CentOS 5.2", - "updated" : "2010-10-10T12:00:00Z", - "created" : "2010-08-10T12:00:00Z", - "status" : "ACTIVE" - }, - { - "id" : 743, - "name" : "My Server Backup", - "serverId" : 12, - "updated" : "2010-10-10T12:00:00Z", - "created" : "2009-07-07T09:56:16-05:00", - "status" : "SAVING", - "progress" : 80 - } - ] -} +{ + "images" : { + "values" : [ + { + "id" : 1, + "name" : "CentOS 5.2", + "updated" : "2010-10-10T12:00:00Z", + "created" : "2010-08-10T12:00:00Z", + "status" : "ACTIVE", + "metadata" : { + "values" : { + "ImageType" : "Gold", + "ImageVersion" : "1.5" + } + }, + "links": [ + { + "rel" : "self", + "href" : "http://servers.api.openstack.org/v1.1/1234/images/1" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+xml", + "href" : "http://servers.api.openstack.org/1234/images/1" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+json", + "href" : "http://servers.api.openstack.org/1234/images/1" + } + ] + }, + { + "id" : 743, + "name" : "My Server Backup", + "serverRef" : "http://servers.api.openstack.org/v1.1/1234/servers/12", + "updated" : "2010-10-10T12:00:00Z", + "created" : "2010-08-10T12:00:00Z", + "status" : "SAVING", + "progress" : 80, + "links": [ + { + "rel" : "self", + "href" : "http://servers.api.openstack.org/v1.1/1234/images/743" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+xml", + "href" : "http://servers.api.openstack.org/1234/images/743" + }, + { + "rel" : "bookmark", + "type" : "application/vnd.openstack.compute-v1.1+json", + "href" : "http://servers.api.openstack.org/1234/images/743" + } + ] + } + ] + } +}