@Test public void testImageToImage() { org.jclouds.profitbricks.domain.Image image = org.jclouds.profitbricks.domain.Image.builder() .isBootable(true) .isCpuHotPlug(true) .isCpuHotUnPlug(false) .isDiscVirtioHotPlug(true) .isDiscVirtioHotUnPlug(true) .id("5ad99c9e-9166-11e4-9d74-52540066fee9") .name("Ubuntu-14.04-LTS-server-2015-01-01") .size(2048f) .type(org.jclouds.profitbricks.domain.Image.Type.HDD) .location(US_LAS) .isNicHotPlug(true) .isNicHotUnPlug(true) .osType(OsType.LINUX) .isPublic(true) .isRamHotPlug(true) .isRamHotUnPlug(false) .isWriteable(true) .build(); Image actual = fnImage.apply(image); Image expected = new ImageBuilder() .ids(image.id()) .name(image.name()) .location(location) .status(Image.Status.AVAILABLE) .operatingSystem(OperatingSystem.builder() .description("UBUNTU") .family(OsFamily.UBUNTU) .version("14.04") .is64Bit(false) .build()) .userMetadata(ImmutableMap.of("provisionableType", "image")) .build(); assertEquals(actual, expected); }
@Override public Image apply(Provisionable input) { checkNotNull(input, "Cannot convert null input"); if (input instanceof org.jclouds.profitbricks.domain.Image) return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input); else if (input instanceof Snapshot) return fnSnapshotToImage.apply((Snapshot) input); else throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '" + input.getClass().getCanonicalName() + "'"); }
ProvisionableToImage implements Function<Provisionable, Image> { @Override public Image apply(Provisionable input) { checkNotNull(input, "Cannot convert null input"); if (input instanceof org.jclouds.profitbricks.domain.Image) return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input); else if (input instanceof Snapshot) return fnSnapshotToImage.apply((Snapshot) input); else throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '" + input.getClass().getCanonicalName() + "'"); } }
ProvisionableToImage implements Function<Provisionable, Image> { @Override public Image apply(Provisionable input) { checkNotNull(input, "Cannot convert null input"); if (input instanceof org.jclouds.profitbricks.domain.Image) return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input); else if (input instanceof Snapshot) return fnSnapshotToImage.apply((Snapshot) input); else throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '" + input.getClass().getCanonicalName() + "'"); } @Inject  ProvisionableToImage(@Memoized Supplier<Set<? extends Location>> locations); }
ProvisionableToImage implements Function<Provisionable, Image> { @Override public Image apply(Provisionable input) { checkNotNull(input, "Cannot convert null input"); if (input instanceof org.jclouds.profitbricks.domain.Image) return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input); else if (input instanceof Snapshot) return fnSnapshotToImage.apply((Snapshot) input); else throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '" + input.getClass().getCanonicalName() + "'"); } @Inject  ProvisionableToImage(@Memoized Supplier<Set<? extends Location>> locations); @Override Image apply(Provisionable input); }
ProvisionableToImage implements Function<Provisionable, Image> { @Override public Image apply(Provisionable input) { checkNotNull(input, "Cannot convert null input"); if (input instanceof org.jclouds.profitbricks.domain.Image) return fnImageToImage.apply((org.jclouds.profitbricks.domain.Image) input); else if (input instanceof Snapshot) return fnSnapshotToImage.apply((Snapshot) input); else throw new UnsupportedOperationException("No implementation found for provisionable of concrete type '" + input.getClass().getCanonicalName() + "'"); } @Inject  ProvisionableToImage(@Memoized Supplier<Set<? extends Location>> locations); @Override Image apply(Provisionable input); static final String KEY_PROVISIONABLE_TYPE; }