private void checkDiskOffering(DiskOffering offering) { assertTrue(offering.isCustomized()); assertEquals(offering.getDiskSize(), 100); assertTrue(offering.getTags().contains("dummy-tag")); }
private void checkDiskOffering(DiskOffering offering) { assertTrue(offering.isCustomized()); assertEquals(offering.getDiskSize(), 100); assertTrue(offering.getTags().contains("dummy-tag")); }
protected DiskOffering getPreferredDiskOffering() { for (DiskOffering candidate : client.getOfferingApi().listDiskOfferings()) { if (!candidate.isCustomized()) { return candidate; } } throw new AssertionError("No suitable DiskOffering found."); }
public void testListDiskOfferings() throws Exception { Set<DiskOffering> response = client.getOfferingClient().listDiskOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (DiskOffering offering : response) { try { DiskOffering newDetails = Iterables.getOnlyElement(client.getOfferingClient().listDiskOfferings( ListDiskOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingClient().getDiskOffering(offering.getId())); assert offering.getId() != null : offering; assert offering.getName() != null : offering; assert offering.getCreated() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getDiskSize() > 0 || (offering.getDiskSize() == 0 && offering.isCustomized()) : offering; assert offering.getTags() != null : offering; } catch (NoSuchElementException e) { // This bug is present both in 2.2.8 and 2.2.12 assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(apiVersion)); } } }
public void testListDiskOfferings() throws Exception { Set<DiskOffering> response = client.getOfferingApi().listDiskOfferings(); assert null != response; long offeringCount = response.size(); assertTrue(offeringCount >= 0); for (DiskOffering offering : response) { try { DiskOffering newDetails = Iterables.getOnlyElement(client.getOfferingApi().listDiskOfferings( ListDiskOfferingsOptions.Builder.id(offering.getId()))); assertEquals(offering, newDetails); assertEquals(offering, client.getOfferingApi().getDiskOffering(offering.getId())); assert offering.getId() != null : offering; assert offering.getName() != null : offering; assert offering.getCreated() != null : offering; assert offering.getDisplayText() != null : offering; assert offering.getDiskSize() > 0 || (offering.getDiskSize() == 0 && offering.isCustomized()) : offering; assert offering.getTags() != null : offering; } catch (NoSuchElementException e) { // This bug is present both in 2.2.8 and 2.2.12 assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(apiVersion)); } } }
public T fromDiskOffering(DiskOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .domain(in.getDomain()) .domainId(in.getDomainId()) .diskSize(in.getDiskSize()) .customized(in.isCustomized()) .tags(in.getTags()); } }
public T fromDiskOffering(DiskOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .domain(in.getDomain()) .domainId(in.getDomainId()) .diskSize(in.getDiskSize()) .customized(in.isCustomized()) .tags(in.getTags()); } }
public T fromDiskOffering(DiskOffering in) { return this .id(in.getId()) .name(in.getName()) .displayText(in.getDisplayText()) .created(in.getCreated()) .domain(in.getDomain()) .domainId(in.getDomainId()) .diskSize(in.getDiskSize()) .customized(in.isCustomized()) .tags(in.getTags()); } }
/** Test requires a custom disk offering to be available */ public void testCreateVolumeFromCustomDiskOffering() { final int size = 1; DiskOffering offering = null; for (DiskOffering candidate : client.getOfferingClient().listDiskOfferings()) { if (candidate.isCustomized()) { offering = candidate; break; } } assertNotNull("No custom disk offering found!", offering); AsyncCreateResponse job = client.getVolumeClient().createVolumeFromCustomDiskOfferingInZone( prefix + "-jclouds-volume", offering.getId(), zoneId, size); assertTrue(jobComplete.apply(job.getJobId())); logger.info("created volume "+job.getId()); Volume volume = findVolumeWithId(job.getId()); try { checkVolume(volume); assertEquals(volume.getSize(), size * 1024 * 1024 * 1024); } finally { client.getVolumeClient().deleteVolume(volume.getId()); } }
/** Test requires a custom disk offering to be available */ public void testCreateVolumeFromCustomDiskOffering() { final int size = 1; DiskOffering offering = null; for (DiskOffering candidate : client.getOfferingApi().listDiskOfferings()) { if (candidate.isCustomized()) { offering = candidate; break; } } assertNotNull("No custom disk offering found!", offering); AsyncCreateResponse job = client.getVolumeApi().createVolumeFromCustomDiskOfferingInZone( prefix + "-jclouds-volume", offering.getId(), zoneId, size); assertTrue(jobComplete.apply(job.getJobId())); logger.info("created volume " + job.getId()); Volume volume = findVolumeWithId(job.getId()); try { checkVolume(volume); assertEquals(volume.getSize(), size * 1024 * 1024 * 1024); } finally { client.getVolumeApi().deleteVolume(volume.getId()); } }