diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java index a5a5b4a9cd..b54e2031c8 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java @@ -138,8 +138,7 @@ public class VirtualBoxComputeServiceContextModule extends bind(new TypeLiteral>>() { }).to((Class) ImagesToYamlImagesFromYamlDescriptor.class); // the yaml config provider - bind(new TypeLiteral>() { - }).to((Class) YamlImagesFromFileConfig.class); + bind(YamlImagesFromFileConfig.class); // the master machines cache bind(new TypeLiteral>() { }).to((Class) MastersLoadingCache.class); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java index 80c5195741..5d0b373c80 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/admin/ImagesToYamlImagesFromYamlDescriptor.java @@ -30,6 +30,7 @@ import javax.inject.Singleton; import org.jclouds.compute.domain.Image; import org.jclouds.virtualbox.domain.YamlImage; +import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig; import org.yaml.snakeyaml.Loader; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; @@ -47,7 +48,7 @@ public class ImagesToYamlImagesFromYamlDescriptor implements Supplier yamlDescriptorSupplier) { + public ImagesToYamlImagesFromYamlDescriptor(/*Supplier yamlDescriptorSupplier*/YamlImagesFromFileConfig yamlDescriptorSupplier) { this.yamlDescriptor = yamlDescriptorSupplier.get(); checkNotNull(yamlDescriptor, "yaml descriptor"); checkState(!yamlDescriptor.equals(""), "yaml descriptor is empty"); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java index 1a4dfb43cd..8998ceb560 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/ImageFromYamlStringTest.java @@ -28,9 +28,9 @@ import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OsFamily; +import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig; import org.testng.annotations.Test; -import com.google.common.base.Supplier; import com.google.common.collect.Iterables; /** @@ -39,29 +39,23 @@ import com.google.common.collect.Iterables; @Test(groups = "unit") public class ImageFromYamlStringTest { - public static final Image TEST1 = new ImageBuilder() - .id("default-ubuntu-11.04-i386") - .name("ubuntu-11.04-server-i386") - .description("ubuntu 11.04 server (i386)") - .operatingSystem( - OperatingSystem.builder().description("ubuntu").family(OsFamily.UBUNTU) - .version("11.04").build()).build(); + public static final Image TEST1 = new ImageBuilder() + .id("default-ubuntu-11.04-i386") + .name("ubuntu-11.04-server-i386") + .description("ubuntu 11.04 server (i386)") + .operatingSystem( + OperatingSystem.builder().description("ubuntu").family(OsFamily.UBUNTU).version("11.04").build()) + .build(); - @Test - public void testNodesParse() throws Exception { + @Test + public void testNodesParse() throws Exception { - final StringBuilder yamlFileLines = new StringBuilder(); - for (Object line : IOUtils.readLines(new InputStreamReader(getClass().getResourceAsStream("/default-images.yaml")))) { - yamlFileLines.append(line).append("\n"); - } - - ImagesToYamlImagesFromYamlDescriptor parser = new ImagesToYamlImagesFromYamlDescriptor(new Supplier() { - - @Override - public String get() { - return yamlFileLines.toString(); + final StringBuilder yamlFileLines = new StringBuilder(); + for (Object line : IOUtils + .readLines(new InputStreamReader(getClass().getResourceAsStream("/default-images.yaml")))) { + yamlFileLines.append(line).append("\n"); } - }); - assertEquals(Iterables.getFirst(parser.get().keySet(), null), TEST1); - } + ImagesToYamlImagesFromYamlDescriptor parser = new ImagesToYamlImagesFromYamlDescriptor(new YamlImagesFromFileConfig("/default-images.yaml")); + assertEquals(Iterables.getFirst(parser.get().keySet(), null), TEST1); + } } \ No newline at end of file