BrooklynImageChooser implements Cloneable { public Function<Iterable<? extends Image>,Image> chooser() { return imageChooserFromOrdering(ordering()); }  List<String> blackListedImageIds(); List<String> whilelistedImageIds(); double score(Image img); @Override BrooklynImageChooser clone(); BrooklynImageChooser cloneFor(ComputeService service); BrooklynImageChooser cloneFor(ConfigBag config); Ordering<Image> orderingScoredWithoutDefaults(); static Ordering<Image> orderingWithDefaults(final Ordering<Image> primaryOrdering); static Function<Iterable<? extends Image>, Image> imageChooserFromOrdering(final Ordering<Image> ordering); static Function<Iterable<? extends Image>, Image> imageChooserFromOrderings(Iterable<? extends Ordering<? super Image>> orderings); static T cloneFor(T item, ComputeService service, ConfigBag config); @SuppressWarnings("unchecked") static T cloneFor(T item, ComputeService service); @SuppressWarnings("unchecked") static T cloneFor(T item, ConfigBag service); Ordering<Image> ordering(); Function<Iterable<? extends Image>,Image> chooser(); @Override String toString();  }
@Test public void testPrefersAzureVanillaCentos() { Image img1 = new ImageBuilder() .id("northeurope/OpenLogic/CentOS/7.6") .providerId("OpenLogic") .name("CentOS") .description("7.6") .version("7.6") .status(Status.AVAILABLE) .operatingSystem(OperatingSystem.builder() .family(OsFamily.CENTOS) .version("7.6") .description("7.6") .is64Bit(true) .build()) .build(); Image img2 = new ImageBuilder() .id("northeurope/OpenLogic/CentOS-SRIOV/7.3-SRIOV") .providerId("OpenLogic") .name("CentOS-SRIOV") .description("7.3-SRIOV") .version("7.3-SRIOV") .status(Status.AVAILABLE) .operatingSystem(OperatingSystem.builder() .family(OsFamily.CENTOS) .version("7.3-SRIOV") .description("7.3-SRIOV") .is64Bit(true) .build()) .build(); Function<Iterable<? extends Image>, Image> func = brooklynImageChooser.chooser(); Image choice = func.apply(ImmutableList.of(img1, img2)); Assert.assertEquals(choice, img1); }