From aa4e4612388e9d1e7690fc5e0479dda6f3a9be51 Mon Sep 17 00:00:00 2001 From: adriancole Date: Tue, 16 Apr 2013 11:03:33 -0700 Subject: [PATCH] cleanup naming convention differences across ultradns apis --- .../jclouds/ultradns/ws/UltraDNSWSApi.java | 2 +- .../ws/binders/UpdatePoolRecordToXML.java | 2 +- .../ultradns/ws/domain/DirectionalGroup.java | 10 + .../domain/DirectionalGroupCoordinates.java | 14 +- .../ultradns/ws/domain/DirectionalPool.java | 91 ++++-- ...Record.java => DirectionalPoolRecord.java} | 24 +- ....java => DirectionalPoolRecordDetail.java} | 40 +-- .../ws/domain/DirectionalRecordType.java | 62 ---- .../jclouds/ultradns/ws/domain/IdAndName.java | 28 +- .../ultradns/ws/domain/PoolRecordSpec.java | 6 +- ...etadata.java => ResourceRecordDetail.java} | 26 +- .../ws/domain/TrafficControllerPool.java | 24 ++ .../domain/TrafficControllerPoolRecord.java | 257 ++--------------- .../TrafficControllerPoolRecordDetail.java | 271 ++++++++++++++++++ .../ultradns/ws/domain/UpdatePoolRecord.java | 50 ++-- .../ws/features/DirectionalGroupApi.java | 16 +- .../ws/features/DirectionalPoolApi.java | 8 +- .../ws/features/ResourceRecordApi.java | 8 +- .../ws/features/RoundRobinPoolApi.java | 18 +- .../ws/features/TrafficControllerPoolApi.java | 35 +-- .../predicates/DirectionalPoolPredicates.java | 78 +++++ .../TrafficControllerPoolPredicates.java | 8 +- .../ultradns/ws/xml/AccountHandler.java | 2 +- ...dler.java => DirectionalGroupHandler.java} | 7 +- .../ws/xml/DirectionalPoolListHandler.java | 4 +- ...> DirectionalPoolRecordDetailHandler.java} | 24 +- ...rectionalPoolRecordDetailListHandler.java} | 14 +- .../ultradns/ws/xml/RegionListHandler.java | 2 +- ....java => ResourceRecordDetailHandler.java} | 14 +- .../ws/xml/ResourceRecordListHandler.java | 12 +- .../ws/xml/RoundRobinPoolHandler.java | 2 +- .../ws/xml/TrafficControllerPoolHandler.java | 2 +- ...ontrollerPoolRecordDetailListHandler.java} | 19 +- .../ultradns/ws/UltraDNSWSApiExpectTest.java | 2 +- .../ultradns/ws/UltraDNSWSApiLiveTest.java | 2 +- .../features/DirectionalGroupApiLiveTest.java | 18 +- .../features/DirectionalPoolApiLiveTest.java | 22 +- .../features/ResourceRecordApiLiveTest.java | 10 +- .../features/RoundRobinPoolApiExpectTest.java | 6 +- .../features/RoundRobinPoolApiLiveTest.java | 32 +-- .../TrafficControllerPoolApiExpectTest.java | 10 +- .../TrafficControllerPoolApiLiveTest.java | 49 ++-- .../GetAccountsListOfUserResponseTest.java | 2 +- .../GetAvailableRegionsResponseTest.java | 6 +- ...irectionalDNSGroupDetailsResponseTest.java | 7 +- ...ectionalDNSRecordsForHostResponseTest.java | 42 +-- ...GetDirectionalPoolsByZoneResponseTest.java | 6 +- ...RLoadBalancingPoolsByZoneResponseTest.java | 6 +- ...ourceRecordsOfDNameByTypeResponseTest.java | 10 +- ...ceRecordsOfResourceRecordResponseTest.java | 14 +- ...CLoadBalancingPoolsByZoneResponseTest.java | 2 +- .../parse/GetTCPoolRecordsResponseTest.java | 31 +- .../DirectionalPoolPredicatesTest.java | 77 +++++ .../TrafficControllerPoolPredicatesTest.java | 10 +- .../src/test/resources/create_tcpool.xml | 2 +- .../src/test/resources/rrpools.xml | 6 +- .../src/test/resources/tcpools.xml | 2 +- 57 files changed, 919 insertions(+), 635 deletions(-) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/{DirectionalRecord.java => DirectionalPoolRecord.java} (86%) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/{DirectionalRecordDetail.java => DirectionalPoolRecordDetail.java} (80%) delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordType.java rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/{ResourceRecordMetadata.java => ResourceRecordDetail.java} (84%) create mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecordDetail.java create mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicates.java rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{DirectionalGroupNameAndRegionsHandler.java => DirectionalGroupHandler.java} (80%) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{DirectionalRecordDetailHandler.java => DirectionalPoolRecordDetailHandler.java} (72%) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{DirectionalRecordDetailListHandler.java => DirectionalPoolRecordDetailListHandler.java} (77%) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{ResourceRecordMetadataHandler.java => ResourceRecordDetailHandler.java} (86%) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{TrafficControllerPoolRecordListHandler.java => TrafficControllerPoolRecordDetailListHandler.java} (80%) create mode 100644 providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicatesTest.java diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java index bb571a0400..7753a7ba87 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java @@ -69,7 +69,7 @@ public interface UltraDNSWSApi extends Closeable { @POST @XMLResponseParser(RegionListHandler.class) @Payload("") - Multimap getRegionsById(); + Multimap getRegionsByIdAndName(); /** * Provides access to Zone features. diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/binders/UpdatePoolRecordToXML.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/binders/UpdatePoolRecordToXML.java index 670a9ca06c..fea8aae891 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/binders/UpdatePoolRecordToXML.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/binders/UpdatePoolRecordToXML.java @@ -43,7 +43,7 @@ public class UpdatePoolRecordToXML implements MapBinder { UpdatePoolRecord update = UpdatePoolRecord.class.cast(postParams.get("update")); - xml.append("").append(update.getPointsTo()).append(""); + xml.append("").append(update.getRData()).append(""); xml.append("").append(update.getPriority()).append(""); xml.append("").append(update.getFailOverDelay()).append(""); xml.append("").append(update.getTTL()).append(""); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java index d43236e2c8..c8b623f1df 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java @@ -134,6 +134,16 @@ public class DirectionalGroup extends ForwardingMultimap { return this; } + /** + * adds to current regionToTerritories + * + * @see DirectionalGroup#getRegionToTerritories() + */ + public Builder mapRegion(String region) { + this.regionToTerritories.put(region, "all"); + return this; + } + /** * replaces current regionToTerritories * diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupCoordinates.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupCoordinates.java index ecd607584f..f7970c0dcf 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupCoordinates.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupCoordinates.java @@ -44,23 +44,23 @@ public class DirectionalGroupCoordinates { } /** - * the {@link DirectionalRecordDetail#getZoneName() name} of the zone. + * the {@link DirectionalPoolRecordDetail#getZoneName() name} of the zone. */ public String getZoneName() { return zoneName; } /** - * the {@link DirectionalRecordDetail#getName() dname} of the record. + * the {@link DirectionalPoolRecordDetail#getName() dname} of the record. */ public String getRecordName() { return recordName; } /** - * the {@link DirectionalRecord#getType() recordType} of the record. + * the {@link DirectionalPoolRecord#getType() recordType} of the record. * - * @see DirectionalRecordDetail#getRecord() + * @see DirectionalPoolRecordDetail#getRecord() */ public int getRecordType() { return recordType; @@ -69,9 +69,9 @@ public class DirectionalGroupCoordinates { /** * the {@link DirectionalGroup#getName() name} of the directional group. * - * @see DirectionalRecordDetail#getGroup() - * @see DirectionalRecordDetail#getGeolocationGroup() - * @see DirectionalRecordDetail#getSourceIpGroup() + * @see DirectionalPoolRecordDetail#getGroup() + * @see DirectionalPoolRecordDetail#getGeolocationGroup() + * @see DirectionalPoolRecordDetail#getSourceIpGroup() */ public String getGroupName() { return groupName; diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPool.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPool.java index 7941e143ca..7d7618d031 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPool.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPool.java @@ -32,16 +32,16 @@ public final class DirectionalPool { private final String zoneId; private final String id; - private final Optional description; + private final Optional name; private final String dname; private final Type type; private final TieBreak tieBreak; - private DirectionalPool(String zoneId, String id, Optional description, String dname, Type type, + private DirectionalPool(String zoneId, String id, Optional name, String dname, Type type, TieBreak tieBreak) { this.zoneId = checkNotNull(zoneId, "zoneId"); this.id = checkNotNull(id, "id"); - this.description = checkNotNull(description, "description for %s", id); + this.name = checkNotNull(name, "name for %s", id); this.dname = checkNotNull(dname, "dname for %s", id); this.type = type; this.tieBreak = tieBreak; @@ -58,15 +58,15 @@ public final class DirectionalPool { /** * The dname of the pool. ex. {@code jclouds.org.} */ - public String getName() { + public String getDName() { return dname; } /** - * The description of the pool. ex. {@code My Pool} + * The name of the pool. ex. {@code My Pool} */ - public Optional getDescription() { - return description; + public Optional getName() { + return name; } public Type getType() { @@ -86,13 +86,66 @@ public final class DirectionalPool { GEOLOCATION, SOURCEIP, MIXED; } + /** + * currently supported {@link ResourceRecord#getType() types} for directional + * groups. + * + */ + public static enum RecordType { + // A/CNAME + IPV4(1), + + // AAAA/CNAME + IPV6(28), + + TXT(16), + + SRV(33), + + PTR(12), + + RP(17), + + HINFO(13), + + NAPTR(35), + + MX(15); + + @Override + public String toString() { + switch (this) { + case IPV4: + return "A"; + case IPV6: + return "AAAA"; + default: + return super.toString(); + } + } + + private final int code; + + private RecordType(int code) { + this.code = code; + } + + /** + * The {@link ResourceRecord#getType() type} that can be used in + * directional groups. + */ + public int getCode() { + return code; + } + } + public static enum TieBreak { GEOLOCATION, SOURCEIP; } @Override public int hashCode() { - return Objects.hashCode(zoneId, id, description, dname); + return Objects.hashCode(zoneId, id, name, dname); } @Override @@ -105,13 +158,13 @@ public final class DirectionalPool { return false; DirectionalPool that = DirectionalPool.class.cast(obj); return Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.id, that.id) - && Objects.equal(this.description, that.description) && Objects.equal(this.dname, that.dname); + && Objects.equal(this.name, that.name) && Objects.equal(this.dname, that.dname); } @Override public String toString() { - return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("name", dname) - .add("description", description.orNull()).add("type", type).add("tieBreak", tieBreak).toString(); + return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("dname", dname) + .add("name", name.orNull()).add("type", type).add("tieBreak", tieBreak).toString(); } public static Builder builder() { @@ -125,7 +178,7 @@ public final class DirectionalPool { public final static class Builder { private String zoneId; private String id; - private Optional description = Optional.absent(); + private Optional name = Optional.absent(); private String dname; private Type type = Type.GEOLOCATION; private TieBreak tieBreak = TieBreak.GEOLOCATION; @@ -147,18 +200,18 @@ public final class DirectionalPool { } /** - * @see DirectionalPool#getName() + * @see DirectionalPool#getDName() */ - public Builder name(String dname) { + public Builder dname(String dname) { this.dname = dname; return this; } /** - * @see DirectionalPool#getDescription() + * @see DirectionalPool#getName() */ - public Builder description(String description) { - this.description = Optional.fromNullable(description); + public Builder name(String name) { + this.name = Optional.fromNullable(name); return this; } @@ -179,11 +232,11 @@ public final class DirectionalPool { } public DirectionalPool build() { - return new DirectionalPool(zoneId, id, description, dname, type, tieBreak); + return new DirectionalPool(zoneId, id, name, dname, type, tieBreak); } public Builder from(DirectionalPool in) { - return this.zoneId(in.zoneId).id(in.id).description(in.description.orNull()).name(in.dname).type(in.type) + return this.zoneId(in.zoneId).id(in.id).name(in.name.orNull()).dname(in.dname).type(in.type) .tieBreak(in.tieBreak); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecord.java similarity index 86% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecord.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecord.java index 2dcdbbac66..c638a61906 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecord.java @@ -33,13 +33,13 @@ import com.google.common.collect.ImmutableList; /** * @author Adrian Cole */ -public class DirectionalRecord { +public class DirectionalPoolRecord { private final String type; private final int ttl; private final boolean noResponseRecord; private final List infoValues; - private DirectionalRecord(String type, int ttl, boolean noResponseRecord, List infoValues) { + private DirectionalPoolRecord(String type, int ttl, boolean noResponseRecord, List infoValues) { this.type = checkNotNull(type, "type"); checkArgument(ttl >= 0, "ttl must be >= 0"); this.ttl = ttl; @@ -84,7 +84,7 @@ public class DirectionalRecord { return true; if (obj == null || getClass() != obj.getClass()) return false; - DirectionalRecord that = DirectionalRecord.class.cast(obj); + DirectionalPoolRecord that = DirectionalPoolRecord.class.cast(obj); return equal(this.type, that.type) && equal(this.ttl, that.ttl) && equal(this.noResponseRecord, that.noResponseRecord) && equal(this.infoValues, that.infoValues); } @@ -110,7 +110,7 @@ public class DirectionalRecord { private ImmutableList.Builder infoValues = ImmutableList. builder(); /** - * @see DirectionalRecord#getType() + * @see DirectionalPoolRecord#getType() */ public Builder type(String type) { this.type = type; @@ -118,7 +118,7 @@ public class DirectionalRecord { } /** - * @see DirectionalRecord#getTTL() + * @see DirectionalPoolRecord#getTTL() */ public Builder ttl(int ttl) { this.ttl = ttl; @@ -126,7 +126,7 @@ public class DirectionalRecord { } /** - * @see DirectionalRecord#isNoResponseRecord() + * @see DirectionalPoolRecord#isNoResponseRecord() */ public Builder noResponseRecord(boolean noResponseRecord) { this.noResponseRecord = noResponseRecord; @@ -136,7 +136,7 @@ public class DirectionalRecord { /** * adds to current values * - * @see DirectionalRecord#getRData() + * @see DirectionalPoolRecord#getRData() */ public Builder infoValue(Object infoValue) { this.infoValues.add(infoValue.toString()); @@ -146,7 +146,7 @@ public class DirectionalRecord { /** * replaces current values * - * @see DirectionalRecord#getRData() + * @see DirectionalPoolRecord#getRData() */ public Builder rdata(Object infoValue) { this.infoValues = ImmutableList. builder().add(infoValue.toString()); @@ -156,18 +156,18 @@ public class DirectionalRecord { /** * replaces current values * - * @see DirectionalRecord#getRData() + * @see DirectionalPoolRecord#getRData() */ public Builder rdata(Iterable infoValues) { this.infoValues = ImmutableList. builder().addAll(transform(infoValues, toStringFunction())); return this; } - public DirectionalRecord build() { - return new DirectionalRecord(type, ttl, noResponseRecord, infoValues.build()); + public DirectionalPoolRecord build() { + return new DirectionalPoolRecord(type, ttl, noResponseRecord, infoValues.build()); } - public Builder from(DirectionalRecord in) { + public Builder from(DirectionalPoolRecord in) { return type(in.type).ttl(in.ttl).noResponseRecord(in.noResponseRecord).rdata(in.infoValues); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecordDetail.java similarity index 80% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecordDetail.java index c19977d07b..7447eb6526 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalPoolRecordDetail.java @@ -28,7 +28,7 @@ import com.google.common.base.Optional; /** * @author Adrian Cole */ -public class DirectionalRecordDetail { +public class DirectionalPoolRecordDetail { private final String zoneName; private final String name; @@ -36,11 +36,11 @@ public class DirectionalRecordDetail { private final Optional group; private final Optional geolocationGroup; private final Optional sourceIpGroup; - private final DirectionalRecord record; + private final DirectionalPoolRecord record; - private DirectionalRecordDetail(String zoneName, String name, String id, + private DirectionalPoolRecordDetail(String zoneName, String name, String id, Optional group, Optional geolocationGroup, - Optional sourceIpGroup, DirectionalRecord record) { + Optional sourceIpGroup, DirectionalPoolRecord record) { this.zoneName = checkNotNull(zoneName, "zoneName"); this.name = checkNotNull(name, "name"); this.id = checkNotNull(id, "id"); @@ -83,7 +83,7 @@ public class DirectionalRecordDetail { return sourceIpGroup; } - public DirectionalRecord getRecord() { + public DirectionalPoolRecord getRecord() { return record; } @@ -98,7 +98,7 @@ public class DirectionalRecordDetail { return true; if (obj == null || getClass() != obj.getClass()) return false; - DirectionalRecordDetail that = DirectionalRecordDetail.class.cast(obj); + DirectionalPoolRecordDetail that = DirectionalPoolRecordDetail.class.cast(obj); return equal(this.zoneName, that.zoneName) && equal(this.name, that.name) && equal(this.id, that.id); } @@ -124,10 +124,10 @@ public class DirectionalRecordDetail { private Optional group = Optional.absent(); private Optional geolocationGroup = Optional.absent(); private Optional sourceIpGroup = Optional.absent(); - private DirectionalRecord record; + private DirectionalPoolRecord record; /** - * @see DirectionalRecordDetail#getZoneName() + * @see DirectionalPoolRecordDetail#getZoneName() */ public Builder zoneName(String zoneName) { this.zoneName = zoneName; @@ -135,7 +135,7 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getName() + * @see DirectionalPoolRecordDetail#getName() */ public Builder name(String name) { this.name = name; @@ -143,7 +143,7 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getId() + * @see DirectionalPoolRecordDetail#getId() */ public Builder id(String id) { this.id = id; @@ -151,7 +151,7 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getGroup() + * @see DirectionalPoolRecordDetail#getGroup() */ public Builder group(IdAndName group) { this.group = Optional.fromNullable(group); @@ -159,7 +159,7 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getGeolocationGroup() + * @see DirectionalPoolRecordDetail#getGeolocationGroup() */ public Builder geolocationGroup(IdAndName geolocationGroup) { this.geolocationGroup = Optional.fromNullable(geolocationGroup); @@ -167,7 +167,7 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getSourceIpGroup() + * @see DirectionalPoolRecordDetail#getSourceIpGroup() */ public Builder sourceIpGroup(IdAndName sourceIpGroup) { this.sourceIpGroup = Optional.fromNullable(sourceIpGroup); @@ -175,26 +175,26 @@ public class DirectionalRecordDetail { } /** - * @see DirectionalRecordDetail#getRecord() + * @see DirectionalPoolRecordDetail#getRecord() */ - public Builder record(DirectionalRecord record) { + public Builder record(DirectionalPoolRecord record) { this.record = record; return this; } /** - * @see DirectionalRecordDetail#getRecord() + * @see DirectionalPoolRecordDetail#getRecord() */ - public Builder record(DirectionalRecord.Builder record) { + public Builder record(DirectionalPoolRecord.Builder record) { this.record = record.build(); return this; } - public DirectionalRecordDetail build() { - return new DirectionalRecordDetail(zoneName, name, id, group, geolocationGroup, sourceIpGroup, record); + public DirectionalPoolRecordDetail build() { + return new DirectionalPoolRecordDetail(zoneName, name, id, group, geolocationGroup, sourceIpGroup, record); } - public Builder from(DirectionalRecordDetail in) { + public Builder from(DirectionalPoolRecordDetail in) { return this.zoneName(in.zoneName).name(in.name).id(in.id).group(in.group.orNull()) .geolocationGroup(in.geolocationGroup.orNull()).sourceIpGroup(in.sourceIpGroup.orNull()) .record(in.record); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordType.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordType.java deleted file mode 100644 index 97b4b6bfcd..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordType.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.ultradns.ws.domain; - -/** - * currently supported {@link ResourceRecord#getType() types} for directional - * groups. - * - * @author Adrian Cole - */ -public enum DirectionalRecordType { - // A/CNAME - IPV4(1), - - // AAAA/CNAME - IPV6(28), - - TXT(16), - - SRV(33), - - PTR(12), - - RP(17), - - HINFO(13), - - NAPTR(35), - - MX(15); - - private final int code; - - private DirectionalRecordType(int code) { - this.code = code; - } - - /** - * The {@link ResourceRecord#getType() type} that can be used in directional - * groups. - */ - public int getCode() { - return code; - } - -} \ No newline at end of file diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java index 764232d0c2..796110c369 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java @@ -19,14 +19,19 @@ package org.jclouds.ultradns.ws.domain; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Predicates.compose; +import static com.google.common.base.Predicates.equalTo; +import com.google.common.base.Function; import com.google.common.base.Objects; +import com.google.common.base.Predicate; /** * @author Adrian Cole */ public final class IdAndName { - public static IdAndName fromIdAndName(String id, String name) { + + public static IdAndName create(String id, String name) { return new IdAndName(id, name); } @@ -71,6 +76,25 @@ public final class IdAndName { @Override public String toString() { - return Objects.toStringHelper(this).add("id", id).add("name", name).toString(); + return Objects.toStringHelper("").add("id", id).add("name", name).toString(); + } + + /** + * convenience predicate as typically the user is unaware of the system + * generated id of a resource + * + * @param name + * see {@link #getName()} + */ + public static Predicate nameEqualTo(String name) { + return compose(equalTo(name), ToName.INSTANCE); + } + + private static enum ToName implements Function { + INSTANCE; + @Override + public String apply(IdAndName input) { + return input.getName(); + } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java index 02f14d608c..d41c7ff06e 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java @@ -57,7 +57,7 @@ public final class PoolRecordSpec { } /** - * correlates to {@link TrafficControllerPoolRecord#getDescription()} + * correlates to {@link TrafficControllerPoolRecordDetail#getDescription()} */ public String getDescription() { return description; @@ -71,7 +71,7 @@ public final class PoolRecordSpec { } /** - * correlates to {@link TrafficControllerPoolRecord#isProbingEnabled()} + * correlates to {@link TrafficControllerPoolRecordDetail#isProbingEnabled()} */ public boolean isProbingEnabled() { return probingEnabled; @@ -85,7 +85,7 @@ public final class PoolRecordSpec { } /** - * correlates to {@link TrafficControllerPoolRecord#getWeight()} + * correlates to {@link TrafficControllerPoolRecordDetail#getWeight()} */ public int getWeight() { return weight; diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordMetadata.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordDetail.java similarity index 84% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordMetadata.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordDetail.java index b98ac37e28..140ae8c266 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordMetadata.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecordDetail.java @@ -30,7 +30,7 @@ import com.google.common.base.Objects; * * @author Adrian Cole */ -public class ResourceRecordMetadata { +public class ResourceRecordDetail { private final String zoneId; private final String guid; @@ -39,7 +39,7 @@ public class ResourceRecordMetadata { private final Date modified; private final ResourceRecord record; - private ResourceRecordMetadata(String zoneId, String guid, String zoneName, Date created, Date modified, + private ResourceRecordDetail(String zoneId, String guid, String zoneName, Date created, Date modified, ResourceRecord record) { this.zoneId = checkNotNull(zoneId, "zoneId"); this.guid = checkNotNull(guid, "guid"); @@ -87,7 +87,7 @@ public class ResourceRecordMetadata { return true; if (obj == null || getClass() != obj.getClass()) return false; - ResourceRecordMetadata that = ResourceRecordMetadata.class.cast(obj); + ResourceRecordDetail that = ResourceRecordDetail.class.cast(obj); return equal(this.zoneId, that.zoneId) && equal(this.guid, that.guid); } @@ -114,7 +114,7 @@ public class ResourceRecordMetadata { private ResourceRecord record; /** - * @see ResourceRecordMetadata#getZoneName() + * @see ResourceRecordDetail#getZoneName() */ public Builder zoneName(String zoneName) { this.zoneName = zoneName; @@ -122,7 +122,7 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getGuid() + * @see ResourceRecordDetail#getGuid() */ public Builder guid(String guid) { this.guid = guid; @@ -130,7 +130,7 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getZoneId() + * @see ResourceRecordDetail#getZoneId() */ public Builder zoneId(String zoneId) { this.zoneId = zoneId; @@ -138,7 +138,7 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getCreated() + * @see ResourceRecordDetail#getCreated() */ public Builder created(Date created) { this.created = created; @@ -146,7 +146,7 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getModified() + * @see ResourceRecordDetail#getModified() */ public Builder modified(Date modified) { this.modified = modified; @@ -154,7 +154,7 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getRecord() + * @see ResourceRecordDetail#getRecord() */ public Builder record(ResourceRecord record) { this.record = record; @@ -162,18 +162,18 @@ public class ResourceRecordMetadata { } /** - * @see ResourceRecordMetadata#getRecord() + * @see ResourceRecordDetail#getRecord() */ public Builder record(ResourceRecord.Builder record) { this.record = record.build(); return this; } - public ResourceRecordMetadata build() { - return new ResourceRecordMetadata(zoneId, guid, zoneName, created, modified, record); + public ResourceRecordDetail build() { + return new ResourceRecordDetail(zoneId, guid, zoneName, created, modified, record); } - public Builder from(ResourceRecordMetadata in) { + public Builder from(ResourceRecordDetail in) { return this.zoneName(in.zoneName).guid(in.guid).zoneId(in.zoneId).created(in.created).modified(in.modified) .record(in.record); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPool.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPool.java index 77f72af35a..7904abb51a 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPool.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPool.java @@ -99,6 +99,30 @@ public final class TrafficControllerPool { return probingEnabled; } + /** + * currently supported {@link ResourceRecord#getType() types} for traffic + * controller pools. + * + */ + public static enum RecordType { + // A/CNAME + IPV4(1), + + // AAAA/CNAME + IPV6(28); + + @Override + public String toString() { + return String.valueOf(code); + } + + private final int code; + + private RecordType(int code) { + this.code = code; + } + } + @Override public int hashCode() { return Objects.hashCode(zoneId, id, name, dname); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java index 1a05fced1d..0e669faa39 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java @@ -18,82 +18,34 @@ */ package org.jclouds.ultradns.ws.domain; -import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Objects.toStringHelper; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Objects; /** - * * @author Adrian Cole */ -public final class TrafficControllerPoolRecord { +public class TrafficControllerPoolRecord { + + public static TrafficControllerPoolRecord createA(String rdata) { + return new TrafficControllerPoolRecord("A", rdata); + } + + public static TrafficControllerPoolRecord createCNAME(String rdata) { + return new TrafficControllerPoolRecord("CNAME", rdata); + } + public static TrafficControllerPoolRecord create(String type, String rdata) { + return new TrafficControllerPoolRecord(type, rdata); + } - private final String id; - private final String poolId; - private final String pointsTo; - private final int weight; - private final int priority; private final String type; - private final String forceAnswer; - private final boolean probingEnabled; - private final Status status; - private final boolean serving; - private final String description; + private final String rdata; - private TrafficControllerPoolRecord(String id, String poolId, String pointsTo, int weight, int priority, - String type, String forceAnswer, boolean probingEnabled, Status status, boolean serving, String description) { - this.id = checkNotNull(id, "id"); - this.poolId = checkNotNull(poolId, "poolId for %s", id); - this.pointsTo = checkNotNull(pointsTo, "pointsTo for %s", poolId); - checkArgument(weight >= 0, "weight of %s must be >= 0", id); - this.weight = weight; - checkArgument(priority >= 0, "priority of %s must be >= 0", id); - this.priority = priority; - this.type = checkNotNull(type, "type for %s", poolId); - this.forceAnswer = checkNotNull(forceAnswer, "forceAnswer for %s", poolId); - this.probingEnabled = probingEnabled; - this.status = checkNotNull(status, "status for %s", poolId); - this.serving = serving; - this.description = checkNotNull(description, "description for %s", description); - } - - /** - * The ID of the zone. - */ - public String getId() { - return id; - } - - /** - * The pool this record belongs to. - */ - public String getPoolId() { - return poolId; - } - - /** - * address or cname this points to. ex. {@code jclouds.org.} or - * {@code 1.2.3.4} - */ - public String getPointsTo() { - return pointsTo; - } - - /** - * 0 or even numbers from 2–100. Determines the traffic load to send to each - * server in a Traffic Controller pool. The value 0 indicates that Traffic - * Controller always serves the record. - */ - public int getWeight() { - return weight; - } - - /** - * the default value is 1. The value 0 is the special All Fail priority. - */ - public int getPriority() { - return priority; + private TrafficControllerPoolRecord(String type, String rdata) { + this.type = checkNotNull(type, "type"); + this.rdata = checkNotNull(rdata, "rdata"); } /** @@ -103,188 +55,31 @@ public final class TrafficControllerPoolRecord { return type; } - public String getForceAnswer() { - return forceAnswer; - } - - public boolean isProbingEnabled() { - return probingEnabled; - } - /** - * status of the record + * address or cname this points to. ex. {@code jclouds.org.} or + * {@code 1.2.3.4} */ - public Status getStatus() { - return status; - } - - public boolean isServing() { - return serving; - } - - /** - * description of the record - */ - public String getDescription() { - return description; - } - - public static enum Status { - - OK, DISABLED, UNRECOGNIZED; - - public static Status fromValue(String status) { - try { - return valueOf(checkNotNull(status, "status")); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } + public String getRData() { + return rdata; } @Override public int hashCode() { - return Objects.hashCode(id, poolId); + return Objects.hashCode(type, rdata); } @Override public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; TrafficControllerPoolRecord that = TrafficControllerPoolRecord.class.cast(obj); - return Objects.equal(this.id, that.id) && Objects.equal(this.poolId, that.poolId); + return equal(this.type, that.type) && equal(this.rdata, that.rdata); } @Override public String toString() { - return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("pointsTo", pointsTo) - .add("weight", weight).add("priority", priority).add("type", type).add("forceAnswer", forceAnswer) - .add("probingEnabled", probingEnabled).add("status", status).add("serving", serving) - .add("description", description).toString(); - } - - public static Builder builder() { - return new Builder(); - } - - public Builder toBuilder() { - return builder().from(this); - } - - public final static class Builder { - private String id; - private String poolId; - private String pointsTo; - private int weight; - private int priority; - private String type; - private String forceAnswer; - private boolean probingEnabled; - private Status status; - private boolean serving; - private String description; - - /** - * @see TrafficControllerPoolRecord#getId() - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getPoolId() - */ - public Builder poolId(String poolId) { - this.poolId = poolId; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getPointsTo() - */ - public Builder pointsTo(String pointsTo) { - this.pointsTo = pointsTo; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getWeight() - */ - public Builder weight(int weight) { - this.weight = weight; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getPriority() - */ - public Builder priority(int priority) { - this.priority = priority; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getType() - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getForceAnswer() - */ - public Builder forceAnswer(String forceAnswer) { - this.forceAnswer = forceAnswer; - return this; - } - - /** - * @see TrafficControllerPoolRecord#isProbingEnabled() - */ - public Builder probingEnabled(boolean probingEnabled) { - this.probingEnabled = probingEnabled; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getStatus() - */ - public Builder status(Status status) { - this.status = status; - return this; - } - - /** - * @see TrafficControllerPoolRecord#isServing() - */ - public Builder serving(boolean serving) { - this.serving = serving; - return this; - } - - /** - * @see TrafficControllerPoolRecord#getDescription() - */ - public Builder description(String description) { - this.description = description; - return this; - } - - public TrafficControllerPoolRecord build() { - return new TrafficControllerPoolRecord(id, poolId, pointsTo, weight, priority, type, forceAnswer, - probingEnabled, status, serving, description); - } - - public Builder from(TrafficControllerPoolRecord in) { - return this.id(in.id).poolId(in.poolId).weight(in.weight).pointsTo(in.pointsTo).priority(in.priority) - .type(in.type).forceAnswer(in.forceAnswer).probingEnabled(in.probingEnabled).status(in.status) - .serving(in.serving).description(in.description); - } + return toStringHelper(this).add("type", type).add("rdata", rdata).toString(); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecordDetail.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecordDetail.java new file mode 100644 index 0000000000..f23a1df11b --- /dev/null +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecordDetail.java @@ -0,0 +1,271 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.ultradns.ws.domain; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.base.Objects; + +/** + * + * @author Adrian Cole + */ +public final class TrafficControllerPoolRecordDetail { + + private final String id; + private final String poolId; + private final TrafficControllerPoolRecord record; + private final int weight; + private final int priority; + private final String forceAnswer; + private final boolean probingEnabled; + private final Status status; + private final boolean serving; + private final String description; + + private TrafficControllerPoolRecordDetail(String id, String poolId, TrafficControllerPoolRecord record, int weight, + int priority, String forceAnswer, boolean probingEnabled, Status status, boolean serving, String description) { + this.id = checkNotNull(id, "id"); + this.poolId = checkNotNull(poolId, "poolId for %s", id); + this.record = checkNotNull(record, "record for %s", poolId); + checkArgument(weight >= 0, "weight of %s must be >= 0", id); + this.weight = weight; + checkArgument(priority >= 0, "priority of %s must be >= 0", id); + this.priority = priority; + this.forceAnswer = checkNotNull(forceAnswer, "forceAnswer for %s", poolId); + this.probingEnabled = probingEnabled; + this.status = checkNotNull(status, "status for %s", poolId); + this.serving = serving; + this.description = checkNotNull(description, "description for %s", description); + } + + /** + * The ID of the zone. + */ + public String getId() { + return id; + } + + /** + * The pool this record belongs to. + */ + public String getPoolId() { + return poolId; + } + + /** + * the record pointed to + */ + public TrafficControllerPoolRecord getRecord() { + return record; + } + + /** + * 0 or even numbers from 2–100. Determines the traffic load to send to each + * server in a Traffic Controller pool. The value 0 indicates that Traffic + * Controller always serves the record. + */ + public int getWeight() { + return weight; + } + + /** + * the default value is 1. The value 0 is the special All Fail priority. + */ + public int getPriority() { + return priority; + } + + public String getForceAnswer() { + return forceAnswer; + } + + public boolean isProbingEnabled() { + return probingEnabled; + } + + /** + * status of the record + */ + public Status getStatus() { + return status; + } + + public boolean isServing() { + return serving; + } + + /** + * description of the record + */ + public String getDescription() { + return description; + } + + public static enum Status { + + OK, WARNING, CRITICAL, FAILURE, DISABLED, UNRECOGNIZED; + + public static Status fromValue(String status) { + try { + return valueOf(checkNotNull(status, "status").toUpperCase()); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + } + + @Override + public int hashCode() { + return Objects.hashCode(id, poolId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TrafficControllerPoolRecordDetail that = TrafficControllerPoolRecordDetail.class.cast(obj); + return Objects.equal(this.id, that.id) && Objects.equal(this.poolId, that.poolId); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("record", record) + .add("weight", weight).add("priority", priority).add("forceAnswer", forceAnswer) + .add("probingEnabled", probingEnabled).add("status", status).add("serving", serving) + .add("description", description).toString(); + } + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return builder().from(this); + } + + public final static class Builder { + private String id; + private String poolId; + private TrafficControllerPoolRecord record; + private int weight; + private int priority; + private String forceAnswer; + private boolean probingEnabled; + private Status status; + private boolean serving; + private String description; + + /** + * @see TrafficControllerPoolRecordDetail#getId() + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getPoolId() + */ + public Builder poolId(String poolId) { + this.poolId = poolId; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getRecord() + */ + public Builder record(TrafficControllerPoolRecord record) { + this.record = record; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getWeight() + */ + public Builder weight(int weight) { + this.weight = weight; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getPriority() + */ + public Builder priority(int priority) { + this.priority = priority; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getForceAnswer() + */ + public Builder forceAnswer(String forceAnswer) { + this.forceAnswer = forceAnswer; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#isProbingEnabled() + */ + public Builder probingEnabled(boolean probingEnabled) { + this.probingEnabled = probingEnabled; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getStatus() + */ + public Builder status(Status status) { + this.status = status; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#isServing() + */ + public Builder serving(boolean serving) { + this.serving = serving; + return this; + } + + /** + * @see TrafficControllerPoolRecordDetail#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + public TrafficControllerPoolRecordDetail build() { + return new TrafficControllerPoolRecordDetail(id, poolId, record, weight, priority, forceAnswer, + probingEnabled, status, serving, description); + } + + public Builder from(TrafficControllerPoolRecordDetail in) { + return this.id(in.id).poolId(in.poolId).weight(in.weight).record(in.record).priority(in.priority) + .forceAnswer(in.forceAnswer).probingEnabled(in.probingEnabled).status(in.status).serving(in.serving) + .description(in.description); + } + } +} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java index b8117cd9be..2bd9af05b5 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java @@ -34,13 +34,13 @@ public final class UpdatePoolRecord { /** * @param spec what to prime updates from - * @param pointsTo new value to point to. + * @param rdata new value to point to. */ - public static UpdatePoolRecord pointingTo(PoolRecordSpec spec, String pointsTo) { - return new Builder().from(spec).pointsTo(pointsTo).build(); + public static UpdatePoolRecord pointingTo(PoolRecordSpec spec, String rdata) { + return new Builder().from(spec).rdata(rdata).build(); } - private final String pointsTo; + private final String rdata; private final String mode; private final int priority; private final int weight; @@ -48,26 +48,26 @@ public final class UpdatePoolRecord { private final int threshold; private final int ttl; - private UpdatePoolRecord(String pointsTo, String mode, int priority, int weight, int failOverDelay, int threshold, + private UpdatePoolRecord(String rdata, String mode, int priority, int weight, int failOverDelay, int threshold, int ttl) { - this.pointsTo = checkNotNull(pointsTo, "pointsTo"); - this.mode = checkNotNull(mode, "mode for %s", pointsTo); + this.rdata = checkNotNull(rdata, "rdata"); + this.mode = checkNotNull(mode, "mode for %s", rdata); this.priority = priority; this.weight = weight; - checkArgument(weight >= 0, "weight of %s must be >= 0", pointsTo); + checkArgument(weight >= 0, "weight of %s must be >= 0", rdata); this.failOverDelay = failOverDelay; - checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", pointsTo); + checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", rdata); this.threshold = threshold; - checkArgument(threshold >= 0, "threshold of %s must be >= 0", pointsTo); + checkArgument(threshold >= 0, "threshold of %s must be >= 0", rdata); this.ttl = ttl; - checkArgument(ttl >= 0, "ttl of %s must be >= 0", pointsTo); + checkArgument(ttl >= 0, "ttl of %s must be >= 0", rdata); } /** - * correlates to {@link TrafficControllerPoolRecord#getPointsTo()} + * correlates to {@link TrafficControllerPoolRecord#getRData()} */ - public String getPointsTo() { - return pointsTo; + public String getRData() { + return rdata; } /** @@ -114,7 +114,7 @@ public final class UpdatePoolRecord { @Override public int hashCode() { - return Objects.hashCode(pointsTo, mode, priority, weight, failOverDelay, threshold, ttl); + return Objects.hashCode(rdata, mode, priority, weight, failOverDelay, threshold, ttl); } @Override @@ -126,14 +126,14 @@ public final class UpdatePoolRecord { if (getClass() != obj.getClass()) return false; UpdatePoolRecord that = UpdatePoolRecord.class.cast(obj); - return equal(this.pointsTo, that.pointsTo) && equal(this.mode, that.mode) && equal(this.priority, that.priority) + return equal(this.rdata, that.rdata) && equal(this.mode, that.mode) && equal(this.priority, that.priority) && equal(this.weight, that.weight) && equal(this.failOverDelay, that.failOverDelay) && equal(this.threshold, that.threshold) && equal(this.ttl, that.ttl); } @Override public String toString() { - return toStringHelper(this).add("pointsTo", pointsTo).add("mode", mode).add("priority", priority) + return toStringHelper(this).add("rdata", rdata).add("mode", mode).add("priority", priority) .add("weight", weight).add("failOverDelay", failOverDelay).add("threshold", threshold).add("ttl", ttl) .toString(); } @@ -147,7 +147,7 @@ public final class UpdatePoolRecord { } public final static class Builder { - private String pointsTo; + private String rdata; private String mode; private int priority; private int weight; @@ -156,10 +156,10 @@ public final class UpdatePoolRecord { private int ttl; /** - * @see UpdatePoolRecord#getPointsTo() + * @see UpdatePoolRecord#getRData() */ - public Builder pointsTo(String pointsTo) { - this.pointsTo = pointsTo; + public Builder rdata(String rdata) { + this.rdata = rdata; return this; } @@ -212,7 +212,7 @@ public final class UpdatePoolRecord { } public UpdatePoolRecord build() { - return new UpdatePoolRecord(pointsTo, mode, priority, weight, failOverDelay, threshold, ttl); + return new UpdatePoolRecord(rdata, mode, priority, weight, failOverDelay, threshold, ttl); } public Builder from(PoolRecordSpec in) { @@ -220,12 +220,12 @@ public final class UpdatePoolRecord { .threshold(in.getThreshold()).ttl(in.getTTL()); } - public Builder from(TrafficControllerPoolRecord in) { - return this.weight(in.getWeight()).pointsTo(in.getPointsTo()).priority(in.getPriority()); + public Builder from(TrafficControllerPoolRecordDetail in) { + return this.weight(in.getWeight()).rdata(in.getRecord().getRData()).priority(in.getPriority()); } public Builder from(UpdatePoolRecord in) { - return this.pointsTo(in.pointsTo).mode(in.mode).priority(in.priority).weight(in.weight) + return this.rdata(in.rdata).mode(in.mode).priority(in.priority).weight(in.weight) .failOverDelay(in.failOverDelay).threshold(in.threshold).ttl(in.ttl); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java index 4f5c0d255d..1517740978 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java @@ -36,11 +36,11 @@ import org.jclouds.ultradns.ws.binders.DirectionalGroupCoordinatesToXML; import org.jclouds.ultradns.ws.domain.AccountLevelGroup; import org.jclouds.ultradns.ws.domain.DirectionalGroup; import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler; -import org.jclouds.ultradns.ws.xml.DirectionalGroupNameAndRegionsHandler; -import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; +import org.jclouds.ultradns.ws.xml.DirectionalGroupHandler; +import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler; import org.jclouds.ultradns.ws.xml.ItemListHandler; import com.google.common.collect.FluentIterable; @@ -63,7 +63,7 @@ public interface DirectionalGroupApi { */ @Named("getDirectionalDNSGroupDetails") @POST - @XMLResponseParser(DirectionalGroupNameAndRegionsHandler.class) + @XMLResponseParser(DirectionalGroupHandler.class) @Fallback(NullOnNotFoundOr404.class) @Payload("{GroupId}") @Nullable @@ -89,9 +89,9 @@ public interface DirectionalGroupApi { */ @Named("getDirectionalDNSRecordsForAcctLvlGroup") @POST - @XMLResponseParser(DirectionalRecordDetailListHandler.class) + @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class) @Payload("{groupId}") - FluentIterable listRecordsByAccountLevelGroup( + FluentIterable listRecordsByAccountLevelGroup( @PayloadParam("groupId") String groupId) throws ResourceNotFoundException; /** @@ -126,9 +126,9 @@ public interface DirectionalGroupApi { */ @Named("getDirectionalDNSRecordsForGroup") @POST - @XMLResponseParser(DirectionalRecordDetailListHandler.class) + @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - FluentIterable listRecordsByGroupCoordinates( + FluentIterable listRecordsByGroupCoordinates( @BinderParam(DirectionalGroupCoordinatesToXML.class) DirectionalGroupCoordinates group) throws ResourceNotFoundException; } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalPoolApi.java index 59ed329c8c..ce33849be2 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalPoolApi.java @@ -30,10 +30,10 @@ import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.domain.DirectionalPool; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.DirectionalPoolListHandler; -import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; +import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler; import com.google.common.collect.FluentIterable; @@ -75,10 +75,10 @@ public interface DirectionalPoolApi { */ @Named("getDirectionalDNSRecordsForHost") @POST - @XMLResponseParser(DirectionalRecordDetailListHandler.class) + @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class) @Payload("{zoneName}{hostName}{poolRecordType}") - FluentIterable listRecordsByNameAndType( + FluentIterable listRecordsByNameAndType( @PayloadParam("hostName") String dname, @PayloadParam("poolRecordType") int type) throws ResourceNotFoundException; } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java index 77c309bca9..f636b53b99 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java @@ -33,7 +33,7 @@ import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML; import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; @@ -92,7 +92,7 @@ public interface ResourceRecordApi { @POST @XMLResponseParser(ResourceRecordListHandler.class) @Payload("{zoneName}0") - FluentIterable list() throws ResourceNotFoundException; + FluentIterable list() throws ResourceNotFoundException; /** * Returns all the specified record types in the zone with the fully @@ -107,7 +107,7 @@ public interface ResourceRecordApi { @POST @XMLResponseParser(ResourceRecordListHandler.class) @Payload("{zoneName}{hostName}0") - FluentIterable listByName(@PayloadParam("hostName") String hostName) + FluentIterable listByName(@PayloadParam("hostName") String hostName) throws ResourceNotFoundException; /** @@ -126,7 +126,7 @@ public interface ResourceRecordApi { @POST @XMLResponseParser(ResourceRecordListHandler.class) @Payload("{zoneName}{hostName}{rrType}") - FluentIterable listByNameAndType( + FluentIterable listByNameAndType( @PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType) throws ResourceNotFoundException; diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java index 4e355b5e6f..fedf379117 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java @@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.ElementTextHandler; @@ -71,7 +71,7 @@ public interface RoundRobinPoolApi { @POST @XMLResponseParser(ResourceRecordListHandler.class) @Payload("{poolId}") - FluentIterable listRecords(@PayloadParam("poolId") String poolId) + FluentIterable listRecords(@PayloadParam("poolId") String poolId) throws ResourceNotFoundException; /** @@ -79,7 +79,7 @@ public interface RoundRobinPoolApi { * * @param name * {@link RoundRobinPool#getName() name} of the RR pool - * @param hostname + * @param dname * {@link RoundRobinPool#getDName() dname} of the RR pool {ex. * www.jclouds.org.} * @return the {@code guid} of the new pool @@ -90,8 +90,8 @@ public interface RoundRobinPoolApi { @POST @XMLResponseParser(ElementTextHandler.RRPoolID.class) @Payload("{zoneName}{hostName}{description}1") - String createAPoolForHostname(@PayloadParam("description") String name, - @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; + String createAPoolForDName(@PayloadParam("description") String name, + @PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException; /** * adds a new {@code A} record to the pool @@ -155,8 +155,8 @@ public interface RoundRobinPoolApi { * * @param name * {@link RoundRobinPool#getName() name} of the RR pool - * @param hostname - * {@link RoundRobinPool#getDName() hostname} {ex. + * @param dname + * {@link RoundRobinPool#getDName() dname} {ex. * www.jclouds.org.} * @return the {@code guid} of the new record * @throws ResourceAlreadyExistsException @@ -166,8 +166,8 @@ public interface RoundRobinPoolApi { @POST @XMLResponseParser(ElementTextHandler.RRPoolID.class) @Payload("{zoneName}{hostName}{description}28") - String createAAAAPoolForHostname(@PayloadParam("description") String name, - @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; + String createAAAAPoolForDName(@PayloadParam("description") String name, + @PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException; /** * adds a new {@code AAAA} record to the pool diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java index 79759943eb..713bc2f0ba 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java @@ -36,14 +36,15 @@ import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsExcepti import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML; import org.jclouds.ultradns.ws.domain.PoolRecordSpec; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; +import org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.AttributeHandler; import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler; -import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; +import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordDetailListHandler; import com.google.common.collect.FluentIterable; @@ -61,9 +62,11 @@ public interface TrafficControllerPoolApi { * * @param name * {@link TrafficControllerPool#getName() name} of the TC pool - * @param hostname + * @param dname * {@link TrafficControllerPool#getDName() dname} of the TC pool * {ex. www.jclouds.org.} + * @param type + * the record types supported. * @return the {@code guid} of the new record * @throws ResourceAlreadyExistsException * if a pool already exists with the same attrs @@ -71,9 +74,9 @@ public interface TrafficControllerPoolApi { @Named("addTCLBPool") @POST @XMLResponseParser(ElementTextHandler.TCPoolID.class) - @Payload("{zoneName}{hostName}{description}1EnabledEnabled0") - String createPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) - throws ResourceAlreadyExistsException; + @Payload("{zoneName}{hostName}{description}{poolRecordType}EnabledEnabled0") + String createPoolForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname, + @PayloadParam("poolRecordType") RecordType type) throws ResourceAlreadyExistsException; /** * Returns all traffic controller pools in the zone. @@ -95,9 +98,9 @@ public interface TrafficControllerPoolApi { */ @Named("getPoolRecords") @POST - @XMLResponseParser(TrafficControllerPoolRecordListHandler.class) + @XMLResponseParser(TrafficControllerPoolRecordDetailListHandler.class) @Payload("{poolId}") - FluentIterable listRecords(@PayloadParam("poolId") String poolId) + FluentIterable listRecords(@PayloadParam("poolId") String poolId) throws ResourceNotFoundException; /** @@ -130,13 +133,13 @@ public interface TrafficControllerPoolApi { /** * adds a new record to the pool with default weight. * - * @param pointsTo + * @param rdata * the ipv4 address or hostname * @param lbPoolID * the pool to add the record to. * @param ttl * the {@link PoolRecordSpec#getTTL ttl} of the record - * @return the {@link TrafficControllerPoolRecord#getId() id} of the new + * @return the {@link TrafficControllerPoolRecordDetail#getId() id} of the new * record * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs @@ -145,13 +148,13 @@ public interface TrafficControllerPoolApi { @POST @XMLResponseParser(ElementTextHandler.PoolRecordID.class) @Payload("{poolID}{pointsTo}{ttl}") - String addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo, @PayloadParam("poolID") String lbPoolID, + String addRecordToPoolWithTTL(@PayloadParam("pointsTo") String rdata, @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; /** * adds a new record to the pool with a specified weight. * - * @param pointsTo + * @param rdata * the ipv4 address or hostname * @param lbPoolID * the pool to add the record to. @@ -159,7 +162,7 @@ public interface TrafficControllerPoolApi { * the {@link PoolRecordSpec#getTTL ttl} of the record * @param weight * the {@link PoolRecordSpec#getWeight() weight} of the record - * @return the {@link TrafficControllerPoolRecord#getId() id} of the new + * @return the {@link TrafficControllerPoolRecordDetail#getId() id} of the new * record * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs @@ -168,13 +171,13 @@ public interface TrafficControllerPoolApi { @POST @XMLResponseParser(ElementTextHandler.PoolRecordID.class) @Payload("{poolID}{pointsTo}{ttl}{weight}") - String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo, + String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String rdata, @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight) throws ResourceAlreadyExistsException; /** * @param poolRecordID - * {@link TrafficControllerPoolRecord#getId()} + * {@link TrafficControllerPoolRecordDetail#getId()} * @return null if not found */ @Named("getPoolRecordSpec>") @@ -189,7 +192,7 @@ public interface TrafficControllerPoolApi { * This request updates an existing pool record. * * @param poolRecordID - * {@link TrafficControllerPoolRecord#getId()} + * {@link TrafficControllerPoolRecordDetail#getId()} * @param update * what to update, usually primed via * {@link UpdatePoolRecord#pointingTo(PoolRecordSpec, String)} or diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicates.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicates.java new file mode 100644 index 0000000000..9cbd24ee5c --- /dev/null +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicates.java @@ -0,0 +1,78 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.ultradns.ws.predicates; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.jclouds.ultradns.ws.domain.DirectionalPool; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; + +import com.google.common.base.Predicate; + +/** + * Predicates handy when working with DirectionalPool Types + * + * @author Adrian Cole + */ +public class DirectionalPoolPredicates { + + public static Predicate idEqualTo(String id) { + return new IdEqualToPredicate(id); + } + + private static final class IdEqualToPredicate implements Predicate { + private final String id; + + public IdEqualToPredicate(String id) { + this.id = checkNotNull(id, "id"); + } + + @Override + public boolean apply(DirectionalPool input) { + return input != null && id.equals(input.getId()); + } + + @Override + public String toString() { + return "IdEqualTo(" + id + ")"; + } + } + + public static Predicate recordIdEqualTo(String recordId) { + return new RecordIdEqualToPredicate(recordId); + } + + private static final class RecordIdEqualToPredicate implements Predicate { + private final String recordId; + + public RecordIdEqualToPredicate(String recordId) { + this.recordId = checkNotNull(recordId, "recordId"); + } + + @Override + public boolean apply(DirectionalPoolRecordDetail input) { + return input != null && recordId.equals(input.getId()); + } + + @Override + public String toString() { + return "RecordIdEqualTo(" + recordId + ")"; + } + } +} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java index 3a358beab0..01b7a7a06f 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java @@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.predicates; import static com.google.common.base.Preconditions.checkNotNull; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; import com.google.common.base.Predicate; @@ -54,11 +54,11 @@ public class TrafficControllerPoolPredicates { } } - public static Predicate recordIdEqualTo(String recordId) { + public static Predicate recordIdEqualTo(String recordId) { return new RecordIdEqualToPredicate(recordId); } - private static final class RecordIdEqualToPredicate implements Predicate { + private static final class RecordIdEqualToPredicate implements Predicate { private final String recordId; public RecordIdEqualToPredicate(String recordId) { @@ -66,7 +66,7 @@ public class TrafficControllerPoolPredicates { } @Override - public boolean apply(TrafficControllerPoolRecord input) { + public boolean apply(TrafficControllerPoolRecordDetail input) { return input != null && recordId.equals(input.getId()); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java index 8a89823295..b815b86213 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java @@ -48,7 +48,7 @@ public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResul public void startElement(String uri, String localName, String qName, Attributes attrs) { Map attributes = cleanseAttributes(attrs); if (equalsOrSuffix(qName, "AccountDetailsData")) { - account = IdAndName.fromIdAndName(attributes.get("accountID"), attributes.get("accountName")); + account = IdAndName.create(attributes.get("accountID"), attributes.get("accountName")); } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupHandler.java similarity index 80% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupHandler.java index 17be49ae14..f1a75633aa 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupHandler.java @@ -26,12 +26,13 @@ import org.jclouds.ultradns.ws.domain.DirectionalGroup.Builder; import org.xml.sax.Attributes; import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableSortedSet; /** * * @author Adrian Cole */ -public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGeneratedRequestWithResult { +public class DirectionalGroupHandler extends ParseSax.HandlerForGeneratedRequestWithResult { private final Builder group = DirectionalGroup.builder(); @@ -44,10 +45,12 @@ public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGe public void startElement(String url, String name, String qName, Attributes attrs) { if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) { group.name(attrs.getValue("GroupName")); + group.description(attrs.getValue("Description")); } else if (equalsOrSuffix(qName, "RegionForNewGroups")) { String regionName = attrs.getValue("RegionName"); Iterable territories = Splitter.on(';').split(attrs.getValue("TerritoryName")); - group.mapRegionToTerritories(regionName, territories); + // for some reason, this isn't sorted here, though it is in other parts of the api. manually sort. + group.mapRegionToTerritories(regionName, ImmutableSortedSet.copyOf(territories)); } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolListHandler.java index 70c271802d..1003959a97 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolListHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolListHandler.java @@ -54,8 +54,8 @@ public class DirectionalPoolListHandler extends ParseSax.HandlerForGeneratedRequ DirectionalPool.Builder pool = DirectionalPool.builder() .zoneId(attributes.get("Zoneid")) .id(attributes.get("dirpoolid")) - .name(attributes.get("Pooldname")) - .description(attributes.get("Description")); + .dname(attributes.get("Pooldname")) + .name(attributes.get("Description")); String type = attributes.get("DirPoolType"); if (type != null) diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailHandler.java similarity index 72% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailHandler.java index 3bf7914c87..e624491bec 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailHandler.java @@ -25,30 +25,30 @@ import java.util.Map; import org.jclouds.http.functions.ParseSax; import static org.jclouds.ultradns.ws.domain.IdAndName.*; -import org.jclouds.ultradns.ws.domain.DirectionalRecord; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; import org.xml.sax.Attributes; /** * * @author Adrian Cole */ -public class DirectionalRecordDetailHandler extends - ParseSax.HandlerForGeneratedRequestWithResult { +public class DirectionalPoolRecordDetailHandler extends + ParseSax.HandlerForGeneratedRequestWithResult { - private DirectionalRecordDetail.Builder drd = DirectionalRecordDetail.builder(); - private DirectionalRecord.Builder dr = DirectionalRecord.drBuilder(); + private DirectionalPoolRecordDetail.Builder drd = DirectionalPoolRecordDetail.builder(); + private DirectionalPoolRecord.Builder dr = DirectionalPoolRecord.drBuilder(); private String zoneName; private String dname; @Override - public DirectionalRecordDetail getResult() { + public DirectionalPoolRecordDetail getResult() { try { return drd.record(dr.build()).build(); } finally { - drd = DirectionalRecordDetail.builder().zoneName(zoneName).name(dname); - dr = DirectionalRecord.drBuilder(); + drd = DirectionalPoolRecordDetail.builder().zoneName(zoneName).name(dname); + dr = DirectionalPoolRecord.drBuilder(); } } @@ -64,14 +64,14 @@ public class DirectionalRecordDetailHandler extends drd.id(attributes.get("DirPoolRecordId")); } if (attributes.containsKey("GroupId")) { - drd.group(fromIdAndName(attributes.get("GroupId"), attributes.get("GroupName"))); + drd.group(create(attributes.get("GroupId"), attributes.get("GroupName"))); } if (attributes.containsKey("GeolocationGroupId")) { - drd.geolocationGroup(fromIdAndName(attributes.get("GeolocationGroupId"), + drd.geolocationGroup(create(attributes.get("GeolocationGroupId"), attributes.get("GeolocationGroupName"))); } if (attributes.containsKey("SourceIPGroupId")) { - drd.sourceIpGroup(fromIdAndName(attributes.get("SourceIPGroupId"), attributes.get("SourceIPGroupName"))); + drd.sourceIpGroup(create(attributes.get("SourceIPGroupId"), attributes.get("SourceIPGroupName"))); } if (attributes.containsKey("recordType")) { dr.type(attributes.get("recordType")); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailListHandler.java similarity index 77% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailListHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailListHandler.java index 76cc2e8d84..3e5b83ce7e 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailListHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalPoolRecordDetailListHandler.java @@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml; import static org.jclouds.util.SaxUtils.equalsOrSuffix; import org.jclouds.http.functions.ParseSax; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; import org.xml.sax.Attributes; import com.google.common.collect.FluentIterable; @@ -33,20 +33,20 @@ import com.google.inject.Inject; * * @author Adrian Cole */ -public class DirectionalRecordDetailListHandler extends - ParseSax.HandlerForGeneratedRequestWithResult> { +public class DirectionalPoolRecordDetailListHandler extends + ParseSax.HandlerForGeneratedRequestWithResult> { - private final DirectionalRecordDetailHandler directionalRecordHandler; + private final DirectionalPoolRecordDetailHandler directionalRecordHandler; - private final Builder drs = ImmutableSet. builder(); + private final Builder drs = ImmutableSet. builder(); @Inject - public DirectionalRecordDetailListHandler(DirectionalRecordDetailHandler directionalRecordHandler) { + public DirectionalPoolRecordDetailListHandler(DirectionalPoolRecordDetailHandler directionalRecordHandler) { this.directionalRecordHandler = directionalRecordHandler; } @Override - public FluentIterable getResult() { + public FluentIterable getResult() { return FluentIterable.from(drs.build()); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java index dc52ea1095..f7a745122c 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java @@ -49,7 +49,7 @@ public class RegionListHandler extends ParseSax.HandlerForGeneratedRequestWithRe public void startElement(String url, String name, String qName, Attributes attrs) { if (equalsOrSuffix(qName, "Region")) { Map attributes = cleanseAttributes(attrs); - IdAndName region = IdAndName.fromIdAndName(attributes.get("RegionID"), attributes.get("RegionName")); + IdAndName region = IdAndName.create(attributes.get("RegionID"), attributes.get("RegionName")); regions.putAll(region, Splitter.on(';').split(attributes.get("TerritoryName"))); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordMetadataHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordDetailHandler.java similarity index 86% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordMetadataHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordDetailHandler.java index 9fbf48e52d..519659264b 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordMetadataHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordDetailHandler.java @@ -26,7 +26,7 @@ import java.util.Map; import org.jclouds.date.DateService; import org.jclouds.http.functions.ParseSax; import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.xml.sax.Attributes; import com.google.inject.Inject; @@ -35,24 +35,24 @@ import com.google.inject.Inject; * * @author Adrian Cole */ -public class ResourceRecordMetadataHandler extends - ParseSax.HandlerForGeneratedRequestWithResult { +public class ResourceRecordDetailHandler extends + ParseSax.HandlerForGeneratedRequestWithResult { private final DateService dateService; @Inject - private ResourceRecordMetadataHandler(DateService dateService) { + private ResourceRecordDetailHandler(DateService dateService) { this.dateService = dateService; } - private ResourceRecordMetadata.Builder rrm = ResourceRecordMetadata.builder(); + private ResourceRecordDetail.Builder rrm = ResourceRecordDetail.builder(); private ResourceRecord.Builder rr = ResourceRecord.rrBuilder(); @Override - public ResourceRecordMetadata getResult() { + public ResourceRecordDetail getResult() { try { return rrm.record(rr.build()).build(); } finally { - rrm = ResourceRecordMetadata.builder(); + rrm = ResourceRecordDetail.builder(); rr = ResourceRecord.rrBuilder(); } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordListHandler.java index 19652b6eb2..e7a29aeee5 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordListHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ResourceRecordListHandler.java @@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml; import static org.jclouds.util.SaxUtils.equalsOrSuffix; import org.jclouds.http.functions.ParseSax; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.xml.sax.Attributes; import com.google.common.collect.FluentIterable; @@ -34,19 +34,19 @@ import com.google.inject.Inject; * @author Adrian Cole */ public class ResourceRecordListHandler extends - ParseSax.HandlerForGeneratedRequestWithResult> { + ParseSax.HandlerForGeneratedRequestWithResult> { - private final ResourceRecordMetadataHandler resourceRecordHandler; + private final ResourceRecordDetailHandler resourceRecordHandler; - private Builder rrs = ImmutableSet. builder(); + private Builder rrs = ImmutableSet. builder(); @Inject - public ResourceRecordListHandler(ResourceRecordMetadataHandler resourceRecordHandler) { + public ResourceRecordListHandler(ResourceRecordDetailHandler resourceRecordHandler) { this.resourceRecordHandler = resourceRecordHandler; } @Override - public FluentIterable getResult() { + public FluentIterable getResult() { return FluentIterable.from(rrs.build()); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RoundRobinPoolHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RoundRobinPoolHandler.java index 779997af60..f77579c149 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RoundRobinPoolHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RoundRobinPoolHandler.java @@ -51,7 +51,7 @@ public class RoundRobinPoolHandler extends ParseSax.HandlerForGeneratedRequestWi if (equalsOrSuffix(qName, "LBPoolData")) { pool.zoneId(attributes.get("zoneid")); } else if (equalsOrSuffix(qName, "PoolData")) { - pool.id(attributes.get("PoolId")).name(attributes.get("PoolName")).dname(attributes.get("PoolDName")); + pool.id(attributes.get("PoolId")).name(attributes.get("description")).dname(attributes.get("PoolDName")); } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolHandler.java index afff20ff55..3bee35c109 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolHandler.java @@ -51,7 +51,7 @@ public class TrafficControllerPoolHandler extends ParseSax.HandlerForGeneratedRe if (equalsOrSuffix(qName, "LBPoolData")) { pool.zoneId(attributes.get("zoneid")); } else if (equalsOrSuffix(qName, "PoolData")) { - pool.id(attributes.get("PoolId")).name(attributes.get("PoolName")).dname(attributes.get("PoolDName")); + pool.id(attributes.get("PoolId")).name(attributes.get("description")).dname(attributes.get("PoolDName")); pool.statusCode(Integer.parseInt(attributes.get("PoolStatus"))); pool.failOverEnabled("Enabled".equalsIgnoreCase(attributes.get("FailOver"))); pool.probingEnabled("Enabled".equalsIgnoreCase(attributes.get("Probing"))); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordDetailListHandler.java similarity index 80% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordListHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordDetailListHandler.java index 7e84c35eef..2a7fc96135 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordListHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TrafficControllerPoolRecordDetailListHandler.java @@ -26,7 +26,8 @@ import java.util.Map; import org.jclouds.http.functions.ParseSax; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status; import org.xml.sax.Attributes; import com.google.common.collect.FluentIterable; @@ -37,13 +38,13 @@ import com.google.common.collect.ImmutableSet.Builder; * * @author Adrian Cole */ -public class TrafficControllerPoolRecordListHandler extends - ParseSax.HandlerForGeneratedRequestWithResult> { +public class TrafficControllerPoolRecordDetailListHandler extends + ParseSax.HandlerForGeneratedRequestWithResult> { - private final Builder records = ImmutableSet. builder(); + private final Builder records = ImmutableSet. builder(); @Override - public FluentIterable getResult() { + public FluentIterable getResult() { return FluentIterable.from(records.build()); } @@ -52,13 +53,15 @@ public class TrafficControllerPoolRecordListHandler extends if (!equalsOrSuffix(qName, "PoolRecordData")) return; Map attributes = cleanseAttributes(attrs); - records.add(TrafficControllerPoolRecord.builder() + TrafficControllerPoolRecord record = TrafficControllerPoolRecord.create( + attributes.get("recordType"), + attributes.get("pointsTo")); + records.add(TrafficControllerPoolRecordDetail.builder() .id(attributes.get("poolRecordID")) .poolId(attributes.get("poolId")) - .pointsTo(attributes.get("pointsTo")) + .record(record) .weight(parseInt(checkNotNull(attributes.get("weight"), "weight"))) .priority(parseInt(checkNotNull(attributes.get("priority"), "priority"))) - .type(attributes.get("recordType")) .forceAnswer(attributes.get("forceAnswer")) .probingEnabled("ENABLED".equalsIgnoreCase(attributes.get("probing"))) .status(Status.valueOf(attributes.get("status"))) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiExpectTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiExpectTest.java index 5ad9827308..0d23c8867e 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiExpectTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiExpectTest.java @@ -65,7 +65,7 @@ public class UltraDNSWSApiExpectTest extends BaseUltraDNSWSApiExpectTest { UltraDNSWSApi success = requestSendsResponse(getRegionsById, getRegionsByIdResponse); assertEquals( - success.getRegionsById().toString(), + success.getRegionsByIdAndName().toString(), new GetAvailableRegionsResponseTest().expected().toString()); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java index e7a4727298..4889854885 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java @@ -47,7 +47,7 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testListRegions() { - for (Entry> region : api.getRegionsById().asMap().entrySet()) { + for (Entry> region : api.getRegionsByIdAndName().asMap().entrySet()) { checkRegion(region); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalGroupApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalGroupApiLiveTest.java index b876072873..2413789ba5 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalGroupApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalGroupApiLiveTest.java @@ -26,13 +26,13 @@ import java.util.EnumSet; import java.util.Set; import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.AccountLevelGroup; -import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates; import org.jclouds.ultradns.ws.domain.DirectionalGroup; +import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates; import org.jclouds.ultradns.ws.domain.DirectionalPool; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; -import org.jclouds.ultradns.ws.domain.DirectionalRecordType; +import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; +import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.testng.annotations.BeforeClass; @@ -72,7 +72,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testListRecordsByAccountLevelGroup() { for (AccountLevelGroup group : api().listAccountLevelGroups()) { - for (DirectionalRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) { + for (DirectionalPoolRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) { DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr); } } @@ -93,11 +93,11 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest { public void testListGroupNamesByRecordNameAndType() { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (DirectionalPool pool : api.getDirectionalPoolApiForZone(zone.getName()).list()) { - for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) { - for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getName(), type.getCode())) { + for (RecordType type : EnumSet.allOf(RecordType.class)) { + for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getDName(), type.getCode())) { allGroups.add(DirectionalGroupCoordinates.builder() .zoneName(zone.getName()) - .recordName(pool.getName()) + .recordName(pool.getDName()) .recordType(type.getCode()) .groupName(groupName).build()); } @@ -109,7 +109,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test(dependsOnMethods = "testListGroupNamesByRecordNameAndType") public void testListRecordsByGroupCoordinates() { for (DirectionalGroupCoordinates group : allGroups) { - for (DirectionalRecordDetail rr : api().listRecordsByGroupCoordinates(group)) { + for (DirectionalPoolRecordDetail rr : api().listRecordsByGroupCoordinates(group)) { DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalPoolApiLiveTest.java index 118c8cc0d0..6c778abd9e 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/DirectionalPoolApiLiveTest.java @@ -28,9 +28,9 @@ import java.util.Set; import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.ultradns.ws.domain.DirectionalPool; -import org.jclouds.ultradns.ws.domain.DirectionalRecord; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; -import org.jclouds.ultradns.ws.domain.DirectionalRecordType; +import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; @@ -69,8 +69,8 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { private void checkDirectional(DirectionalPool pool) { assertNotNull(pool.getZoneId(), "ZoneId cannot be null " + pool); assertNotNull(pool.getId(), "Id cannot be null " + pool); - assertNotNull(pool.getName(), "DName cannot be null " + pool); - assertNotNull(pool.getDescription(), "Description cannot be null " + pool); + assertNotNull(pool.getDName(), "DName cannot be null " + pool); + assertNotNull(pool.getName(), "Name cannot be null " + pool); assertNotNull(pool.getType(), "Type cannot be null " + pool); assertNotNull(pool.getTieBreak(), "TieBreak cannot be null " + pool); } @@ -81,9 +81,9 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { public void testListDirectionalRecords() { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (DirectionalPool pool : api(zone.getName()).list()) { - for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) { - for (DirectionalRecordDetail rr : api(zone.getName()) - .listRecordsByNameAndType(pool.getName(), type.getCode())) { + for (RecordType type : EnumSet.allOf(RecordType.class)) { + for (DirectionalPoolRecordDetail rr : api(zone.getName()) + .listRecordsByNameAndType(pool.getDName(), type.getCode())) { checkDirectionalRecordDetail(rr); Iterable groups = Optional.presentInstances(ImmutableSet.of(rr.getGroup(), rr.getGeolocationGroup(), rr.getGeolocationGroup())); @@ -94,7 +94,7 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertNotNull(group.getName(), "Name cannot be null " + group); } assertEquals(rr.getZoneName(), zone.getName()); - assertEquals(rr.getName(), pool.getName()); + assertEquals(rr.getName(), pool.getDName()); switch (pool.getType()) { case GEOLOCATION: assertNotNull(rr.getGeolocationGroup().or(rr.getGroup()).orNull(), @@ -116,13 +116,13 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { } } - static void checkDirectionalRecord(DirectionalRecord rr) { + static void checkDirectionalRecord(DirectionalPoolRecord rr) { assertNotNull(rr.getType(), "Type cannot be null " + rr); assertNotNull(rr.getTTL(), "TTL cannot be null " + rr); assertNotNull(rr.getRData(), "InfoValues cannot be null " + rr); } - static void checkDirectionalRecordDetail(DirectionalRecordDetail rr) { + static void checkDirectionalRecordDetail(DirectionalPoolRecordDetail rr) { assertNotNull(rr.getZoneName(), "ZoneName cannot be null " + rr); assertNotNull(rr.getName(), "DName cannot be null " + rr); assertNotNull(rr.getId(), "Id cannot be null " + rr); diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java index e31c9caa6b..9a7f62e913 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java @@ -33,7 +33,7 @@ import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.testng.annotations.AfterClass; @@ -80,7 +80,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertNotNull(rr.getRData(), "InfoValues cannot be null for " + rr); } - static void checkResourceRecordMetadata(ResourceRecordMetadata rr) { + static void checkResourceRecordMetadata(ResourceRecordDetail rr) { assertNotNull(rr.getZoneId(), "ZoneId cannot be null for " + rr); assertNotNull(rr.getGuid(), "Guid cannot be null for " + rr); assertNotNull(rr.getZoneName(), "ZoneName cannot be null for " + rr); @@ -95,7 +95,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { public void testListResourceRecords() { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { zones.incrementAndGet(); - for (ResourceRecordMetadata rr : api(zone.getName()).list()) { + for (ResourceRecordDetail rr : api(zone.getName()).list()) { recordTypeCounts.getUnchecked(rr.getRecord().getType()).incrementAndGet(); checkResourceRecordMetadata(rr); } @@ -177,8 +177,8 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertFalse(listRRs().anyMatch(equalTo(mx))); } - static Function toRecord = new Function() { - public ResourceRecord apply(ResourceRecordMetadata in) { + static Function toRecord = new Function() { + public ResourceRecord apply(ResourceRecordDetail in) { checkResourceRecordMetadata(in); return in.getRecord(); } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiExpectTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiExpectTest.java index dd0425b519..2d83e75f88 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiExpectTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiExpectTest.java @@ -52,12 +52,12 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest { public void testCreateAWhenResponseIs2xx() { UltraDNSWSApi success = requestSendsResponse(createA, createResponse); - assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655"); + assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655"); } public void testCreateAAAAWhenResponseIs2xx() { UltraDNSWSApi success = requestSendsResponse(createAAAA, createResponse); - assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655"); + assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655"); } HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode()) @@ -66,7 +66,7 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest { @Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.") public void testCreateWhenResponseError2912() { UltraDNSWSApi already = requestSendsResponse(createA, alreadyCreated); - already.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForHostname("www.jclouds.org.", "foo"); + already.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForDName("www.jclouds.org.", "foo"); } HttpRequest list = HttpRequest.builder().method(POST) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java index 7bcea4edd0..dc6294a08e 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java @@ -31,7 +31,7 @@ import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; @@ -81,7 +81,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { public void testListRRPoolRecords() { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (RoundRobinPool pool : api(zone.getName()).list()) { - for (ResourceRecordMetadata record : api(zone.getName()).listRecords(pool.getId())) { + for (ResourceRecordDetail record : api(zone.getName()).listRecords(pool.getId())) { ResourceRecordApiLiveTest.checkResourceRecordMetadata(record); } } @@ -98,15 +98,15 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { api(zoneName).delete("06063D9C54C5AE09"); } - String hostname = "www.rrpool." + zoneName; + String dname = "www.rrpool." + zoneName; String aPoolId; @Test public void testCreateAPool() { - aPoolId = api(zoneName).createAPoolForHostname("A pool", hostname); + aPoolId = api(zoneName).createAPoolForDName("A pool", dname); getAnonymousLogger().info("created A rr pool: " + aPoolId); try { - api(zoneName).createAPoolForHostname("A pool", hostname); + api(zoneName).createAPoolForDName("A pool", dname); fail(); } catch (ResourceAlreadyExistsException e) { @@ -114,7 +114,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { Optional aPool = getPoolById(aPoolId); assertTrue(aPool.isPresent()); assertEquals(aPool.get().getName(), "A pool"); - assertEquals(aPool.get().getDName(), hostname); + assertEquals(aPool.get().getDName(), dname); } String aRecord1; @@ -127,12 +127,12 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { getAnonymousLogger().info("created A record: " + aRecord1); assertTrue(listRRs(aPoolId).anyMatch( - equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("1.2.3.4").build()))); + equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("1.2.3.4").build()))); aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", 1); assertTrue(listRRs(aPoolId).anyMatch( - equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("3.4.5.6").build()))); + equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("3.4.5.6").build()))); getAnonymousLogger().info("created A record: " + aRecord1); try { @@ -147,17 +147,17 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { public void testUpdateRecord() { api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", 0); assertTrue(listRRs(aPoolId).anyMatch( - equalTo(rrBuilder().name(hostname).type(1).ttl(0).rdata("1.1.1.1").build()))); + equalTo(rrBuilder().name(dname).type(1).ttl(0).rdata("1.1.1.1").build()))); } @Test(dependsOnMethods = "testUpdateRecord") public void testDeleteRecord() { api(zoneName).deleteRecord(aRecord2); assertTrue(listRRs(aPoolId).anyMatch( - equalTo(rrBuilder().name(hostname).type(1).ttl(0).rdata("1.1.1.1").build()))); + equalTo(rrBuilder().name(dname).type(1).ttl(0).rdata("1.1.1.1").build()))); assertFalse(listRRs(aPoolId).anyMatch( - equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("3.4.5.6").build()))); + equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("3.4.5.6").build()))); } @Test(dependsOnMethods = "testDeleteRecord") @@ -170,10 +170,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test public void testCreateAAAAPool() { - aaaaPoolId = api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname); + aaaaPoolId = api(zoneName).createAAAAPoolForDName("AAAA pool", dname); getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId); try { - api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname); + api(zoneName).createAAAAPoolForDName("AAAA pool", dname); fail(); } catch (ResourceAlreadyExistsException e) { @@ -181,7 +181,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { Optional aPool = getPoolById(aaaaPoolId); assertTrue(aPool.isPresent()); assertEquals(aPool.get().getName(), "AAAA pool"); - assertEquals(aPool.get().getDName(), hostname); + assertEquals(aPool.get().getDName(), dname); } String aaaaRecord1; @@ -195,7 +195,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { getAnonymousLogger().info("created AAAA record: " + aaaaRecord1); assertTrue(listRRs(aaaaPoolId).anyMatch( - equalTo(rrBuilder().name(hostname) + equalTo(rrBuilder().name(dname) .type(28) .ttl(1) .rdata("2001:0DB8:85A3:0000:0000:8A2E:0370:7334") @@ -205,7 +205,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { 1); assertTrue(listRRs(aaaaPoolId).anyMatch( - equalTo(rrBuilder().name(hostname) + equalTo(rrBuilder().name(dname) .type(28) .ttl(1) .rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334") diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiExpectTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiExpectTest.java index 52331a1e25..7bf93f4604 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiExpectTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiExpectTest.java @@ -21,6 +21,7 @@ import static com.google.common.net.HttpHeaders.HOST; import static javax.ws.rs.HttpMethod.POST; import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; import static javax.ws.rs.core.Response.Status.OK; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType.IPV4; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; @@ -50,7 +51,9 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT public void testCreateWhenResponseIs2xx() { UltraDNSWSApi success = requestSendsResponse(create, createResponse); - assertEquals(success.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForHostname("www.jclouds.org.", "foo"), "060339AA0417567A"); + assertEquals( + success.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForDNameAndType("foo", + "www.jclouds.org.", IPV4), "060339AA0417567A"); } HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode()) @@ -59,7 +62,8 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT @Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.") public void testCreateWhenResponseError2912() { UltraDNSWSApi already = requestSendsResponse(create, alreadyCreated); - already.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForHostname("www.jclouds.org.", "foo"); + already.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForDNameAndType("foo", "www.jclouds.org.", + IPV4); } HttpRequest list = HttpRequest.builder().method(POST) @@ -189,7 +193,7 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT } UpdatePoolRecord update = UpdatePoolRecord.builder() - .pointsTo("www.baz.com.") + .rdata("www.baz.com.") .mode("Normal") .weight(98) .failOverDelay(0) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java index c54817001a..ecd8b2e4ea 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java @@ -19,6 +19,8 @@ package org.jclouds.ultradns.ws.features; import static java.util.logging.Logger.getAnonymousLogger; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType.IPV4; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status.UNRECOGNIZED; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; import static org.testng.Assert.assertEquals; @@ -34,7 +36,7 @@ import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.PoolRecordSpec; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; @@ -85,14 +87,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest public void testListTCPoolRecords() { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (TrafficControllerPool pool : api(zone.getName()).list()) { - for (TrafficControllerPoolRecord record : api(zone.getName()).listRecords(pool.getId())) { + for (TrafficControllerPoolRecordDetail record : api(zone.getName()).listRecords(pool.getId())) { checkPoolRecordConsistent(zone.getName(), record); } } } } - private TrafficControllerPoolRecord checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecord record) { + private TrafficControllerPoolRecordDetail checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecordDetail record) { Optional pool = getPoolByZoneAndId(zoneName, record.getPoolId()); assertTrue(pool.isPresent(), "could not get pool for " + record); assertEquals(record.getDescription(), pool.get().getName()); @@ -103,15 +105,15 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest return checkTrafficControllerPoolRecord(record); } - static TrafficControllerPoolRecord checkTrafficControllerPoolRecord(TrafficControllerPoolRecord record) { + static TrafficControllerPoolRecordDetail checkTrafficControllerPoolRecord(TrafficControllerPoolRecordDetail record) { assertNotNull(record.getId(), "Id cannot be null for " + record); assertNotNull(record.getPoolId(), "PoolId cannot be null for " + record); - assertNotNull(record.getPointsTo(), "PointsTo cannot be null for " + record); + assertNotNull(record.getRecord().getRData(), "Record.RData cannot be null for " + record); + assertNotNull(record.getRecord().getType(), "Record.Type cannot be null for " + record); assertTrue(record.getWeight() >= 0, "Weight must be unsigned for " + record); assertTrue(record.getPriority() >= 0, "Priority must be unsigned for " + record); - assertNotNull(record.getType(), "Type cannot be null for " + record); assertNotNull(record.getStatus(), "Status cannot be null for " + record); - assertTrue(record.getStatus() != Status.UNRECOGNIZED, "unrecognized status for " + record); + assertTrue(record.getStatus() != UNRECOGNIZED, "unrecognized status for " + record); assertNotNull(record.getDescription(), "Description cannot be null for " + record); return record; } @@ -156,25 +158,25 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest @Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Pool Record does not exist.") public void testUpdateRecordWhenNotFound() { api(zoneName).updateRecord("06063D9C54C5AE09", - UpdatePoolRecord.builder().pointsTo("www.foo.com.").mode("Normal").build()); + UpdatePoolRecord.builder().rdata("www.foo.com.").mode("Normal").build()); } - String hostname = "www.tcpool." + zoneName; + String dname = "www.tcpool." + zoneName; String poolId; @Test public void testCreatePool() { - poolId = api(zoneName).createPoolForHostname("pool", hostname); + poolId = api(zoneName).createPoolForDNameAndType("pool", dname, IPV4); getAnonymousLogger().info("created tc pool: " + poolId); try { - api(zoneName).createPoolForHostname("pool", hostname); + api(zoneName).createPoolForDNameAndType("pool", dname, IPV4); fail(); } catch (ResourceAlreadyExistsException e) { } - // ensure there's only one pool for a hostname + // ensure there's only one pool for a dname try { - api(zoneName).createPoolForHostname("pool1", hostname); + api(zoneName).createPoolForDNameAndType("pool1", dname, IPV4); fail(); } catch (ResourceAlreadyExistsException e) { @@ -183,7 +185,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest assertTrue(pool.isPresent()); assertEquals(pool.get().getId(), poolId); assertEquals(pool.get().getName(), "pool"); - assertEquals(pool.get().getDName(), hostname); + assertEquals(pool.get().getDName(), dname); checkTCPool(pool.get()); } @@ -202,18 +204,17 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest } @Test(dependsOnMethods = "testCreatePool", dataProvider = "records") - public TrafficControllerPoolRecord addRecordToPool(String pointsTo, String type, int ttl, Optional weight) { + public TrafficControllerPoolRecordDetail addRecordToPool(String rdata, String type, int ttl, Optional weight) { String recordId; if (weight.isPresent()) { - recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(pointsTo, poolId, ttl, weight.get()); + recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(rdata, poolId, ttl, weight.get()); } else { - recordId = api(zoneName).addRecordToPoolWithTTL(pointsTo, poolId, ttl); + recordId = api(zoneName).addRecordToPoolWithTTL(rdata, poolId, ttl); } getAnonymousLogger().info("created " + type + " record: " + recordId); - TrafficControllerPoolRecord record = checkPoolRecordConsistent(zoneName, getRecordById(recordId).get()); + TrafficControllerPoolRecordDetail record = checkPoolRecordConsistent(zoneName, getRecordById(recordId).get()); PoolRecordSpec recordSpec = checkPoolRecordSpec(api(zoneName).getRecordSpec(recordId)); - assertEquals(record.getPointsTo(), pointsTo); - assertEquals(record.getType(), type); + assertEquals(record.getRecord(), TrafficControllerPoolRecord.create(type, rdata)); assertEquals(record.getWeight(), weight.or(2).intValue()); assertEquals(recordSpec.getTTL(), ttl); return record; @@ -240,14 +241,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest public void testUpdateRecord() { PoolRecordSpec spec = api(zoneName).getRecordSpec(cname2); UpdatePoolRecord update = UpdatePoolRecord.builder().from(spec) - .pointsTo("www.baz.com.") + .rdata("www.baz.com.") .weight(98) .ttl(200).build(); api(zoneName).updateRecord(cname2, update); - TrafficControllerPoolRecord record = getRecordById(cname2).get(); - assertEquals(record.getPointsTo(), "www.baz.com."); + TrafficControllerPoolRecordDetail record = getRecordById(cname2).get(); + assertEquals(record.getRecord().getRData(), "www.baz.com."); spec = api(zoneName).getRecordSpec(cname2); assertEquals(spec.getWeight(), 98); @@ -267,7 +268,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest assertFalse(getPoolByZoneAndId(zoneName, poolId).isPresent()); } - private Optional getRecordById(String recordId) { + private Optional getRecordById(String recordId) { return api(zoneName).listRecords(poolId).firstMatch(recordIdEqualTo(recordId)); } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAccountsListOfUserResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAccountsListOfUserResponseTest.java index dc87545aae..02cf8f76b7 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAccountsListOfUserResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAccountsListOfUserResponseTest.java @@ -45,7 +45,7 @@ public class GetAccountsListOfUserResponseTest extends BaseHandlerTest { } public IdAndName expected() { - return IdAndName.fromIdAndName("AAAAAAAAAAAAAAAA", "jclouds"); + return IdAndName.create("AAAAAAAAAAAAAAAA", "jclouds"); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAvailableRegionsResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAvailableRegionsResponseTest.java index 20f560c6ba..3cfa385038 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAvailableRegionsResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetAvailableRegionsResponseTest.java @@ -18,7 +18,7 @@ */ package org.jclouds.ultradns.ws.parse; -import static org.jclouds.ultradns.ws.domain.IdAndName.fromIdAndName; +import static org.jclouds.ultradns.ws.domain.IdAndName.create; import static org.testng.Assert.assertEquals; import java.io.InputStream; @@ -51,8 +51,8 @@ public class GetAvailableRegionsResponseTest extends BaseHandlerTest { public Multimap expected() { return ImmutableMultimap. builder() - .put(fromIdAndName("14", "Anonymous Proxy (A1)"), "Anonymous Proxy") - .putAll(fromIdAndName("3", "Antarctica"), ImmutableSet. builder() + .put(create("14", "Anonymous Proxy (A1)"), "Anonymous Proxy") + .putAll(create("3", "Antarctica"), ImmutableSet. builder() .add("Antarctica") .add("Bouvet Island") .add("French Southern Territories") diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSGroupDetailsResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSGroupDetailsResponseTest.java index 2f84f3c3fa..a1799b8372 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSGroupDetailsResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSGroupDetailsResponseTest.java @@ -24,7 +24,7 @@ import java.io.InputStream; import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.ultradns.ws.domain.DirectionalGroup; -import org.jclouds.ultradns.ws.xml.DirectionalGroupNameAndRegionsHandler; +import org.jclouds.ultradns.ws.xml.DirectionalGroupHandler; import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; @@ -40,7 +40,7 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest { DirectionalGroup expected = expected(); - DirectionalGroupNameAndRegionsHandler handler = injector.getInstance(DirectionalGroupNameAndRegionsHandler.class); + DirectionalGroupHandler handler = injector.getInstance(DirectionalGroupHandler.class); DirectionalGroup result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); @@ -52,8 +52,9 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest { .mapRegionToTerritory("Anonymous Proxy (A1)", "Anonymous Proxy") .mapRegionToTerritory("Mexico", "Mexico") .mapRegionToTerritories("Antarctica", ImmutableList. builder() + .add("Antarctica") .add("Bouvet Island") .add("French Southern Territories") - .add("Antarctica").build()).build(); + .build()).build(); } } \ No newline at end of file diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSRecordsForHostResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSRecordsForHostResponseTest.java index 26b94865db..49d41d6f41 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSRecordsForHostResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalDNSRecordsForHostResponseTest.java @@ -18,15 +18,15 @@ */ package org.jclouds.ultradns.ws.parse; -import static org.jclouds.ultradns.ws.domain.IdAndName.fromIdAndName; +import static org.jclouds.ultradns.ws.domain.IdAndName.create; import static org.testng.Assert.assertEquals; import java.io.InputStream; import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ultradns.ws.domain.DirectionalRecord; -import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; -import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; +import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler; import org.testng.annotations.Test; import com.google.common.collect.FluentIterable; @@ -41,52 +41,52 @@ public class GetDirectionalDNSRecordsForHostResponseTest extends BaseHandlerTest public void test() { InputStream is = getClass().getResourceAsStream("/directionalrecords.xml"); - FluentIterable expected = expected(); + FluentIterable expected = expected(); - DirectionalRecordDetailListHandler handler = injector.getInstance(DirectionalRecordDetailListHandler.class); - FluentIterable result = factory.create(handler).parse(is); + DirectionalPoolRecordDetailListHandler handler = injector.getInstance(DirectionalPoolRecordDetailListHandler.class); + FluentIterable result = factory.create(handler).parse(is); assertEquals(result.toSet().toString(), expected.toSet().toString()); } - public FluentIterable expected() { - return FluentIterable.from(ImmutableSet. builder() - .add(DirectionalRecordDetail.builder() + public FluentIterable expected() { + return FluentIterable.from(ImmutableSet. builder() + .add(DirectionalPoolRecordDetail.builder() .zoneName("geo.jclouds.org.") .name("www.geo.jclouds.org.") .id("A000000000000001") - .geolocationGroup(fromIdAndName("C000000000000001", "southamerica")) - .record(DirectionalRecord.drBuilder() + .geolocationGroup(create("C000000000000001", "southamerica")) + .record(DirectionalPoolRecord.drBuilder() .type("CNAME") .ttl(300) .noResponseRecord(false) .rdata("southamerica.geo.jclouds.org.").build()).build()) - .add(DirectionalRecordDetail.builder() + .add(DirectionalPoolRecordDetail.builder() .zoneName("geo.jclouds.org.") .name("www.geo.jclouds.org.") .id("A000000000000002") - .group(fromIdAndName("B000000000000001", "All Non-Configured Regions")) - .record(DirectionalRecord.drBuilder() + .group(create("B000000000000001", "All Non-Configured Regions")) + .record(DirectionalPoolRecord.drBuilder() .type("A") .ttl(500) .noResponseRecord(false) .rdata("1.1.1.2").build()).build()) - .add(DirectionalRecordDetail.builder() + .add(DirectionalPoolRecordDetail.builder() .zoneName("geo.jclouds.org.") .name("www.geo.jclouds.org.") .id("A000000000000003") - .geolocationGroup(fromIdAndName("C000000000000002", "antarctica-unsupported")) - .record(DirectionalRecord.drBuilder() + .geolocationGroup(create("C000000000000002", "antarctica-unsupported")) + .record(DirectionalPoolRecord.drBuilder() .type("A") .ttl(0) .noResponseRecord(true) .rdata("No Data Response").build()).build()) - .add(DirectionalRecordDetail.builder() + .add(DirectionalPoolRecordDetail.builder() .zoneName("geo.jclouds.org.") .name("www.geo.jclouds.org.") .id("A000000000000004") - .geolocationGroup(fromIdAndName("C000000000000003", "alazona")) - .record(DirectionalRecord.drBuilder() + .geolocationGroup(create("C000000000000003", "alazona")) + .record(DirectionalPoolRecord.drBuilder() .type("A") .ttl(86400) // default .noResponseRecord(false) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalPoolsByZoneResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalPoolsByZoneResponseTest.java index 75f6266092..31862e4391 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalPoolsByZoneResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetDirectionalPoolsByZoneResponseTest.java @@ -54,13 +54,13 @@ public class GetDirectionalPoolsByZoneResponseTest extends BaseHandlerTest { .add(DirectionalPool.builder() .zoneId("0000000000000001") .id("000000000000000A") - .name("mixy.jclouds.org.") + .dname("mixy.jclouds.org.") .type(Type.MIXED) .tieBreak(TieBreak.GEOLOCATION) - .description("mixy").build()) + .name("mixy").build()) .add(DirectionalPool.builder() .zoneId("0000000000000002") .id("000000000000000B") - .name("geo.jclouds.org.").build()).build()); + .dname("geo.jclouds.org.").build()).build()); } } \ No newline at end of file diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetRRLoadBalancingPoolsByZoneResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetRRLoadBalancingPoolsByZoneResponseTest.java index 05b43d12a7..78743813a9 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetRRLoadBalancingPoolsByZoneResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetRRLoadBalancingPoolsByZoneResponseTest.java @@ -52,17 +52,17 @@ public class GetRRLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest { .add(RoundRobinPool.builder() .zoneId("0000000000000001") .id("000000000000002") - .name("app-uswest1.jclouds.org.") + .name("uswest1") .dname("app-uswest1.jclouds.org.").build()) .add(RoundRobinPool.builder() .zoneId("0000000000000001") .id("000000000000003") - .name("app-uswest2.jclouds.org.") + .name("uswest2") .dname("app-uswest2.jclouds.org.").build()) .add(RoundRobinPool.builder() .zoneId("0000000000000001") .id("000000000000004") - .name("app-euwest.jclouds.org.") + .name("euwest") .dname("app-euwest.jclouds.org.").build()).build()); } } \ No newline at end of file diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfDNameByTypeResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfDNameByTypeResponseTest.java index 64483a177b..891fbc169c 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfDNameByTypeResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfDNameByTypeResponseTest.java @@ -25,7 +25,7 @@ import java.io.InputStream; import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.testng.annotations.Test; @@ -43,16 +43,16 @@ public class GetResourceRecordsOfDNameByTypeResponseTest extends BaseHandlerTest public void test() { InputStream is = getClass().getResourceAsStream("/records_by_name_and_type.xml"); - FluentIterable expected = expected(); + FluentIterable expected = expected(); ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class); - FluentIterable result = factory.create(handler).parse(is); + FluentIterable result = factory.create(handler).parse(is); assertEquals(result.toList().toString(), expected.toList().toString()); } - public FluentIterable expected() { - ResourceRecordMetadata record = ResourceRecordMetadata.builder() + public FluentIterable expected() { + ResourceRecordDetail record = ResourceRecordDetail.builder() .zoneId("03053D8E57C7A22A") .guid("04053D8E57C7A22F") .zoneName("adrianc.rr.ultradnstest.jclouds.org.") diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfResourceRecordResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfResourceRecordResponseTest.java index 6cd64d24a1..b6a5943b1c 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfResourceRecordResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetResourceRecordsOfResourceRecordResponseTest.java @@ -25,8 +25,8 @@ import java.io.InputStream; import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata.Builder; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail; +import org.jclouds.ultradns.ws.domain.ResourceRecordDetail.Builder; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.testng.annotations.Test; @@ -45,17 +45,17 @@ public class GetResourceRecordsOfResourceRecordResponseTest extends BaseHandlerT public void test() { InputStream is = getClass().getResourceAsStream("/records.xml"); - FluentIterable expected = expected(); + FluentIterable expected = expected(); ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class); - FluentIterable result = factory.create(handler).parse(is); + FluentIterable result = factory.create(handler).parse(is); assertEquals(result.toList().toString(), expected.toList().toString()); } - public FluentIterable expected() { - Builder builder = ResourceRecordMetadata.builder().zoneId("0000000000000001").zoneName("jclouds.org."); - ImmutableList records = ImmutableList. builder() + public FluentIterable expected() { + Builder builder = ResourceRecordDetail.builder().zoneId("0000000000000001").zoneName("jclouds.org."); + ImmutableList records = ImmutableList. builder() .add(builder.guid("04023A2507B6468F") .created(dateService.iso8601DateParse("2010-10-02T16:57:16.000Z")) .modified(dateService.iso8601DateParse("2011-09-27T23:49:21.000Z")) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCLoadBalancingPoolsByZoneResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCLoadBalancingPoolsByZoneResponseTest.java index c808c76b66..13faa9fe7f 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCLoadBalancingPoolsByZoneResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCLoadBalancingPoolsByZoneResponseTest.java @@ -52,7 +52,7 @@ public class GetTCLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest { .add(TrafficControllerPool.builder() .zoneId("0000000000000001") .id("000000000000002") - .name("us-west-1c.discovery.jclouds.org.") + .name("us-west-1c") .dname("us-west-1c.discovery.jclouds.org.") .statusCode(1) .failOverEnabled(true) diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCPoolRecordsResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCPoolRecordsResponseTest.java index 4e753cd51a..6ea56896ab 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCPoolRecordsResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/GetTCPoolRecordsResponseTest.java @@ -18,14 +18,15 @@ */ package org.jclouds.ultradns.ws.parse; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.createCNAME; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status.OK; import static org.testng.Assert.assertEquals; import java.io.InputStream; import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; -import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; +import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordDetailListHandler; import org.testng.annotations.Test; import com.google.common.collect.FluentIterable; @@ -40,38 +41,36 @@ public class GetTCPoolRecordsResponseTest extends BaseHandlerTest { public void test() { InputStream is = getClass().getResourceAsStream("/tcrecords.xml"); - FluentIterable expected = expected(); + FluentIterable expected = expected(); - TrafficControllerPoolRecordListHandler handler = injector.getInstance(TrafficControllerPoolRecordListHandler.class); - FluentIterable result = factory.create(handler).parse(is); + TrafficControllerPoolRecordDetailListHandler handler = injector.getInstance(TrafficControllerPoolRecordDetailListHandler.class); + FluentIterable result = factory.create(handler).parse(is); assertEquals(result.toSet().toString(), expected.toSet().toString()); } - public FluentIterable expected() { - return FluentIterable.from(ImmutableSet. builder() - .add(TrafficControllerPoolRecord.builder() + public FluentIterable expected() { + return FluentIterable.from(ImmutableSet. builder() + .add(TrafficControllerPoolRecordDetail.builder() .id("0000000000000001") .poolId("0000000000000001") - .pointsTo("canary.jclouds.org.") + .record(createCNAME("canary.jclouds.org.")) .weight(2) .priority(2) - .type("CNAME") .forceAnswer("Normal") .probingEnabled(true) - .status(Status.OK) + .status(OK) .serving(true) .description("canary app").build()) - .add(TrafficControllerPoolRecord.builder() + .add(TrafficControllerPoolRecordDetail.builder() .id("0000000000000002") .poolId("0000000000000001") - .pointsTo("prod.jclouds.org.") + .record(createCNAME("prod.jclouds.org.")) .weight(98) .priority(1) - .type("CNAME") .forceAnswer("Normal") .probingEnabled(true) - .status(Status.OK) + .status(OK) .serving(true) .description("prod app").build()) .build()); diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicatesTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicatesTest.java new file mode 100644 index 0000000000..2892c8b809 --- /dev/null +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/DirectionalPoolPredicatesTest.java @@ -0,0 +1,77 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.ultradns.ws.predicates; + +import static org.jclouds.ultradns.ws.domain.IdAndName.create; +import static org.jclouds.ultradns.ws.predicates.DirectionalPoolPredicates.idEqualTo; +import static org.jclouds.ultradns.ws.predicates.DirectionalPoolPredicates.recordIdEqualTo; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import org.jclouds.ultradns.ws.domain.DirectionalPool; +import org.jclouds.ultradns.ws.domain.DirectionalPool.TieBreak; +import org.jclouds.ultradns.ws.domain.DirectionalPool.Type; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord; +import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "DirectionalPoolPredicatesTest") +public class DirectionalPoolPredicatesTest { + DirectionalPool pool = DirectionalPool.builder() + .zoneId("0000000000000001") + .id("000000000000000A") + .dname("mixy.jclouds.org.") + .type(Type.MIXED) + .tieBreak(TieBreak.GEOLOCATION) + .name("mixy").build(); + + @Test + public void testIdEqualToWhenEqual() { + assertTrue(idEqualTo("000000000000000A").apply(pool)); + } + + @Test + public void testIdEqualToWhenNotEqual() { + assertFalse(idEqualTo("000000000000000B").apply(pool)); + } + + DirectionalPoolRecordDetail record = DirectionalPoolRecordDetail.builder() + .zoneName("geo.jclouds.org.") + .name("www.geo.jclouds.org.") + .id("A000000000000001") + .geolocationGroup(create("C000000000000001", "southamerica")) + .record(DirectionalPoolRecord.drBuilder() + .type("CNAME") + .ttl(300) + .noResponseRecord(false) + .rdata("southamerica.geo.jclouds.org.").build()).build(); + @Test + public void testRecordIdEqualToWhenEqual() { + assertTrue(recordIdEqualTo("A000000000000001").apply(record)); + } + + @Test + public void testRecordIdEqualToWhenNotEqual() { + assertFalse(recordIdEqualTo("A000000000000002").apply(record)); + } +} diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java index 528ae26998..90fe3933f3 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java @@ -18,14 +18,15 @@ */ package org.jclouds.ultradns.ws.predicates; +import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.createCNAME; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail; +import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status; import org.testng.annotations.Test; /** @@ -53,13 +54,12 @@ public class TrafficControllerPoolPredicatesTest { assertFalse(idEqualTo("000000000000003").apply(pool)); } - TrafficControllerPoolRecord record = TrafficControllerPoolRecord.builder() + TrafficControllerPoolRecordDetail record = TrafficControllerPoolRecordDetail.builder() .id("0000000000000001") .poolId("0000000000000001") - .pointsTo("canary.jclouds.org.") + .record(createCNAME("canary.jclouds.org.")) .weight(2) .priority(2) - .type("CNAME") .forceAnswer("Normal") .probingEnabled(true) .status(Status.OK) diff --git a/providers/ultradns-ws/src/test/resources/create_tcpool.xml b/providers/ultradns-ws/src/test/resources/create_tcpool.xml index 48fe1bdcc6..42cd8dadfd 100644 --- a/providers/ultradns-ws/src/test/resources/create_tcpool.xml +++ b/providers/ultradns-ws/src/test/resources/create_tcpool.xml @@ -1 +1 @@ -identitycredentialjclouds.org.foowww.jclouds.org.1EnabledEnabled0 \ No newline at end of file +identitycredentialjclouds.org.www.jclouds.org.foo1EnabledEnabled0 \ No newline at end of file diff --git a/providers/ultradns-ws/src/test/resources/rrpools.xml b/providers/ultradns-ws/src/test/resources/rrpools.xml index 4d0986734d..8a0156a017 100644 --- a/providers/ultradns-ws/src/test/resources/rrpools.xml +++ b/providers/ultradns-ws/src/test/resources/rrpools.xml @@ -4,17 +4,17 @@ xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"> - - - diff --git a/providers/ultradns-ws/src/test/resources/tcpools.xml b/providers/ultradns-ws/src/test/resources/tcpools.xml index 69199637e4..6f75312df4 100644 --- a/providers/ultradns-ws/src/test/resources/tcpools.xml +++ b/providers/ultradns-ws/src/test/resources/tcpools.xml @@ -4,7 +4,7 @@ xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"> -