mirror of https://github.com/apache/jclouds.git
Merge pull request #1039 from petergardfjall/master
Brings glesys jclouds provider up to speed with latest GleSYS API version. Fix for https://github.com/jclouds/jclouds/issues/1035
This commit is contained in:
commit
0b7e67e8e3
|
@ -173,9 +173,9 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
|
||||||
for (Entry<String, AllowedArgumentsForCreateServer> platformToArgs : api.getServerApi()
|
for (Entry<String, AllowedArgumentsForCreateServer> platformToArgs : api.getServerApi()
|
||||||
.getAllowedArgumentsForCreateByPlatform().entrySet())
|
.getAllowedArgumentsForCreateByPlatform().entrySet())
|
||||||
for (String datacenter : platformToArgs.getValue().getDataCenters())
|
for (String datacenter : platformToArgs.getValue().getDataCenters())
|
||||||
for (int diskSizeGB : platformToArgs.getValue().getDiskSizesInGB())
|
for (int diskSizeGB : platformToArgs.getValue().getDiskSizesInGB().getAllowedUnits())
|
||||||
for (int cpuCores : platformToArgs.getValue().getCpuCoreOptions())
|
for (int cpuCores : platformToArgs.getValue().getCpuCoreOptions().getAllowedUnits())
|
||||||
for (int memorySizeMB : platformToArgs.getValue().getMemorySizesInMB()) {
|
for (int memorySizeMB : platformToArgs.getValue().getMemorySizesInMB().getAllowedUnits()) {
|
||||||
ImmutableSet.Builder<String> templatesSupportedBuilder = ImmutableSet.builder();
|
ImmutableSet.Builder<String> templatesSupportedBuilder = ImmutableSet.builder();
|
||||||
for (OSTemplate template : images) {
|
for (OSTemplate template : images) {
|
||||||
if (template.getPlatform().equals(platformToArgs.getKey())
|
if (template.getPlatform().equals(platformToArgs.getKey())
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package org.jclouds.glesys.domain;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import java.beans.ConstructorProperties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the allowed arguments for a certain server resource type (such as
|
||||||
|
* disksize, memorysize, cpucores, and transfer).
|
||||||
|
* <p/>
|
||||||
|
* This is a composite type consisting of both the set of allowed units for the
|
||||||
|
* resource type as well as the cost per unit.
|
||||||
|
*
|
||||||
|
* @see AllowedArgumentsForCreateServer
|
||||||
|
* @author Peter Gardfjäll
|
||||||
|
*/
|
||||||
|
public class AllowedArguments {
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromAllowedArgument(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
protected Cost costPerUnit;
|
||||||
|
protected Set<Integer> allowedUnits;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AllowedArguments#getCostPerUnit()
|
||||||
|
*/
|
||||||
|
public Builder costPerUnit(Cost costPerUnit) {
|
||||||
|
this.costPerUnit = costPerUnit;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AllowedArguments#getAllowedUnits()
|
||||||
|
*/
|
||||||
|
public Builder allowedUnits(Set<Integer> allowedUnits) {
|
||||||
|
this.allowedUnits = ImmutableSet.copyOf(checkNotNull(allowedUnits,
|
||||||
|
"allowedUnits"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder allowedUnits(Integer... allowedUnits) {
|
||||||
|
return allowedUnits(ImmutableSet.copyOf(allowedUnits));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AllowedArguments build() {
|
||||||
|
return new AllowedArguments(this.costPerUnit, this.allowedUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromAllowedArgument(AllowedArguments in) {
|
||||||
|
return this.costPerUnit(in.getCostPerUnit()).allowedUnits(
|
||||||
|
in.getAllowedUnits());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Cost costPerUnit;
|
||||||
|
private final Set<Integer> allowedUnits;
|
||||||
|
|
||||||
|
@ConstructorProperties({ "costperunit", "units" })
|
||||||
|
protected AllowedArguments(Cost costPerUnit, Set<Integer> units) {
|
||||||
|
this.costPerUnit = checkNotNull(costPerUnit, "costPerUnit");
|
||||||
|
this.allowedUnits = ImmutableSet.copyOf(checkNotNull(units,
|
||||||
|
"allowedUnits"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the cost per unit.
|
||||||
|
*/
|
||||||
|
public Cost getCostPerUnit() {
|
||||||
|
return this.costPerUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the set of allowed units for the resource type.
|
||||||
|
*/
|
||||||
|
public Set<Integer> getAllowedUnits() {
|
||||||
|
return this.allowedUnits;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(this.costPerUnit, this.allowedUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((obj == null) || (getClass() != obj.getClass())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
AllowedArguments that = AllowedArguments.class.cast(obj);
|
||||||
|
return Objects.equal(this.costPerUnit, that.costPerUnit)
|
||||||
|
&& Objects.equal(this.allowedUnits, that.allowedUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ToStringHelper string() {
|
||||||
|
return Objects.toStringHelper("").add("costPerUnit", this.costPerUnit)
|
||||||
|
.add("allowedUnits", this.allowedUnits);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return string().toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,93 +35,78 @@ import com.google.common.collect.ImmutableSet;
|
||||||
*/
|
*/
|
||||||
public class AllowedArgumentsForCreateServer {
|
public class AllowedArgumentsForCreateServer {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder builder() {
|
||||||
return new ConcreteBuilder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder<?> toBuilder() {
|
public Builder toBuilder() {
|
||||||
return new ConcreteBuilder().fromAllowedArgumentsForCreateServer(this);
|
return new Builder().fromAllowedArgumentsForCreateServer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class Builder<T extends Builder<T>> {
|
public static class Builder {
|
||||||
protected abstract T self();
|
protected AllowedArguments diskSizes;
|
||||||
|
protected AllowedArguments memorySizes;
|
||||||
protected Set<Integer> diskSizes = ImmutableSet.of();
|
protected AllowedArguments cpuCores;
|
||||||
protected Set<Integer> memorySizes = ImmutableSet.of();
|
|
||||||
protected Set<Integer> cpuCores = ImmutableSet.of();
|
|
||||||
protected Set<String> templates = ImmutableSet.of();
|
protected Set<String> templates = ImmutableSet.of();
|
||||||
protected Set<Integer> transfers = ImmutableSet.of();
|
protected AllowedArguments transfers;
|
||||||
protected Set<String> dataCenters = ImmutableSet.of();
|
protected Set<String> dataCenters = ImmutableSet.of();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getDiskSizesInGB()
|
* @see AllowedArgumentsForCreateServer#getDiskSizesInGB()
|
||||||
*/
|
*/
|
||||||
public T diskSizes(Set<Integer> diskSizes) {
|
public Builder diskSizes(AllowedArguments diskSizes) {
|
||||||
this.diskSizes = ImmutableSet.copyOf(checkNotNull(diskSizes, "diskSizesInGB"));
|
this.diskSizes = checkNotNull(diskSizes, "diskSizesInGB");
|
||||||
return self();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T diskSizes(Integer... in) {
|
|
||||||
return diskSizes(ImmutableSet.copyOf(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getMemorySizesInMB()
|
* @see AllowedArgumentsForCreateServer#getMemorySizesInMB()
|
||||||
*/
|
*/
|
||||||
public T memorySizes(Set<Integer> memorySizes) {
|
public Builder memorySizes(AllowedArguments memorySizes) {
|
||||||
this.memorySizes = ImmutableSet.copyOf(checkNotNull(memorySizes, "memorySizesInMB"));
|
this.memorySizes = checkNotNull(memorySizes, "memorySizesInMB");
|
||||||
return self();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T memorySizes(Integer... in) {
|
|
||||||
return memorySizes(ImmutableSet.copyOf(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getCpuCoreOptions()
|
* @see AllowedArgumentsForCreateServer#getCpuCoreOptions()
|
||||||
*/
|
*/
|
||||||
public T cpuCores(Set<Integer> cpuCores) {
|
public Builder cpuCores(AllowedArguments cpuCores) {
|
||||||
this.cpuCores = ImmutableSet.copyOf(checkNotNull(cpuCores, "cpuCoreOptions"));
|
this.cpuCores = checkNotNull(cpuCores, "cpuCoreOptions");
|
||||||
return self();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T cpuCores(Integer... in) {
|
|
||||||
return cpuCores(ImmutableSet.copyOf(in));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getTemplateNames()
|
* @see AllowedArgumentsForCreateServer#getTemplateNames()
|
||||||
*/
|
*/
|
||||||
public T templates(Set<String> templates) {
|
public Builder templates(Set<String> templates) {
|
||||||
this.templates = ImmutableSet.copyOf(checkNotNull(templates, "templateNames"));
|
this.templates = ImmutableSet.copyOf(checkNotNull(templates, "templateNames"));
|
||||||
return self();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T templates(String... in) {
|
public Builder templates(String... in) {
|
||||||
return templates(ImmutableSet.copyOf(in));
|
return templates(ImmutableSet.copyOf(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getTransfersInGB()
|
* @see AllowedArgumentsForCreateServer#getTransfersInGB()
|
||||||
*/
|
*/
|
||||||
public T transfers(Set<Integer> transfers) {
|
public Builder transfers(AllowedArguments transfers) {
|
||||||
this.transfers = ImmutableSet.copyOf(checkNotNull(transfers, "transfersInGB"));
|
this.transfers = checkNotNull(transfers, "transfersInGB");
|
||||||
return self();
|
return this;
|
||||||
}
|
|
||||||
|
|
||||||
public T transfers(Integer... in) {
|
|
||||||
return transfers(ImmutableSet.copyOf(in));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AllowedArgumentsForCreateServer#getDataCenters()
|
* @see AllowedArgumentsForCreateServer#getDataCenters()
|
||||||
*/
|
*/
|
||||||
public T dataCenters(Set<String> dataCenters) {
|
public Builder dataCenters(Set<String> dataCenters) {
|
||||||
this.dataCenters = ImmutableSet.copyOf(checkNotNull(dataCenters, "dataCenters"));
|
this.dataCenters = ImmutableSet.copyOf(checkNotNull(dataCenters, "dataCenters"));
|
||||||
return self();
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T dataCenters(String... in) {
|
public Builder dataCenters(String... in) {
|
||||||
return dataCenters(ImmutableSet.copyOf(in));
|
return dataCenters(ImmutableSet.copyOf(in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +114,7 @@ public class AllowedArgumentsForCreateServer {
|
||||||
return new AllowedArgumentsForCreateServer(diskSizes, memorySizes, cpuCores, templates, transfers, dataCenters);
|
return new AllowedArgumentsForCreateServer(diskSizes, memorySizes, cpuCores, templates, transfers, dataCenters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T fromAllowedArgumentsForCreateServer(AllowedArgumentsForCreateServer in) {
|
public Builder fromAllowedArgumentsForCreateServer(AllowedArgumentsForCreateServer in) {
|
||||||
return this
|
return this
|
||||||
.diskSizes(in.getDiskSizesInGB())
|
.diskSizes(in.getDiskSizesInGB())
|
||||||
.memorySizes(in.getMemorySizesInMB())
|
.memorySizes(in.getMemorySizesInMB())
|
||||||
|
@ -140,29 +125,22 @@ public class AllowedArgumentsForCreateServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
private final AllowedArguments diskSizesInGB;
|
||||||
@Override
|
private final AllowedArguments memorySizesInMB;
|
||||||
protected ConcreteBuilder self() {
|
private final AllowedArguments cpuCoreOptions;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Set<Integer> diskSizesInGB;
|
|
||||||
private final Set<Integer> memorySizesInMB;
|
|
||||||
private final Set<Integer> cpuCoreOptions;
|
|
||||||
private final Set<String> templateNames;
|
private final Set<String> templateNames;
|
||||||
private final Set<Integer> transfersInGB;
|
private final AllowedArguments transfersInGB;
|
||||||
private final Set<String> dataCenters;
|
private final Set<String> dataCenters;
|
||||||
|
|
||||||
@ConstructorProperties({
|
@ConstructorProperties({
|
||||||
"disksize", "memorysize", "cpucores", "template", "transfer", "datacenter"
|
"disksize", "memorysize", "cpucores", "template", "transfer", "datacenter"
|
||||||
})
|
})
|
||||||
protected AllowedArgumentsForCreateServer(Set<Integer> diskSizesInGB, Set<Integer> memorySizesInMB, Set<Integer> cpuCoreOptions, Set<String> templateNames, Set<Integer> transfersInGB, Set<String> dataCenters) {
|
protected AllowedArgumentsForCreateServer(AllowedArguments diskSizesInGB, AllowedArguments memorySizesInMB, AllowedArguments cpuCoreOptions, Set<String> templateNames, AllowedArguments transfersInGB, Set<String> dataCenters) {
|
||||||
this.diskSizesInGB = ImmutableSet.copyOf(checkNotNull(diskSizesInGB, "diskSizesInGB"));
|
this.diskSizesInGB = checkNotNull(diskSizesInGB, "diskSizesInGB");
|
||||||
this.memorySizesInMB = ImmutableSet.copyOf(checkNotNull(memorySizesInMB, "memorySizesInMB"));
|
this.memorySizesInMB = checkNotNull(memorySizesInMB, "memorySizesInMB");
|
||||||
this.cpuCoreOptions = ImmutableSet.copyOf(checkNotNull(cpuCoreOptions, "cpuCoreOptions"));
|
this.cpuCoreOptions = checkNotNull(cpuCoreOptions, "cpuCoreOptions");
|
||||||
this.templateNames = ImmutableSet.copyOf(checkNotNull(templateNames, "templateNames"));
|
this.templateNames = ImmutableSet.copyOf(checkNotNull(templateNames, "templateNames"));
|
||||||
this.transfersInGB = ImmutableSet.copyOf(checkNotNull(transfersInGB, "transfersInGB"));
|
this.transfersInGB = checkNotNull(transfersInGB, "transfersInGB");
|
||||||
this.dataCenters = ImmutableSet.copyOf(checkNotNull(dataCenters, "dataCenters"));
|
this.dataCenters = ImmutableSet.copyOf(checkNotNull(dataCenters, "dataCenters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +148,7 @@ public class AllowedArgumentsForCreateServer {
|
||||||
* @return a list of disk sizes, in GB, that can be used for creating servers on this platform
|
* @return a list of disk sizes, in GB, that can be used for creating servers on this platform
|
||||||
* @see org.jclouds.glesys.domain.OSTemplate#getMinDiskSize()
|
* @see org.jclouds.glesys.domain.OSTemplate#getMinDiskSize()
|
||||||
*/
|
*/
|
||||||
public Set<Integer> getDiskSizesInGB() {
|
public AllowedArguments getDiskSizesInGB() {
|
||||||
return this.diskSizesInGB;
|
return this.diskSizesInGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,14 +156,14 @@ public class AllowedArgumentsForCreateServer {
|
||||||
* @return a list of memory sizes, in MB, that can be used for creating servers on this platform
|
* @return a list of memory sizes, in MB, that can be used for creating servers on this platform
|
||||||
* @see org.jclouds.glesys.domain.OSTemplate#getMinMemSize()
|
* @see org.jclouds.glesys.domain.OSTemplate#getMinMemSize()
|
||||||
*/
|
*/
|
||||||
public Set<Integer> getMemorySizesInMB() {
|
public AllowedArguments getMemorySizesInMB() {
|
||||||
return this.memorySizesInMB;
|
return this.memorySizesInMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a list of which core counts can be used for creating servers on this platform
|
* @return a list of which core counts can be used for creating servers on this platform
|
||||||
*/
|
*/
|
||||||
public Set<Integer> getCpuCoreOptions() {
|
public AllowedArguments getCpuCoreOptions() {
|
||||||
return this.cpuCoreOptions;
|
return this.cpuCoreOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +178,7 @@ public class AllowedArgumentsForCreateServer {
|
||||||
/**
|
/**
|
||||||
* @return the list of transfer settings available for creating servers on this platform
|
* @return the list of transfer settings available for creating servers on this platform
|
||||||
*/
|
*/
|
||||||
public Set<Integer> getTransfersInGB() {
|
public AllowedArguments getTransfersInGB() {
|
||||||
return this.transfersInGB;
|
return this.transfersInGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.glesys.domain.AllowedArguments;
|
||||||
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
|
import org.jclouds.glesys.domain.AllowedArgumentsForCreateServer;
|
||||||
import org.jclouds.glesys.domain.Console;
|
import org.jclouds.glesys.domain.Console;
|
||||||
import org.jclouds.glesys.domain.Cost;
|
import org.jclouds.glesys.domain.Cost;
|
||||||
|
@ -93,26 +94,40 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_allowed_arguments.json")).build()).getServerApi();
|
HttpResponse.builder().statusCode(204).payload(payloadFromResource("/server_allowed_arguments.json")).build()).getServerApi();
|
||||||
|
|
||||||
Map<String, AllowedArgumentsForCreateServer> expected = Maps.newLinkedHashMap();
|
Map<String, AllowedArgumentsForCreateServer> expected = Maps.newLinkedHashMap();
|
||||||
|
AllowedArguments openvzAllowedMemorySizes = AllowedArguments.builder().allowedUnits(128, 256, 512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 14336, 16384).costPerUnit(Cost.builder().amount(0.09).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments openvzAllowedDiskSizes = AllowedArguments.builder().allowedUnits(5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 150).costPerUnit(Cost.builder().amount(2.2).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments openvzAllowedCpuCores = AllowedArguments.builder().allowedUnits(1, 2, 3, 4, 5, 6, 7, 8).costPerUnit(Cost.builder().amount(30).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments openvzAllowedTransfers = AllowedArguments.builder().allowedUnits(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000).costPerUnit(Cost.builder().amount(0.2).currency("SEK").timePeriod("month").build()).build();
|
||||||
AllowedArgumentsForCreateServer openvz = AllowedArgumentsForCreateServer.builder()
|
AllowedArgumentsForCreateServer openvz = AllowedArgumentsForCreateServer.builder()
|
||||||
.dataCenters("Amsterdam", "Falkenberg", "New York City", "Stockholm")
|
.dataCenters("Amsterdam", "Falkenberg", "New York City", "Stockholm")
|
||||||
.memorySizes(128, 256, 512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288)
|
.memorySizes(openvzAllowedMemorySizes)
|
||||||
.diskSizes(5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 150)
|
.diskSizes(openvzAllowedDiskSizes)
|
||||||
.cpuCores(1, 2, 3, 4, 5, 6, 7, 8)
|
.cpuCores(openvzAllowedCpuCores)
|
||||||
.templates("Centos 5", "Centos 5 64-bit", "Centos 6 32-bit", "Centos 6 64-bit", "Debian 5.0 32-bit",
|
.templates("Centos 5", "Centos 5 64-bit", "Centos 6 32-bit", "Centos 6 64-bit", "Debian 5.0 32-bit",
|
||||||
"Debian 5.0 64-bit", "Debian 6.0 32-bit", "Debian 6.0 64-bit", "Fedora Core 11", "Fedora Core 11 64-bit",
|
"Debian 5.0 64-bit", "Debian 6.0 32-bit", "Debian 6.0 64-bit", "Fedora Core 11", "Fedora Core 11 64-bit",
|
||||||
"Gentoo", "Gentoo 64-bit", "Scientific Linux 6", "Scientific Linux 6 64-bit", "Slackware 12",
|
"Gentoo", "Gentoo 64-bit", "Scientific Linux 6", "Scientific Linux 6 64-bit", "Slackware 12",
|
||||||
"Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit")
|
"Ubuntu 10.04 LTS 32-bit", "Ubuntu 10.04 LTS 64-bit", "Ubuntu 11.04 64-bit", "Ubuntu 12.04 LTS 32-bit",
|
||||||
.transfers(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
|
"Ubuntu 12.04 LTS 64-bit")
|
||||||
|
.transfers(openvzAllowedTransfers)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
AllowedArguments xenAllowedMemorySizes = AllowedArguments.builder().allowedUnits(512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 14336, 16384).costPerUnit(Cost.builder().amount(0.09).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments xenAllowedDiskSizes = AllowedArguments.builder().allowedUnits(5, 10, 20, 30, 40, 50, 80, 100, 120, 140, 150, 160, 160, 200, 250, 300).costPerUnit(Cost.builder().amount(2.2).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments xenAllowedCpuCores = AllowedArguments.builder().allowedUnits(1, 2, 3, 4, 5, 6, 7, 8).costPerUnit(Cost.builder().amount(30).currency("SEK").timePeriod("month").build()).build();
|
||||||
|
AllowedArguments xenAllowedTransfers = AllowedArguments.builder().allowedUnits(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000).costPerUnit(Cost.builder().amount(0.2).currency("SEK").timePeriod("month").build()).build();
|
||||||
AllowedArgumentsForCreateServer xen = AllowedArgumentsForCreateServer.builder()
|
AllowedArgumentsForCreateServer xen = AllowedArgumentsForCreateServer.builder()
|
||||||
.memorySizes(512, 768, 1024, 1536, 2048, 2560, 3072, 3584, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 14336, 16384)
|
.memorySizes(xenAllowedMemorySizes)
|
||||||
.diskSizes(5, 10, 20, 30, 40, 50, 80, 100, 120, 140, 150, 160, 160, 200, 250, 300)
|
.diskSizes(xenAllowedDiskSizes)
|
||||||
.cpuCores(1, 2, 3, 4, 5, 6, 7, 8)
|
.cpuCores(xenAllowedCpuCores)
|
||||||
.templates("CentOS 5.5 x64", "CentOS 5.5 x86", "Centos 6 x64", "Centos 6 x86", "Debian-6 x64",
|
|
||||||
"Debian 5.0.1 x64", "FreeBSD 8.2", "Gentoo 10.1 x64", "Ubuntu 8.04 x64", "Ubuntu 10.04 LTS 64-bit",
|
|
||||||
"Ubuntu 10.10 x64", "Ubuntu 11.04 x64", "Windows Server 2008 R2 x64 std",
|
.templates("CentOS 5.5 x64", "CentOS 5.5 x86", "Centos 6 x64", "Centos 6 x86",
|
||||||
"Windows Server 2008 R2 x64 web", "Windows Server 2008 x64 web", "Windows Server 2008 x86 web")
|
"Debian-6 x64", "Debian 5.0.1 x64", "FreeBSD 8.2", "FreeBSD 9.0",
|
||||||
.transfers(50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000)
|
"Gentoo 10.1 x64", "OpenSUSE 11.4 64-bit", "Ubuntu 8.04 x64",
|
||||||
|
"Ubuntu 10.04 LTS 64-bit", "Ubuntu 10.10 x64", "Ubuntu 11.04 x64",
|
||||||
|
"Ubuntu 12.04 x64", "Ubuntu 12.04 x86", "Windows Server 2008 R2 x64 std",
|
||||||
|
"Windows Server 2008 R2 x64 web", "Windows Server 2008 x64 web")
|
||||||
|
.transfers(xenAllowedTransfers)
|
||||||
.dataCenters("Falkenberg")
|
.dataCenters("Falkenberg")
|
||||||
.build();
|
.build();
|
||||||
expected.put("Xen", xen);
|
expected.put("Xen", xen);
|
||||||
|
|
|
@ -98,12 +98,12 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest {
|
||||||
assertNotNull(t);
|
assertNotNull(t);
|
||||||
|
|
||||||
assert t.getDataCenters().size() > 0 : t;
|
assert t.getDataCenters().size() > 0 : t;
|
||||||
assert t.getCpuCoreOptions().size() > 0 : t;
|
assert t.getCpuCoreOptions().getAllowedUnits().size() > 0 : t;
|
||||||
assert t.getDiskSizesInGB().size() > 0 : t;
|
assert t.getDiskSizesInGB().getAllowedUnits().size() > 0 : t;
|
||||||
assert t.getMemorySizesInMB().size() > 0 : t;
|
assert t.getMemorySizesInMB().getAllowedUnits().size() > 0 : t;
|
||||||
assert t.getTemplateNames().size() > 0 : t;
|
assert t.getTemplateNames().size() > 0 : t;
|
||||||
assert t.getTransfersInGB().size() > 0 : t;
|
assert t.getTransfersInGB().getAllowedUnits().size() > 0 : t;
|
||||||
assert t.getTransfersInGB().size() > 0 : t;
|
assert t.getTransfersInGB().getAllowedUnits().size() > 0 : t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTemplates() throws Exception {
|
public void testListTemplates() throws Exception {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"response":{"status":{"code":200,"timestamp":"2012-02-08T17:07:38+01:00","text":"OK"},"argumentslist":{"Xen":{"disksize":[5,10,20,30,40,50,80,100,120,140,150,160,160,200,250,300],"memorysize":[512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288,14336,16384],"cpucores":[1,2,3,4,5,6,7,8],"template":["CentOS 5.5 x64","CentOS 5.5 x86","Centos 6 x64","Centos 6 x86","Debian-6 x64","Debian 5.0.1 x64","FreeBSD 8.2","Gentoo 10.1 x64","Ubuntu 8.04 x64","Ubuntu 10.04 LTS 64-bit","Ubuntu 10.10 x64","Ubuntu 11.04 x64","Windows Server 2008 R2 x64 std","Windows Server 2008 R2 x64 web","Windows Server 2008 x64 web","Windows Server 2008 x86 web"],"transfer":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000],"datacenter":["Falkenberg"]},"OpenVZ":{"disksize":[5,10,20,30,40,50,60,70,80,90,100,120,140,150],"memorysize":[128,256,512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288],"cpucores":[1,2,3,4,5,6,7,8],"template":["Centos 5","Centos 5 64-bit","Centos 6 32-bit","Centos 6 64-bit","Debian 5.0 32-bit","Debian 5.0 64-bit","Debian 6.0 32-bit","Debian 6.0 64-bit","Fedora Core 11","Fedora Core 11 64-bit","Gentoo","Gentoo 64-bit","Scientific Linux 6","Scientific Linux 6 64-bit","Slackware 12","Ubuntu 10.04 LTS 32-bit","Ubuntu 10.04 LTS 64-bit","Ubuntu 11.04 64-bit"],"transfer":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000],"datacenter":["Amsterdam","Falkenberg","New York City","Stockholm"]}},"debug":{"input":[]}}}
|
{"response":{"status":{"code":200,"timestamp":"2012-12-05T08:15:17+01:00","text":"OK"},"argumentslist":{"Xen":{"disksize":{"costperunit":{"amount":2.2,"currency":"SEK","timeperiod":"month"},"units":[5,10,20,30,40,50,80,100,120,140,150,160,200,250,300]},"memorysize":{"costperunit":{"amount":0.09,"currency":"SEK","timeperiod":"month"},"units":[512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288,14336,16384]},"cpucores":{"costperunit":{"amount":30,"currency":"SEK","timeperiod":"month"},"units":[1,2,3,4,5,6,7,8]},"template":["CentOS 5.5 x64","CentOS 5.5 x86","Centos 6 x64","Centos 6 x86","Debian-6 x64","Debian 5.0.1 x64","FreeBSD 8.2","FreeBSD 9.0","Gentoo 10.1 x64","OpenSUSE 11.4 64-bit","Ubuntu 8.04 x64","Ubuntu 10.04 LTS 64-bit","Ubuntu 10.10 x64","Ubuntu 11.04 x64","Ubuntu 12.04 x64","Ubuntu 12.04 x86","Windows Server 2008 R2 x64 std","Windows Server 2008 R2 x64 web","Windows Server 2008 x64 web"],"transfer":{"costperunit":{"amount":0.2,"currency":"SEK","timeperiod":"month"},"units":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000]},"datacenter":["Falkenberg"]},"OpenVZ":{"disksize":{"costperunit":{"amount":2.2,"currency":"SEK","timeperiod":"month"},"units":[5,10,20,30,40,50,60,70,80,90,100,120,140,150]},"memorysize":{"costperunit":{"amount":0.09,"currency":"SEK","timeperiod":"month"},"units":[128,256,512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288,14336,16384]},"cpucores":{"costperunit":{"amount":30,"currency":"SEK","timeperiod":"month"},"units":[1,2,3,4,5,6,7,8]},"transfer":{"costperunit":{"amount":0.2,"currency":"SEK","timeperiod":"month"},"units":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000]},"template":["Centos 5","Centos 5 64-bit","Centos 6 32-bit","Centos 6 64-bit","Debian 5.0 32-bit","Debian 5.0 64-bit","Debian 6.0 32-bit","Debian 6.0 64-bit","Fedora Core 11","Fedora Core 11 64-bit","Gentoo","Gentoo 64-bit","Scientific Linux 6","Scientific Linux 6 64-bit","Slackware 12","Ubuntu 10.04 LTS 32-bit","Ubuntu 10.04 LTS 64-bit","Ubuntu 11.04 64-bit","Ubuntu 12.04 LTS 32-bit","Ubuntu 12.04 LTS 64-bit"],"datacenter":["Amsterdam","Falkenberg","New York City","Stockholm"]}},"debug":{"input":[]}}}
|
Loading…
Reference in New Issue