fixed a minor vcloud bug and toString statements

This commit is contained in:
Adrian Cole 2010-05-23 00:26:50 -07:00
parent dbd42ce7ac
commit 5b300f87cc
6 changed files with 17 additions and 9 deletions

View File

@ -29,11 +29,11 @@ public enum NodeState {
*/ */
PENDING, PENDING,
/** /**
* The node is not running * The node is visible, and in the process of being deleted.
*/ */
TERMINATED, TERMINATED,
/** /**
* The node is deployed, but suspended * The node is deployed, but suspended or stopped.
*/ */
SUSPENDED, SUSPENDED,
/** /**

View File

@ -118,7 +118,7 @@ public class ImageImpl extends ComputeMetadataImpl implements Image {
return "[id=" + getId() + ", providerId=" + getProviderId() + ", name=" + getName() return "[id=" + getId() + ", providerId=" + getProviderId() + ", name=" + getName()
+ ", locationId=" + (getLocation() != null ? getLocation().getId() : "null") + ", locationId=" + (getLocation() != null ? getLocation().getId() : "null")
+ ", architecture=" + architecture + ", osDescription=" + osDescription + ", architecture=" + architecture + ", osDescription=" + osDescription
+ ", version=" + version + ", osFamily=" + osFamily + ", version=" + version + "]"; + ", version=" + version + ", osFamily=" + osFamily + "]";
} }
@Override @Override

View File

@ -476,7 +476,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
logger.trace("<< matched images(%s)", matchingImages); logger.trace("<< matched images(%s)", matchingImages);
List<? extends Image> maxImages = Utils.multiMax(DEFAULT_IMAGE_ORDERING, matchingImages); List<? extends Image> maxImages = Utils.multiMax(DEFAULT_IMAGE_ORDERING, matchingImages);
if (logger.isTraceEnabled()) if (logger.isTraceEnabled())
logger.debug("<< best images(%s)", maxImages); logger.trace("<< best images(%s)", maxImages);
return maxImages; return maxImages;
} catch (NoSuchElementException exception) { } catch (NoSuchElementException exception) {
throw new NoSuchElementException("image didn't match: " + toString() + "\n" + images); throw new NoSuchElementException("image didn't match: " + toString() + "\n" + images);

View File

@ -229,6 +229,12 @@ public abstract class BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException") @Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
public void testScriptExecutionAfterBootWithBasicTemplate() throws Exception { public void testScriptExecutionAfterBootWithBasicTemplate() throws Exception {
String tag = this.tag + "run"; String tag = this.tag + "run";
try {
client.destroyNodesMatching(NodePredicates.withTag(tag));
} catch (Exception e) {
}
TemplateOptions options = client.templateOptions().blockOnPort(22, 120); TemplateOptions options = client.templateOptions().blockOnPort(22, 120);
try { try {
Set<? extends NodeMetadata> nodes = client.runNodesWithTag(tag, 1, options); Set<? extends NodeMetadata> nodes = client.runNodesWithTag(tag, 1, options);
@ -374,7 +380,7 @@ public abstract class BaseComputeServiceLiveTest {
// assert nodeMetadata.getImage() != null : node; // assert nodeMetadata.getImage() != null : node;
// user specified name is not always supported // user specified name is not always supported
// assert nodeMetadata.getName() != null : nodeMetadata; // assert nodeMetadata.getName() != null : nodeMetadata;
if (nodeMetadata.getState() != NodeState.TERMINATED) { if (nodeMetadata.getState() == NodeState.RUNNING) {
assert nodeMetadata.getPublicAddresses() != null : nodeMetadata; assert nodeMetadata.getPublicAddresses() != null : nodeMetadata;
assert nodeMetadata.getPublicAddresses().size() > 0 assert nodeMetadata.getPublicAddresses().size() > 0
|| nodeMetadata.getPrivateAddresses().size() > 0 : nodeMetadata; || nodeMetadata.getPrivateAddresses().size() > 0 : nodeMetadata;

View File

@ -85,11 +85,12 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
this.providerName = providerName; this.providerName = providerName;
} }
@Singleton @Singleton
@Provides @Provides
Map<VAppStatus, NodeState> provideVAppStatusToNodeState() { Map<VAppStatus, NodeState> provideVAppStatusToNodeState() {
return ImmutableMap.<VAppStatus, NodeState> builder().put(VAppStatus.OFF, return ImmutableMap.<VAppStatus, NodeState> builder().put(VAppStatus.OFF,
NodeState.TERMINATED).put(VAppStatus.ON, NodeState.RUNNING).put(VAppStatus.RESOLVED, NodeState.SUSPENDED).put(VAppStatus.ON, NodeState.RUNNING).put(VAppStatus.RESOLVED,
NodeState.PENDING).put(VAppStatus.SUSPENDED, NodeState.SUSPENDED).put( NodeState.PENDING).put(VAppStatus.SUSPENDED, NodeState.SUSPENDED).put(
VAppStatus.UNRESOLVED, NodeState.PENDING).build(); VAppStatus.UNRESOLVED, NodeState.PENDING).build();
} }

View File

@ -113,7 +113,7 @@ public class VCloudRestClientModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
protected Predicate<String> successTester(TaskSuccess success) { protected Predicate<String> successTester(TaskSuccess success) {
return new RetryablePredicate<String>(success, 600, 10, TimeUnit.SECONDS); return new RetryablePredicate<String>(success, 60 * 30, 10, TimeUnit.SECONDS);
} }
@Provides @Provides
@ -163,8 +163,9 @@ public class VCloudRestClientModule extends AbstractModule {
try { try {
return login.login().get(180, TimeUnit.SECONDS); return login.login().get(180, TimeUnit.SECONDS);
} catch (Exception e) { } catch (Exception e) {
Throwables.propagateIfPossible(e); Throwables.propagate(e);
throw new RuntimeException("Error logging in", e); assert false;
return null;
} }
} }
}, seconds, TimeUnit.SECONDS); }, seconds, TimeUnit.SECONDS);