From c8d8aefbc7903425accc47116b291ae83cf56af4 Mon Sep 17 00:00:00 2001 From: adriancole Date: Thu, 18 Apr 2013 15:00:40 -0700 Subject: [PATCH] fixed order of zone and fqdn in dynect --- .../org/jclouds/dynect/v3/domain/Node.java | 30 +++++++++---------- .../jclouds/dynect/v3/domain/RecordId.java | 30 +++++++++---------- .../v3/parse/GetGeoServiceResponseTest.java | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/Node.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/Node.java index ab8882fd2b..0bf1a53e7b 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/Node.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/Node.java @@ -26,26 +26,19 @@ import com.google.common.base.Objects; public class Node { - public static Node create(String fqdn, String zone) { - return new Node(fqdn, zone); + public static Node create(String zone, String fqdn) { + return new Node(zone, fqdn); } - private final String fqdn; private final String zone; + private final String fqdn; - @ConstructorProperties({ "fqdn", "zone" }) - protected Node(String fqdn, String zone) { + @ConstructorProperties({ "zone", "fqdn" }) + protected Node(String zone, String fqdn) { this.fqdn = checkNotNull(fqdn, "fqdn"); this.zone = checkNotNull(zone, "zone for %s", fqdn); } - /** - * Fully qualified domain name of a node in the zone - */ - public String getFQDN() { - return fqdn; - } - /** * Name of the zone */ @@ -53,9 +46,16 @@ public class Node { return zone; } + /** + * Fully qualified domain name of a node in the zone + */ + public String getFQDN() { + return fqdn; + } + @Override public int hashCode() { - return Objects.hashCode(fqdn, zone); + return Objects.hashCode(zone, fqdn); } @Override @@ -67,11 +67,11 @@ public class Node { if (getClass() != obj.getClass()) return false; Node that = Node.class.cast(obj); - return Objects.equal(this.fqdn, that.fqdn) && Objects.equal(this.zone, that.zone); + return Objects.equal(this.zone, that.zone) && Objects.equal(this.fqdn, that.fqdn); } @Override public String toString() { - return Objects.toStringHelper("").add("fqdn", fqdn).add("zone", zone).toString(); + return Objects.toStringHelper("").add("zone", zone).add("fqdn", fqdn).toString(); } } diff --git a/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/RecordId.java b/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/RecordId.java index e80aa72ca9..d45c00df6a 100644 --- a/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/RecordId.java +++ b/providers/dynect/src/main/java/org/jclouds/dynect/v3/domain/RecordId.java @@ -35,9 +35,9 @@ public class RecordId extends Node { private final long id; private final String type; - @ConstructorProperties({"fqdn", "zone", "record_type", "record_id" }) - RecordId(String fqdn, String zone, String type, long id) { - super(fqdn, zone); + @ConstructorProperties({"zone", "fqdn", "record_type", "record_id" }) + RecordId(String zone, String fqdn, String type, long id) { + super(zone, fqdn); this.id = checkNotNull(id, "id"); this.type = checkNotNull(type, "type of %s", id); } @@ -80,7 +80,7 @@ public class RecordId extends Node { } protected ToStringHelper string() { - return toStringHelper(this).add("fqdn", getFQDN()).add("zone", getZone()).add("type", type).add("id", id); + return toStringHelper(this).add("zone", getZone()).add("fqdn", getFQDN()).add("type", type).add("id", id); } public static Builder recordIdBuilder() { @@ -94,19 +94,11 @@ public class RecordId extends Node { public abstract static class Builder> { protected abstract B self(); - protected String fqdn; protected String zone; + protected String fqdn; protected String type; protected long id; - /** - * @see Node#getFQDN() - */ - public B fqdn(String fqdn) { - this.fqdn = fqdn; - return self(); - } - /** * @see Node#getZone() */ @@ -115,6 +107,14 @@ public class RecordId extends Node { return self(); } + /** + * @see Node#getFQDN() + */ + public B fqdn(String fqdn) { + this.fqdn = fqdn; + return self(); + } + /** * @see RecordId#getType() */ @@ -132,11 +132,11 @@ public class RecordId extends Node { } public RecordId build() { - return new RecordId(fqdn, zone, type, id); + return new RecordId(zone, fqdn, type, id); } public B from(RecordId in) { - return fqdn(in.getFQDN()).zone(in.getZone()).type(in.type).id(in.id); + return zone(in.getZone()).fqdn(in.getFQDN()).type(in.type).id(in.id); } } diff --git a/providers/dynect/src/test/java/org/jclouds/dynect/v3/parse/GetGeoServiceResponseTest.java b/providers/dynect/src/test/java/org/jclouds/dynect/v3/parse/GetGeoServiceResponseTest.java index ff3813b528..b4bba16cd4 100644 --- a/providers/dynect/src/test/java/org/jclouds/dynect/v3/parse/GetGeoServiceResponseTest.java +++ b/providers/dynect/src/test/java/org/jclouds/dynect/v3/parse/GetGeoServiceResponseTest.java @@ -54,7 +54,7 @@ public class GetGeoServiceResponseTest extends BaseDynECTParseTest { .name("CCS") .active(true) .ttl(30) - .addNode(Node.create("srv.jclouds.org", "jclouds.org")) + .addNode(Node.create("jclouds.org", "srv.jclouds.org")) .addGroup( GeoRegionGroup .builder()