You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2016/06/20 23:12:14 UTC
jclouds git commit: Make links nullable
Repository: jclouds
Updated Branches:
refs/heads/master 1d192dfe5 -> 112c64e92
Make links nullable
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/112c64e9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/112c64e9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/112c64e9
Branch: refs/heads/master
Commit: 112c64e92a047bcd4771f4cafd6460ce30bbdb82
Parents: 1d192df
Author: Arvind Nadendla <ar...@gmail.com>
Authored: Sat Jun 18 23:49:38 2016 -0700
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Mon Jun 20 18:11:12 2016 -0500
----------------------------------------------------------------------
.../jclouds/openstack/v2_0/domain/Resource.java | 9 ++++---
.../parse/ParseExtensionListNormalTest.java | 26 ++++++++++--------
.../test/resources/extension_list_normal.json | 28 +++++++++++++++++---
.../src/test/resources/flavor_new.json | 3 +--
4 files changed, 45 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/112c64e9/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/domain/Resource.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/domain/Resource.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/domain/Resource.java
index 1824835..df5231a 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/domain/Resource.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/domain/Resource.java
@@ -49,7 +49,7 @@ public class Resource implements Comparable<Resource> {
protected String id;
protected String name;
- protected Set<Link> links = ImmutableSet.of();
+ protected Set<Link> links;
/**
* @see Resource#getId()
@@ -71,12 +71,12 @@ public class Resource implements Comparable<Resource> {
* @see Resource#getLinks()
*/
public T links(Set<Link> links) {
- this.links = ImmutableSet.copyOf(checkNotNull(links, "links"));
+ this.links = links == null ? null : ImmutableSet.copyOf(links);
return self();
}
public T links(Link... in) {
- return links(ImmutableSet.copyOf(in));
+ return links(in == null ? null : ImmutableSet.copyOf(in));
}
public Resource build() {
@@ -108,7 +108,7 @@ public class Resource implements Comparable<Resource> {
protected Resource(String id, @Nullable String name, @Nullable Set<Link> links) {
this.id = checkNotNull(id, "id");
this.name = name;
- this.links = links == null ? ImmutableSet.<Link>of() : ImmutableSet.copyOf(checkNotNull(links, "links"));
+ this.links = links == null ? null : ImmutableSet.copyOf(links);
}
/**
@@ -132,6 +132,7 @@ public class Resource implements Comparable<Resource> {
/**
* @return the links of the id address allocated to the new server
*/
+ @Nullable
public Set<Link> getLinks() {
return this.links;
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/112c64e9/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
index 8bdef8a..8a65a29 100644
--- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
+++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseExtensionListNormalTest.java
@@ -27,6 +27,7 @@ import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule;
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
import org.jclouds.openstack.v2_0.domain.Extension;
+import org.jclouds.openstack.v2_0.domain.Link;
import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test;
@@ -47,22 +48,25 @@ public class ParseExtensionListNormalTest extends BaseSetParserTest<Extension> {
@Consumes(MediaType.APPLICATION_JSON)
public Set<Extension> expected() {
return ImmutableSet.of(
- Extension.builder().alias("os-keypairs").name("Keypairs")
- .namespace(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1"))
- .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-08-08T00:00:00+00:00"))
- .description("Keypair Support").build(),
- Extension.builder().alias("os-volumes").name("Volumes")
- .namespace(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1"))
- .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-03-25T00:00:00+00:00"))
- .description("Volumes support").build(),
+ Extension.builder().alias("os-keypairs").name("Keypairs").namespace(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-08-08T00:00:00+00:00")).description("Keypair Support")
+ .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/keypairs/api/v1.1")).build())
+ .build(),
+ Extension.builder().alias("os-volumes").name("Volumes").namespace(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1"))
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-03-25T00:00:00+00:00")).description("Volumes support")
+ .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/volumes/api/v1.1")).build())
+ .build(),
Extension.builder().alias("security_groups").name("SecurityGroups")
.namespace(URI.create("http://docs.openstack.org/ext/securitygroups/api/v1.1"))
.updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-07-21T00:00:00+00:00"))
- .description("Security group support").build(),
+ .description("Security group support")
+ .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/securitygroups/api/v1.1")).build())
+ .build(),
Extension.builder().alias("os-floating-ips").name("Floating_ips")
.namespace(URI.create("http://docs.openstack.org/ext/floating_ips/api/v1.1"))
- .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-06-16T00:00:00+00:00"))
- .description("Floating IPs support").build());
+ .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-06-16T00:00:00+00:00")).description("Floating IPs support")
+ .links(Link.builder().relation(Link.Relation.SELF).href(URI.create("http://docs.openstack.org/ext/floating_ips/api/v1.1")).build())
+ .build());
}
protected Injector injector() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/112c64e9/apis/openstack-nova/src/test/resources/extension_list_normal.json
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/test/resources/extension_list_normal.json b/apis/openstack-nova/src/test/resources/extension_list_normal.json
index 211338d..e672575 100644
--- a/apis/openstack-nova/src/test/resources/extension_list_normal.json
+++ b/apis/openstack-nova/src/test/resources/extension_list_normal.json
@@ -3,7 +3,12 @@
{
"updated": "2011-08-08T00:00:00+00:00",
"name": "Keypairs",
- "links": [],
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://docs.openstack.org/ext/keypairs/api/v1.1"
+ }
+ ],
"namespace": "http://docs.openstack.org/ext/keypairs/api/v1.1",
"alias": "os-keypairs",
"description": "Keypair Support"
@@ -11,7 +16,12 @@
{
"updated": "2011-03-25T00:00:00+00:00",
"name": "Volumes",
- "links": [],
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://docs.openstack.org/ext/volumes/api/v1.1"
+ }
+ ],
"namespace": "http://docs.openstack.org/ext/volumes/api/v1.1",
"alias": "os-volumes",
"description": "Volumes support"
@@ -19,7 +29,12 @@
{
"updated": "2011-07-21T00:00:00+00:00",
"name": "SecurityGroups",
- "links": [],
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://docs.openstack.org/ext/securitygroups/api/v1.1"
+ }
+ ],
"namespace": "http://docs.openstack.org/ext/securitygroups/api/v1.1",
"alias": "security_groups",
"description": "Security group support"
@@ -27,7 +42,12 @@
{
"updated": "2011-06-16T00:00:00+00:00",
"name": "Floating_ips",
- "links": [],
+ "links": [
+ {
+ "rel": "self",
+ "href": "http://docs.openstack.org/ext/floating_ips/api/v1.1"
+ }
+ ],
"namespace": "http://docs.openstack.org/ext/floating_ips/api/v1.1",
"alias": "os-floating-ips",
"description": "Floating IPs support"
http://git-wip-us.apache.org/repos/asf/jclouds/blob/112c64e9/apis/openstack-nova/src/test/resources/flavor_new.json
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/test/resources/flavor_new.json b/apis/openstack-nova/src/test/resources/flavor_new.json
index 8208993..b3fd7a6 100644
--- a/apis/openstack-nova/src/test/resources/flavor_new.json
+++ b/apis/openstack-nova/src/test/resources/flavor_new.json
@@ -4,7 +4,6 @@
"name": "128 MB Server",
"ram": 128,
"disk": 10,
- "vcpus": 1,
- "links": []
+ "vcpus": 1
}
}