Issue 112: corrected status

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2461 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-12-18 07:11:23 +00:00
parent 31321cade6
commit 9253e755bd
4 changed files with 34 additions and 9 deletions

View File

@ -26,19 +26,42 @@ package org.jclouds.vcloud.domain;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Indicates the status of the VApp.
*
* @author Adrian Cole
*/
public enum VAppStatus {
CREATING, TODO_I_DONT_KNOW, OFF, ON;
/**
* The vApp is unresolved (one or more file references are unavailable in the cloud)
*/
UNRESOLVED,
/**
* The vApp is resolved (all file references are available in the cloud) but not deployed
*/
RESOLVED,
/**
* The vApp is deployed and powered off
*/
OFF,
/**
* The vApp is deployed and suspended
*/
SUSPENDED,
/**
* The vApp is deployed and powered on
*/
ON;
public String value() {
switch (this) {
case CREATING:
case UNRESOLVED:
return "0";
case TODO_I_DONT_KNOW:
case RESOLVED:
return "1";
case OFF:
return "2";
case SUSPENDED:
return "3";
case ON:
return "4";
default:
@ -53,11 +76,13 @@ public enum VAppStatus {
public static VAppStatus fromValue(int v) {
switch (v) {
case 0:
return CREATING;
return UNRESOLVED;
case 1:
return TODO_I_DONT_KNOW;
return RESOLVED;
case 2:
return OFF;
case 3:
return SUSPENDED;
case 4:
return ON;
default:

View File

@ -56,7 +56,7 @@ public class HostingDotComVAppHandlerTest extends BaseHandlerTest {
HostingDotComVApp expects = new HostingDotComVAppImpl("188849-33", "188849-33", URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-33"),
VAppStatus.TODO_I_DONT_KNOW, null, ImmutableListMultimap.<String, InetAddress> of(),
VAppStatus.RESOLVED, null, ImmutableListMultimap.<String, InetAddress> of(),
null, null, ImmutableSortedSet.<ResourceAllocation> of(), "root", "meatisyummy");
assertEquals(result, expects);

View File

@ -119,7 +119,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
System.out.printf("%d: instantiating vApp%n", System.currentTimeMillis());
vApp = tmClient.instantiateVAppTemplate(serverName, templateId, vDCId);
assertEquals(vApp.getStatus(), VAppStatus.CREATING);
assertEquals(vApp.getStatus(), VAppStatus.UNRESOLVED);
// in terremark, this should be a no-op, as it should simply return the above task, which is
// already deploying
@ -131,7 +131,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
vApp = tmClient.getVApp(vApp.getId());
assertEquals(vApp.getStatus(), VAppStatus.CREATING);
assertEquals(vApp.getStatus(), VAppStatus.UNRESOLVED);
try {// per docs, this is not supported
tmClient.cancelTask(deployTask.getId());

View File

@ -88,7 +88,7 @@ public class TerremarkVAppHandlerTest extends BaseHandlerTest {
assertEquals(result.getId(), 13775 + "");
assertEquals(result.getName(), "adriantest");
assertEquals(result.getStatus(), VAppStatus.CREATING);
assertEquals(result.getStatus(), VAppStatus.UNRESOLVED);
assertEquals(result.getSize(), new Long(4));