From 2252451ab0d241ababe93d8d8b9e9c8c675fc79b Mon Sep 17 00:00:00 2001 From: adriancole Date: Mon, 11 Mar 2013 14:56:09 -0700 Subject: [PATCH] ultradns-ws: replaced usage of UnsignedInteger with int --- .../ultradns/ws/ResourceTypeToValue.java | 23 +++++----- .../ultradns/ws/domain/ResourceRecord.java | 42 +++++++------------ .../org/jclouds/ultradns/ws/domain/Zone.java | 34 +++++++-------- .../ultradns/ws/domain/ZoneProperties.java | 22 ++++------ .../ws/features/ResourceRecordApi.java | 9 +--- .../ws/features/ResourceRecordAsyncApi.java | 12 ------ .../ws/features/RoundRobinPoolApi.java | 7 ++-- .../ws/features/RoundRobinPoolAsyncApi.java | 7 ++-- .../ws/xml/ResourceRecordMetadataHandler.java | 5 +-- .../jclouds/ultradns/ws/xml/ZoneHandler.java | 3 +- .../features/ResourceRecordApiExpectTest.java | 3 +- .../features/ResourceRecordApiLiveTest.java | 13 +++--- .../features/RoundRobinPoolApiLiveTest.java | 16 ++++--- 13 files changed, 72 insertions(+), 124 deletions(-) diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/ResourceTypeToValue.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/ResourceTypeToValue.java index f3e76d3ae1..6d9da796d2 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/ResourceTypeToValue.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/ResourceTypeToValue.java @@ -29,7 +29,6 @@ import com.google.common.base.Function; import com.google.common.collect.BiMap; import com.google.common.collect.ForwardingMap; import com.google.common.collect.ImmutableBiMap; -import com.google.common.primitives.UnsignedInteger; /** * Most UltraDNS commands use the numerical type value of a resource record @@ -41,8 +40,8 @@ import com.google.common.primitives.UnsignedInteger; * @see org.jclouds.rest.annotations.ParamParser */ @Beta -public class ResourceTypeToValue extends ForwardingMap implements Function, - BiMap { +public class ResourceTypeToValue extends ForwardingMap implements Function, + BiMap { /** * look up the value (ex. {@code 28}) for the mnemonic name (ex. {@code AAAA} @@ -53,7 +52,7 @@ public class ResourceTypeToValue extends ForwardingMap * @throws IllegalArgumentException * if the type was not configured. */ - public static UnsignedInteger lookup(String type) throws IllegalArgumentException { + public static Integer lookup(String type) throws IllegalArgumentException { checkNotNull(type, "resource type was null"); checkArgument(lookup.containsKey(type), "%s do not include %s; types: %s", ResourceTypes.class.getSimpleName(), type, EnumSet.allOf(ResourceTypes.class)); @@ -113,22 +112,22 @@ public class ResourceTypeToValue extends ForwardingMap */ SRV(33); - private final UnsignedInteger value; + private final int value; private ResourceTypes(int value) { - this.value = UnsignedInteger.fromIntBits(value); + this.value = value; } } @Override - protected ImmutableBiMap delegate() { + protected ImmutableBiMap delegate() { return lookup; } - private static final ImmutableBiMap lookup; + private static final ImmutableBiMap lookup; static { - ImmutableBiMap.Builder builder = ImmutableBiMap.builder(); + ImmutableBiMap.Builder builder = ImmutableBiMap.builder(); for (ResourceTypes r : EnumSet.allOf(ResourceTypes.class)) { builder.put(r.name(), r.value); } @@ -140,17 +139,17 @@ public class ResourceTypeToValue extends ForwardingMap */ @Deprecated @Override - public UnsignedInteger forcePut(String key, UnsignedInteger value) { + public Integer forcePut(String key, Integer value) { return lookup.forcePut(key, value); } @Override - public Set values() { + public Set values() { return lookup.values(); } @Override - public BiMap inverse() { + public BiMap inverse() { return lookup.inverse(); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java index 005d002d71..e505f1bb2d 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java @@ -21,6 +21,7 @@ package org.jclouds.ultradns.ws.domain; import static com.google.common.base.Functions.toStringFunction; import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.toStringHelper; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Iterables.transform; @@ -30,7 +31,6 @@ import org.jclouds.ultradns.ws.ResourceTypeToValue; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; -import com.google.common.primitives.UnsignedInteger; /** * @author Adrian Cole @@ -38,14 +38,16 @@ import com.google.common.primitives.UnsignedInteger; public class ResourceRecord { private final String dName; - private final UnsignedInteger type; - private final UnsignedInteger ttl; + private final int type; + private final int ttl; private final List infoValues; - private ResourceRecord(String dName, UnsignedInteger type, UnsignedInteger ttl, List infoValues) { + private ResourceRecord(String dName, int type, int ttl, List infoValues) { this.dName = checkNotNull(dName, "dName"); - this.type = checkNotNull(type, "type of %s", dName); - this.ttl = checkNotNull(ttl, "ttl of %s", dName); + checkArgument(type >= 0, "type of %s must be unsigned", dName); + this.type = type; + checkArgument(ttl >= 0, "ttl of %s must be unsigned", dName); + this.ttl = ttl; this.infoValues = checkNotNull(infoValues, "infoValues of %s", dName); } @@ -59,11 +61,11 @@ public class ResourceRecord { /** * the type value. ex {@code 1} for type {@code A} */ - public UnsignedInteger getType() { + public int getType() { return type; } - public UnsignedInteger getTTL() { + public int getTTL() { return ttl; } @@ -106,8 +108,8 @@ public class ResourceRecord { public final static class Builder { private String dName; - private UnsignedInteger type; - private UnsignedInteger ttl; + private int type = -1; + private int ttl = -1; private ImmutableList.Builder infoValues = ImmutableList. builder(); /** @@ -132,26 +134,11 @@ public class ResourceRecord { return this; } - /** - * @see ResourceRecord#getType() - */ - public Builder type(UnsignedInteger type) { - this.type = type; - return this; - } - /** * @see ResourceRecord#getType() */ public Builder type(int type) { - return type(UnsignedInteger.fromIntBits(type)); - } - - /** - * @see ResourceRecord#getTTL() - */ - public Builder ttl(UnsignedInteger ttl) { - this.ttl = ttl; + this.type = type; return this; } @@ -159,7 +146,8 @@ public class ResourceRecord { * @see ResourceRecord#getTTL() */ public Builder ttl(int ttl) { - return ttl(UnsignedInteger.fromIntBits(ttl)); + this.ttl = ttl; + return this; } /** diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java index d44c1cfcb5..45b6e83686 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java @@ -18,11 +18,11 @@ */ 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; import com.google.common.base.Optional; -import com.google.common.primitives.UnsignedInteger; /** * @@ -33,17 +33,18 @@ public final class Zone { private final String id; private final String name; private final Type type; - private final UnsignedInteger typeCode; + private final int typeCode; private final String accountId; private final String ownerId; private final DNSSECStatus dnssecStatus; private final Optional primarySrc; - private Zone(String id, String name, Type type, UnsignedInteger typeCode, String accountId, String ownerId, + private Zone(String id, String name, Type type, int typeCode, String accountId, String ownerId, DNSSECStatus dnssecStatus, Optional primarySrc) { this.id = checkNotNull(id, "id"); this.name = checkNotNull(name, "name for %s", id); - this.typeCode = checkNotNull(typeCode, "typeCode for %s", name); + checkArgument(typeCode >= 0, "typeCode of %s must be unsigned", id); + this.typeCode = typeCode; this.type = checkNotNull(type, "type for %s", name); this.accountId = checkNotNull(accountId, "accountId for %s", name); this.ownerId = checkNotNull(ownerId, "ownerId for %s", name); @@ -75,7 +76,7 @@ public final class Zone { /** * The type of the zone */ - public UnsignedInteger getTypeCode() { + public int getTypeCode() { return typeCode; } @@ -136,13 +137,13 @@ public final class Zone { PRIMARY(1), SECONDARY(2), ALIAS(3), UNRECOGNIZED(-1); - private final UnsignedInteger code; + private final int code; Type(int code) { - this.code = UnsignedInteger.fromIntBits(code); + this.code = code; } - public UnsignedInteger getCode() { + public int getCode() { return code; } @@ -152,11 +153,11 @@ public final class Zone { } public static Type fromValue(String type) { - return fromValue(UnsignedInteger.valueOf(checkNotNull(type, "type"))); + return fromValue(Integer.parseInt(checkNotNull(type, "type"))); } - public static Type fromValue(UnsignedInteger code) { - switch (code.intValue()) { + public static Type fromValue(int code) { + switch (code) { case 1: return PRIMARY; case 2: @@ -194,7 +195,7 @@ public final class Zone { private String id; private String name; private Type type; - private UnsignedInteger typeCode; + private int typeCode = -1; private String accountId; private String ownerId; private DNSSECStatus dnssecStatus; @@ -227,19 +228,12 @@ public final class Zone { /** * @see Zone#getTypeCode() */ - public Builder typeCode(UnsignedInteger typeCode) { + public Builder typeCode(int typeCode) { this.typeCode = typeCode; this.type = Type.fromValue(typeCode); return this; } - /** - * @see ZoneProperties#getTypeCode() - */ - public Builder typeCode(int typeCode) { - return typeCode(UnsignedInteger.fromIntBits(typeCode)); - } - /** * @see Zone#getAccountId() */ diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java index a05cf0ee59..014a7f801b 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java @@ -18,6 +18,7 @@ */ package org.jclouds.ultradns.ws.domain; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Date; @@ -25,7 +26,6 @@ import java.util.Date; import org.jclouds.ultradns.ws.domain.Zone.Type; import com.google.common.base.Objects; -import com.google.common.primitives.UnsignedInteger; /** * @@ -35,13 +35,14 @@ public final class ZoneProperties { private final String name; private final Type type; - private final UnsignedInteger typeCode; + private final int typeCode; private final Date modified; private final int resourceRecordCount; - private ZoneProperties(String name, Type type, UnsignedInteger typeCode, Date modified, int resourceRecordCount) { + private ZoneProperties(String name, Type type, int typeCode, Date modified, int resourceRecordCount) { this.name = checkNotNull(name, "name"); - this.typeCode = checkNotNull(typeCode, "typeCode for %s", name); + checkArgument(typeCode >= 0, "typeCode of %s must be unsigned", name); + this.typeCode = typeCode; this.type = checkNotNull(type, "type for %s", name); this.modified = checkNotNull(modified, "modified for %s", name); this.resourceRecordCount = checkNotNull(resourceRecordCount, "resourceRecordCount for %s", name); @@ -64,7 +65,7 @@ public final class ZoneProperties { /** * The type of the zone */ - public UnsignedInteger getTypeCode() { + public int getTypeCode() { return typeCode; } @@ -114,7 +115,7 @@ public final class ZoneProperties { public final static class Builder { private String name; private Type type; - private UnsignedInteger typeCode; + private int typeCode = -1; private Date modified; private int resourceRecordCount; @@ -137,19 +138,12 @@ public final class ZoneProperties { /** * @see ZoneProperties#getTypeCode() */ - public Builder typeCode(UnsignedInteger typeCode) { + public Builder typeCode(int typeCode) { this.typeCode = typeCode; this.type = Type.fromValue(typeCode); return this; } - /** - * @see ZoneProperties#getTypeCode() - */ - public Builder typeCode(int typeCode) { - return typeCode(UnsignedInteger.fromIntBits(typeCode)); - } - /** * @see ZoneProperties#getModified() */ 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 fd78949bf5..e8d3072d30 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 @@ -25,7 +25,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import com.google.common.collect.FluentIterable; -import com.google.common.primitives.UnsignedInteger; /** * @see ResourceRecordAsyncApi @@ -88,12 +87,6 @@ public interface ResourceRecordApi { * @throws ResourceNotFoundException * if the zone doesn't exist */ - FluentIterable listByNameAndType(String hostName, UnsignedInteger rrType) - throws ResourceNotFoundException; - - /** - * @see #listByNameAndType(String, UnsignedInteger) - */ FluentIterable listByNameAndType(String hostName, int rrType) throws ResourceNotFoundException; @@ -101,7 +94,7 @@ public interface ResourceRecordApi { * @param type * the literal type defined in {@link ResourceTypeToValue}. ex * {@code AAAA} - * @see #listByNameAndType(String, UnsignedInteger) + * @see #listByNameAndType(String, int) */ FluentIterable listByNameAndType(String hostName, String type) throws ResourceNotFoundException; diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java index fac2b181c9..76447e74a6 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java @@ -41,7 +41,6 @@ import org.jclouds.ultradns.ws.xml.GuidHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import com.google.common.collect.FluentIterable; -import com.google.common.primitives.UnsignedInteger; import com.google.common.util.concurrent.ListenableFuture; /** @@ -92,17 +91,6 @@ public interface ResourceRecordAsyncApi { ListenableFuture> listByName(@PayloadParam("hostName") String hostName) throws ResourceNotFoundException; - /** - * @see ResourceRecordApi#listByNameAndType(String, UnsignedInteger) - */ - @Named("getResourceRecordsOfDNameByType") - @POST - @XMLResponseParser(ResourceRecordListHandler.class) - @Payload("{zoneName}{hostName}{rrType}") - ListenableFuture> listByNameAndType( - @PayloadParam("hostName") String hostName, @PayloadParam("rrType") UnsignedInteger rrType) - throws ResourceNotFoundException; - /** * @see ResourceRecordApi#listByNameAndType(String, int) */ 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 7cba3e8f43..9c4eb87f18 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 @@ -25,7 +25,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.RoundRobinPool; import com.google.common.collect.FluentIterable; -import com.google.common.primitives.UnsignedInteger; /** * @see RoundRobinPoolAsyncApi @@ -59,7 +58,7 @@ public interface RoundRobinPoolApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String addARecordWithAddressAndTTL(String lbPoolID, String ipv4Address, UnsignedInteger ttl) + String addARecordWithAddressAndTTL(String lbPoolID, String ipv4Address, int ttl) throws ResourceAlreadyExistsException; /** @@ -89,7 +88,7 @@ public interface RoundRobinPoolApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String addAAAARecordWithAddressAndTTL(String lbPoolID, String ipv6Address, UnsignedInteger ttl) + String addAAAARecordWithAddressAndTTL(String lbPoolID, String ipv6Address, int ttl) throws ResourceAlreadyExistsException; /** @@ -108,7 +107,7 @@ public interface RoundRobinPoolApi { * @throws ResourceNotFoundException * if the guid doesn't exist */ - void updateRecordWithAddressAndTTL(String lbPoolID, String guid, String address, UnsignedInteger ttl) + void updateRecordWithAddressAndTTL(String lbPoolID, String guid, String address, int ttl) throws ResourceNotFoundException; /** diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java index 795392eccc..9e8c9d39c7 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java @@ -39,7 +39,6 @@ import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler; import com.google.common.collect.FluentIterable; -import com.google.common.primitives.UnsignedInteger; import com.google.common.util.concurrent.ListenableFuture; /** @@ -89,7 +88,7 @@ public interface RoundRobinPoolAsyncApi { @XMLResponseParser(GuidHandler.class) @Payload("") ListenableFuture addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, - @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") UnsignedInteger ttl) + @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; /** @@ -100,7 +99,7 @@ public interface RoundRobinPoolAsyncApi { @Payload("") ListenableFuture updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, @PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address, - @PayloadParam("ttl") UnsignedInteger ttl) throws ResourceNotFoundException; + @PayloadParam("ttl") int ttl) throws ResourceNotFoundException; /** * @see RoundRobinPoolApi#deleteRecord(String) @@ -129,7 +128,7 @@ public interface RoundRobinPoolAsyncApi { @XMLResponseParser(GuidHandler.class) @Payload("") ListenableFuture addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, - @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") UnsignedInteger ttl) + @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; /** 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/ResourceRecordMetadataHandler.java index 17265f2a56..9fbf48e52d 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/ResourceRecordMetadataHandler.java @@ -29,7 +29,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.xml.sax.Attributes; -import com.google.common.primitives.UnsignedInteger; import com.google.inject.Inject; /** @@ -67,9 +66,9 @@ public class ResourceRecordMetadataHandler extends rrm.zoneName(attributes.get("ZoneName")); rrm.created(dateService.iso8601DateParse(attributes.get("Created"))); rrm.modified(dateService.iso8601DateParse(attributes.get("Modified"))); - rr.type(UnsignedInteger.valueOf(attributes.get("Type"))); + rr.type(Integer.parseInt(attributes.get("Type"))); rr.name(attributes.get("DName")); - rr.ttl(UnsignedInteger.valueOf(attributes.get("TTL"))); + rr.ttl(Integer.parseInt(attributes.get("TTL"))); } else if (equalsOrSuffix(qName, "InfoValues")) { rr.rdata(attributes.values()); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ZoneHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ZoneHandler.java index 43ee32f23b..d61c15da80 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ZoneHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ZoneHandler.java @@ -29,7 +29,6 @@ import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone.DNSSECStatus; import org.xml.sax.Attributes; -import com.google.common.primitives.UnsignedInteger; /** * @@ -55,7 +54,7 @@ public class ZoneHandler extends ParseSax.HandlerForGeneratedRequestWithResult 0, "Type must be positive for a ResourceRecord " + rr); + assertTrue(rr.getType() > 0, "Type must be unsigned for a ResourceRecord " + rr); checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr); checkNotNull(rr.getTTL(), "TTL cannot be null for a ResourceRecord %s", rr); checkNotNull(rr.getRData(), "InfoValues cannot be null for a ResourceRecord %s", rr); @@ -105,19 +104,19 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { } } - LoadingCache recordTypeCounts = CacheBuilder.newBuilder().build( - new CacheLoader() { - public AtomicLong load(UnsignedInteger key) throws Exception { + LoadingCache recordTypeCounts = CacheBuilder.newBuilder().build( + new CacheLoader() { + public AtomicLong load(Integer key) throws Exception { return new AtomicLong(); } }); - private final static BiMap valueToType = new ResourceTypeToValue().inverse(); + private final static BiMap valueToType = new ResourceTypeToValue().inverse(); @AfterClass void logSummary() { getAnonymousLogger().info("zoneCount: " + zones); - for (Entry entry : recordTypeCounts.asMap().entrySet()) + for (Entry entry : recordTypeCounts.asMap().entrySet()) getAnonymousLogger().info( String.format("type: %s, count: %s", valueToType.get(entry.getKey()), entry.getValue())); } 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 64f3cf7125..d6f31b4560 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 @@ -42,7 +42,6 @@ import org.testng.annotations.Test; import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.collect.FluentIterable; -import com.google.common.primitives.UnsignedInteger; /** * @author Adrian Cole @@ -122,21 +121,21 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test(dependsOnMethods = "testCreateAPool") public void addARecordToPool() { - aRecord1 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", UnsignedInteger.ONE); + aRecord1 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", 1); getAnonymousLogger().info("created A record: " + aRecord1); assertTrue(listRRs(aPoolId).anyMatch( equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("1.2.3.4").build()))); - aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", UnsignedInteger.ONE); + aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", 1); assertTrue(listRRs(aPoolId).anyMatch( equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("3.4.5.6").build()))); getAnonymousLogger().info("created A record: " + aRecord1); try { - api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", UnsignedInteger.ONE); + api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", 1); fail(); } catch (ResourceAlreadyExistsException e) { @@ -145,7 +144,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test(dependsOnMethods = "addARecordToPool") public void testUpdateRecord() { - api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", UnsignedInteger.ZERO); + api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", 0); assertTrue(listRRs(aPoolId).anyMatch( equalTo(rrBuilder().name(hostname).type("A").ttl(0).rdata("1.1.1.1").build()))); } @@ -190,7 +189,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { @Test(dependsOnMethods = "testCreateAAAAPool") public void addAAAARecordToPool() { aaaaRecord1 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", - UnsignedInteger.ONE); + 1); getAnonymousLogger().info("created AAAA record: " + aaaaRecord1); @@ -199,7 +198,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { .build()))); aaaaRecord2 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2002:0DB8:85A3:0000:0000:8A2E:0370:7334", - UnsignedInteger.ONE); + 1); assertTrue(listRRs(aaaaPoolId).anyMatch( equalTo(rrBuilder().name(hostname).type("AAAA").ttl(1).rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334") @@ -207,8 +206,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { getAnonymousLogger().info("created AAAA record: " + aaaaRecord1); try { - api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", - UnsignedInteger.ONE); + api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", 1); fail(); } catch (ResourceAlreadyExistsException e) {