fixed regressions

This commit is contained in:
Adrian Cole 2011-01-16 22:17:08 -08:00
parent 59d7a46208
commit 99c02b1684
10 changed files with 30 additions and 21 deletions

View File

@ -61,7 +61,7 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
// TODO: move this into the dependent modules // TODO: move this into the dependent modules
String provider = injector.getInstance(Key.get(String.class, Provider.class)); String provider = injector.getInstance(Key.get(String.class, Provider.class));
if ("ec2".equals(provider) || "ec2".equals(provider)) if ("aws-ec2".equals(provider))
return template.osFamily(AMZN_LINUX).os64Bit(true); return template.osFamily(AMZN_LINUX).os64Bit(true);
else if ("nova-ec2".equals(provider)) else if ("nova-ec2".equals(provider))
return super.provideTemplate(injector, template); return super.provideTemplate(injector, template);

View File

@ -89,8 +89,10 @@ public class EC2HardwareSupplier implements Supplier<Set<? extends Hardware>> {
}); });
sizes.add(cc1_4xlarge().location(location).supportsImageIds(ccAmi).build()); sizes.add(cc1_4xlarge().location(location).supportsImageIds(ccAmi).build());
} }
// TODO move logic to dependent module
sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large() sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large()
.build(), !"ec2".equals(providerName) ? m1_small().supportsImage(any()).build() : m1_small().build(), .build(),
!"aws-ec2".equals(providerName) ? m1_small().supportsImage(any()).build() : m1_small().build(),
m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(), m2_4xlarge().build())); m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(), m2_4xlarge().build()));
return sizes; return sizes;
} }

View File

@ -52,14 +52,12 @@ import org.jclouds.elasticstack.predicates.DriveClaimed;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.location.Provider; import org.jclouds.location.Provider;
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -83,9 +81,6 @@ public class ElasticStackComputeServiceContextModule
super.configure(); super.configure();
bind(new TypeLiteral<ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location>>() { bind(new TypeLiteral<ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location>>() {
}).to(ElasticStackComputeServiceAdapter.class); }).to(ElasticStackComputeServiceAdapter.class);
bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE);
bind(new TypeLiteral<Supplier<Location>>() {
}).to(OnlyLocationOrFirstZone.class);
bind(new TypeLiteral<Function<ServerInfo, NodeMetadata>>() { bind(new TypeLiteral<Function<ServerInfo, NodeMetadata>>() {
}).to(ServerInfoToNodeMetadata.class); }).to(ServerInfoToNodeMetadata.class);
bind(new TypeLiteral<Function<Image, Image>>() { bind(new TypeLiteral<Function<Image, Image>>() {

View File

@ -76,7 +76,7 @@ import com.google.inject.Module;
public class ElasticStackClientLiveTest { public class ElasticStackClientLiveTest {
protected long driveSize = 1 * 1024 * 1024 * 1024l; protected long driveSize = 1 * 1024 * 1024 * 1024l;
protected int maxDriveImageTime = 120; protected int maxDriveImageTime = 360;
protected String vncPassword = "Il0veVNC"; protected String vncPassword = "Il0veVNC";
protected ElasticStackClient client; protected ElasticStackClient client;
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context; protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context;

View File

@ -75,7 +75,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false); assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(template.getImage().getVersion(), "20110101"); assertEquals(template.getImage().getVersion(), "20110115");
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(), "us-east-1");
assertEquals(getCores(template.getHardware()), 1.0d); assertEquals(getCores(template.getHardware()), 1.0d);

View File

@ -52,13 +52,11 @@ import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Provides; import com.google.inject.Provides;
@ -78,7 +76,7 @@ public class CloudSigmaComputeServiceContextModule
@Override @Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).osVersionMatches("10.04").os64Bit(true).minRam(1024); return template.osFamily(UBUNTU).osVersionMatches("10.10").os64Bit(true).minRam(1024);
} }
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
@ -87,9 +85,6 @@ public class CloudSigmaComputeServiceContextModule
super.configure(); super.configure();
bind(new TypeLiteral<ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location>>() { bind(new TypeLiteral<ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location>>() {
}).to(CloudSigmaComputeServiceAdapter.class); }).to(CloudSigmaComputeServiceAdapter.class);
bind(IdentityFunction.class).toInstance(IdentityFunction.INSTANCE);
bind(new TypeLiteral<Supplier<Location>>() {
}).to(OnlyLocationOrFirstZone.class);
bind(new TypeLiteral<Function<ServerInfo, NodeMetadata>>() { bind(new TypeLiteral<Function<ServerInfo, NodeMetadata>>() {
}).to(ServerInfoToNodeMetadata.class); }).to(ServerInfoToNodeMetadata.class);
bind(new TypeLiteral<Function<Hardware, Hardware>>() { bind(new TypeLiteral<Function<Hardware, Hardware>>() {

View File

@ -370,7 +370,7 @@ public class CloudSigmaClientLiveTest {
protected void prepareDrive() { protected void prepareDrive() {
client.destroyDrive(drive.getUuid()); client.destroyDrive(drive.getUuid());
drive = client.cloneDrive("0b060e09-d98b-44cc-95a4-7e3a22ba1b53", drive.getName(), drive = client.cloneDrive("6a9cd9c2-4814-4953-8e86-f8ee6a3e57d5", drive.getName(),
new CloneDriveOptions().size(driveSize)); new CloneDriveOptions().size(driveSize));
assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid()); assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid());
System.err.println("after prepare" + client.getDriveInfo(drive.getUuid())); System.err.println("after prepare" + client.getDriveInfo(drive.getUuid()));

View File

@ -19,8 +19,14 @@
package org.jclouds.cloudsigma.compute; package org.jclouds.cloudsigma.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.jclouds.compute.BaseTemplateBuilderLiveTest; import org.jclouds.compute.BaseTemplateBuilderLiveTest;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit; import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -45,7 +51,7 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
return ((input.family == OsFamily.RHEL) || // return ((input.family == OsFamily.RHEL) || //
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || // (input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
(input.family == OsFamily.UBUNTU && !(input.version.matches("10.[01][04]") && input.is64Bit)) || // (input.family == OsFamily.UBUNTU && !(input.version.matches("10.10") && input.is64Bit)) || //
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008 R2") && input.is64Bit) (input.family == OsFamily.WINDOWS && !((input.version.equals("2008 R2") && input.is64Bit)
|| (input.version.equals("2008") && !input.is64Bit) || (input.version.equals("2003")))) // || (input.version.equals("2008") && !input.is64Bit) || (input.version.equals("2003")))) //
); );
@ -53,4 +59,13 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
}; };
} }
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
} }

View File

@ -50,8 +50,8 @@ public class GoGridTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
return ((input.family == OsFamily.RHEL && !input.version.equals("5.4")) || // return ((input.family == OsFamily.RHEL && !input.version.equals("5.4")) || //
(input.family == OsFamily.CENTOS && input.version.matches("5.[54]")) || // (input.family == OsFamily.CENTOS && input.version.matches("5.[542]")) || //
(input.family == OsFamily.CENTOS && input.is64Bit && input.version.equals("5.4")) || // (input.family == OsFamily.CENTOS && input.is64Bit && input.version.equals("5.[42]")) || //
(input.family == OsFamily.UBUNTU) || // (input.family == OsFamily.UBUNTU) || //
(input.family == OsFamily.WINDOWS && input.version.equals("2008 SP2") || // (input.family == OsFamily.WINDOWS && input.version.equals("2008 SP2") || //
(input.family == OsFamily.WINDOWS && input.version.equals("2008 R2")))); (input.family == OsFamily.WINDOWS && input.version.equals("2008 R2"))));

View File

@ -22,6 +22,8 @@ package org.jclouds.skalicloud.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.jclouds.compute.BaseTemplateBuilderLiveTest; import org.jclouds.compute.BaseTemplateBuilderLiveTest;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
@ -57,8 +59,8 @@ public class SkaliCloudMalaysiaTemplateBuilderLiveTest extends BaseTemplateBuild
}; };
} }
@Test @Override
public void testTemplateBuilder() { public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = this.context.getComputeService().templateBuilder().build(); Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10");