@Test(dependsOnMethods = "testSetNotesOnVirtualGuest") public void testPauseVirtualGuest() throws Exception { virtualGuestApi.pauseVirtualGuest(virtualGuest.getId()); checkState(retry(new Predicate<VirtualGuest>() { public boolean apply(VirtualGuest guest) { guest = api().getVirtualGuest(virtualGuest.getId()); return guest.getPowerState().getKeyName() == VirtualGuest.State.PAUSED; } }, 5 * 60 * 1000).apply(virtualGuest), "%s still not paused!", virtualGuest); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); assertTrue(found.getPowerState().getKeyName() == VirtualGuest.State.PAUSED); }
@Test(dependsOnMethods = "testPauseVirtualGuest") public void testResumeVirtualGuest() throws Exception { virtualGuestApi.resumeVirtualGuest(virtualGuest.getId()); checkState(retry(new Predicate<VirtualGuest>() { public boolean apply(VirtualGuest guest) { guest = api().getVirtualGuest(virtualGuest.getId()); return guest.getPowerState().getKeyName() == VirtualGuest.State.RUNNING; } }, 5 * 60 * 1000).apply(virtualGuest), "%s still not running!", virtualGuest); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); assertTrue(found.getPowerState().getKeyName() == VirtualGuest.State.RUNNING); }
public boolean apply(VirtualGuest guest) { guest = api().getVirtualGuest(virtualGuest.getId()); return guest.getPowerState().getKeyName() == VirtualGuest.State.RUNNING; } }, 5 * 60 * 1000).apply(virtualGuest), "%s still not running!", virtualGuest);
public boolean apply(VirtualGuest guest) { guest = api().getVirtualGuest(virtualGuest.getId()); return guest.getPowerState().getKeyName() == VirtualGuest.State.PAUSED; } }, 5 * 60 * 1000).apply(virtualGuest), "%s still not paused!", virtualGuest);
@Override public NodeMetadata apply(VirtualGuest from) { // convert the result object to a jclouds NodeMetadata NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getId() + ""); builder.name(from.getHostname()); builder.hostname(from.getHostname()); if (from.getDatacenter() != null) builder.location(from(locations.get()).firstMatch( LocationPredicates.idEquals(from.getDatacenter().getId() + "")).orNull()); builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getHostname())); Image image = images.getImage(from); if (image != null) { builder.imageId(image.getId()); builder.operatingSystem(image.getOperatingSystem()); } builder.hardware(hardware.getHardware(from)); builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName())); // These are null for 'bad' guest orders in the HALTED state. if (from.getPrimaryIpAddress() != null) builder.publicAddresses(ImmutableSet.<String> of(from.getPrimaryIpAddress())); if (from.getPrimaryBackendIpAddress() != null) builder.privateAddresses(ImmutableSet.<String> of(from.getPrimaryBackendIpAddress())); return builder.build(); }
@Override public NodeMetadata apply(VirtualGuest from) { // convert the result object to a jclouds NodeMetadata NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getId() + ""); builder.name(from.getHostname()); builder.hostname(from.getHostname()); if (from.getDatacenter() != null) builder.location(from(locations.get()).firstMatch( LocationPredicates.idEquals(from.getDatacenter().getId() + "")).orNull()); builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getHostname())); Image image = images.getImage(from); if (image != null) { builder.imageId(image.getId()); builder.operatingSystem(image.getOperatingSystem()); } builder.hardware(hardware.getHardware(from)); builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName())); // These are null for 'bad' guest orders in the HALTED state. if (from.getPrimaryIpAddress() != null) builder.publicAddresses(ImmutableSet.<String> of(from.getPrimaryIpAddress())); if (from.getPrimaryBackendIpAddress() != null) builder.privateAddresses(ImmutableSet.<String> of(from.getPrimaryBackendIpAddress())); return builder.build(); }
builder.operatingSystem(image.getOperatingSystem()); if (from.getPowerState() != null) { builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName()));
@Override public NodeMetadata apply(VirtualGuest from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getId() + ""); builder.name(from.getHostname()); builder.hostname(from.getHostname()); if (from.getDatacenter() != null) builder.location(from(locations.get()).firstMatch( LocationPredicates.idEquals(from.getDatacenter().getId() + "")).orNull()); builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getHostname())); Image image = new VirtualGuestToImage().apply(from); if (image != null) { builder.imageId(image.getId()); builder.operatingSystem(image.getOperatingSystem()); builder.hardware(new VirtualGuestToHardware().apply(from)); } builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName())); if (from.getPrimaryIpAddress() != null) builder.publicAddresses(ImmutableSet.<String> of(from.getPrimaryIpAddress())); if (from.getPrimaryBackendIpAddress() != null) builder.privateAddresses(ImmutableSet.<String> of(from.getPrimaryBackendIpAddress())); return builder.build(); }
builder.operatingSystem(image.getOperatingSystem()); if (from.getPowerState() != null) { builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName()));
builder.operatingSystem(image.getOperatingSystem()); if (from.getPowerState() != null) { builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName()));
public T fromVirtualGuest(VirtualGuest in) { return this .accountId(in.getAccountId()) .createDate(in.getCreateDate()) .dedicatedAccountHostOnly(in.isDedicatedAccountHostOnly()) .domain(in.getDomain()) .fullyQualifiedDomainName(in.getFullyQualifiedDomainName()) .hostname(in.getHostname()) .id(in.getId()) .lastVerifiedDate(in.getLastVerifiedDate()) .maxCpu(in.getMaxCpu()) .maxCpuUnits(in.getMaxCpuUnits()) .maxMemory(in.getMaxMemory()) .metricPollDate(in.getMetricPollDate()) .modifyDate(in.getModifyDate()) .notes(in.getNotes()) .privateNetworkOnly(in.isPrivateNetworkOnly()) .startCpus(in.getStartCpus()) .statusId(in.getStatusId()) .uuid(in.getUuid()) .primaryBackendIpAddress(in.getPrimaryBackendIpAddress()) .primaryIpAddress(in.getPrimaryIpAddress()) .billingItemId(in.getBillingItemId()) .operatingSystem(in.getOperatingSystem()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()); } }
public T fromVirtualGuest(VirtualGuest in) { return this .accountId(in.getAccountId()) .createDate(in.getCreateDate()) .dedicatedAccountHostOnly(in.isDedicatedAccountHostOnly()) .domain(in.getDomain()) .fullyQualifiedDomainName(in.getFullyQualifiedDomainName()) .hostname(in.getHostname()) .id(in.getId()) .lastVerifiedDate(in.getLastVerifiedDate()) .maxCpu(in.getMaxCpu()) .maxCpuUnits(in.getMaxCpuUnits()) .maxMemory(in.getMaxMemory()) .metricPollDate(in.getMetricPollDate()) .modifyDate(in.getModifyDate()) .notes(in.getNotes()) .privateNetworkOnly(in.isPrivateNetworkOnly()) .startCpus(in.getStartCpus()) .statusId(in.getStatusId()) .uuid(in.getUuid()) .primaryBackendIpAddress(in.getPrimaryBackendIpAddress()) .primaryIpAddress(in.getPrimaryIpAddress()) .billingItemId(in.getBillingItemId()) .operatingSystem(in.getOperatingSystem()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()); } }
.operatingSystemReferenceCode(in.getOperatingSystemReferenceCode()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()) .activeTransactionCount(in.getActiveTransactionCount()) .localDiskFlag(in.isLocalDiskFlag())
.operatingSystemReferenceCode(in.getOperatingSystemReferenceCode()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()) .activeTransactionCount(in.getActiveTransactionCount()) .hourlyBillingFlag(in.isHourlyBillingFlag())
.operatingSystemReferenceCode(in.getOperatingSystemReferenceCode()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()) .activeTransactionCount(in.getActiveTransactionCount()) .hourlyBillingFlag(in.isHourlyBillingFlag())
.operatingSystemReferenceCode(in.getOperatingSystemReferenceCode()) .datacenter(in.getDatacenter()) .powerState(in.getPowerState()) .activeTransactionCount(in.getActiveTransactionCount()) .hourlyBillingFlag(in.isHourlyBillingFlag())