mirror of https://github.com/apache/jclouds.git
ultradns-ws: replaced usage of UnsignedInteger with int
This commit is contained in:
parent
aeee6ceb31
commit
2252451ab0
|
@ -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<String, UnsignedInteger> implements Function<Object, String>,
|
||||
BiMap<String, UnsignedInteger> {
|
||||
public class ResourceTypeToValue extends ForwardingMap<String, Integer> implements Function<Object, String>,
|
||||
BiMap<String, Integer> {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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<String, UnsignedInteger>
|
|||
*/
|
||||
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<String, UnsignedInteger> delegate() {
|
||||
protected ImmutableBiMap<String, Integer> delegate() {
|
||||
return lookup;
|
||||
}
|
||||
|
||||
private static final ImmutableBiMap<String, UnsignedInteger> lookup;
|
||||
private static final ImmutableBiMap<String, Integer> lookup;
|
||||
|
||||
static {
|
||||
ImmutableBiMap.Builder<String, UnsignedInteger> builder = ImmutableBiMap.builder();
|
||||
ImmutableBiMap.Builder<String, Integer> 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<String, UnsignedInteger>
|
|||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public UnsignedInteger forcePut(String key, UnsignedInteger value) {
|
||||
public Integer forcePut(String key, Integer value) {
|
||||
return lookup.forcePut(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnsignedInteger> values() {
|
||||
public Set<Integer> values() {
|
||||
return lookup.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiMap<UnsignedInteger, String> inverse() {
|
||||
public BiMap<Integer, String> inverse() {
|
||||
return lookup.inverse();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<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.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<String> infoValues = ImmutableList.<String> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<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) {
|
||||
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()
|
||||
*/
|
||||
|
|
|
@ -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()
|
||||
*/
|
||||
|
|
|
@ -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<ResourceRecordMetadata> listByNameAndType(String hostName, UnsignedInteger rrType)
|
||||
throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* @see #listByNameAndType(String, UnsignedInteger)
|
||||
*/
|
||||
FluentIterable<ResourceRecordMetadata> 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<ResourceRecordMetadata> listByNameAndType(String hostName, String type)
|
||||
throws ResourceNotFoundException;
|
||||
|
|
|
@ -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<FluentIterable<ResourceRecordMetadata>> listByName(@PayloadParam("hostName") String hostName)
|
||||
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)
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -100,7 +99,7 @@ public interface RoundRobinPoolAsyncApi {
|
|||
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
|
||||
ListenableFuture<Void> 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("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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<Z
|
|||
zone = Zone.builder()
|
||||
.id(attributes.get("zoneId"))
|
||||
.name(attributes.get("zoneName"))
|
||||
.typeCode(UnsignedInteger.valueOf(checkNotNull(attributes.get("zoneType"), "zoneType")))
|
||||
.typeCode(Integer.parseInt(checkNotNull(attributes.get("zoneType"), "zoneType")))
|
||||
.accountId(attributes.get("accountId"))
|
||||
.ownerId(attributes.get("owner"))
|
||||
.dnssecStatus(DNSSECStatus.fromValue(attributes.get("dnssecStatus")))
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiExpectTest;
|
|||
import org.jclouds.ultradns.ws.parse.GetResourceRecordsOfResourceRecordResponseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -127,7 +126,7 @@ public class ResourceRecordApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
|
||||
assertEquals(
|
||||
success.getResourceRecordApiForZone("jclouds.org.")
|
||||
.listByNameAndType("www.jclouds.org.", UnsignedInteger.ONE).toString(),
|
||||
.listByNameAndType("www.jclouds.org.", 1).toString(),
|
||||
new GetResourceRecordsOfResourceRecordResponseTest().expected().toString());
|
||||
|
||||
assertEquals(success.getResourceRecordApiForZone("jclouds.org.").listByNameAndType("www.jclouds.org.", "A")
|
||||
|
|
|
@ -47,7 +47,6 @@ import com.google.common.cache.CacheLoader;
|
|||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -77,7 +76,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
static void checkResourceRecord(ResourceRecord 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);
|
||||
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.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<UnsignedInteger, AtomicLong> recordTypeCounts = CacheBuilder.newBuilder().build(
|
||||
new CacheLoader<UnsignedInteger, AtomicLong>() {
|
||||
public AtomicLong load(UnsignedInteger key) throws Exception {
|
||||
LoadingCache<Integer, AtomicLong> recordTypeCounts = CacheBuilder.newBuilder().build(
|
||||
new CacheLoader<Integer, AtomicLong>() {
|
||||
public AtomicLong load(Integer key) throws Exception {
|
||||
return new AtomicLong();
|
||||
}
|
||||
});
|
||||
|
||||
private final static BiMap<UnsignedInteger, String> valueToType = new ResourceTypeToValue().inverse();
|
||||
private final static BiMap<Integer, String> valueToType = new ResourceTypeToValue().inverse();
|
||||
|
||||
@AfterClass
|
||||
void logSummary() {
|
||||
getAnonymousLogger().info("zoneCount: " + zones);
|
||||
for (Entry<UnsignedInteger, AtomicLong> entry : recordTypeCounts.asMap().entrySet())
|
||||
for (Entry<Integer, AtomicLong> entry : recordTypeCounts.asMap().entrySet())
|
||||
getAnonymousLogger().info(
|
||||
String.format("type: %s, count: %s", valueToType.get(entry.getKey()), entry.getValue()));
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue