updated template builders for current images

This commit is contained in:
Adrian Cole 2011-12-21 03:10:09 -08:00
parent 95753e5695
commit 208c474969
3 changed files with 38 additions and 31 deletions

View File

@ -51,15 +51,17 @@ public class CloudServersUKTemplateBuilderLiveTest extends BaseTemplateBuilderLi
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
return !(input.version.startsWith("12.04") || input.version.startsWith("11.10")) && input.is64Bit; return (input.version.equals("") || input.version.equals("10.04") || input.version.startsWith("11"))
case DEBIAN: && input.is64Bit;
return input.is64Bit && !input.version.matches("[56].0"); case DEBIAN:
case CENTOS: return input.is64Bit && !input.version.matches("[56].0");
return !(input.version.matches("5.[0237]") || input.version.equals("6.0")) && input.is64Bit; case CENTOS:
case WINDOWS: return (input.version.equals("") || input.version.equals("5.6") || input.version.equals("6.0"))
return input.version.equals("2008 SP2") || input.version.equals("") && input.is64Bit;
|| (input.version.equals("2008 R2") && input.is64Bit); case WINDOWS:
return input.version.equals("2008 SP2") || input.version.equals("")
|| (input.version.equals("2008 R2") && input.is64Bit);
default: default:
return false; return false;
} }
@ -72,7 +74,7 @@ public class CloudServersUKTemplateBuilderLiveTest extends BaseTemplateBuilderLi
public void testTemplateBuilder() { public void testTemplateBuilder() {
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(), "11.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), provider); assertEquals(defaultTemplate.getLocation().getId(), provider);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);

View File

@ -51,15 +51,17 @@ public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLi
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
return !(input.version.startsWith("12.04") || input.version.startsWith("11.10")) && input.is64Bit; return (input.version.equals("") || input.version.equals("10.04") || input.version.startsWith("11"))
case DEBIAN: && input.is64Bit;
return input.is64Bit && !input.version.matches("[56].0"); case DEBIAN:
case CENTOS: return input.is64Bit && !input.version.matches("[56].0");
return !(input.version.matches("5.[0237]") || input.version.equals("6.0")) && input.is64Bit; case CENTOS:
case WINDOWS: return (input.version.equals("") || input.version.equals("5.6") || input.version.equals("6.0"))
return input.version.equals("2008 SP2") || input.version.equals("") && input.is64Bit;
|| (input.version.equals("2008 R2") && input.is64Bit); case WINDOWS:
return input.version.equals("2008 SP2") || input.version.equals("")
|| (input.version.equals("2008 R2") && input.is64Bit);
default: default:
return false; return false;
} }
@ -72,7 +74,7 @@ public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLi
public void testTemplateBuilder() { public void testTemplateBuilder() {
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(), "11.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), provider); assertEquals(defaultTemplate.getLocation().getId(), provider);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);

View File

@ -53,18 +53,16 @@ public class SlicehostTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
return !(input.version.startsWith("11.10") || input.version.equals("8.04") || (input.version return (input.version.equals("") || input.version.equals("10.04") || input.version.startsWith("11"))
.equals("11.04") && !input.is64Bit)); && input.is64Bit;
case DEBIAN: case DEBIAN:
return !(input.version.equals("6.0") && !input.is64Bit); return input.is64Bit;
case RHEL:
return input.version.equals("") && input.is64Bit;
case CENTOS: case CENTOS:
return input.version.equals("") || input.version.matches("5.[45]") return (input.version.equals("") || input.version.matches("5.[0456]") || input.version.equals("6.0"))
|| (input.version.matches("5.[06]") && input.is64Bit); && input.is64Bit;
case WINDOWS: case WINDOWS:
return input.version.equals("") || (input.version.equals("2008 SP2") && !input.is64Bit) return input.version.equals("2008 SP2") || input.version.equals("")
|| input.version.equals("") || (input.version.equals("2008 R2") && input.is64Bit); || ((input.version.equals("2003") || input.version.equals("2008 R2")) && input.is64Bit);
default: default:
return false; return false;
} }
@ -73,10 +71,15 @@ public class SlicehostTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
}); });
} }
@Override
public void testFromTemplate() {
// TODO: multiple servers match
}
@Test @Test
public void testDefaultTemplateBuilder() throws IOException { public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build(); Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 0.25d); assertEquals(getCores(defaultTemplate.getHardware()), 0.25d);