Merge pull request #1552 from jclouds/fqdn-order-dynect-1.6.x
fixed order of zone and fqdn in dynect (1.6.x)
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 ab8882f..0bf1a53 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,36 +26,36 @@
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
*/
public String getZone() {
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 @@
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 e80aa72..d45c00d 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 @@
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 @@
}
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,20 +94,12 @@
public abstract static class Builder<B extends Builder<B>> {
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()
*/
public B zone(String zone) {
@@ -116,6 +108,14 @@
}
/**
+ * @see Node#getFQDN()
+ */
+ public B fqdn(String fqdn) {
+ this.fqdn = fqdn;
+ return self();
+ }
+
+ /**
* @see RecordId#getType()
*/
public B type(String type) {
@@ -132,11 +132,11 @@
}
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 ff3813b..b4bba16 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 @@
.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()