Issue 564:parse debian images

This commit is contained in:
Adrian Cole 2011-05-30 17:08:10 -07:00
parent be2009b267
commit fca0e3d093
27 changed files with 256 additions and 223 deletions

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,24 +46,26 @@ public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("11.04") || input.version.equals("8.04") || !input.is64Bit; return !(input.version.equals("11.04") || input.version.equals("8.04")) && input.is64Bit;
case DEBIAN:
return !(input.version.equals("6.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return input.version.matches("5.[023]") || !input.is64Bit; return !(input.version.matches("5.[023]") || input.version.equals("8.04")) && input.is64Bit;
case WINDOWS: case WINDOWS:
return input.version.equals("2008") || input.version.indexOf("2003") != -1 return input.version.equals("2008 SP2") || input.version.equals("")
|| (input.version.equals("2008 R2") && !input.is64Bit); || (input.version.equals("2008 R2") && input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -57,7 +57,7 @@ public interface ComputeServiceConstants {
public static class ReferenceData { public static class ReferenceData {
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_OS_VERSION_MAP_JSON) @Named(PROPERTY_OS_VERSION_MAP_JSON)
public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\"},\"windows\":{\"\":\"\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}"; public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"debian\":{\"\":\"\",\"lenny\":\"5.0\",\"squeeze\":\"6.0\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"10.04.1\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\"},\"windows\":{\"\":\"\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}";
} }
@Singleton @Singleton

View File

@ -39,6 +39,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.Module; import com.google.inject.Module;
@ -55,23 +56,25 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
return false;
case CENTOS:
return !(input.version.matches("5.[42]") || input.version.equals(""));
case WINDOWS:
return !(input.version.matches("200[38]") || input.version.equals(""));
default:
return true; return true;
case DEBIAN:
return true;
case CENTOS:
return input.version.matches("5.[42]") || input.version.equals("");
case WINDOWS:
return input.version.matches("200[38]") || input.version.equals("");
default:
return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -52,7 +52,7 @@ public class BluelockVCloudDirectorTemplateBuilderLiveTest extends BaseTemplateB
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
return !input.version.equals(""); return !input.version.equals("") || !input.is64Bit;
default: default:
return true; return true;
} }

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,25 +46,26 @@ public class CloudServersUKTemplateBuilderLiveTest extends BaseTemplateBuilderLi
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("11.04") || input.version.equals("8.04") || !input.is64Bit; return !(input.version.equals("11.04") || input.version.equals("8.04")) && input.is64Bit;
case DEBIAN:
return !(input.version.equals("6.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return input.version.matches("5.[023]") || !input.is64Bit; return (input.version.equals("") || input.version.matches("5.[45]")) && input.is64Bit;
case WINDOWS: case WINDOWS:
return input.version.equals("2008") || input.version.equals("2008 R1") return input.version.equals("2008 SP2") || input.version.equals("")
|| input.version.indexOf("2003") != -1 || (input.version.equals("2008 R2") && input.is64Bit);
|| (input.version.equals("2008 R2") && !input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,25 +46,26 @@ public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLi
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("11.04") || input.version.equals("8.04") || !input.is64Bit; return !(input.version.equals("11.04") || input.version.equals("8.04")) && input.is64Bit;
case DEBIAN:
return !(input.version.equals("6.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return input.version.matches("5.[023]") || !input.is64Bit; return !(input.version.matches("5.[023]")) && input.is64Bit;
case WINDOWS: case WINDOWS:
return input.version.equals("2008") || input.version.equals("2008 R1") return input.version.equals("2008 SP2") || input.version.equals("")
|| input.version.indexOf("2003") != -1 || (input.version.equals("2008 R2") && input.is64Bit);
|| (input.version.equals("2008 R2") && !input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -23,13 +23,16 @@ import static com.google.common.base.Predicates.containsPattern;
import static com.google.common.base.Predicates.not; import static com.google.common.base.Predicates.not;
import static com.google.common.base.Predicates.or; import static com.google.common.base.Predicates.or;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit; import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.util.ComputeServiceUtils;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -42,6 +45,12 @@ import com.google.common.base.Function;
*/ */
@Singleton @Singleton
public class ParseOsFamilyVersion64BitFromImageName implements Function<String, OsFamilyVersion64Bit> { public class ParseOsFamilyVersion64BitFromImageName implements Function<String, OsFamilyVersion64Bit> {
private final Map<OsFamily, Map<String, String>> osVersionMap;
@Inject
public ParseOsFamilyVersion64BitFromImageName(Map<OsFamily, Map<String, String>> osVersionMap) {
this.osVersionMap = osVersionMap;
}
// ex CentOS 5.5 Linux 64bit Preinstalled System with AppFirst Monitoring // ex CentOS 5.5 Linux 64bit Preinstalled System with AppFirst Monitoring
public static final Pattern PATTERN = Pattern.compile("([^ ]+)[^0-9]([0-9.]+) .*"); public static final Pattern PATTERN = Pattern.compile("([^ ]+)[^0-9]([0-9.]+) .*");
@ -49,7 +58,7 @@ public class ParseOsFamilyVersion64BitFromImageName implements Function<String,
@Override @Override
public OsFamilyVersion64Bit apply(String input) { public OsFamilyVersion64Bit apply(String input) {
boolean is64Bit = and(not(containsPattern("32bit")), boolean is64Bit = and(not(containsPattern("32bit")),
or(containsPattern("64bit"), not(containsPattern("Windows")))).apply(input); or(containsPattern("64bit"), not(containsPattern("Windows")))).apply(input);
if (input.contains("Windows")) { if (input.contains("Windows")) {
String version = null; String version = null;
Matcher matcher = Pattern.compile(".*(20[01][0-9] R[1-9]).*").matcher(input); Matcher matcher = Pattern.compile(".*(20[01][0-9] R[1-9]).*").matcher(input);
@ -60,18 +69,17 @@ public class ParseOsFamilyVersion64BitFromImageName implements Function<String,
if (matcher.find()) if (matcher.find())
version = matcher.group(1); version = matcher.group(1);
} }
return new OsFamilyVersion64Bit(OsFamily.WINDOWS, version, is64Bit); return new OsFamilyVersion64Bit(OsFamily.WINDOWS, osVersionMap.get(OsFamily.WINDOWS).get(version), is64Bit);
} else { } else {
Matcher matcher = PATTERN.matcher(input); Matcher matcher = PATTERN.matcher(input);
if (matcher.find()) { if (matcher.find()) {
OsFamily fam = OsFamily.fromValue(matcher.group(1).toLowerCase()); OsFamily fam = OsFamily.fromValue(matcher.group(1).toLowerCase());
String version = matcher.group(2);
switch (fam) { switch (fam) {
case UNRECOGNIZED: case UNRECOGNIZED:
return new OsFamilyVersion64Bit(OsFamily.UNRECOGNIZED, null, is64Bit); return new OsFamilyVersion64Bit(OsFamily.UNRECOGNIZED, null, is64Bit);
case WINDOWS:
} }
return new OsFamilyVersion64Bit(fam, version, is64Bit); return new OsFamilyVersion64Bit(fam, ComputeServiceUtils.parseVersionOrReturnEmptyString(fam, matcher
.group(2), osVersionMap), is64Bit);
} else { } else {
return new OsFamilyVersion64Bit(OsFamily.UNRECOGNIZED, null, is64Bit); return new OsFamilyVersion64Bit(OsFamily.UNRECOGNIZED, null, is64Bit);
} }

View File

@ -24,8 +24,9 @@ import javax.inject.Singleton;
import org.jclouds.cloudsigma.domain.DriveInfo; import org.jclouds.cloudsigma.domain.DriveInfo;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamilyVersion64Bit; import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.OperatingSystem.Builder;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
@ -53,7 +54,7 @@ public class PreinstalledDiskToImage implements Function<DriveInfo, Image> {
if (drive.getName() == null) if (drive.getName() == null)
return null; return null;
String description = drive.getDescription() != null ? drive.getDescription() : drive.getName(); String description = drive.getDescription() != null ? drive.getDescription() : drive.getName();
OperatingSystemBuilder builder = new OperatingSystemBuilder(); Builder builder = OperatingSystem.builder();
OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName()); OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName());
builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version).family( builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version).family(
parsed.family); parsed.family);

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,25 +47,27 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && !(input.version.equals("10.10") && input.is64Bit); return (input.version.equals("") || input.version.equals("10.04"))
|| !(input.version.matches("^[89].*")) && input.is64Bit;
case DEBIAN:
return input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.matches("5.[05]")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !((input.version.equals("2008 R2") && input.is64Bit) return (input.version.equals("2008 R2") && input.is64Bit)
|| (input.version.equals("2008") && !input.is64Bit) || input.version.equals("") || (input.version || (input.version.equals("2008") && !input.is64Bit) || input.version.equals("")
.equals("2003"))); || (input.version.equals("2003"));
default: default:
return true; return false;
} }
} }
}; });
} }
@Override @Override

View File

@ -28,8 +28,11 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.jclouds.cloudsigma.compute.functions.ParseOsFamilyVersion64BitFromImageName; import org.jclouds.cloudsigma.compute.functions.ParseOsFamilyVersion64BitFromImageName;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.OsFamilyVersion64Bit; import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule;
import org.jclouds.json.internal.GsonWrapper; import org.jclouds.json.internal.GsonWrapper;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
@ -37,6 +40,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.inject.Guice;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
/** /**
@ -65,7 +69,9 @@ public class ParseOsFamilyVersion64BitFromImageNameTest {
})).toArray(new Object[][] {}); })).toArray(new Object[][] {});
} }
ParseOsFamilyVersion64BitFromImageName parser = new ParseOsFamilyVersion64BitFromImageName(); ParseOsFamilyVersion64BitFromImageName parser = new ParseOsFamilyVersion64BitFromImageName(new BaseComputeServiceContextModule() {
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
.getInstance(Json.class)));
@Test(dataProvider = "data") @Test(dataProvider = "data")
public void test(String input, OsFamilyVersion64Bit expected) { public void test(String input, OsFamilyVersion64Bit expected) {

View File

@ -1,5 +1,11 @@
{ {
"Ubuntu 10.04.1 LTS Desktop Edition 32bit Preinstalled System": {
"family": "UBUNTU",
"version": "10.04",
"is64Bit": false
},
"Ubuntu 10.04 Server Edition Linux 64bit with Plesk": { "Ubuntu 10.04 Server Edition Linux 64bit with Plesk": {
"family": "UBUNTU", "family": "UBUNTU",
"version": "10.04", "version": "10.04",
@ -39,7 +45,7 @@
"Fedora 14 Linux 64bit Preinstalled System": { "Fedora 14 Linux 64bit Preinstalled System": {
"family": "FEDORA", "family": "FEDORA",
"version": "14", "version": "",
"is64Bit": true "is64Bit": true
}, },
@ -102,7 +108,7 @@
"FreeBSD 8.1 Preinstalled Base System": { "FreeBSD 8.1 Preinstalled Base System": {
"family": "FREEBSD", "family": "FREEBSD",
"version": "8.1", "version": "",
"is64Bit": true "is64Bit": true
}, },
@ -114,7 +120,7 @@
"Fedora 13 Linux 64bit Preinstalled System": { "Fedora 13 Linux 64bit Preinstalled System": {
"family": "FEDORA", "family": "FEDORA",
"version": "13", "version": "",
"is64Bit": true "is64Bit": true
}, },
@ -134,7 +140,12 @@
"family": "DEBIAN", "family": "DEBIAN",
"version": "5.0", "version": "5.0",
"is64Bit": true "is64Bit": true
},
"Debian 6.0 No X Minimal Linux 64bit Preinstalled System": {
"family": "DEBIAN",
"version": "6.0",
"is64Bit": true
} }
} }

View File

@ -36,7 +36,7 @@ public class ElasticHostsBlueSquareLondonPropertiesBuilder extends ElasticStackP
protected Properties defaultProperties() { protected Properties defaultProperties() {
Properties properties = super.defaultProperties(); Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ISO3166_CODES, "GB-LND"); properties.setProperty(PROPERTY_ISO3166_CODES, "GB-LND");
properties.setProperty(PROPERTY_ENDPOINT, "https://api.lon-p.elastichosts.com"); properties.setProperty(PROPERTY_ENDPOINT, "https://api.lon-b.elastichosts.com");
properties.setProperty(PROPERTY_API_VERSION, "1.0"); properties.setProperty(PROPERTY_API_VERSION, "1.0");
return properties; return properties;
} }

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,26 +46,26 @@ public class ElasticHostsBlueSquareLondonTemplateBuilderLiveTest extends BaseTem
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
&& !(input.version.equals("10.04") && input.is64Bit); case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit)); && input.is64Bit;
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,26 +46,26 @@ public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplate
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
&& !(input.version.equals("10.04") && input.is64Bit); case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit)); && input.is64Bit;
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,26 +46,26 @@ public class ElasticHostsPeer1SanAntonioTemplateBuilderLiveTest extends BaseTemp
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
&& !(input.version.equals("10.04") && input.is64Bit); case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit)); && input.is64Bit;
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -18,7 +18,7 @@
*/ */
package org.jclouds.epc.config; package org.jclouds.epc.config;
import static org.jclouds.compute.domain.OsFamily.CENTOS; import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule; import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
@ -39,7 +39,7 @@ public class EucalyptusPartnerCloudComputeServiceContextModule extends EC2Comput
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
String virt = injector.getInstance(Key.get(String.class, Names String virt = injector.getInstance(Key.get(String.class, Names
.named("eucalyptus-partnercloud-ec2.virtualization-type"))); .named("eucalyptus-partnercloud-ec2.virtualization-type")));
return template.osFamily(CENTOS).locationId(virt + "-cluster").osDescriptionMatches(virt); return template.osFamily(UBUNTU).locationId(virt + "-cluster");
} }
@Override @Override

View File

@ -44,7 +44,7 @@ import org.jclouds.logging.Logger;
@Singleton @Singleton
public class EucalyptusPartnerCloudReviseParsedImage implements ReviseParsedImage { public class EucalyptusPartnerCloudReviseParsedImage implements ReviseParsedImage {
// centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml // debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml
public static final Pattern PATTERN = Pattern.compile("^([^-]+)-([^-]+)-.*"); public static final Pattern PATTERN = Pattern.compile("^([^-]+)-([^-]+)-.*");
public static final Pattern WINDOWS = Pattern.compile("^windows-([^/]+)/.*"); public static final Pattern WINDOWS = Pattern.compile("^windows-([^/]+)/.*");

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,23 +47,23 @@ public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends Bas
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.3") && input.is64Bit);
case WINDOWS:
return !(input.version.equals("") && input.is64Bit)
&& !(input.version.equals("2008") && input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test
@ -70,12 +71,12 @@ public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends Bas
Template defaultTemplate = context.getComputeService().templateBuilder().build(); Template defaultTemplate = context.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getProviderId().startsWith("emi-")) : defaultTemplate; assert (defaultTemplate.getImage().getProviderId().startsWith("emi-")) : defaultTemplate;
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
assertEquals(defaultTemplate.getLocation().getId(), "kvm-cluster"); assertEquals(defaultTemplate.getLocation().getId(), "kvm-cluster");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
} }

View File

@ -25,7 +25,7 @@ import java.util.Set;
import org.jclouds.compute.config.BaseComputeServiceContextModule; import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
@ -60,29 +60,30 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
Set<org.jclouds.compute.domain.Image> result = convertImages("/eucalyptus_images.xml"); Set<org.jclouds.compute.domain.Image> result = convertImages("/eucalyptus_images.xml");
assertEquals(result.size(), 3); assertEquals(result.size(), 3);
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem( assertEquals(Iterables.get(result, 0).toString(), new ImageBuilder().operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("paravirtual").version("5.3").description( OperatingSystem.builder().family(OsFamily.DEBIAN).arch("paravirtual").version("6.0").description(
"centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml").is64Bit(true).build()).description( "debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml").is64Bit(true).build()).description(
"centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml").defaultCredentials( "debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml")
new Credentials("root", null)).id("us-east-1/emi-F96014E1").providerId("emi-F96014E1").location( .defaultCredentials(new Credentials("root", null)).id("us-east-1/emi-892C130F").providerId(
defaultLocation).userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")) "emi-892C130F").location(defaultLocation).userMetadata(
.build()); ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build().toString());
assertEquals(Iterables.get(result, 1), new ImageBuilder().operatingSystem( assertEquals(Iterables.get(result, 1).toString(), new ImageBuilder().operatingSystem(
new OperatingSystemBuilder().family(OsFamily.WINDOWS).arch("paravirtual").version("2008").description( OperatingSystem.builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.5").description(
"windows-2008-server/windows.my2008server.img.manifest.xml").is64Bit(true).build()) "centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml").is64Bit(true).build()).description(
.description("windows-2008-server/windows.my2008server.img.manifest.xml").defaultCredentials( "centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml")
new Credentials("root", null)).id("us-east-1/emi-767B178C").providerId("emi-767B178C") .defaultCredentials(new Credentials("root", null)).id("us-east-1/emi-9B751369").providerId(
.location(defaultLocation).userMetadata( "emi-9B751369").location(defaultLocation).userMetadata(
ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build()); ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build().toString());
assertEquals(Iterables.get(result, 2), new ImageBuilder().operatingSystem( assertEquals(Iterables.get(result, 2).toString(), new ImageBuilder().operatingSystem(
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("paravirtual").version("5.3").description( OperatingSystem.builder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04").description(
"centos-5.3-x86_64-kvm/centos.5-3.x86-64.img.manifest.xml").is64Bit(true).build()).description( "ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").is64Bit(true).build()).description(
"centos-5.3-x86_64-kvm/centos.5-3.x86-64.img.manifest.xml").defaultCredentials( "ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").defaultCredentials(
new Credentials("root", null)).id("us-east-1/emi-F9ED14E7").providerId("emi-F9ED14E7").location( new Credentials("root", null)).id("us-east-1/emi-E0641459").providerId("emi-E0641459").location(
defaultLocation).userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")) defaultLocation).userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store"))
.build()); .build().toString());
} }
static Location defaultLocation = new LocationBuilder().scope(LocationScope.REGION).id("us-east-1").description( static Location defaultLocation = new LocationBuilder().scope(LocationScope.REGION).id("us-east-1").description(

View File

@ -1,9 +1,22 @@
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"> <DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/">
<requestId>0bd968c0-b1d2-41bd-ad04-fc35017b5110</requestId> <requestId>a70893be-64cb-4cee-a6ef-ab1fcea75266</requestId>
<imagesSet> <imagesSet>
<item> <item>
<imageId>eri-91061322</imageId> <imageId>eki-23CD15B0</imageId>
<imageLocation>initrd-64-xen/initrd-2.6.27.21-0.1-xen.manifest.xml</imageLocation> <imageLocation>kvm-kernel-x86_64/vmlinuz-2.6.28-11-generic.manifest.xml
</imageLocation>
<imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>x86_64</architecture>
<imageType>kernel</imageType>
<platform>linux</platform>
</item>
<item>
<imageId>eri-849A1703</imageId>
<imageLocation>kvm-ramdisk-x86_64/initrd.img-2.6.28-11-generic.manifest.xml
</imageLocation>
<imageState>available</imageState> <imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId> <imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic> <isPublic>true</isPublic>
@ -13,78 +26,33 @@
<platform>linux</platform> <platform>linux</platform>
</item> </item>
<item> <item>
<imageId>emi-F96014E1</imageId> <imageId>emi-892C130F</imageId>
<imageLocation>centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml</imageLocation> <imageLocation>debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml
</imageLocation>
<imageState>available</imageState> <imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId> <imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic> <isPublic>true</isPublic>
<productCodes /> <productCodes />
<architecture>x86_64</architecture> <architecture>x86_64</architecture>
<imageType>machine</imageType> <imageType>machine</imageType>
<kernelId>eki-AE7F138B</kernelId>
<ramdiskId>eri-91061322</ramdiskId>
<platform>linux</platform> <platform>linux</platform>
</item> </item>
<item> <item>
<imageId>emi-767B178C</imageId> <imageId>emi-9B751369</imageId>
<imageLocation>windows-2008-server/windows.my2008server.img.manifest.xml</imageLocation> <imageLocation>centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml
</imageLocation>
<imageState>available</imageState> <imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId> <imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic> <isPublic>true</isPublic>
<productCodes /> <productCodes />
<architecture>x86_64</architecture> <architecture>x86_64</architecture>
<imageType>machine</imageType> <imageType>machine</imageType>
<platform>windows</platform>
</item>
<item>
<imageId>eki-AE7F138B</imageId>
<imageLocation>kernel-64-xen/vmlinuz-2.6.27.21-0.1-xen.manifest.xml</imageLocation>
<imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>x86_64</architecture>
<imageType>kernel</imageType>
<platform>linux</platform> <platform>linux</platform>
</item> </item>
<item> <item>
<imageId>eki-101E1514</imageId> <imageId>eri-042914D2</imageId>
<imageLocation>kernel-deb-ec2-32bit/vmlinuz-2.6.32-308-ec2.manifest.xml</imageLocation> <imageLocation>xen-ramdisk-x86_64/initrd-2.6.27.21-0.1-xen.manifest.xml
<imageState>available</imageState> </imageLocation>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>i386</architecture>
<imageType>kernel</imageType>
<platform>linux</platform>
</item>
<item>
<imageId>emi-F9ED14E7</imageId>
<imageLocation>centos-5.3-x86_64-kvm/centos.5-3.x86-64.img.manifest.xml</imageLocation>
<imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>x86_64</architecture>
<imageType>machine</imageType>
<kernelId>eki-C9BE147B</kernelId>
<ramdiskId>eri-0AEE155E</ramdiskId>
<platform>linux</platform>
</item>
<item>
<imageId>eki-C9BE147B</imageId>
<imageLocation>kernel-64-kvm/vmlinuz-2.6.28-11-generic.manifest.xml</imageLocation>
<imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>x86_64</architecture>
<imageType>kernel</imageType>
<platform>linux</platform>
</item>
<item>
<imageId>eri-0AEE155E</imageId>
<imageLocation>initrd-64-kvm/initrd.img-2.6.28-11-generic.manifest.xml</imageLocation>
<imageState>available</imageState> <imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId> <imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic> <isPublic>true</isPublic>
@ -94,8 +62,21 @@
<platform>linux</platform> <platform>linux</platform>
</item> </item>
<item> <item>
<imageId>eki-9383133A</imageId> <imageId>emi-E0641459</imageId>
<imageLocation>kernel-deb-ec2/vmlinuz-2.6.32-308-ec2.manifest.xml</imageLocation> <imageLocation>ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml
</imageLocation>
<imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic>
<productCodes />
<architecture>x86_64</architecture>
<imageType>machine</imageType>
<platform>linux</platform>
</item>
<item>
<imageId>eki-08A714DD</imageId>
<imageLocation>xen-kernel-x86_64/vmlinuz-2.6.27.21-0.1-xen.manifest.xml
</imageLocation>
<imageState>available</imageState> <imageState>available</imageState>
<imageOwnerId>admin</imageOwnerId> <imageOwnerId>admin</imageOwnerId>
<isPublic>true</isPublic> <isPublic>true</isPublic>

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,24 +47,25 @@ public class GoGridTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override @Override
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case RHEL: case RHEL:
return !input.version.equals("") && !input.version.equals("5.4"); return input.version.equals("") || input.version.equals("5.4");
case DEBIAN:
return input.version.equals("") || input.version.equals("5.0");
case UBUNTU: case UBUNTU:
return !input.version.equals("") && !input.version.equals("10.04"); return input.version.equals("") || input.version.equals("10.04");
case CENTOS: case CENTOS:
return !input.version.equals("") && !input.version.matches("5.[35]"); return input.version.equals("") || input.version.matches("5.[35]");
case WINDOWS: case WINDOWS:
return !input.version.equals("") && (input.is64Bit && !input.version.matches("200[38]")) return input.version.equals("") || input.version.matches("200[38]");
|| (input.version.matches("200[38] [RS]P?[12]") && !input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,23 +47,23 @@ public class OpenHostingEast1TemplateBuilderLiveTest extends BaseTemplateBuilder
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("10.10")) && input.is64Bit;
&& !(input.version.equals("10.10") && input.is64Bit); case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -20,6 +20,7 @@ package org.jclouds.serverlove;
import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import java.util.Properties; import java.util.Properties;
@ -34,6 +35,7 @@ public class ServerloveManchesterPropertiesBuilder extends ElasticStackPropertie
@Override @Override
protected Properties defaultProperties() { protected Properties defaultProperties() {
Properties properties = super.defaultProperties(); Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ISO3166_CODES, "GB-MAN");
properties.setProperty(PROPERTY_ENDPOINT, "https://api.z1-man.serverlove.com"); properties.setProperty(PROPERTY_ENDPOINT, "https://api.z1-man.serverlove.com");
properties.setProperty(PROPERTY_API_VERSION, "1.0"); properties.setProperty(PROPERTY_API_VERSION, "1.0");
return properties; return properties;

View File

@ -30,6 +30,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -45,26 +46,25 @@ public class ServerloveManchesterTemplateBuilderLiveTest extends BaseTemplateBui
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
&& !(input.version.equals("10.04") && input.is64Bit); case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
&& !(input.version.equals("5.5") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit;
&& !(input.version.equals("2008 R2") && input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,24 +47,25 @@ public class SkaliCloudMalaysiaTemplateBuilderLiveTest extends BaseTemplateBuild
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && !input.version.equals("10.10"); return input.version.equals("") || input.version.equals("10.10");
case DEBIAN:
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
case CENTOS: case CENTOS:
return !input.version.equals("") && !input.version.equals("5.5"); return input.version.equals("") || input.version.equals("5.5");
case WINDOWS: case WINDOWS:
return !(input.version.equals("") && input.is64Bit) return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit;
&& !(input.version.equals("2008 R2") && input.is64Bit);
default: default:
return true; return false;
} }
} }
}; });
} }
@Override @Override

View File

@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -46,30 +47,29 @@ public class SlicehostTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
@Override @Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() { protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() { return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@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.equals("") && !(input.version.equals("10.04") || input.version.endsWith(".10")); return input.version.equals("") || input.version.startsWith("10") || input.version.equals("9.10");
case DEBIAN:
return !input.version.equals("6.0");
case RHEL: case RHEL:
return !(input.version.equals("") && input.is64Bit); return input.version.equals("") && input.is64Bit;
case CENTOS: case CENTOS:
return !input.version.equals("") && input.version.matches("5.[23]") return input.version.equals("") || input.version.matches("5.[45]")
|| (input.version.equals("5.0") && !input.is64Bit); || (input.version.equals("5.0") && input.is64Bit);
case WINDOWS: case WINDOWS:
return !input.version.equals("") return input.version.equals("") || (input.version.equals("2008 SP2") && !input.is64Bit)
&& input.version.startsWith("2008") || input.version.equals("") || (input.version.equals("2008 R2") && input.is64Bit);
&& !(input.version.startsWith("2008 R2") && input.is64Bit || input.version
.startsWith("2008 SP2")
&& !input.is64Bit) || input.version.indexOf("2003") != -1;
default: default:
return true; return false;
} }
} }
}; });
} }
@Test @Test

View File

@ -51,8 +51,9 @@ public class RimuHostingTemplateBuilderLiveTest extends BaseTemplateBuilderLiveT
public boolean apply(OsFamilyVersion64Bit input) { public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) { switch (input.family) {
case UBUNTU: case UBUNTU:
// support for all ubuntu w/empty version and 10.04 & 10.10 return input.version.matches("^[89].*");
return !(input.version.equals("") || input.version.startsWith("10.")); case DEBIAN:
return false;
case CENTOS: case CENTOS:
return !input.version.equals(""); return !input.version.equals("");
default: default: