Merge pull request #345 from andreisavu/less-regions

Changed testTemplateBuilderWithLessRegions to query eu-west-1
This commit is contained in:
Adrian Cole 2012-02-02 08:25:53 -08:00
commit d4fb6bb802
1 changed files with 23 additions and 21 deletions

View File

@ -18,16 +18,11 @@
*/ */
package org.jclouds.aws.ec2.compute; package org.jclouds.aws.ec2.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import com.google.common.base.Predicate;
import static org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService.getJavaMethodForRequestAtIndex; import com.google.common.base.Predicates;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; import com.google.common.collect.ImmutableSet;
import static org.testng.Assert.assertEquals; import com.google.common.collect.Lists;
import com.google.inject.Module;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.reference.AWSEC2Constants; import org.jclouds.aws.ec2.reference.AWSEC2Constants;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
@ -45,14 +40,18 @@ import org.jclouds.ec2.reference.EC2Constants;
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient; import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
import org.jclouds.http.HttpCommand; import org.jclouds.http.HttpCommand;
import org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService; import org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService;
import org.jclouds.location.reference.LocationConstants;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import java.io.IOException;
import com.google.common.base.Predicates; import java.util.List;
import com.google.common.collect.ImmutableSet; import java.util.Properties;
import com.google.common.collect.Lists; import java.util.Set;
import com.google.inject.Module;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService.getJavaMethodForRequestAtIndex;
import static org.testng.Assert.assertEquals;
/** /**
* *
@ -314,7 +313,10 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
try { try {
Properties overrides = setupProperties(); Properties overrides = setupProperties();
// set regions to only 1 // set regions to only 1
overrides.setProperty(PROPERTY_REGIONS, Region.US_EAST_1); overrides.setProperty(LocationConstants.PROPERTY_REGIONS, Region.EU_WEST_1);
overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_CC_REGIONS, "");
overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY, "");
overrides.setProperty(AWSEC2Constants.PROPERTY_EC2_CC_AMI_QUERY, "");
final List<HttpCommand> commandsInvoked = Lists.newArrayList(); final List<HttpCommand> commandsInvoked = Lists.newArrayList();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of( context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(
@ -325,14 +327,14 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assert context.getComputeService().listImages().size() < this.context.getComputeService().listImages().size(); assert context.getComputeService().listImages().size() < this.context.getComputeService().listImages().size();
Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build(); Template template = context.getComputeService().templateBuilder().imageId("eu-west-1/ami-a33b06d7").build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert (template.getImage().getProviderId().startsWith("ami-")) : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "2011.09.2");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
assertEquals(template.getImage().getVersion(), "4.4.10"); assertEquals(template.getImage().getVersion(), "2011.09.2");
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(template.getLocation().getId(), "us-east-1"); assertEquals(template.getLocation().getId(), "eu-west-1");
assertEquals(getCores(template.getHardware()), 2.0d); assertEquals(getCores(template.getHardware()), 2.0d);
assertEquals(template.getHardware().getId(), "m1.large"); // because it assertEquals(template.getHardware().getId(), "m1.large"); // because it
// is 64bit // is 64bit