diff --git a/providers/digitalocean2/pom.xml b/providers/digitalocean2/pom.xml index fc81952e26..1a8e495c30 100644 --- a/providers/digitalocean2/pom.xml +++ b/providers/digitalocean2/pom.xml @@ -38,7 +38,7 @@ 2 FIXME FIXME - osFamily=UBUNTU,os64Bit=true,osVersionMatches=14.* + osFamily=UBUNTU,os64Bit=true,osVersionMatches=16.* org.jclouds.digitalocean2*;version="${project.version}" org.jclouds.compute.internal;version="${project.version}", diff --git a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/DigitalOcean2ApiMetadata.java b/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/DigitalOcean2ApiMetadata.java index 9aedaaafc1..4630b52f14 100644 --- a/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/DigitalOcean2ApiMetadata.java +++ b/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/DigitalOcean2ApiMetadata.java @@ -68,7 +68,7 @@ public class DigitalOcean2ApiMetadata extends BaseHttpApiMetadata regions(); public abstract Date createdAt(); + public abstract float minDiskSize(); + public abstract float sizeGBs(); - @SerializedNames({ "id", "name", "type", "distribution", "slug", "public", "regions", "created_at" }) + @SerializedNames({ "id", "name", "type", "distribution", "slug", "public", "regions", "created_at", "min_disk_size", + "size_gigabytes" }) public static Image create(int id, String name, String type, String distribution, String slug, boolean isPublic, - List regions, Date createdAt) { - return new AutoValue_Image(id, name, type, distribution, slug, isPublic, copyOf(regions), createdAt); + List regions, Date createdAt, float minDiskSize, float sizeGBs) { + return new AutoValue_Image(id, name, type, distribution, slug, isPublic, copyOf(regions), createdAt, minDiskSize, + sizeGBs); } Image() {} diff --git a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/DigitalOcean2TemplateBuilderLiveTest.java b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/DigitalOcean2TemplateBuilderLiveTest.java index 698483a883..b7738c06b2 100644 --- a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/DigitalOcean2TemplateBuilderLiveTest.java +++ b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/DigitalOcean2TemplateBuilderLiveTest.java @@ -40,7 +40,7 @@ public class DigitalOcean2TemplateBuilderLiveTest extends BaseTemplateBuilderLiv @Override public void testDefaultTemplateBuilder() throws IOException { Template defaultTemplate = view.getComputeService().templateBuilder().build(); - assert defaultTemplate.getImage().getOperatingSystem().getVersion().startsWith("14.") : defaultTemplate + assert defaultTemplate.getImage().getOperatingSystem().getVersion().startsWith("16.") : defaultTemplate .getImage().getOperatingSystem().getVersion(); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); diff --git a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/DropletToNodeMetadataTest.java b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/DropletToNodeMetadataTest.java index ba6d3de192..93f4bf44a1 100644 --- a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/DropletToNodeMetadataTest.java +++ b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/DropletToNodeMetadataTest.java @@ -79,7 +79,7 @@ public class DropletToNodeMetadataTest { @BeforeMethod public void setup() { image = org.jclouds.digitalocean2.domain.Image.create(1, "14.04 x64", - "distribution", "Ubuntu", "ubuntu-1404-x86", true, ImmutableList.of("sfo1"), new Date()); + "distribution", "Ubuntu", "ubuntu-1404-x86", true, ImmutableList.of("sfo1"), new Date(), 20, 20); region = Region.create("sfo1", "San Francisco 1", ImmutableList.of("2gb"), true, ImmutableList. of()); images = ImmutableSet.of(new ImageBuilder() @@ -146,7 +146,7 @@ public class DropletToNodeMetadataTest { public void testConvertDropletOldImage() throws ParseException { // Use an image id that is not in the list of images org.jclouds.digitalocean2.domain.Image image = org.jclouds.digitalocean2.domain.Image.create(2, "14.04 x64", - "distribution", "Ubuntu", "ubuntu2-1404-x86", true, ImmutableList.of("sfo1"), new Date()); + "distribution", "Ubuntu", "ubuntu2-1404-x86", true, ImmutableList.of("sfo1"), new Date(), 20, 20); Droplet droplet = Droplet.create( 1, diff --git a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/ImageInRegionToImageTest.java b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/ImageInRegionToImageTest.java index f1072d6dab..38b466251d 100644 --- a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/ImageInRegionToImageTest.java +++ b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/compute/functions/ImageInRegionToImageTest.java @@ -75,7 +75,7 @@ public class ImageInRegionToImageTest { @Test public void testConvertImage() { Image image = Image.create(1, "14.04 x64", "distribution", "Ubuntu", "ubuntu-1404-x86", true, - ImmutableList.of("sfo1", "lon1"), new Date()); + ImmutableList.of("sfo1", "lon1"), new Date(), 20, 20); org.jclouds.compute.domain.Image expected = new ImageBuilder() .id("lon1/ubuntu-1404-x86") // Location scoped images have the location encoded in the id .providerId("1") diff --git a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/features/DropletApiLiveTest.java b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/features/DropletApiLiveTest.java index f18a24f30d..62f40f43ab 100644 --- a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/features/DropletApiLiveTest.java +++ b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/features/DropletApiLiveTest.java @@ -57,8 +57,8 @@ public class DropletApiLiveTest extends BaseDigitalOcean2ApiLiveTest { @BeforeClass public void setupDroplet() { region = firstAvailableRegion(); - size = cheapestSizeInRegion(region); image = ubuntuImageInRegion(region); + size = cheapestSizeInRegionForImage(region, image); Map keyPair = SshKeys.generate(); key = api.keyApi().create(prefix + "-droplet-livetest", keyPair.get("public")); diff --git a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/internal/BaseDigitalOcean2ApiLiveTest.java b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/internal/BaseDigitalOcean2ApiLiveTest.java index 722ef971f9..4b7b0ec4d5 100644 --- a/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/internal/BaseDigitalOcean2ApiLiveTest.java +++ b/providers/digitalocean2/src/test/java/org/jclouds/digitalocean2/internal/BaseDigitalOcean2ApiLiveTest.java @@ -104,11 +104,11 @@ public class BaseDigitalOcean2ApiLiveTest extends BaseApiLiveTest() { @Override public boolean apply(Size input) { - return input.available() && input.regions().contains(region.slug()); + return input.available() && input.regions().contains(region.slug()) && input.disk() >= image.minDiskSize(); } })); }