mirror of https://github.com/apache/jclouds.git
fixed order of zone and fqdn in dynect
This commit is contained in:
parent
85e815a743
commit
7f6929b623
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<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()
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class GetGeoServiceResponseTest extends BaseDynECTParseTest<GeoService> {
|
|||
.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()
|
||||
|
|
Loading…
Reference in New Issue