mirror of https://github.com/apache/jclouds.git
Improving Server and Archive services, also adjusting equals to match Glesys api spec
This commit is contained in:
parent
92d9ee3ff1
commit
79674bd89b
|
@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
* @author Adam Lowe
|
||||
* @see <a href= "https://customer.glesys.com/api.php?a=doc#archive_details" />
|
||||
*/
|
||||
public class Archive {
|
||||
public class Archive implements Comparable<Archive> {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
@ -82,7 +82,12 @@ public class Archive {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(username, totalSize, freeSize, locked);
|
||||
return Objects.hashCode(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Archive other) {
|
||||
return username.compareTo(other.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,15 +95,8 @@ public class Archive {
|
|||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof Archive) {
|
||||
Archive other = (Archive) obj;
|
||||
return Objects.equal(username, other.username)
|
||||
&& Objects.equal(totalSize, other.totalSize)
|
||||
&& Objects.equal(freeSize, other.freeSize)
|
||||
&& Objects.equal(locked, other.locked);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return obj instanceof Archive
|
||||
&& Objects.equal(username, ((Archive) obj).username);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,12 +61,8 @@ public class ArchiveAllowedArguments {
|
|||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof ArchiveAllowedArguments) {
|
||||
ArchiveAllowedArguments other = (ArchiveAllowedArguments) object;
|
||||
return Objects.equal(archiveSizes, other.archiveSizes);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return object instanceof ArchiveAllowedArguments
|
||||
&& Objects.equal(archiveSizes, ((ArchiveAllowedArguments) object).archiveSizes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* @author Adrian Cole
|
||||
* @see <a href= "https://customer.glesys.com/api.php?a=doc#server_list" />
|
||||
*/
|
||||
public class Server {
|
||||
public class Server implements Comparable<Server> {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
@ -110,17 +110,18 @@ public class Server {
|
|||
return datacenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Server other) {
|
||||
return id.compareTo(other.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof Server) {
|
||||
final Server other = (Server) object;
|
||||
return Objects.equal(datacenter, other.datacenter)
|
||||
&& Objects.equal(hostname, other.hostname)
|
||||
&& Objects.equal(id, other.id)
|
||||
&& Objects.equal(platform, other.platform);
|
||||
return Objects.equal(id, ((Server) object).id);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -128,7 +129,7 @@ public class Server {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(datacenter, hostname, id, platform);
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,8 +82,7 @@ public class ServerConsole {
|
|||
if (object instanceof ServerConsole) {
|
||||
final ServerConsole other = (ServerConsole) object;
|
||||
return Objects.equal(host, other.host)
|
||||
&& Objects.equal(port, other.port)
|
||||
&& Objects.equal(password, other.password);
|
||||
&& Objects.equal(port, other.port);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -91,7 +90,7 @@ public class ServerConsole {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(host, port, password);
|
||||
return Objects.hashCode(host, port);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,18 +82,13 @@ public class ServerCreated {
|
|||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof ServerCreated) {
|
||||
final ServerCreated other = (ServerCreated) object;
|
||||
return Objects.equal(id, other.id)
|
||||
&& Objects.equal(ips, other.ips);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return object instanceof ServerCreated
|
||||
&& Objects.equal(id, ((ServerCreated) object).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id, ips);
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -161,27 +161,4 @@ public class ServerDetails extends Server {
|
|||
hostname, datacenter, platform, description, cpuCores, memory, disk, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(description, cpuCores, disk, memory, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof ServerDetails) {
|
||||
final ServerDetails other = (ServerDetails) object;
|
||||
return super.equals(other)
|
||||
&& Objects.equal(description, other.description)
|
||||
&& Objects.equal(cpuCores, other.cpuCores)
|
||||
&& Objects.equal(disk, other.disk)
|
||||
&& Objects.equal(memory, other.memory)
|
||||
&& Objects.equal(cost, other.cost);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,9 +115,6 @@ public class ServerTemplate {
|
|||
if (object instanceof ServerTemplate) {
|
||||
final ServerTemplate other = (ServerTemplate) object;
|
||||
return Objects.equal(name, other.name)
|
||||
&& Objects.equal(minDiskSize, other.minDiskSize)
|
||||
&& Objects.equal(minMemSize, other.minMemSize)
|
||||
&& Objects.equal(os, other.os)
|
||||
&& Objects.equal(platform, other.platform);
|
||||
} else {
|
||||
return false;
|
||||
|
@ -126,7 +123,7 @@ public class ServerTemplate {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, minDiskSize, minMemSize, os, platform);
|
||||
return Objects.hashCode(name, platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface ArchiveAsyncClient {
|
|||
/**
|
||||
* @see ArchiveClient#listArchives
|
||||
*/
|
||||
@GET
|
||||
@POST
|
||||
@Path("/archive/list/format/json")
|
||||
@SelectJson("archives")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
|
@ -57,7 +57,7 @@ public interface ArchiveAsyncClient {
|
|||
/**
|
||||
* @see ArchiveClient#archiveDetails
|
||||
*/
|
||||
@GET
|
||||
@POST
|
||||
@Path("/archive/details/format/json")
|
||||
@SelectJson("details")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface ServerAsyncClient {
|
|||
/**
|
||||
* @see ServerClient#listServers
|
||||
*/
|
||||
@GET
|
||||
@POST
|
||||
@Path("/server/list/format/json")
|
||||
@SelectJson("servers")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
|
@ -56,43 +56,43 @@ public interface ServerAsyncClient {
|
|||
/**
|
||||
* @see ServerClient#getServerDetails
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/details/serverid/{id}/format/json")
|
||||
@POST
|
||||
@Path("/server/details/format/json")
|
||||
@SelectJson("server")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ServerDetails> getServerDetails(@PathParam("id") String id);
|
||||
ListenableFuture<ServerDetails> getServerDetails(@FormParam("serverid") String id);
|
||||
|
||||
/**
|
||||
* @see ServerClient#getServerStatus
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/status/serverid/{id}/format/json")
|
||||
@POST
|
||||
@Path("/server/status/format/json")
|
||||
@SelectJson("server")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ServerStatus> getServerStatus(@PathParam("id") String id);
|
||||
ListenableFuture<ServerStatus> getServerStatus(@FormParam("serverid") String id);
|
||||
|
||||
/**
|
||||
* @see ServerClient#getServerLimits
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/limits/serverid/{id}/format/json")
|
||||
@POST
|
||||
@Path("/server/limits/format/json")
|
||||
@SelectJson("limits")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<SortedMap<String, ServerLimit>> getServerLimits(@PathParam("id") String id);
|
||||
ListenableFuture<SortedMap<String, ServerLimit>> getServerLimits(@FormParam("serverid") String id);
|
||||
|
||||
|
||||
/**
|
||||
* @see ServerClient#getServerConsole
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/console/serverid/{id}/format/json")
|
||||
@POST
|
||||
@Path("/server/console/format/json")
|
||||
@SelectJson("server")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<ServerConsole> getServerConsole(@PathParam("id") String id);
|
||||
ListenableFuture<ServerConsole> getServerConsole(@FormParam("serverid") String id);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -116,30 +116,30 @@ public interface ServerAsyncClient {
|
|||
/**
|
||||
* @see ServerClient#stopServer
|
||||
*/
|
||||
@GET
|
||||
@POST
|
||||
@Path("/server/resetlimit/serverid/{id}/type/{type}/format/json")
|
||||
ListenableFuture<Void> resetServerLimit(@PathParam("id") String id, @PathParam("type") String type);
|
||||
ListenableFuture<Void> resetServerLimit(@FormParam("id") String id, @FormParam("type") String type);
|
||||
|
||||
/**
|
||||
* @see ServerClient#rebootServer
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/reboot/serverid/{id}/format/json")
|
||||
ListenableFuture<Void> rebootServer(@PathParam("id") String id);
|
||||
@POST
|
||||
@Path("/server/reboot/format/json")
|
||||
ListenableFuture<Void> rebootServer(@FormParam("id") String id);
|
||||
|
||||
/**
|
||||
* @see ServerClient#startServer
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/start/serverid/{id}/format/json")
|
||||
ListenableFuture<Void> startServer(@PathParam("id") String id);
|
||||
@POST
|
||||
@Path("/server/start/format/json")
|
||||
ListenableFuture<Void> startServer(@FormParam("id") String id);
|
||||
|
||||
/**
|
||||
* @see ServerClient#stopServer
|
||||
*/
|
||||
@GET
|
||||
@Path("/server/stop/serverid/{id}/format/json")
|
||||
ListenableFuture<Void> stopServer(@PathParam("id") String id);
|
||||
@POST
|
||||
@Path("/server/stop/format/json")
|
||||
ListenableFuture<Void> stopServer(@FormParam("id") String id);
|
||||
|
||||
/**
|
||||
* @see ServerClient#createServer
|
||||
|
|
|
@ -56,11 +56,13 @@ public class ArchiveClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
}, 30, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@AfterGroups(alwaysRun = true, groups={"live"})
|
||||
public void teardownClient() {
|
||||
@AfterGroups(groups={"live"})
|
||||
public void tearDown() {
|
||||
int before = client.listArchives().size();
|
||||
client.deleteArchive(archiveUser);
|
||||
assertTrue(archiveCounter.apply(before - 1));
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private ArchiveClient client;
|
||||
|
|
|
@ -18,57 +18,108 @@
|
|||
*/
|
||||
package org.jclouds.glesys.features;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code ServerAsyncClient}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
@Test(groups = "unit", testName = "ServerAsyncClientTest")
|
||||
public class ServerAsyncClientTest extends BaseGleSYSAsyncClientTest<ServerAsyncClient> {
|
||||
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = ServerAsyncClient.class.getMethod("listServers");
|
||||
public void testListServers() throws Exception {
|
||||
testVoidArgsMethod("listServers", "list", "POST", ReturnEmptySetOnNotFoundOr404.class);
|
||||
}
|
||||
|
||||
public void testGetAllowedArguments() throws Exception {
|
||||
testVoidArgsMethod("getServerAllowedArguments", "allowedarguments", "GET", MapHttp4xxCodesToExceptions.class);
|
||||
}
|
||||
|
||||
public void testGetTemplates() throws Exception {
|
||||
testVoidArgsMethod("getTemplates", "templates", "GET", MapHttp4xxCodesToExceptions.class);
|
||||
}
|
||||
|
||||
public void testGetServer() throws Exception {
|
||||
testServerMethod("getServerDetails", "details");
|
||||
}
|
||||
|
||||
public void testGetgetServerStatus() throws Exception {
|
||||
testServerMethod("getServerStatus", "status");
|
||||
}
|
||||
|
||||
public void testGetServerLimits() throws Exception {
|
||||
testServerMethod("getServerLimits", "limits");
|
||||
}
|
||||
|
||||
public void testGetServerConsole() throws Exception {
|
||||
testServerMethod("getServerConsole", "console");
|
||||
}
|
||||
|
||||
public void testStartServer() throws Exception {
|
||||
testServerMethodVoidReturn("startServer", "start");
|
||||
}
|
||||
|
||||
public void testStopServer() throws Exception {
|
||||
testServerMethodVoidReturn("stopServer", "stop");
|
||||
}
|
||||
|
||||
public void testRebootServer() throws Exception {
|
||||
testServerMethodVoidReturn("rebootServer", "reboot");
|
||||
}
|
||||
|
||||
protected void testVoidArgsMethod(String localMethod, String remoteCall, String httpMethod, Class exceptionParser) throws Exception {
|
||||
Method method = ServerAsyncClient.class.getMethod(localMethod);
|
||||
HttpRequest httpRequest = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.glesys.com/server/list/format/json HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, httpMethod + " https://api.glesys.com/server/" + remoteCall + "/format/json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
|
||||
assertExceptionParserClassEquals(method, exceptionParser);
|
||||
|
||||
checkFilters(httpRequest);
|
||||
|
||||
}
|
||||
|
||||
public void testGetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = ServerAsyncClient.class.getMethod("getServerDetails", String.class);
|
||||
protected void testServerMethod(String localMethod, String remoteMethod) throws Exception {
|
||||
testServerMethod(localMethod, remoteMethod, "serverid", true);
|
||||
}
|
||||
|
||||
protected void testServerMethodVoidReturn(String localMethod, String remoteMethod) throws Exception {
|
||||
testServerMethod(localMethod, remoteMethod, "id", false);
|
||||
}
|
||||
|
||||
protected void testServerMethod(String localMethod, String remoteMethod, String serverIdField, boolean acceptHeader) throws Exception {
|
||||
Method method = ServerAsyncClient.class.getMethod(localMethod, String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "abcd");
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET https://api.glesys.com/server/details/serverid/abcd/format/json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
"POST https://api.glesys.com/server/" + remoteMethod + "/format/json HTTP/1.1");
|
||||
|
||||
if (acceptHeader) {
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||
}
|
||||
|
||||
assertPayloadEquals(httpRequest, serverIdField + "=abcd", "application/x-www-form-urlencoded", false);
|
||||
|
||||
assertSaxResponseParserClassEquals(method, null);
|
||||
|
||||
checkFilters(httpRequest);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,11 +20,14 @@ package org.jclouds.glesys.features;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import org.jclouds.glesys.domain.*;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
|
@ -39,7 +42,29 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
@BeforeGroups(groups = {"live"})
|
||||
public void setupClient() {
|
||||
super.setupClient();
|
||||
|
||||
client = context.getApi().getServerClient();
|
||||
|
||||
runningServerCounter = new RetryablePredicate<Integer>(
|
||||
new Predicate<Integer>() {
|
||||
public boolean apply(Integer value){
|
||||
int count = 0;
|
||||
for(Server server : client.listServers()) {
|
||||
ServerStatus status = client.getServerStatus(server.getId());
|
||||
if (status.getState() == ServerState.RUNNING &&
|
||||
status.getUptime() > 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count == value;
|
||||
}
|
||||
}, 120, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@AfterGroups(groups = {"live"})
|
||||
public void tearDown() {
|
||||
client.destroyServer(testServer.getId(), 0);
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public static class ServerStatePredicate implements Predicate<ServerClient> {
|
||||
|
@ -56,6 +81,21 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
}
|
||||
|
||||
private ServerClient client;
|
||||
private ServerCreated testServer;
|
||||
private RetryablePredicate<Integer> runningServerCounter;
|
||||
|
||||
@Test
|
||||
public void testCreateServer() throws Exception {
|
||||
int before = client.listServers().size();
|
||||
|
||||
testServer = client.createServer("Falkenberg", "OpenVZ", "jclouds-test", "Ubuntu 10.04 LTS 32-bit", 5, 512, 1, "password", 50, null, null);
|
||||
|
||||
assertNotNull(testServer.getId());
|
||||
assertNotNull(testServer.getHostname());
|
||||
assertFalse(testServer.getIps().isEmpty());
|
||||
|
||||
assertTrue(runningServerCounter.apply(before + 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllowedArguments() throws Exception {
|
||||
|
@ -106,11 +146,12 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
assert t.getMinMemSize() > 0 : t;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(dependsOnMethods = "testCreateServer")
|
||||
public void testListServers() throws Exception {
|
||||
Set<Server> response = client.listServers();
|
||||
assert null != response;
|
||||
assertTrue(response.size() >= 0);
|
||||
assertNotNull(response);
|
||||
assertTrue(response.size() > 0);
|
||||
|
||||
for (Server server : response) {
|
||||
ServerDetails newDetails = client.getServerDetails(server.getId());
|
||||
assertEquals(newDetails.getId(), server.getId());
|
||||
|
@ -118,9 +159,39 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
assertEquals(newDetails.getPlatform(), server.getPlatform());
|
||||
assertEquals(newDetails.getDatacenter(), server.getDatacenter());
|
||||
checkServer(newDetails);
|
||||
ServerStatus newStatus = client.getServerStatus(server.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateServer")
|
||||
public void testServerDetails() throws Exception {
|
||||
ServerStatus newStatus = client.getServerStatus(testServer.getId());
|
||||
checkStatus(newStatus);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateServer")
|
||||
public void testServerLimits() throws Exception {
|
||||
Map<String, ServerLimit> limits = client.getServerLimits(testServer.getId());
|
||||
assertNotNull(limits);
|
||||
for(Map.Entry<String,ServerLimit> entry : limits.entrySet()) {
|
||||
assertNotNull(entry.getKey());
|
||||
assertNotNull(entry.getValue());
|
||||
ServerLimit limit = entry.getValue();
|
||||
assertTrue(limit.getBarrier() >= 0);
|
||||
assertTrue(limit.getFailCount() == 0);
|
||||
assertTrue(limit.getHeld() >= 0);
|
||||
assertTrue(limit.getLimit() > 0);
|
||||
assertTrue(limit.getMaxHeld() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO in progress
|
||||
@Test(enabled=false, dependsOnMethods = "testCreateServer")
|
||||
public void testServerConsole() throws Exception {
|
||||
ServerConsole console = client.getServerConsole(testServer.getId());
|
||||
assertNotNull(console);
|
||||
assertNotNull(console.getHost());
|
||||
assertTrue(console.getPort() > 0 && console.getPort() < 65537);
|
||||
assertNotNull(console.getPassword());
|
||||
}
|
||||
|
||||
private void checkServer(ServerDetails server) {
|
||||
|
@ -143,7 +214,9 @@ public class ServerClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
assertNotNull(status.getCpu());
|
||||
assert status.getCpu().getSystem() >= 0.0 : status;
|
||||
assert status.getCpu().getUser() >= 0.0 : status;
|
||||
if (status.getCpu().getNice() != null) {
|
||||
assert status.getCpu().getNice() >= 0.0 : status;
|
||||
}
|
||||
assert status.getCpu().getIdle() >= 0.0 : status;
|
||||
assertNotNull(status.getCpu().getUnit());
|
||||
|
||||
|
|
Loading…
Reference in New Issue