mirror of https://github.com/apache/jclouds.git
Ensure SOME_CONSTANTS are static final
Found via error-prone.
This commit is contained in:
parent
4193031c62
commit
e058973abc
|
@ -102,8 +102,8 @@ public class SignedHeaderAuthTest {
|
||||||
.put("X-Ops-Authorization-6", "DzWNPylHJqMeGKVYwGQKpg62QDfe5yXh3wZLiQcXow==")
|
.put("X-Ops-Authorization-6", "DzWNPylHJqMeGKVYwGQKpg62QDfe5yXh3wZLiQcXow==")
|
||||||
.put("X-Ops-Timestamp", TIMESTAMP_ISO8601).build();
|
.put("X-Ops-Timestamp", TIMESTAMP_ISO8601).build();
|
||||||
|
|
||||||
public static String PUBLIC_KEY;
|
public static final String PUBLIC_KEY;
|
||||||
public static String PRIVATE_KEY;
|
public static final String PRIVATE_KEY;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -111,7 +111,7 @@ public class SignedHeaderAuthTest {
|
||||||
|
|
||||||
PRIVATE_KEY = Strings2.toStringAndClose(SignedHeaderAuthTest.class.getResourceAsStream("/privkey.txt"));
|
PRIVATE_KEY = Strings2.toStringAndClose(SignedHeaderAuthTest.class.getResourceAsStream("/privkey.txt"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ public class Network {
|
||||||
protected String broadcastDomainType;
|
protected String broadcastDomainType;
|
||||||
protected URI broadcastURI;
|
protected URI broadcastURI;
|
||||||
protected String displayText;
|
protected String displayText;
|
||||||
protected String DNS1;
|
protected String dns1;
|
||||||
protected String DNS2;
|
protected String dns2;
|
||||||
protected String domain;
|
protected String domain;
|
||||||
protected String domainId;
|
protected String domainId;
|
||||||
protected String endIP;
|
protected String endIP;
|
||||||
|
@ -72,7 +72,7 @@ public class Network {
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String state;
|
protected String state;
|
||||||
protected GuestIPType guestIPType;
|
protected GuestIPType guestIPType;
|
||||||
protected String VLAN;
|
protected String vlan;
|
||||||
protected TrafficType trafficType;
|
protected TrafficType trafficType;
|
||||||
protected String zoneId;
|
protected String zoneId;
|
||||||
protected boolean securityGroupEnabled;
|
protected boolean securityGroupEnabled;
|
||||||
|
@ -123,8 +123,8 @@ public class Network {
|
||||||
* @return the DNS for the Network
|
* @return the DNS for the Network
|
||||||
*/
|
*/
|
||||||
public T DNS(List<String> DNS) {
|
public T DNS(List<String> DNS) {
|
||||||
if (!DNS.isEmpty()) this.DNS1 = DNS.get(0);
|
if (!DNS.isEmpty()) this.dns1 = DNS.get(0);
|
||||||
if (DNS.size() > 1) this.DNS2 = DNS.get(1);
|
if (DNS.size() > 1) this.dns2 = DNS.get(1);
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ public class Network {
|
||||||
/**
|
/**
|
||||||
* @see Network#getVLAN()
|
* @see Network#getVLAN()
|
||||||
*/
|
*/
|
||||||
public T VLAN(String VLAN) {
|
public T VLAN(String vlan) {
|
||||||
this.VLAN = VLAN;
|
this.vlan = vlan;
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ public class Network {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Network build() {
|
public Network build() {
|
||||||
return new Network(id, account, broadcastDomainType, broadcastURI, displayText, DNS1, DNS2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, VLAN, trafficType, zoneId, tags, securityGroupEnabled, services);
|
return new Network(id, account, broadcastDomainType, broadcastURI, displayText, dns1, dns2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, vlan, trafficType, zoneId, tags, securityGroupEnabled, services);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T fromNetwork(Network in) {
|
public T fromNetwork(Network in) {
|
||||||
|
@ -375,8 +375,8 @@ public class Network {
|
||||||
private final String broadcastDomainType;
|
private final String broadcastDomainType;
|
||||||
private final URI broadcastURI;
|
private final URI broadcastURI;
|
||||||
private final String displayText;
|
private final String displayText;
|
||||||
private final String DNS1;
|
private final String dns1;
|
||||||
private final String DNS2;
|
private final String dns2;
|
||||||
private final String domain;
|
private final String domain;
|
||||||
private final String domainId;
|
private final String domainId;
|
||||||
private final String endIP;
|
private final String endIP;
|
||||||
|
@ -395,7 +395,7 @@ public class Network {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String state;
|
private final String state;
|
||||||
private final GuestIPType guestIPType;
|
private final GuestIPType guestIPType;
|
||||||
private final String VLAN;
|
private final String vlan;
|
||||||
private final TrafficType trafficType;
|
private final TrafficType trafficType;
|
||||||
private final String zoneId;
|
private final String zoneId;
|
||||||
private final Set<Tag> tags;
|
private final Set<Tag> tags;
|
||||||
|
@ -406,20 +406,20 @@ public class Network {
|
||||||
"id", "account", "broadcastdomaintype", "broadcasturi", "displaytext", "dns1", "dns2", "domain", "domainid", "endip", "gateway", "isdefault", "isshared", "issystem", "netmask", "networkdomain", "networkofferingavailability", "networkofferingdisplaytext", "networkofferingid", "networkofferingname", "related", "startip", "name", "state", "type", "vlan", "traffictype", "zoneid", "tags", "securitygroupenabled", "service"
|
"id", "account", "broadcastdomaintype", "broadcasturi", "displaytext", "dns1", "dns2", "domain", "domainid", "endip", "gateway", "isdefault", "isshared", "issystem", "netmask", "networkdomain", "networkofferingavailability", "networkofferingdisplaytext", "networkofferingid", "networkofferingname", "related", "startip", "name", "state", "type", "vlan", "traffictype", "zoneid", "tags", "securitygroupenabled", "service"
|
||||||
})
|
})
|
||||||
protected Network(String id, @Nullable String account, @Nullable String broadcastDomainType, @Nullable URI broadcastURI,
|
protected Network(String id, @Nullable String account, @Nullable String broadcastDomainType, @Nullable URI broadcastURI,
|
||||||
@Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2, @Nullable String domain, @Nullable String domainId,
|
@Nullable String displayText, @Nullable String dns1, @Nullable String dns2, @Nullable String domain, @Nullable String domainId,
|
||||||
@Nullable String endIP, @Nullable String gateway, boolean isDefault, boolean isShared, boolean isSystem,
|
@Nullable String endIP, @Nullable String gateway, boolean isDefault, boolean isShared, boolean isSystem,
|
||||||
@Nullable String netmask, @Nullable String networkDomain, @Nullable String networkOfferingAvailability,
|
@Nullable String netmask, @Nullable String networkDomain, @Nullable String networkOfferingAvailability,
|
||||||
@Nullable String networkOfferingDisplayText, @Nullable String networkOfferingId, @Nullable String networkOfferingName,
|
@Nullable String networkOfferingDisplayText, @Nullable String networkOfferingId, @Nullable String networkOfferingName,
|
||||||
@Nullable String related, @Nullable String startIP, @Nullable String name, @Nullable String state,
|
@Nullable String related, @Nullable String startIP, @Nullable String name, @Nullable String state,
|
||||||
@Nullable GuestIPType guestIPType, @Nullable String VLAN, @Nullable TrafficType trafficType,
|
@Nullable GuestIPType guestIPType, @Nullable String vlan, @Nullable TrafficType trafficType,
|
||||||
@Nullable String zoneId, @Nullable Set<Tag> tags, boolean securityGroupEnabled, Set<? extends NetworkService> services) {
|
@Nullable String zoneId, @Nullable Set<Tag> tags, boolean securityGroupEnabled, Set<? extends NetworkService> services) {
|
||||||
this.id = checkNotNull(id, "id");
|
this.id = checkNotNull(id, "id");
|
||||||
this.account = account;
|
this.account = account;
|
||||||
this.broadcastDomainType = broadcastDomainType;
|
this.broadcastDomainType = broadcastDomainType;
|
||||||
this.broadcastURI = broadcastURI;
|
this.broadcastURI = broadcastURI;
|
||||||
this.displayText = displayText;
|
this.displayText = displayText;
|
||||||
this.DNS1 = DNS1;
|
this.dns1 = dns1;
|
||||||
this.DNS2 = DNS2;
|
this.dns2 = dns2;
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
this.endIP = endIP;
|
this.endIP = endIP;
|
||||||
|
@ -438,7 +438,7 @@ public class Network {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.guestIPType = guestIPType;
|
this.guestIPType = guestIPType;
|
||||||
this.VLAN = VLAN;
|
this.vlan = vlan;
|
||||||
this.trafficType = trafficType;
|
this.trafficType = trafficType;
|
||||||
this.zoneId = zoneId;
|
this.zoneId = zoneId;
|
||||||
this.tags = tags != null ? ImmutableSet.copyOf(tags) : ImmutableSet.<Tag> of();
|
this.tags = tags != null ? ImmutableSet.copyOf(tags) : ImmutableSet.<Tag> of();
|
||||||
|
@ -487,10 +487,10 @@ public class Network {
|
||||||
|
|
||||||
public List<String> getDNS() {
|
public List<String> getDNS() {
|
||||||
ImmutableList.Builder<String> builder = ImmutableList.builder();
|
ImmutableList.Builder<String> builder = ImmutableList.builder();
|
||||||
if (DNS1 != null && !"".equals(DNS1))
|
if (dns1 != null && !"".equals(dns1))
|
||||||
builder.add(DNS1);
|
builder.add(dns1);
|
||||||
if (DNS2 != null && !"".equals(DNS2))
|
if (dns2 != null && !"".equals(dns2))
|
||||||
builder.add(DNS2);
|
builder.add(dns2);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ public class Network {
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getVLAN() {
|
public String getVLAN() {
|
||||||
return this.VLAN;
|
return this.vlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -681,7 +681,7 @@ public class Network {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(id, account, broadcastDomainType, broadcastURI, displayText, DNS1, DNS2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, VLAN, trafficType, zoneId, tags, securityGroupEnabled, services);
|
return Objects.hashCode(id, account, broadcastDomainType, broadcastURI, displayText, dns1, dns2, domain, domainId, endIP, gateway, isDefault, isShared, isSystem, netmask, networkDomain, networkOfferingAvailability, networkOfferingDisplayText, networkOfferingId, networkOfferingName, related, startIP, name, state, guestIPType, vlan, trafficType, zoneId, tags, securityGroupEnabled, services);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -694,8 +694,8 @@ public class Network {
|
||||||
&& Objects.equal(this.broadcastDomainType, that.broadcastDomainType)
|
&& Objects.equal(this.broadcastDomainType, that.broadcastDomainType)
|
||||||
&& Objects.equal(this.broadcastURI, that.broadcastURI)
|
&& Objects.equal(this.broadcastURI, that.broadcastURI)
|
||||||
&& Objects.equal(this.displayText, that.displayText)
|
&& Objects.equal(this.displayText, that.displayText)
|
||||||
&& Objects.equal(this.DNS1, that.DNS1)
|
&& Objects.equal(this.dns1, that.dns1)
|
||||||
&& Objects.equal(this.DNS2, that.DNS2)
|
&& Objects.equal(this.dns2, that.dns2)
|
||||||
&& Objects.equal(this.domain, that.domain)
|
&& Objects.equal(this.domain, that.domain)
|
||||||
&& Objects.equal(this.domainId, that.domainId)
|
&& Objects.equal(this.domainId, that.domainId)
|
||||||
&& Objects.equal(this.endIP, that.endIP)
|
&& Objects.equal(this.endIP, that.endIP)
|
||||||
|
@ -714,7 +714,7 @@ public class Network {
|
||||||
&& Objects.equal(this.name, that.name)
|
&& Objects.equal(this.name, that.name)
|
||||||
&& Objects.equal(this.state, that.state)
|
&& Objects.equal(this.state, that.state)
|
||||||
&& Objects.equal(this.guestIPType, that.guestIPType)
|
&& Objects.equal(this.guestIPType, that.guestIPType)
|
||||||
&& Objects.equal(this.VLAN, that.VLAN)
|
&& Objects.equal(this.vlan, that.vlan)
|
||||||
&& Objects.equal(this.trafficType, that.trafficType)
|
&& Objects.equal(this.trafficType, that.trafficType)
|
||||||
&& Objects.equal(this.zoneId, that.zoneId)
|
&& Objects.equal(this.zoneId, that.zoneId)
|
||||||
&& Objects.equal(this.tags, that.tags)
|
&& Objects.equal(this.tags, that.tags)
|
||||||
|
@ -725,12 +725,12 @@ public class Network {
|
||||||
protected ToStringHelper string() {
|
protected ToStringHelper string() {
|
||||||
return Objects.toStringHelper(this)
|
return Objects.toStringHelper(this)
|
||||||
.add("id", id).add("account", account).add("broadcastDomainType", broadcastDomainType).add("broadcastURI", broadcastURI)
|
.add("id", id).add("account", account).add("broadcastDomainType", broadcastDomainType).add("broadcastURI", broadcastURI)
|
||||||
.add("displayText", displayText).add("DNS1", DNS1).add("DNS2", DNS2).add("domain", domain).add("domainId", domainId)
|
.add("displayText", displayText).add("DNS1", dns1).add("dns2", dns2).add("domain", domain).add("domainId", domainId)
|
||||||
.add("endIP", endIP).add("gateway", gateway).add("isDefault", isDefault).add("isShared", isShared).add("isSystem", isSystem)
|
.add("endIP", endIP).add("gateway", gateway).add("isDefault", isDefault).add("isShared", isShared).add("isSystem", isSystem)
|
||||||
.add("netmask", netmask).add("networkDomain", networkDomain).add("networkOfferingAvailability", networkOfferingAvailability)
|
.add("netmask", netmask).add("networkDomain", networkDomain).add("networkOfferingAvailability", networkOfferingAvailability)
|
||||||
.add("networkOfferingDisplayText", networkOfferingDisplayText).add("networkOfferingId", networkOfferingId)
|
.add("networkOfferingDisplayText", networkOfferingDisplayText).add("networkOfferingId", networkOfferingId)
|
||||||
.add("networkOfferingName", networkOfferingName).add("related", related).add("startIP", startIP).add("name", name)
|
.add("networkOfferingName", networkOfferingName).add("related", related).add("startIP", startIP).add("name", name)
|
||||||
.add("state", state).add("guestIPType", guestIPType).add("VLAN", VLAN).add("trafficType", trafficType)
|
.add("state", state).add("guestIPType", guestIPType).add("VLAN", vlan).add("trafficType", trafficType)
|
||||||
.add("zoneId", zoneId).add("tags", tags).add("securityGroupEnabled", securityGroupEnabled).add("services", services);
|
.add("zoneId", zoneId).add("tags", tags).add("securityGroupEnabled", securityGroupEnabled).add("services", services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String description;
|
protected String description;
|
||||||
protected String displayText;
|
protected String displayText;
|
||||||
protected String DNS1;
|
protected String dns1;
|
||||||
protected String DNS2;
|
protected String dns2;
|
||||||
protected String domain;
|
protected String domain;
|
||||||
protected String domainId;
|
protected String domainId;
|
||||||
protected String guestCIDRAddress;
|
protected String guestCIDRAddress;
|
||||||
|
@ -54,7 +54,7 @@ public class Zone implements Comparable<Zone> {
|
||||||
protected String internalDNS2;
|
protected String internalDNS2;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected NetworkType networkType;
|
protected NetworkType networkType;
|
||||||
protected String VLAN;
|
protected String vlan;
|
||||||
protected boolean securityGroupsEnabled;
|
protected boolean securityGroupsEnabled;
|
||||||
protected AllocationState allocationState;
|
protected AllocationState allocationState;
|
||||||
protected String dhcpProvider;
|
protected String dhcpProvider;
|
||||||
|
@ -89,8 +89,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
* @see Zone#getDNS()
|
* @see Zone#getDNS()
|
||||||
*/
|
*/
|
||||||
public T DNS(List<String> DNS) {
|
public T DNS(List<String> DNS) {
|
||||||
if (!DNS.isEmpty()) this.DNS1 = DNS.get(0);
|
if (!DNS.isEmpty()) this.dns1 = DNS.get(0);
|
||||||
if (DNS.size() > 1) this.DNS2 = DNS.get(1);
|
if (DNS.size() > 1) this.dns2 = DNS.get(1);
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +146,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
/**
|
/**
|
||||||
* @see Zone#getVLAN()
|
* @see Zone#getVLAN()
|
||||||
*/
|
*/
|
||||||
public T VLAN(String VLAN) {
|
public T VLAN(String vlan) {
|
||||||
this.VLAN = VLAN;
|
this.vlan = vlan;
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Zone build() {
|
public Zone build() {
|
||||||
return new Zone(id, description, displayText, DNS1, DNS2, domain, domainId, guestCIDRAddress, internalDNS1, internalDNS2,
|
return new Zone(id, description, displayText, dns1, dns2, domain, domainId, guestCIDRAddress, internalDNS1, internalDNS2,
|
||||||
name, networkType, VLAN, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken, tags);
|
name, networkType, vlan, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken, tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T fromZone(Zone in) {
|
public T fromZone(Zone in) {
|
||||||
|
@ -231,8 +231,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String description;
|
private final String description;
|
||||||
private final String displayText;
|
private final String displayText;
|
||||||
private final String DNS1;
|
private final String dns1;
|
||||||
private final String DNS2;
|
private final String dns2;
|
||||||
private final String domain;
|
private final String domain;
|
||||||
private final String domainId;
|
private final String domainId;
|
||||||
private final String guestCIDRAddress;
|
private final String guestCIDRAddress;
|
||||||
|
@ -240,7 +240,7 @@ public class Zone implements Comparable<Zone> {
|
||||||
private final String internalDNS2;
|
private final String internalDNS2;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final NetworkType networkType;
|
private final NetworkType networkType;
|
||||||
private final String VLAN;
|
private final String vlan;
|
||||||
private final boolean securityGroupsEnabled;
|
private final boolean securityGroupsEnabled;
|
||||||
private final AllocationState allocationState;
|
private final AllocationState allocationState;
|
||||||
private final String dhcpProvider;
|
private final String dhcpProvider;
|
||||||
|
@ -250,16 +250,16 @@ public class Zone implements Comparable<Zone> {
|
||||||
@ConstructorProperties({
|
@ConstructorProperties({
|
||||||
"id", "description", "displaytext", "dns1", "dns2", "domain", "domainid", "guestcidraddress", "internaldns1", "internaldns2", "name", "networktype", "vlan", "securitygroupsenabled", "allocationstate", "dhcpprovider", "zonetoken", "tags"
|
"id", "description", "displaytext", "dns1", "dns2", "domain", "domainid", "guestcidraddress", "internaldns1", "internaldns2", "name", "networktype", "vlan", "securitygroupsenabled", "allocationstate", "dhcpprovider", "zonetoken", "tags"
|
||||||
})
|
})
|
||||||
protected Zone(String id, @Nullable String description, @Nullable String displayText, @Nullable String DNS1, @Nullable String DNS2,
|
protected Zone(String id, @Nullable String description, @Nullable String displayText, @Nullable String dns1, @Nullable String dns2,
|
||||||
@Nullable String domain, @Nullable String domainId, @Nullable String guestCIDRAddress, @Nullable String internalDNS1,
|
@Nullable String domain, @Nullable String domainId, @Nullable String guestCIDRAddress, @Nullable String internalDNS1,
|
||||||
@Nullable String internalDNS2, @Nullable String name, @Nullable NetworkType networkType, @Nullable String VLAN,
|
@Nullable String internalDNS2, @Nullable String name, @Nullable NetworkType networkType, @Nullable String vlan,
|
||||||
boolean securityGroupsEnabled, @Nullable AllocationState allocationState, @Nullable String dhcpProvider,
|
boolean securityGroupsEnabled, @Nullable AllocationState allocationState, @Nullable String dhcpProvider,
|
||||||
@Nullable String zoneToken, @Nullable Set<Tag> tags) {
|
@Nullable String zoneToken, @Nullable Set<Tag> tags) {
|
||||||
this.id = checkNotNull(id, "id");
|
this.id = checkNotNull(id, "id");
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.displayText = displayText;
|
this.displayText = displayText;
|
||||||
this.DNS1 = DNS1;
|
this.dns1 = dns1;
|
||||||
this.DNS2 = DNS2;
|
this.dns2 = dns2;
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
this.guestCIDRAddress = guestCIDRAddress;
|
this.guestCIDRAddress = guestCIDRAddress;
|
||||||
|
@ -267,7 +267,7 @@ public class Zone implements Comparable<Zone> {
|
||||||
this.internalDNS2 = internalDNS2;
|
this.internalDNS2 = internalDNS2;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.networkType = networkType;
|
this.networkType = networkType;
|
||||||
this.VLAN = VLAN;
|
this.vlan = vlan;
|
||||||
this.securityGroupsEnabled = securityGroupsEnabled;
|
this.securityGroupsEnabled = securityGroupsEnabled;
|
||||||
this.allocationState = allocationState;
|
this.allocationState = allocationState;
|
||||||
this.dhcpProvider = dhcpProvider;
|
this.dhcpProvider = dhcpProvider;
|
||||||
|
@ -303,10 +303,10 @@ public class Zone implements Comparable<Zone> {
|
||||||
*/
|
*/
|
||||||
public List<String> getDNS() {
|
public List<String> getDNS() {
|
||||||
ImmutableList.Builder<String> builder = ImmutableList.builder();
|
ImmutableList.Builder<String> builder = ImmutableList.builder();
|
||||||
if (DNS1 != null && !"".equals(DNS1))
|
if (dns1 != null && !"".equals(dns1))
|
||||||
builder.add(DNS1);
|
builder.add(dns1);
|
||||||
if (DNS2 != null && !"".equals(DNS2))
|
if (dns2 != null && !"".equals(dns2))
|
||||||
builder.add(DNS2);
|
builder.add(dns2);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ public class Zone implements Comparable<Zone> {
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getVLAN() {
|
public String getVLAN() {
|
||||||
return this.VLAN;
|
return this.vlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -410,8 +410,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(id, description, displayText, DNS1, DNS2, domain, domainId, guestCIDRAddress, internalDNS1,
|
return Objects.hashCode(id, description, displayText, dns1, dns2, domain, domainId, guestCIDRAddress, internalDNS1,
|
||||||
internalDNS2, name, networkType, VLAN, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken, tags);
|
internalDNS2, name, networkType, vlan, securityGroupsEnabled, allocationState, dhcpProvider, zoneToken, tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -422,8 +422,8 @@ public class Zone implements Comparable<Zone> {
|
||||||
return Objects.equal(this.id, that.id)
|
return Objects.equal(this.id, that.id)
|
||||||
&& Objects.equal(this.description, that.description)
|
&& Objects.equal(this.description, that.description)
|
||||||
&& Objects.equal(this.displayText, that.displayText)
|
&& Objects.equal(this.displayText, that.displayText)
|
||||||
&& Objects.equal(this.DNS1, that.DNS1)
|
&& Objects.equal(this.dns1, that.dns1)
|
||||||
&& Objects.equal(this.DNS2, that.DNS2)
|
&& Objects.equal(this.dns2, that.dns2)
|
||||||
&& Objects.equal(this.domain, that.domain)
|
&& Objects.equal(this.domain, that.domain)
|
||||||
&& Objects.equal(this.domainId, that.domainId)
|
&& Objects.equal(this.domainId, that.domainId)
|
||||||
&& Objects.equal(this.guestCIDRAddress, that.guestCIDRAddress)
|
&& Objects.equal(this.guestCIDRAddress, that.guestCIDRAddress)
|
||||||
|
@ -431,7 +431,7 @@ public class Zone implements Comparable<Zone> {
|
||||||
&& Objects.equal(this.internalDNS2, that.internalDNS2)
|
&& Objects.equal(this.internalDNS2, that.internalDNS2)
|
||||||
&& Objects.equal(this.name, that.name)
|
&& Objects.equal(this.name, that.name)
|
||||||
&& Objects.equal(this.networkType, that.networkType)
|
&& Objects.equal(this.networkType, that.networkType)
|
||||||
&& Objects.equal(this.VLAN, that.VLAN)
|
&& Objects.equal(this.vlan, that.vlan)
|
||||||
&& Objects.equal(this.securityGroupsEnabled, that.securityGroupsEnabled)
|
&& Objects.equal(this.securityGroupsEnabled, that.securityGroupsEnabled)
|
||||||
&& Objects.equal(this.allocationState, that.allocationState)
|
&& Objects.equal(this.allocationState, that.allocationState)
|
||||||
&& Objects.equal(this.dhcpProvider, that.dhcpProvider)
|
&& Objects.equal(this.dhcpProvider, that.dhcpProvider)
|
||||||
|
@ -441,9 +441,9 @@ public class Zone implements Comparable<Zone> {
|
||||||
|
|
||||||
protected ToStringHelper string() {
|
protected ToStringHelper string() {
|
||||||
return Objects.toStringHelper(this)
|
return Objects.toStringHelper(this)
|
||||||
.add("id", id).add("description", description).add("displayText", displayText).add("DNS1", DNS1).add("DNS2", DNS2)
|
.add("id", id).add("description", description).add("displayText", displayText).add("DNS1", dns1).add("DNS2", dns2)
|
||||||
.add("domain", domain).add("domainId", domainId).add("guestCIDRAddress", guestCIDRAddress).add("internalDNS1", internalDNS1)
|
.add("domain", domain).add("domainId", domainId).add("guestCIDRAddress", guestCIDRAddress).add("internalDNS1", internalDNS1)
|
||||||
.add("internalDNS2", internalDNS2).add("name", name).add("networkType", networkType).add("VLAN", VLAN)
|
.add("internalDNS2", internalDNS2).add("name", name).add("networkType", networkType).add("VLAN", vlan)
|
||||||
.add("securityGroupsEnabled", securityGroupsEnabled).add("allocationState", allocationState).add("dhcpProvider", dhcpProvider)
|
.add("securityGroupsEnabled", securityGroupsEnabled).add("allocationState", allocationState).add("dhcpProvider", dhcpProvider)
|
||||||
.add("zoneToken", zoneToken).add("tags", tags);
|
.add("zoneToken", zoneToken).add("tags", tags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
*/
|
*/
|
||||||
public class ListStoragePoolsOptions extends BaseHttpRequestOptions {
|
public class ListStoragePoolsOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
public static ListStoragePoolsOptions NONE = new ListStoragePoolsOptions();
|
public static final ListStoragePoolsOptions NONE = new ListStoragePoolsOptions();
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
@Test(groups = { "unit" })
|
@Test(groups = { "unit" })
|
||||||
public class MapToDriveInfoTest {
|
public class MapToDriveInfoTest {
|
||||||
public static DriveInfo ONE = new DriveInfo.Builder()
|
public static final DriveInfo ONE = new DriveInfo.Builder()
|
||||||
.status(DriveStatus.ACTIVE)
|
.status(DriveStatus.ACTIVE)
|
||||||
.name("Ubuntu 10.10 Server Edition Linux 64bit Preinstalled System")
|
.name("Ubuntu 10.10 Server Edition Linux 64bit Preinstalled System")
|
||||||
.metrics(
|
.metrics(
|
||||||
|
|
|
@ -41,7 +41,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
@Test(groups = { "unit" })
|
@Test(groups = { "unit" })
|
||||||
public class MapToServerInfoTest {
|
public class MapToServerInfoTest {
|
||||||
public static ServerInfo ONE = new ServerInfo.Builder()
|
public static final ServerInfo ONE = new ServerInfo.Builder()
|
||||||
.persistent(true)
|
.persistent(true)
|
||||||
.uuid("f8bee9cd-8e4b-4a05-8593-1314e3bfe49b")
|
.uuid("f8bee9cd-8e4b-4a05-8593-1314e3bfe49b")
|
||||||
.cpu(2000)
|
.cpu(2000)
|
||||||
|
@ -75,7 +75,7 @@ public class MapToServerInfoTest {
|
||||||
.readBytes(45686784).writeRequests(3698).writeBytes(15147008).build())).build())
|
.readBytes(45686784).writeRequests(3698).writeBytes(15147008).build())).build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static ServerInfo TWO = new ServerInfo.Builder()
|
public static final ServerInfo TWO = new ServerInfo.Builder()
|
||||||
.status(ServerStatus.STOPPED)
|
.status(ServerStatus.STOPPED)
|
||||||
.name("Demo")
|
.name("Demo")
|
||||||
.mem(1024)
|
.mem(1024)
|
||||||
|
@ -123,7 +123,7 @@ public class MapToServerInfoTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ServerInfo NEW = new ServerInfo.Builder()
|
public static final ServerInfo NEW = new ServerInfo.Builder()
|
||||||
.persistent(true)
|
.persistent(true)
|
||||||
.uuid("bd98615a-6f74-4d63-ad1e-b13338b9356a")
|
.uuid("bd98615a-6f74-4d63-ad1e-b13338b9356a")
|
||||||
.cpu(1000)
|
.cpu(1000)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
@Test(groups = { "unit" })
|
@Test(groups = { "unit" })
|
||||||
public class MapToStandardDriveTest {
|
public class MapToStandardDriveTest {
|
||||||
public static StandardDrive ONE = new StandardDrive.Builder()
|
public static final StandardDrive ONE = new StandardDrive.Builder()
|
||||||
.name("Windows Web Server 2008 R2")
|
.name("Windows Web Server 2008 R2")
|
||||||
.uuid("11b84345-7169-4279-8038-18d6ba1a7712")//
|
.uuid("11b84345-7169-4279-8038-18d6ba1a7712")//
|
||||||
.claimType(ClaimType.SHARED)
|
.claimType(ClaimType.SHARED)
|
||||||
|
|
|
@ -36,8 +36,6 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
*/
|
*/
|
||||||
public class ServerExtendedStatus {
|
public class ServerExtendedStatus {
|
||||||
|
|
||||||
public static String PREFIX;
|
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ import com.google.common.collect.FluentIterable;
|
||||||
@Test(groups = "live", testName = "KeyPairApiLiveTest")
|
@Test(groups = "live", testName = "KeyPairApiLiveTest")
|
||||||
public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
|
public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
final String KEYPAIR_NAME = "testkp";
|
private static final String KEYPAIR_NAME = "testkp";
|
||||||
final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
|
private static final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
|
||||||
|
|
||||||
public void testListKeyPairs() throws Exception {
|
public void testListKeyPairs() throws Exception {
|
||||||
for (String regionId : api.getConfiguredRegions()) {
|
for (String regionId : api.getConfiguredRegions()) {
|
||||||
|
|
|
@ -56,10 +56,10 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||||
@Test(groups = "live", singleThreaded = true)
|
@Test(groups = "live", singleThreaded = true)
|
||||||
public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreIntegrationTest {
|
public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
private final File BIG_FILE;
|
private static final File BIG_FILE = new File("random.dat");
|
||||||
private final long SIZE = 10 * 1000 * 1000;
|
private static final long SIZE = 10 * 1000 * 1000;
|
||||||
private BlobStore blobStore;
|
private BlobStore blobStore;
|
||||||
private String ETAG;
|
private String etag;
|
||||||
private ListeningExecutorService executor =
|
private ListeningExecutorService executor =
|
||||||
MoreExecutors.listeningDecorator(
|
MoreExecutors.listeningDecorator(
|
||||||
MoreExecutors.getExitingExecutorService(
|
MoreExecutors.getExitingExecutorService(
|
||||||
|
@ -67,7 +67,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
5000L, TimeUnit.MILLISECONDS,
|
5000L, TimeUnit.MILLISECONDS,
|
||||||
new ArrayBlockingQueue<Runnable>(10, true), new ThreadPoolExecutor.CallerRunsPolicy())));
|
new ArrayBlockingQueue<Runnable>(10, true), new ThreadPoolExecutor.CallerRunsPolicy())));
|
||||||
|
|
||||||
private String CONTAINER = "jcloudsparalleltest" + UUID.randomUUID();
|
private static final String CONTAINER = "jcloudsparalleltest" + UUID.randomUUID();
|
||||||
|
|
||||||
public RegionScopedSwiftBlobStoreParallelLiveTest() {
|
public RegionScopedSwiftBlobStoreParallelLiveTest() {
|
||||||
provider = "openstack-swift";
|
provider = "openstack-swift";
|
||||||
|
@ -96,9 +96,9 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
blobStore = getBlobStore();
|
blobStore = getBlobStore();
|
||||||
createRandomFile(SIZE, BIG_FILE);
|
createRandomFile(SIZE, BIG_FILE);
|
||||||
HashCode hashCode = Files.hash(BIG_FILE, Hashing.md5());
|
HashCode hashCode = Files.hash(BIG_FILE, Hashing.md5());
|
||||||
ETAG = hashCode.toString();
|
etag = hashCode.toString();
|
||||||
blobStore.createContainerInLocation(null, CONTAINER);
|
blobStore.createContainerInLocation(null, CONTAINER);
|
||||||
System.out.println("generated file md5: " + ETAG);
|
System.out.println("generated file md5: " + etag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
@ -119,7 +119,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
.build();
|
.build();
|
||||||
// configure the blobstore to use multipart uploading of the file
|
// configure the blobstore to use multipart uploading of the file
|
||||||
String eTag = blobStore.putBlob(CONTAINER, blob, multipart(executor));
|
String eTag = blobStore.putBlob(CONTAINER, blob, multipart(executor));
|
||||||
// assertEquals(eTag, ETAG);
|
// assertEquals(eTag, etag);
|
||||||
// The etag returned by Swift is not the md5 of the Blob uploaded
|
// The etag returned by Swift is not the md5 of the Blob uploaded
|
||||||
// It is the md5 of the concatenated segment md5s
|
// It is the md5 of the concatenated segment md5s
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
final File downloadedFile = new File(BIG_FILE + ".downloaded");
|
final File downloadedFile = new File(BIG_FILE + ".downloaded");
|
||||||
blobStore.downloadBlob(CONTAINER, BIG_FILE.getName(), downloadedFile, executor);
|
blobStore.downloadBlob(CONTAINER, BIG_FILE.getName(), downloadedFile, executor);
|
||||||
String eTag = Files.hash(downloadedFile, Hashing.md5()).toString();
|
String eTag = Files.hash(downloadedFile, Hashing.md5()).toString();
|
||||||
assertEquals(eTag, ETAG);
|
assertEquals(eTag, etag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "uploadMultipartBlob", singleThreaded = true)
|
@Test(dependsOnMethods = "uploadMultipartBlob", singleThreaded = true)
|
||||||
|
@ -146,7 +146,7 @@ public class RegionScopedSwiftBlobStoreParallelLiveTest extends BaseBlobStoreInt
|
||||||
}
|
}
|
||||||
|
|
||||||
is.close();
|
is.close();
|
||||||
assertEquals(hasher.hash().toString(), ETAG);
|
assertEquals(hasher.hash().toString(), etag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRandomFile(long size, File file) throws IOException, InterruptedException {
|
private void createRandomFile(long size, File file) throws IOException, InterruptedException {
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.domain.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
@ -40,8 +41,9 @@ public class BaseLoadBalancer<N extends BaseNode<N>, T extends BaseLoadBalancer<
|
||||||
|
|
||||||
private static final String ENABLED = "enabled";
|
private static final String ENABLED = "enabled";
|
||||||
private static final String PERSISTENCE_TYPE = "persistenceType";
|
private static final String PERSISTENCE_TYPE = "persistenceType";
|
||||||
public static Algorithm[] WEIGHTED_ALGORITHMS = { Algorithm.WEIGHTED_LEAST_CONNECTIONS,
|
public static final Collection<Algorithm> WEIGHTED_ALGORITHMS = ImmutableSet.of(
|
||||||
Algorithm.WEIGHTED_ROUND_ROBIN };
|
Algorithm.WEIGHTED_LEAST_CONNECTIONS,
|
||||||
|
Algorithm.WEIGHTED_ROUND_ROBIN);
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String protocol;
|
protected String protocol;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -114,7 +113,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
assert n.getAddress() != null : n;
|
assert n.getAddress() != null : n;
|
||||||
assert n.getPort() != -1 : n;
|
assert n.getPort() != -1 : n;
|
||||||
assert n.getStatus() != null : n;
|
assert n.getStatus() != null : n;
|
||||||
assert !Arrays.asList(LoadBalancer.WEIGHTED_ALGORITHMS).contains(lb.getAlgorithm())
|
assert !LoadBalancer.WEIGHTED_ALGORITHMS.contains(lb.getAlgorithm())
|
||||||
|| n.getWeight() != null : n;
|
|| n.getWeight() != null : n;
|
||||||
|
|
||||||
Node getDetails = api.getNodeApi(lb.getRegion(), lb.getId()).get(n.getId());
|
Node getDetails = api.getNodeApi(lb.getRegion(), lb.getId()).get(n.getId());
|
||||||
|
@ -125,7 +124,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
assertEquals(getDetails.getAddress(), n.getAddress());
|
assertEquals(getDetails.getAddress(), n.getAddress());
|
||||||
assertEquals(getDetails.getPort(), n.getPort());
|
assertEquals(getDetails.getPort(), n.getPort());
|
||||||
assertEquals(getDetails.getStatus(), n.getStatus());
|
assertEquals(getDetails.getStatus(), n.getStatus());
|
||||||
if (Arrays.asList(LoadBalancer.WEIGHTED_ALGORITHMS).contains(lb.getAlgorithm())) {
|
if (LoadBalancer.WEIGHTED_ALGORITHMS.contains(lb.getAlgorithm())) {
|
||||||
assertEquals(getDetails.getWeight(), n.getWeight());
|
assertEquals(getDetails.getWeight(), n.getWeight());
|
||||||
}
|
}
|
||||||
} catch (AssertionError e) {
|
} catch (AssertionError e) {
|
||||||
|
|
|
@ -29,8 +29,8 @@ import com.google.common.base.Function;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> {
|
public class ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> {
|
||||||
private static Pattern pattern = Pattern.compile("<ETag>([\\S&&[^<]]+)</ETag>");
|
private static final Pattern PATTERN = Pattern.compile("<ETag>([\\S&&[^<]]+)</ETag>");
|
||||||
private static String ESCAPED_QUOTE = """;
|
private static final String ESCAPED_QUOTE = """;
|
||||||
private final ReturnStringIf2xx returnStringIf200;
|
private final ReturnStringIf2xx returnStringIf200;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -43,7 +43,7 @@ public class ETagFromHttpResponseViaRegex implements Function<HttpResponse, Stri
|
||||||
String value = null;
|
String value = null;
|
||||||
String content = returnStringIf200.apply(response);
|
String content = returnStringIf200.apply(response);
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
Matcher matcher = pattern.matcher(content);
|
Matcher matcher = PATTERN.matcher(content);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
value = matcher.group(1);
|
value = matcher.group(1);
|
||||||
if (value.indexOf(ESCAPED_QUOTE) != -1) {
|
if (value.indexOf(ESCAPED_QUOTE) != -1) {
|
||||||
|
|
|
@ -35,12 +35,12 @@ import com.google.common.collect.Multimaps;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BindMapToHeadersWithPrefix implements Binder {
|
public class BindMapToHeadersWithPrefix implements Binder {
|
||||||
private final Function<String, String> FN;
|
private final Function<String, String> fn;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BindMapToHeadersWithPrefix(@Named(PROPERTY_USER_METADATA_PREFIX) final String metadataPrefix) {
|
public BindMapToHeadersWithPrefix(@Named(PROPERTY_USER_METADATA_PREFIX) final String metadataPrefix) {
|
||||||
checkNotNull(metadataPrefix, PROPERTY_USER_METADATA_PREFIX);
|
checkNotNull(metadataPrefix, PROPERTY_USER_METADATA_PREFIX);
|
||||||
FN = new Function<String, String>() {
|
fn = new Function<String, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apply(String arg0) {
|
public String apply(String arg0) {
|
||||||
|
@ -63,7 +63,7 @@ public class BindMapToHeadersWithPrefix implements Binder {
|
||||||
checkArgument(checkNotNull(input, "input") instanceof Map<?, ?>, "this binder is only valid for Maps!");
|
checkArgument(checkNotNull(input, "input") instanceof Map<?, ?>, "this binder is only valid for Maps!");
|
||||||
checkNotNull(request, "request");
|
checkNotNull(request, "request");
|
||||||
|
|
||||||
Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, FN);
|
Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, fn);
|
||||||
return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(userMetadata)).build();
|
return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(userMetadata)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit")
|
@Test(groups = "unit")
|
||||||
public final class MpuPartitioningAlgorithmTest {
|
public final class MpuPartitioningAlgorithmTest {
|
||||||
private final long MIN_PART_SIZE = 5L * 1024 * 1024;
|
private static final long MIN_PART_SIZE = 5L * 1024 * 1024;
|
||||||
private final long MAX_PART_SIZE = 5L * 1024 * 1024 * 1024;
|
private static final long MAX_PART_SIZE = 5L * 1024 * 1024 * 1024;
|
||||||
private final int MAX_NUMBER_OF_PARTS = 10 * 1000;
|
private static final int MAX_NUMBER_OF_PARTS = 10 * 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Below 1 parts the MPU is not used.
|
* Below 1 parts the MPU is not used.
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class Reflection2Test {
|
||||||
assertEquals(methodInSuper.getParameters().get(0).getType().getRawType(), Object.class);
|
assertEquals(methodInSuper.getParameters().get(0).getType().getRawType(), Object.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<String> SET_METHODS = ImmutableSet.of(
|
private static final ImmutableSet<String> SET_METHODS = ImmutableSet.of(
|
||||||
// Java 6 and 7 methods
|
// Java 6 and 7 methods
|
||||||
"add",
|
"add",
|
||||||
"addAll",
|
"addAll",
|
||||||
|
@ -131,7 +131,7 @@ public class Reflection2Test {
|
||||||
"spliterator",
|
"spliterator",
|
||||||
"stream");
|
"stream");
|
||||||
|
|
||||||
ImmutableSet<String> SORTED_SET_METHODS = ImmutableSet.<String>builder()
|
private static final ImmutableSet<String> SORTED_SET_METHODS = ImmutableSet.<String>builder()
|
||||||
.addAll(SET_METHODS)
|
.addAll(SET_METHODS)
|
||||||
.add("comparator")
|
.add("comparator")
|
||||||
.add("first")
|
.add("first")
|
||||||
|
|
|
@ -40,10 +40,10 @@ import com.google.common.collect.Lists;
|
||||||
@Test(groups = "unit", singleThreaded = true)
|
@Test(groups = "unit", singleThreaded = true)
|
||||||
public class Predicates2Test {
|
public class Predicates2Test {
|
||||||
// Grace must be reasonably big; Thread.sleep can take a bit longer to wake up sometimes...
|
// Grace must be reasonably big; Thread.sleep can take a bit longer to wake up sometimes...
|
||||||
public static int SLOW_BUILD_SERVER_GRACE = 250;
|
public static final int SLOW_BUILD_SERVER_GRACE = 250;
|
||||||
|
|
||||||
// Sometimes returns sooner than timer would predict (e.g. observed 2999ms, when expected 3000ms)
|
// Sometimes returns sooner than timer would predict (e.g. observed 2999ms, when expected 3000ms)
|
||||||
public static int EARLY_RETURN_GRACE = 10;
|
public static final int EARLY_RETURN_GRACE = 10;
|
||||||
|
|
||||||
private Stopwatch stopwatch;
|
private Stopwatch stopwatch;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ import com.google.gson.Gson;
|
||||||
@Test(groups = "unit", testName = "ForwardingRuleCreationBinderTest")
|
@Test(groups = "unit", testName = "ForwardingRuleCreationBinderTest")
|
||||||
public class ForwardingRuleCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
|
public class ForwardingRuleCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
|
||||||
|
|
||||||
private static String DESCRIPTION = "This is a test!";
|
private static final String DESCRIPTION = "This is a test!";
|
||||||
private static String IP_ADDRESS = "1.2.1.1.1";
|
private static final String IP_ADDRESS = "1.2.1.1.1";
|
||||||
private static String PORT_RANGE = "1.2.3.4.1";
|
private static final String PORT_RANGE = "1.2.3.4.1";
|
||||||
private static URI TARGET = URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool");
|
private static final URI TARGET = URI.create(BASE_URL + "/party/regions/europe-west1/targetPools/test-target-pool");
|
||||||
|
|
||||||
Json json = new GsonWrapper(new Gson());
|
Json json = new GsonWrapper(new Gson());
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,11 @@ import com.google.gson.Gson;
|
||||||
@Test(groups = "unit", testName = "HttpHealthCheckCreationBinderTest")
|
@Test(groups = "unit", testName = "HttpHealthCheckCreationBinderTest")
|
||||||
public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
|
public class HttpHealthCheckCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
|
||||||
|
|
||||||
private String NAME = "testHttpHealthCheck";
|
private static final String NAME = "testHttpHealthCheck";
|
||||||
private Integer TIMEOUTSEC = 3;
|
private static final int TIMEOUTSEC = 3;
|
||||||
private Integer UNHEALTHYTHRESHOLD = 5;
|
private static final int UNHEALTHYTHRESHOLD = 5;
|
||||||
private Integer HEALTHYTHRESHOLD = 4;
|
private static final int HEALTHYTHRESHOLD = 4;
|
||||||
private static String DESCRIPTION = "This is a test!";
|
private static final String DESCRIPTION = "This is a test!";
|
||||||
|
|
||||||
Json json = new GsonWrapper(new Gson());
|
Json json = new GsonWrapper(new Gson());
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "TargetInstanceApiMockTest", singleThreaded = true)
|
@Test(groups = "unit", testName = "TargetInstanceApiMockTest", singleThreaded = true)
|
||||||
public class TargetInstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
public class TargetInstanceApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||||
|
|
||||||
public static String TARGET_INSTANCE_NAME = "target-instance-1";
|
public static final String TARGET_INSTANCE_NAME = "target-instance-1";
|
||||||
|
|
||||||
public void get() throws Exception {
|
public void get() throws Exception {
|
||||||
server.enqueue(jsonResponse("/target_instance_get.json"));
|
server.enqueue(jsonResponse("/target_instance_get.json"));
|
||||||
|
|
|
@ -31,12 +31,12 @@ import org.jclouds.io.Payloads;
|
||||||
*/
|
*/
|
||||||
public class ProfitBricksSoapMessageEnvelope implements HttpRequestFilter {
|
public class ProfitBricksSoapMessageEnvelope implements HttpRequestFilter {
|
||||||
|
|
||||||
private final String SOAP_PREFIX
|
private static final String SOAP_PREFIX
|
||||||
= "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
|
= "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
|
||||||
+ "<soapenv:Header/>"
|
+ "<soapenv:Header/>"
|
||||||
+ "<soapenv:Body>";
|
+ "<soapenv:Body>";
|
||||||
|
|
||||||
private final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
|
private static final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
public HttpRequest filter(HttpRequest request) throws HttpException {
|
||||||
|
|
|
@ -42,7 +42,7 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
|
||||||
@Test(groups = "unit", testName = "ResponseStatusFromPayloadHttpCommandExecutorServiceTest")
|
@Test(groups = "unit", testName = "ResponseStatusFromPayloadHttpCommandExecutorServiceTest")
|
||||||
public class ResponseStatusFromPayloadHttpCommandExecutorServiceTest extends BaseProfitBricksMockTest {
|
public class ResponseStatusFromPayloadHttpCommandExecutorServiceTest extends BaseProfitBricksMockTest {
|
||||||
|
|
||||||
private final int MAX_RETRIES = 5;
|
private static final int MAX_RETRIES = 5;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotFound() throws Exception {
|
public void testNotFound() throws Exception {
|
||||||
|
|
|
@ -27,19 +27,19 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "ProfitBricksSoapMessageEnvelopeTest")
|
@Test(groups = "unit", testName = "ProfitBricksSoapMessageEnvelopeTest")
|
||||||
public class ProfitBricksSoapMessageEnvelopeTest {
|
public class ProfitBricksSoapMessageEnvelopeTest {
|
||||||
|
|
||||||
private final String SOAP_PREFIX
|
private static final String SOAP_PREFIX
|
||||||
= "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
|
= "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.api.profitbricks.com/\">"
|
||||||
+ "<soapenv:Header/>"
|
+ "<soapenv:Header/>"
|
||||||
+ "<soapenv:Body>";
|
+ "<soapenv:Body>";
|
||||||
private final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
|
private static final String SOAP_SUFFIX = "</soapenv:Body></soapenv:Envelope>";
|
||||||
private final String endpoint = "https://api.profitbricks.com/1.3";
|
private static final String ENDPOINT = "https://api.profitbricks.com/1.3";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPayloadEnclosedWithSoapTags() {
|
public void testPayloadEnclosedWithSoapTags() {
|
||||||
String requestBody = "<ws:getAllDataCenters/>";
|
String requestBody = "<ws:getAllDataCenters/>";
|
||||||
String expectedPayload = SOAP_PREFIX.concat(requestBody).concat(SOAP_SUFFIX);
|
String expectedPayload = SOAP_PREFIX.concat(requestBody).concat(SOAP_SUFFIX);
|
||||||
|
|
||||||
HttpRequest request = HttpRequest.builder().method("POST").endpoint(endpoint).payload(requestBody).build();
|
HttpRequest request = HttpRequest.builder().method("POST").endpoint(ENDPOINT).payload(requestBody).build();
|
||||||
|
|
||||||
ProfitBricksSoapMessageEnvelope soapEnvelope = new ProfitBricksSoapMessageEnvelope();
|
ProfitBricksSoapMessageEnvelope soapEnvelope = new ProfitBricksSoapMessageEnvelope();
|
||||||
HttpRequest filtered = soapEnvelope.filter(request);
|
HttpRequest filtered = soapEnvelope.filter(request);
|
||||||
|
@ -50,7 +50,7 @@ public class ProfitBricksSoapMessageEnvelopeTest {
|
||||||
|
|
||||||
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*must contain payload message.*")
|
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*must contain payload message.*")
|
||||||
public void testNullRequest() {
|
public void testNullRequest() {
|
||||||
HttpRequest request = HttpRequest.builder().method("POST").endpoint(endpoint).build();
|
HttpRequest request = HttpRequest.builder().method("POST").endpoint(ENDPOINT).build();
|
||||||
new ProfitBricksSoapMessageEnvelope().filter(request);
|
new ProfitBricksSoapMessageEnvelope().filter(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "ZoneAndResourceRecordToXMLTest")
|
@Test(groups = "unit", testName = "ZoneAndResourceRecordToXMLTest")
|
||||||
public class ZoneAndResourceRecordToXMLTest {
|
public class ZoneAndResourceRecordToXMLTest {
|
||||||
|
|
||||||
String A = "<v01:createResourceRecord><transactionID /><resourceRecord ZoneName=\"jclouds.org.\" Type=\"1\" DName=\"www.jclouds.org.\" TTL=\"3600\"><InfoValues Info1Value=\"1.1.1.1\" /></resourceRecord></v01:createResourceRecord>";
|
private static final String A = "<v01:createResourceRecord><transactionID /><resourceRecord ZoneName=\"jclouds.org.\" Type=\"1\" DName=\"www.jclouds.org.\" TTL=\"3600\"><InfoValues Info1Value=\"1.1.1.1\" /></resourceRecord></v01:createResourceRecord>";
|
||||||
|
|
||||||
public void testA() {
|
public void testA() {
|
||||||
assertEquals(ZoneAndResourceRecordToXML.toXML("jclouds.org.", ResourceRecord.rrBuilder()
|
assertEquals(ZoneAndResourceRecordToXML.toXML("jclouds.org.", ResourceRecord.rrBuilder()
|
||||||
|
@ -34,7 +34,7 @@ public class ZoneAndResourceRecordToXMLTest {
|
||||||
.rdata("1.1.1.1").build()), A);
|
.rdata("1.1.1.1").build()), A);
|
||||||
}
|
}
|
||||||
|
|
||||||
String MX = "<v01:createResourceRecord><transactionID /><resourceRecord ZoneName=\"jclouds.org.\" Type=\"15\" DName=\"mail.jclouds.org.\" TTL=\"1800\"><InfoValues Info1Value=\"10\" Info2Value=\"maileast.jclouds.org.\" /></resourceRecord></v01:createResourceRecord>";
|
private static final String MX = "<v01:createResourceRecord><transactionID /><resourceRecord ZoneName=\"jclouds.org.\" Type=\"15\" DName=\"mail.jclouds.org.\" TTL=\"1800\"><InfoValues Info1Value=\"10\" Info2Value=\"maileast.jclouds.org.\" /></resourceRecord></v01:createResourceRecord>";
|
||||||
|
|
||||||
public void testMX() {
|
public void testMX() {
|
||||||
assertEquals(ZoneAndResourceRecordToXML.toXML("jclouds.org.", ResourceRecord.rrBuilder()
|
assertEquals(ZoneAndResourceRecordToXML.toXML("jclouds.org.", ResourceRecord.rrBuilder()
|
||||||
|
@ -45,7 +45,7 @@ public class ZoneAndResourceRecordToXMLTest {
|
||||||
.infoValue("maileast.jclouds.org.").build()), MX);
|
.infoValue("maileast.jclouds.org.").build()), MX);
|
||||||
}
|
}
|
||||||
|
|
||||||
String A_UPDATE = "<v01:updateResourceRecord><transactionID /><resourceRecord Guid=\"ABCDEF\" ZoneName=\"jclouds.org.\" Type=\"1\" DName=\"www.jclouds.org.\" TTL=\"3600\"><InfoValues Info1Value=\"1.1.1.1\" /></resourceRecord></v01:updateResourceRecord>";
|
private static final String A_UPDATE = "<v01:updateResourceRecord><transactionID /><resourceRecord Guid=\"ABCDEF\" ZoneName=\"jclouds.org.\" Type=\"1\" DName=\"www.jclouds.org.\" TTL=\"3600\"><InfoValues Info1Value=\"1.1.1.1\" /></resourceRecord></v01:updateResourceRecord>";
|
||||||
|
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
assertEquals(ZoneAndResourceRecordToXML.update("ABCDEF", A), A_UPDATE);
|
assertEquals(ZoneAndResourceRecordToXML.update("ABCDEF", A), A_UPDATE);
|
||||||
|
|
Loading…
Reference in New Issue