diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java index 24247292ff..c5f6ff2e15 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/EC2TemplateBuilderLiveTest.java @@ -74,6 +74,32 @@ public class EC2TemplateBuilderLiveTest { return overrides; } + @Test + public void testTemplateBuilderM1SMALLWithDescription() { + ComputeServiceContext newContext = null; + try { + newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet + . of(new Log4JLoggingModule()), setupProperties()); + + Template template = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL) + .osVersionMatches("10.04").imageDescriptionMatches("ubuntu-images").osFamily(OsFamily.UBUNTU).build(); + + System.out.println(template.getHardware()); + assert (template.getImage().getProviderId().startsWith("ami-")) : template; + assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04"); + assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); + assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(template.getImage().getVersion(), "20100921"); + assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); + assertEquals(template.getLocation().getId(), "us-east-1"); + assertEquals(getCores(template.getHardware()), 1.0d); + assertEquals(template.getHardware().getId(), InstanceType.M1_SMALL); + } finally { + if (newContext != null) + newContext.close(); + } + } + @Test public void testTemplateBuilderCanUseImageIdAndhardwareId() { ComputeServiceContext newContext = null; diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java index 53842fee08..5c0599b453 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java @@ -320,7 +320,7 @@ public class TemplateBuilderImpl implements TemplateBuilder { public boolean apply(Image input) { boolean returnVal = true; if (imageDescription != null) { - if (input.getName() == null) + if (input.getDescription() == null) returnVal = false; else returnVal = input.getDescription().equals(imageDescription)