@Test public void testConvertDropletOldImage() throws ParseException { 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(), 20, 20);
@Test public void testConvertImage() { Image image = Image.create(1, "14.04 x64", "distribution", "Ubuntu", "ubuntu-1404-x86", true, 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") .name("14.04 x64") .description("Ubuntu 14.04 x64") .status(AVAILABLE) .operatingSystem( OperatingSystem.builder().name("Ubuntu").description("Ubuntu 14.04 x64").family(OsFamily.UBUNTU) .version("14.04").arch("x64").is64Bit(true).build()) .location(Iterables.get(locations, 1)) .userMetadata(ImmutableMap.of("publicImage", "true")).build(); org.jclouds.compute.domain.Image result = function.apply(ImageInRegion.create(image, "lon1")); assertEquals(result, expected); assertEquals(result.getDescription(), expected.getDescription()); assertEquals(result.getOperatingSystem(), expected.getOperatingSystem()); assertEquals(result.getStatus(), expected.getStatus()); assertEquals(result.getLocation(), Iterables.get(locations, 1)); } }
@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(), 20, 20); region = Region.create("sfo1", "San Francisco 1", ImmutableList.of("2gb"), true, ImmutableList.<String> of()); images = ImmutableSet.of(new ImageBuilder() .id("sfo1/ubuntu-1404-x86") .providerId("1") .name("mock image") .status(AVAILABLE) .operatingSystem( OperatingSystem.builder().name("Ubuntu 14.04 x86_64").description("Ubuntu").family(OsFamily.UBUNTU) .version("10.04").arch("x86_64").is64Bit(true).build()).build()); hardwares = ImmutableSet.of(new HardwareBuilder().id("2gb").providerId("2gb").name("mock hardware") .processor(new Processor(1.0, 1.0)).ram(2048) .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build()).build()); locations = ImmutableSet.of(new LocationBuilder() .id("sfo1") .description("sfo1/San Francisco 1") .scope(LocationScope.REGION) .parent( new LocationBuilder().id("0").description("mock parent location").scope(LocationScope.PROVIDER) .build()).build()); credentials = LoginCredentials.builder().user("foo").password("bar").build(); function = createNodeParser(hardwares, images, locations, ImmutableMap.of("node#1", (Credentials) credentials)); }