From 84a84f481fc651730f4b2bab45cb5213a2695645 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 1 Apr 2011 11:39:42 -0700 Subject: [PATCH] fixed templates in rimu --- .../miro/RimuHostingClientLiveTest.java | 2 +- .../RimuHostingComputeServiceLiveTest.java | 16 ----------- .../RimuHostingTemplateBuilderLiveTest.java | 27 ++++++++++++++++--- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java index 541034f263..9b429f2bf1 100644 --- a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java +++ b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java @@ -92,7 +92,7 @@ public class RimuHostingClientLiveTest { public void testPricingPlans() { Set plans = connection.getPricingPlanList(); for (PricingPlan plan : plans) { - if (plan.getId().equalsIgnoreCase("miro1")) { + if (plan.getId().equalsIgnoreCase("MIRO4B")) { assertTrue(true); return; } diff --git a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java index 86443924e8..5153fae6cd 100755 --- a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java +++ b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java @@ -19,12 +19,7 @@ package org.jclouds.rimuhosting.miro.compute; -import static org.jclouds.compute.util.ComputeServiceUtils.getCores; -import static org.testng.Assert.assertEquals; - import org.jclouds.compute.BaseComputeServiceLiveTest; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.Template; import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -44,17 +39,6 @@ public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTes group = "rimuhosting.jclouds"; } - @Test - public void testTemplateBuilder() { - Template defaultTemplate = client.templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS"); - assertEquals(defaultTemplate.getHardware().getProviderId(), "MIRO4B"); - assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); - } - @Override protected JschSshClientModule getSshModule() { return new JschSshClientModule(); diff --git a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java index 047f04bd2b..9df2680a27 100644 --- a/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java +++ b/sandbox-providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java @@ -19,11 +19,15 @@ package org.jclouds.rimuhosting.miro.compute; +import static org.jclouds.compute.util.ComputeServiceUtils.getCores; +import static org.testng.Assert.assertEquals; + import java.util.Set; import org.jclouds.compute.BaseTemplateBuilderLiveTest; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamilyVersion64Bit; +import org.jclouds.compute.domain.Template; import org.testng.annotations.Test; import com.google.common.base.Predicate; @@ -46,14 +50,31 @@ public class RimuHostingTemplateBuilderLiveTest extends BaseTemplateBuilderLiveT @Override public boolean apply(OsFamilyVersion64Bit input) { - return input.family != OsFamily.UBUNTU || // - Float.parseFloat(input.version) > 10.04 || // - (!(input.is64Bit) && Float.parseFloat(input.version) < 8.10); + switch (input.family) { + case UBUNTU: + // support for all ubuntu w/empty version and 10.04 & 10.10 + return !(input.version.equals("") || input.version.startsWith("10.")); + case CENTOS: + return !input.version.equals(""); + default: + return true; + } } }; } + @Test + public void testTemplateBuilder() { + Template defaultTemplate = context.getComputeService().templateBuilder().build(); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS"); + assertEquals(defaultTemplate.getHardware().getProviderId(), "MIRO4B"); + assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); + } + @Override protected Set getIso3166Codes() { return ImmutableSet. of("NZ-AUK", "US-TX", "AU-NSW", "GB-LND");