GleSYS provider: updating ServerStatus for GleSYS api Beta v0.1.6 changes

This commit is contained in:
Adam Lowe 2012-01-27 10:35:22 +00:00
parent 2897caf24d
commit 3ce3b28b21
4 changed files with 11 additions and 12 deletions

View File

@ -33,11 +33,11 @@ public class ResourceUsage {
}
public static class Builder {
private Double usage;
private double usage;
private double max;
private String unit;
public Builder usage(Double usage) {
public Builder usage(double usage) {
this.usage = usage;
return this;
}
@ -61,11 +61,11 @@ public class ResourceUsage {
}
}
private final Double usage;
private final double usage;
private final double max;
private final String unit;
public ResourceUsage(Double usage, double max, String unit) {
public ResourceUsage(double usage, double max, String unit) {
this.usage = usage;
this.max = max;
this.unit = unit;
@ -74,7 +74,7 @@ public class ResourceUsage {
/**
* @return the usage in #unit
*/
public Double getUsage() {
public double getUsage() {
return usage;
}

View File

@ -528,10 +528,10 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest<GleSYSClien
private ServerStatus expectedServerStatus() {
ResourceUsage cpu = ResourceUsage.builder().unit("cores").max(1.0).usage(null).build();
ResourceUsage disk = ResourceUsage.builder().unit("MB").usage(372.0).max(5120).build();
ResourceUsage cpu = ResourceUsage.builder().unit("cores").max(1.0).usage(0.0).build();
ResourceUsage disk = ResourceUsage.builder().unit("MB").usage(371.0).max(5120).build();
ResourceUsage memory = ResourceUsage.builder().unit("MB").usage(3.0).max(128).build();
ServerUptime uptime = ServerUptime.builder().current(108).unit("seconds").build();
ServerUptime uptime = ServerUptime.builder().current(23).unit("seconds").build();
return ServerStatus.builder().state(ServerState.RUNNING).uptime(uptime).
cpu(cpu).disk(disk).memory(memory).build();
}

View File

@ -265,9 +265,8 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
for (ResourceUsage usage : new ResourceUsage[] { status.getCpu(), status.getDisk(), status.getMemory() }) {
assertNotNull(usage);
assert usage.getMax() >= 0.0 : status;
if (usage.getUsage() != null) {
assert usage.getUsage() >= 0.0 : status;
}
assert usage.getUsage() >= 0.0 : status;
assertNotNull(usage.getUnit());
}

View File

@ -1 +1 @@
{"response":{"status":{"code":200,"text":"OK"},"server":{"state":"running","cpu":{"usage":null,"max":"1","unit":"cores"},"memory":{"usage":"3","max":"128","unit":"MB"},"disk":{"usage":372,"max":5120,"unit":"MB"},"transfer":{"usage":0,"max":"50","unit":"GB last 30 days"},"uptime":{"current":108,"unit":"seconds"}},"debug":{"input":{"serverid":"vz1596078"}}}}
{"response":{"status":{"code":200,"text":"OK"},"server":{"state":"running","cpu":{"usage":0,"max":1,"unit":"cores"},"memory":{"usage":3,"max":128,"unit":"MB"},"disk":{"usage":371,"max":5120,"unit":"MB"},"transfer":{"usage":0,"max":50,"unit":"GB last 30 days"},"uptime":{"current":23,"unit":"seconds"}},"debug":{"input":{"serverid":"vz1952928"}}}}