Issue 624:update terremark config to use ubuntu 10.04 templates

This commit is contained in:
Adrian Cole 2011-07-12 20:53:06 -07:00
parent f945398068
commit 2506b8c581
2 changed files with 14 additions and 24 deletions

View File

@ -18,8 +18,6 @@
*/
package org.jclouds.vcloud.terremark.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -31,7 +29,6 @@ import org.jclouds.compute.ComputeService;
import org.jclouds.compute.config.BindComputeStrategiesByClass;
import org.jclouds.compute.config.BindComputeSuppliersByClass;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
@ -48,7 +45,6 @@ import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptio
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
@ -72,12 +68,6 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressCom
}
// prefer jeos as the copy time is much shorter
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).osDescriptionMatches(".*JeOS.*").os64Bit(true);
}
@Override
protected void configure() {
super.configure();

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
@ -46,30 +47,29 @@ public class TerremarkVCloudExpressTemplateBuilderLiveTest extends BaseTemplateB
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) {
case RHEL:
return !input.version.equals("") && !input.version.equals("5.0");
return input.version.equals("") || input.version.equals("5.0");
case CENTOS:
return !input.version.equals("") && !input.version.matches("5.0");
return input.version.equals("") || input.version.equals("5.0");
case UBUNTU:
return !input.version.equals("") && !(input.version.equals("9.04") || input.version.equals("9.10"));
return input.version.equals("") || input.version.matches("9.[10][04]") || input.version.equals("10.04");
case WINDOWS:
return !input.version.equals("") && !input.version.equals("2003") //
&& !input.version.equals("2008");
return input.version.equals("") || input.version.equals("2003") || input.version.equals("2008");
default:
return true;
return false;
}
}
};
});
}
@Test
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);