ultradns-ws: replaced usage of UnsignedInteger with int

This commit is contained in:
adriancole 2013-03-11 14:56:09 -07:00
parent aeee6ceb31
commit 2252451ab0
13 changed files with 72 additions and 124 deletions

View File

@ -29,7 +29,6 @@ import com.google.common.base.Function;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.ForwardingMap; import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableBiMap;
import com.google.common.primitives.UnsignedInteger;
/** /**
* Most UltraDNS commands use the numerical type value of a resource record * 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 * @see org.jclouds.rest.annotations.ParamParser
*/ */
@Beta @Beta
public class ResourceTypeToValue extends ForwardingMap<String, UnsignedInteger> implements Function<Object, String>, public class ResourceTypeToValue extends ForwardingMap<String, Integer> implements Function<Object, String>,
BiMap<String, UnsignedInteger> { BiMap<String, Integer> {
/** /**
* look up the value (ex. {@code 28}) for the mnemonic name (ex. {@code AAAA} * look up the value (ex. {@code 28}) for the mnemonic name (ex. {@code AAAA}
@ -53,7 +52,7 @@ public class ResourceTypeToValue extends ForwardingMap<String, UnsignedInteger>
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if the type was not configured. * 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"); checkNotNull(type, "resource type was null");
checkArgument(lookup.containsKey(type), "%s do not include %s; types: %s", ResourceTypes.class.getSimpleName(), checkArgument(lookup.containsKey(type), "%s do not include %s; types: %s", ResourceTypes.class.getSimpleName(),
type, EnumSet.allOf(ResourceTypes.class)); type, EnumSet.allOf(ResourceTypes.class));
@ -113,22 +112,22 @@ public class ResourceTypeToValue extends ForwardingMap<String, UnsignedInteger>
*/ */
SRV(33); SRV(33);
private final UnsignedInteger value; private final int value;
private ResourceTypes(int value) { private ResourceTypes(int value) {
this.value = UnsignedInteger.fromIntBits(value); this.value = value;
} }
} }
@Override @Override
protected ImmutableBiMap<String, UnsignedInteger> delegate() { protected ImmutableBiMap<String, Integer> delegate() {
return lookup; return lookup;
} }
private static final ImmutableBiMap<String, UnsignedInteger> lookup; private static final ImmutableBiMap<String, Integer> lookup;
static { static {
ImmutableBiMap.Builder<String, UnsignedInteger> builder = ImmutableBiMap.builder(); ImmutableBiMap.Builder<String, Integer> builder = ImmutableBiMap.builder();
for (ResourceTypes r : EnumSet.allOf(ResourceTypes.class)) { for (ResourceTypes r : EnumSet.allOf(ResourceTypes.class)) {
builder.put(r.name(), r.value); builder.put(r.name(), r.value);
} }
@ -140,17 +139,17 @@ public class ResourceTypeToValue extends ForwardingMap<String, UnsignedInteger>
*/ */
@Deprecated @Deprecated
@Override @Override
public UnsignedInteger forcePut(String key, UnsignedInteger value) { public Integer forcePut(String key, Integer value) {
return lookup.forcePut(key, value); return lookup.forcePut(key, value);
} }
@Override @Override
public Set<UnsignedInteger> values() { public Set<Integer> values() {
return lookup.values(); return lookup.values();
} }
@Override @Override
public BiMap<UnsignedInteger, String> inverse() { public BiMap<Integer, String> inverse() {
return lookup.inverse(); return lookup.inverse();
} }

View File

@ -21,6 +21,7 @@ package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Functions.toStringFunction; import static com.google.common.base.Functions.toStringFunction;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper; 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.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform; 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.base.Objects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -38,14 +38,16 @@ import com.google.common.primitives.UnsignedInteger;
public class ResourceRecord { public class ResourceRecord {
private final String dName; private final String dName;
private final UnsignedInteger type; private final int type;
private final UnsignedInteger ttl; private final int ttl;
private final List<String> infoValues; private final List<String> infoValues;
private ResourceRecord(String dName, UnsignedInteger type, UnsignedInteger ttl, List<String> infoValues) { private ResourceRecord(String dName, int type, int ttl, List<String> infoValues) {
this.dName = checkNotNull(dName, "dName"); this.dName = checkNotNull(dName, "dName");
this.type = checkNotNull(type, "type of %s", dName); checkArgument(type >= 0, "type of %s must be unsigned", dName);
this.ttl = checkNotNull(ttl, "ttl of %s", 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); 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} * the type value. ex {@code 1} for type {@code A}
*/ */
public UnsignedInteger getType() { public int getType() {
return type; return type;
} }
public UnsignedInteger getTTL() { public int getTTL() {
return ttl; return ttl;
} }
@ -106,8 +108,8 @@ public class ResourceRecord {
public final static class Builder { public final static class Builder {
private String dName; private String dName;
private UnsignedInteger type; private int type = -1;
private UnsignedInteger ttl; private int ttl = -1;
private ImmutableList.Builder<String> infoValues = ImmutableList.<String> builder(); private ImmutableList.Builder<String> infoValues = ImmutableList.<String> builder();
/** /**
@ -132,26 +134,11 @@ public class ResourceRecord {
return this; return this;
} }
/**
* @see ResourceRecord#getType()
*/
public Builder type(UnsignedInteger type) {
this.type = type;
return this;
}
/** /**
* @see ResourceRecord#getType() * @see ResourceRecord#getType()
*/ */
public Builder type(int type) { public Builder type(int type) {
return type(UnsignedInteger.fromIntBits(type)); this.type = type;
}
/**
* @see ResourceRecord#getTTL()
*/
public Builder ttl(UnsignedInteger ttl) {
this.ttl = ttl;
return this; return this;
} }
@ -159,7 +146,8 @@ public class ResourceRecord {
* @see ResourceRecord#getTTL() * @see ResourceRecord#getTTL()
*/ */
public Builder ttl(int ttl) { public Builder ttl(int ttl) {
return ttl(UnsignedInteger.fromIntBits(ttl)); this.ttl = ttl;
return this;
} }
/** /**

View File

@ -18,11 +18,11 @@
*/ */
package org.jclouds.ultradns.ws.domain; package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Optional; 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 id;
private final String name; private final String name;
private final Type type; private final Type type;
private final UnsignedInteger typeCode; private final int typeCode;
private final String accountId; private final String accountId;
private final String ownerId; private final String ownerId;
private final DNSSECStatus dnssecStatus; private final DNSSECStatus dnssecStatus;
private final Optional<String> primarySrc; private final Optional<String> 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<String> primarySrc) { DNSSECStatus dnssecStatus, Optional<String> primarySrc) {
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name for %s", 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.type = checkNotNull(type, "type for %s", name);
this.accountId = checkNotNull(accountId, "accountId for %s", name); this.accountId = checkNotNull(accountId, "accountId for %s", name);
this.ownerId = checkNotNull(ownerId, "ownerId for %s", name); this.ownerId = checkNotNull(ownerId, "ownerId for %s", name);
@ -75,7 +76,7 @@ public final class Zone {
/** /**
* The type of the zone * The type of the zone
*/ */
public UnsignedInteger getTypeCode() { public int getTypeCode() {
return typeCode; return typeCode;
} }
@ -136,13 +137,13 @@ public final class Zone {
PRIMARY(1), SECONDARY(2), ALIAS(3), UNRECOGNIZED(-1); PRIMARY(1), SECONDARY(2), ALIAS(3), UNRECOGNIZED(-1);
private final UnsignedInteger code; private final int code;
Type(int code) { Type(int code) {
this.code = UnsignedInteger.fromIntBits(code); this.code = code;
} }
public UnsignedInteger getCode() { public int getCode() {
return code; return code;
} }
@ -152,11 +153,11 @@ public final class Zone {
} }
public static Type fromValue(String type) { 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) { public static Type fromValue(int code) {
switch (code.intValue()) { switch (code) {
case 1: case 1:
return PRIMARY; return PRIMARY;
case 2: case 2:
@ -194,7 +195,7 @@ public final class Zone {
private String id; private String id;
private String name; private String name;
private Type type; private Type type;
private UnsignedInteger typeCode; private int typeCode = -1;
private String accountId; private String accountId;
private String ownerId; private String ownerId;
private DNSSECStatus dnssecStatus; private DNSSECStatus dnssecStatus;
@ -227,19 +228,12 @@ public final class Zone {
/** /**
* @see Zone#getTypeCode() * @see Zone#getTypeCode()
*/ */
public Builder typeCode(UnsignedInteger typeCode) { public Builder typeCode(int typeCode) {
this.typeCode = typeCode; this.typeCode = typeCode;
this.type = Type.fromValue(typeCode); this.type = Type.fromValue(typeCode);
return this; return this;
} }
/**
* @see ZoneProperties#getTypeCode()
*/
public Builder typeCode(int typeCode) {
return typeCode(UnsignedInteger.fromIntBits(typeCode));
}
/** /**
* @see Zone#getAccountId() * @see Zone#getAccountId()
*/ */

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.ultradns.ws.domain; package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Date; import java.util.Date;
@ -25,7 +26,6 @@ import java.util.Date;
import org.jclouds.ultradns.ws.domain.Zone.Type; import org.jclouds.ultradns.ws.domain.Zone.Type;
import com.google.common.base.Objects; 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 String name;
private final Type type; private final Type type;
private final UnsignedInteger typeCode; private final int typeCode;
private final Date modified; private final Date modified;
private final int resourceRecordCount; 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.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.type = checkNotNull(type, "type for %s", name);
this.modified = checkNotNull(modified, "modified for %s", name); this.modified = checkNotNull(modified, "modified for %s", name);
this.resourceRecordCount = checkNotNull(resourceRecordCount, "resourceRecordCount for %s", name); this.resourceRecordCount = checkNotNull(resourceRecordCount, "resourceRecordCount for %s", name);
@ -64,7 +65,7 @@ public final class ZoneProperties {
/** /**
* The type of the zone * The type of the zone
*/ */
public UnsignedInteger getTypeCode() { public int getTypeCode() {
return typeCode; return typeCode;
} }
@ -114,7 +115,7 @@ public final class ZoneProperties {
public final static class Builder { public final static class Builder {
private String name; private String name;
private Type type; private Type type;
private UnsignedInteger typeCode; private int typeCode = -1;
private Date modified; private Date modified;
private int resourceRecordCount; private int resourceRecordCount;
@ -137,19 +138,12 @@ public final class ZoneProperties {
/** /**
* @see ZoneProperties#getTypeCode() * @see ZoneProperties#getTypeCode()
*/ */
public Builder typeCode(UnsignedInteger typeCode) { public Builder typeCode(int typeCode) {
this.typeCode = typeCode; this.typeCode = typeCode;
this.type = Type.fromValue(typeCode); this.type = Type.fromValue(typeCode);
return this; return this;
} }
/**
* @see ZoneProperties#getTypeCode()
*/
public Builder typeCode(int typeCode) {
return typeCode(UnsignedInteger.fromIntBits(typeCode));
}
/** /**
* @see ZoneProperties#getModified() * @see ZoneProperties#getModified()
*/ */

View File

@ -25,7 +25,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @see ResourceRecordAsyncApi * @see ResourceRecordAsyncApi
@ -88,12 +87,6 @@ public interface ResourceRecordApi {
* @throws ResourceNotFoundException * @throws ResourceNotFoundException
* if the zone doesn't exist * if the zone doesn't exist
*/ */
FluentIterable<ResourceRecordMetadata> listByNameAndType(String hostName, UnsignedInteger rrType)
throws ResourceNotFoundException;
/**
* @see #listByNameAndType(String, UnsignedInteger)
*/
FluentIterable<ResourceRecordMetadata> listByNameAndType(String hostName, int rrType) FluentIterable<ResourceRecordMetadata> listByNameAndType(String hostName, int rrType)
throws ResourceNotFoundException; throws ResourceNotFoundException;
@ -101,7 +94,7 @@ public interface ResourceRecordApi {
* @param type * @param type
* the literal type defined in {@link ResourceTypeToValue}. ex * the literal type defined in {@link ResourceTypeToValue}. ex
* {@code AAAA} * {@code AAAA}
* @see #listByNameAndType(String, UnsignedInteger) * @see #listByNameAndType(String, int)
*/ */
FluentIterable<ResourceRecordMetadata> listByNameAndType(String hostName, String type) FluentIterable<ResourceRecordMetadata> listByNameAndType(String hostName, String type)
throws ResourceNotFoundException; throws ResourceNotFoundException;

View File

@ -41,7 +41,6 @@ import org.jclouds.ultradns.ws.xml.GuidHandler;
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
@ -92,17 +91,6 @@ public interface ResourceRecordAsyncApi {
ListenableFuture<FluentIterable<ResourceRecordMetadata>> listByName(@PayloadParam("hostName") String hostName) ListenableFuture<FluentIterable<ResourceRecordMetadata>> listByName(@PayloadParam("hostName") String hostName)
throws ResourceNotFoundException; throws ResourceNotFoundException;
/**
* @see ResourceRecordApi#listByNameAndType(String, UnsignedInteger)
*/
@Named("getResourceRecordsOfDNameByType")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>{rrType}</rrType></v01:getResourceRecordsOfDNameByType>")
ListenableFuture<FluentIterable<ResourceRecordMetadata>> listByNameAndType(
@PayloadParam("hostName") String hostName, @PayloadParam("rrType") UnsignedInteger rrType)
throws ResourceNotFoundException;
/** /**
* @see ResourceRecordApi#listByNameAndType(String, int) * @see ResourceRecordApi#listByNameAndType(String, int)
*/ */

View File

@ -25,7 +25,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @see RoundRobinPoolAsyncApi * @see RoundRobinPoolAsyncApi
@ -59,7 +58,7 @@ public interface RoundRobinPoolApi {
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs * 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; throws ResourceAlreadyExistsException;
/** /**
@ -89,7 +88,7 @@ public interface RoundRobinPoolApi {
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs * 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; throws ResourceAlreadyExistsException;
/** /**
@ -108,7 +107,7 @@ public interface RoundRobinPoolApi {
* @throws ResourceNotFoundException * @throws ResourceNotFoundException
* if the guid doesn't exist * 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; throws ResourceNotFoundException;
/** /**

View File

@ -39,7 +39,6 @@ import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler; import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
@ -89,7 +88,7 @@ public interface RoundRobinPoolAsyncApi {
@XMLResponseParser(GuidHandler.class) @XMLResponseParser(GuidHandler.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>") @Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") UnsignedInteger ttl) @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl)
throws ResourceAlreadyExistsException; throws ResourceAlreadyExistsException;
/** /**
@ -100,7 +99,7 @@ public interface RoundRobinPoolAsyncApi {
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>") @Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
ListenableFuture<Void> updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, ListenableFuture<Void> updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address, @PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address,
@PayloadParam("ttl") UnsignedInteger ttl) throws ResourceNotFoundException; @PayloadParam("ttl") int ttl) throws ResourceNotFoundException;
/** /**
* @see RoundRobinPoolApi#deleteRecord(String) * @see RoundRobinPoolApi#deleteRecord(String)
@ -129,7 +128,7 @@ public interface RoundRobinPoolAsyncApi {
@XMLResponseParser(GuidHandler.class) @XMLResponseParser(GuidHandler.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>") @Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv6Address, @PayloadParam("ttl") UnsignedInteger ttl) @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl)
throws ResourceAlreadyExistsException; throws ResourceAlreadyExistsException;
/** /**

View File

@ -29,7 +29,6 @@ import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.primitives.UnsignedInteger;
import com.google.inject.Inject; import com.google.inject.Inject;
/** /**
@ -67,9 +66,9 @@ public class ResourceRecordMetadataHandler extends
rrm.zoneName(attributes.get("ZoneName")); rrm.zoneName(attributes.get("ZoneName"));
rrm.created(dateService.iso8601DateParse(attributes.get("Created"))); rrm.created(dateService.iso8601DateParse(attributes.get("Created")));
rrm.modified(dateService.iso8601DateParse(attributes.get("Modified"))); 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.name(attributes.get("DName"));
rr.ttl(UnsignedInteger.valueOf(attributes.get("TTL"))); rr.ttl(Integer.parseInt(attributes.get("TTL")));
} else if (equalsOrSuffix(qName, "InfoValues")) { } else if (equalsOrSuffix(qName, "InfoValues")) {
rr.rdata(attributes.values()); rr.rdata(attributes.values());
} }

View File

@ -29,7 +29,6 @@ import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.domain.Zone.DNSSECStatus; import org.jclouds.ultradns.ws.domain.Zone.DNSSECStatus;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.primitives.UnsignedInteger;
/** /**
* *
@ -55,7 +54,7 @@ public class ZoneHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Z
zone = Zone.builder() zone = Zone.builder()
.id(attributes.get("zoneId")) .id(attributes.get("zoneId"))
.name(attributes.get("zoneName")) .name(attributes.get("zoneName"))
.typeCode(UnsignedInteger.valueOf(checkNotNull(attributes.get("zoneType"), "zoneType"))) .typeCode(Integer.parseInt(checkNotNull(attributes.get("zoneType"), "zoneType")))
.accountId(attributes.get("accountId")) .accountId(attributes.get("accountId"))
.ownerId(attributes.get("owner")) .ownerId(attributes.get("owner"))
.dnssecStatus(DNSSECStatus.fromValue(attributes.get("dnssecStatus"))) .dnssecStatus(DNSSECStatus.fromValue(attributes.get("dnssecStatus")))

View File

@ -31,7 +31,6 @@ import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiExpectTest;
import org.jclouds.ultradns.ws.parse.GetResourceRecordsOfResourceRecordResponseTest; import org.jclouds.ultradns.ws.parse.GetResourceRecordsOfResourceRecordResponseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -127,7 +126,7 @@ public class ResourceRecordApiExpectTest extends BaseUltraDNSWSApiExpectTest {
assertEquals( assertEquals(
success.getResourceRecordApiForZone("jclouds.org.") success.getResourceRecordApiForZone("jclouds.org.")
.listByNameAndType("www.jclouds.org.", UnsignedInteger.ONE).toString(), .listByNameAndType("www.jclouds.org.", 1).toString(),
new GetResourceRecordsOfResourceRecordResponseTest().expected().toString()); new GetResourceRecordsOfResourceRecordResponseTest().expected().toString());
assertEquals(success.getResourceRecordApiForZone("jclouds.org.").listByNameAndType("www.jclouds.org.", "A") assertEquals(success.getResourceRecordApiForZone("jclouds.org.").listByNameAndType("www.jclouds.org.", "A")

View File

@ -47,7 +47,6 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -77,7 +76,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
static void checkResourceRecord(ResourceRecord rr) { static void checkResourceRecord(ResourceRecord rr) {
checkNotNull(rr.getName(), "DName cannot be null for a ResourceRecord %s", rr); checkNotNull(rr.getName(), "DName cannot be null for a ResourceRecord %s", rr);
checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr); checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr);
assertTrue(rr.getType().intValue() > 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.getType(), "Type cannot be null for a ResourceRecord %s", rr);
checkNotNull(rr.getTTL(), "TTL 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); checkNotNull(rr.getRData(), "InfoValues cannot be null for a ResourceRecord %s", rr);
@ -105,19 +104,19 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
} }
} }
LoadingCache<UnsignedInteger, AtomicLong> recordTypeCounts = CacheBuilder.newBuilder().build( LoadingCache<Integer, AtomicLong> recordTypeCounts = CacheBuilder.newBuilder().build(
new CacheLoader<UnsignedInteger, AtomicLong>() { new CacheLoader<Integer, AtomicLong>() {
public AtomicLong load(UnsignedInteger key) throws Exception { public AtomicLong load(Integer key) throws Exception {
return new AtomicLong(); return new AtomicLong();
} }
}); });
private final static BiMap<UnsignedInteger, String> valueToType = new ResourceTypeToValue().inverse(); private final static BiMap<Integer, String> valueToType = new ResourceTypeToValue().inverse();
@AfterClass @AfterClass
void logSummary() { void logSummary() {
getAnonymousLogger().info("zoneCount: " + zones); getAnonymousLogger().info("zoneCount: " + zones);
for (Entry<UnsignedInteger, AtomicLong> entry : recordTypeCounts.asMap().entrySet()) for (Entry<Integer, AtomicLong> entry : recordTypeCounts.asMap().entrySet())
getAnonymousLogger().info( getAnonymousLogger().info(
String.format("type: %s, count: %s", valueToType.get(entry.getKey()), entry.getValue())); String.format("type: %s, count: %s", valueToType.get(entry.getKey()), entry.getValue()));
} }

View File

@ -42,7 +42,6 @@ import org.testng.annotations.Test;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -122,21 +121,21 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test(dependsOnMethods = "testCreateAPool") @Test(dependsOnMethods = "testCreateAPool")
public void addARecordToPool() { 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); getAnonymousLogger().info("created A record: " + aRecord1);
assertTrue(listRRs(aPoolId).anyMatch( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("1.2.3.4").build()))); 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( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("3.4.5.6").build()))); equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("3.4.5.6").build())));
getAnonymousLogger().info("created A record: " + aRecord1); getAnonymousLogger().info("created A record: " + aRecord1);
try { try {
api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", UnsignedInteger.ONE); api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", 1);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {
@ -145,7 +144,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test(dependsOnMethods = "addARecordToPool") @Test(dependsOnMethods = "addARecordToPool")
public void testUpdateRecord() { 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( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(0).rdata("1.1.1.1").build()))); 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") @Test(dependsOnMethods = "testCreateAAAAPool")
public void addAAAARecordToPool() { public void addAAAARecordToPool() {
aaaaRecord1 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", aaaaRecord1 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334",
UnsignedInteger.ONE); 1);
getAnonymousLogger().info("created AAAA record: " + aaaaRecord1); getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
@ -199,7 +198,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
.build()))); .build())));
aaaaRecord2 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2002:0DB8:85A3:0000:0000:8A2E:0370:7334", aaaaRecord2 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2002:0DB8:85A3:0000:0000:8A2E:0370:7334",
UnsignedInteger.ONE); 1);
assertTrue(listRRs(aaaaPoolId).anyMatch( assertTrue(listRRs(aaaaPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("AAAA").ttl(1).rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334") 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); getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
try { try {
api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334", 1);
UnsignedInteger.ONE);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {