mirror of https://github.com/apache/jclouds.git
Issue 564:parse debian images
This commit is contained in:
parent
be2009b267
commit
fca0e3d093
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,24 +46,26 @@ public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
|
|||
|
||||
@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 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:
|
||||
return input.version.matches("5.[023]") || !input.is64Bit;
|
||||
return !(input.version.matches("5.[023]") || input.version.equals("8.04")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return input.version.equals("2008") || input.version.indexOf("2003") != -1
|
||||
|| (input.version.equals("2008 R2") && !input.is64Bit);
|
||||
return input.version.equals("2008 SP2") || input.version.equals("")
|
||||
|| (input.version.equals("2008 R2") && input.is64Bit);
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -57,7 +57,7 @@ public interface ComputeServiceConstants {
|
|||
public static class ReferenceData {
|
||||
@Inject(optional = true)
|
||||
@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
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -55,23 +56,25 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|||
|
||||
@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 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;
|
||||
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
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BluelockVCloudDirectorTemplateBuilderLiveTest extends BaseTemplateB
|
|||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
switch (input.family) {
|
||||
case UBUNTU:
|
||||
return !input.version.equals("");
|
||||
return !input.version.equals("") || !input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,25 +46,26 @@ public class CloudServersUKTemplateBuilderLiveTest extends BaseTemplateBuilderLi
|
|||
|
||||
@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 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:
|
||||
return input.version.matches("5.[023]") || !input.is64Bit;
|
||||
return (input.version.equals("") || input.version.matches("5.[45]")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return input.version.equals("2008") || input.version.equals("2008 R1")
|
||||
|| input.version.indexOf("2003") != -1
|
||||
|| (input.version.equals("2008 R2") && !input.is64Bit);
|
||||
return input.version.equals("2008 SP2") || input.version.equals("")
|
||||
|| (input.version.equals("2008 R2") && input.is64Bit);
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,25 +46,26 @@ public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLi
|
|||
|
||||
@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 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:
|
||||
return input.version.matches("5.[023]") || !input.is64Bit;
|
||||
return !(input.version.matches("5.[023]")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return input.version.equals("2008") || input.version.equals("2008 R1")
|
||||
|| input.version.indexOf("2003") != -1
|
||||
|| (input.version.equals("2008 R2") && !input.is64Bit);
|
||||
return input.version.equals("2008 SP2") || input.version.equals("")
|
||||
|| (input.version.equals("2008 R2") && input.is64Bit);
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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.or;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
|
||||
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
|
@ -42,6 +45,12 @@ import com.google.common.base.Function;
|
|||
*/
|
||||
@Singleton
|
||||
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
|
||||
public static final Pattern PATTERN = Pattern.compile("([^ ]+)[^0-9]([0-9.]+) .*");
|
||||
|
@ -60,18 +69,17 @@ public class ParseOsFamilyVersion64BitFromImageName implements Function<String,
|
|||
if (matcher.find())
|
||||
version = matcher.group(1);
|
||||
}
|
||||
return new OsFamilyVersion64Bit(OsFamily.WINDOWS, version, is64Bit);
|
||||
return new OsFamilyVersion64Bit(OsFamily.WINDOWS, osVersionMap.get(OsFamily.WINDOWS).get(version), is64Bit);
|
||||
} else {
|
||||
Matcher matcher = PATTERN.matcher(input);
|
||||
if (matcher.find()) {
|
||||
OsFamily fam = OsFamily.fromValue(matcher.group(1).toLowerCase());
|
||||
String version = matcher.group(2);
|
||||
switch (fam) {
|
||||
case UNRECOGNIZED:
|
||||
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 {
|
||||
return new OsFamilyVersion64Bit(OsFamily.UNRECOGNIZED, null, is64Bit);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,9 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.cloudsigma.domain.DriveInfo;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
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.OperatingSystem.Builder;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.Location;
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class PreinstalledDiskToImage implements Function<DriveInfo, Image> {
|
|||
if (drive.getName() == null)
|
||||
return null;
|
||||
String description = drive.getDescription() != null ? drive.getDescription() : drive.getName();
|
||||
OperatingSystemBuilder builder = new OperatingSystemBuilder();
|
||||
Builder builder = OperatingSystem.builder();
|
||||
OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName());
|
||||
builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version).family(
|
||||
parsed.family);
|
||||
|
|
|
@ -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,25 +47,27 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
|
|||
|
||||
@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 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:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.matches("5.[05]")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return !((input.version.equals("2008 R2") && input.is64Bit)
|
||||
|| (input.version.equals("2008") && !input.is64Bit) || input.version.equals("") || (input.version
|
||||
.equals("2003")));
|
||||
return (input.version.equals("2008 R2") && input.is64Bit)
|
||||
|| (input.version.equals("2008") && !input.is64Bit) || input.version.equals("")
|
||||
|| (input.version.equals("2003"));
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,8 +28,11 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.cloudsigma.compute.functions.ParseOsFamilyVersion64BitFromImageName;
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.json.internal.GsonWrapper;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
@ -37,6 +40,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
|
@ -65,7 +69,9 @@ public class ParseOsFamilyVersion64BitFromImageNameTest {
|
|||
})).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")
|
||||
public void test(String input, OsFamilyVersion64Bit expected) {
|
||||
|
|
|
@ -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": {
|
||||
"family": "UBUNTU",
|
||||
"version": "10.04",
|
||||
|
@ -39,7 +45,7 @@
|
|||
|
||||
"Fedora 14 Linux 64bit Preinstalled System": {
|
||||
"family": "FEDORA",
|
||||
"version": "14",
|
||||
"version": "",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
|
@ -102,7 +108,7 @@
|
|||
|
||||
"FreeBSD 8.1 Preinstalled Base System": {
|
||||
"family": "FREEBSD",
|
||||
"version": "8.1",
|
||||
"version": "",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
|
@ -114,7 +120,7 @@
|
|||
|
||||
"Fedora 13 Linux 64bit Preinstalled System": {
|
||||
"family": "FEDORA",
|
||||
"version": "13",
|
||||
"version": "",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
|
@ -134,7 +140,12 @@
|
|||
"family": "DEBIAN",
|
||||
"version": "5.0",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
"Debian 6.0 No X Minimal Linux 64bit Preinstalled System": {
|
||||
"family": "DEBIAN",
|
||||
"version": "6.0",
|
||||
"is64Bit": true
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -36,7 +36,7 @@ public class ElasticHostsBlueSquareLondonPropertiesBuilder extends ElasticStackP
|
|||
protected Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
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");
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,26 +46,26 @@ public class ElasticHostsBlueSquareLondonTemplateBuilderLiveTest extends BaseTem
|
|||
|
||||
@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 UBUNTU:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit));
|
||||
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
|
||||
&& input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,26 +46,26 @@ public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplate
|
|||
|
||||
@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 UBUNTU:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit));
|
||||
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
|
||||
&& input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,26 +46,26 @@ public class ElasticHostsPeer1SanAntonioTemplateBuilderLiveTest extends BaseTemp
|
|||
|
||||
@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 UBUNTU:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !((input.version.equals("2008 R2") && input.is64Bit) || (input.version.equals("2008") && input.is64Bit));
|
||||
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
|
||||
&& input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
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.ec2.compute.config.EC2ComputeServiceContextModule;
|
||||
|
@ -39,7 +39,7 @@ public class EucalyptusPartnerCloudComputeServiceContextModule extends EC2Comput
|
|||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
String virt = injector.getInstance(Key.get(String.class, Names
|
||||
.named("eucalyptus-partnercloud-ec2.virtualization-type")));
|
||||
return template.osFamily(CENTOS).locationId(virt + "-cluster").osDescriptionMatches(virt);
|
||||
return template.osFamily(UBUNTU).locationId(virt + "-cluster");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.logging.Logger;
|
|||
@Singleton
|
||||
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 WINDOWS = Pattern.compile("^windows-([^/]+)/.*");
|
||||
|
||||
|
|
|
@ -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,23 +47,23 @@ public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends Bas
|
|||
|
||||
@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 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:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.3") && input.is64Bit);
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("2008") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -70,12 +71,12 @@ public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends Bas
|
|||
|
||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||
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().getFamily(), OsFamily.CENTOS);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "kvm-cluster");
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
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.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Credentials;
|
||||
|
@ -60,29 +60,30 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
|
|||
Set<org.jclouds.compute.domain.Image> result = convertImages("/eucalyptus_images.xml");
|
||||
assertEquals(result.size(), 3);
|
||||
|
||||
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("paravirtual").version("5.3").description(
|
||||
"centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml").is64Bit(true).build()).description(
|
||||
"centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml").defaultCredentials(
|
||||
new Credentials("root", null)).id("us-east-1/emi-F96014E1").providerId("emi-F96014E1").location(
|
||||
defaultLocation).userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store"))
|
||||
.build());
|
||||
assertEquals(Iterables.get(result, 0).toString(), new ImageBuilder().operatingSystem(
|
||||
OperatingSystem.builder().family(OsFamily.DEBIAN).arch("paravirtual").version("6.0").description(
|
||||
"debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml").is64Bit(true).build()).description(
|
||||
"debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml")
|
||||
.defaultCredentials(new Credentials("root", null)).id("us-east-1/emi-892C130F").providerId(
|
||||
"emi-892C130F").location(defaultLocation).userMetadata(
|
||||
ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build().toString());
|
||||
|
||||
assertEquals(Iterables.get(result, 1), new ImageBuilder().operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.WINDOWS).arch("paravirtual").version("2008").description(
|
||||
"windows-2008-server/windows.my2008server.img.manifest.xml").is64Bit(true).build())
|
||||
.description("windows-2008-server/windows.my2008server.img.manifest.xml").defaultCredentials(
|
||||
new Credentials("root", null)).id("us-east-1/emi-767B178C").providerId("emi-767B178C")
|
||||
.location(defaultLocation).userMetadata(
|
||||
ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build());
|
||||
assertEquals(Iterables.get(result, 1).toString(), new ImageBuilder().operatingSystem(
|
||||
OperatingSystem.builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.5").description(
|
||||
"centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml").is64Bit(true).build()).description(
|
||||
"centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml")
|
||||
.defaultCredentials(new Credentials("root", null)).id("us-east-1/emi-9B751369").providerId(
|
||||
"emi-9B751369").location(defaultLocation).userMetadata(
|
||||
ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build().toString());
|
||||
|
||||
assertEquals(Iterables.get(result, 2), new ImageBuilder().operatingSystem(
|
||||
new OperatingSystemBuilder().family(OsFamily.CENTOS).arch("paravirtual").version("5.3").description(
|
||||
"centos-5.3-x86_64-kvm/centos.5-3.x86-64.img.manifest.xml").is64Bit(true).build()).description(
|
||||
"centos-5.3-x86_64-kvm/centos.5-3.x86-64.img.manifest.xml").defaultCredentials(
|
||||
new Credentials("root", null)).id("us-east-1/emi-F9ED14E7").providerId("emi-F9ED14E7").location(
|
||||
assertEquals(Iterables.get(result, 2).toString(), new ImageBuilder().operatingSystem(
|
||||
OperatingSystem.builder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04").description(
|
||||
"ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").is64Bit(true).build()).description(
|
||||
"ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").defaultCredentials(
|
||||
new Credentials("root", null)).id("us-east-1/emi-E0641459").providerId("emi-E0641459").location(
|
||||
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(
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
<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>
|
||||
<item>
|
||||
<imageId>eri-91061322</imageId>
|
||||
<imageLocation>initrd-64-xen/initrd-2.6.27.21-0.1-xen.manifest.xml</imageLocation>
|
||||
<imageId>eki-23CD15B0</imageId>
|
||||
<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>
|
||||
<imageOwnerId>admin</imageOwnerId>
|
||||
<isPublic>true</isPublic>
|
||||
|
@ -13,78 +26,33 @@
|
|||
<platform>linux</platform>
|
||||
</item>
|
||||
<item>
|
||||
<imageId>emi-F96014E1</imageId>
|
||||
<imageLocation>centos-5.3-x86_64-xen/centos.5-3.x86-64.img.manifest.xml</imageLocation>
|
||||
<imageId>emi-892C130F</imageId>
|
||||
<imageLocation>debian-6.0-x86_64/debian.6-0.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-AE7F138B</kernelId>
|
||||
<ramdiskId>eri-91061322</ramdiskId>
|
||||
<platform>linux</platform>
|
||||
</item>
|
||||
<item>
|
||||
<imageId>emi-767B178C</imageId>
|
||||
<imageLocation>windows-2008-server/windows.my2008server.img.manifest.xml</imageLocation>
|
||||
<imageId>emi-9B751369</imageId>
|
||||
<imageLocation>centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml
|
||||
</imageLocation>
|
||||
<imageState>available</imageState>
|
||||
<imageOwnerId>admin</imageOwnerId>
|
||||
<isPublic>true</isPublic>
|
||||
<productCodes />
|
||||
<architecture>x86_64</architecture>
|
||||
<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>
|
||||
</item>
|
||||
<item>
|
||||
<imageId>eki-101E1514</imageId>
|
||||
<imageLocation>kernel-deb-ec2-32bit/vmlinuz-2.6.32-308-ec2.manifest.xml</imageLocation>
|
||||
<imageState>available</imageState>
|
||||
<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>
|
||||
<imageId>eri-042914D2</imageId>
|
||||
<imageLocation>xen-ramdisk-x86_64/initrd-2.6.27.21-0.1-xen.manifest.xml
|
||||
</imageLocation>
|
||||
<imageState>available</imageState>
|
||||
<imageOwnerId>admin</imageOwnerId>
|
||||
<isPublic>true</isPublic>
|
||||
|
@ -94,8 +62,21 @@
|
|||
<platform>linux</platform>
|
||||
</item>
|
||||
<item>
|
||||
<imageId>eki-9383133A</imageId>
|
||||
<imageLocation>kernel-deb-ec2/vmlinuz-2.6.32-308-ec2.manifest.xml</imageLocation>
|
||||
<imageId>emi-E0641459</imageId>
|
||||
<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>
|
||||
<imageOwnerId>admin</imageOwnerId>
|
||||
<isPublic>true</isPublic>
|
||||
|
|
|
@ -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,24 +47,25 @@ public class GoGridTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|||
|
||||
@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.4");
|
||||
return input.version.equals("") || input.version.equals("5.4");
|
||||
case DEBIAN:
|
||||
return input.version.equals("") || input.version.equals("5.0");
|
||||
case UBUNTU:
|
||||
return !input.version.equals("") && !input.version.equals("10.04");
|
||||
return input.version.equals("") || input.version.equals("10.04");
|
||||
case CENTOS:
|
||||
return !input.version.equals("") && !input.version.matches("5.[35]");
|
||||
return input.version.equals("") || input.version.matches("5.[35]");
|
||||
case WINDOWS:
|
||||
return !input.version.equals("") && (input.is64Bit && !input.version.matches("200[38]"))
|
||||
|| (input.version.matches("200[38] [RS]P?[12]") && !input.is64Bit);
|
||||
return input.version.equals("") || input.version.matches("200[38]");
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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,23 +47,23 @@ public class OpenHostingEast1TemplateBuilderLiveTest extends BaseTemplateBuilder
|
|||
|
||||
@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 UBUNTU:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("10.10") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("10.10")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.serverlove;
|
|||
|
||||
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -34,6 +35,7 @@ public class ServerloveManchesterPropertiesBuilder extends ElasticStackPropertie
|
|||
@Override
|
||||
protected Properties 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_API_VERSION, "1.0");
|
||||
return properties;
|
||||
|
|
|
@ -30,6 +30,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;
|
||||
|
||||
/**
|
||||
|
@ -45,26 +46,25 @@ public class ServerloveManchesterTemplateBuilderLiveTest extends BaseTemplateBui
|
|||
|
||||
@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 UBUNTU:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("5.0")) && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("2008 R2") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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,24 +47,25 @@ public class SkaliCloudMalaysiaTemplateBuilderLiveTest extends BaseTemplateBuild
|
|||
|
||||
@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 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:
|
||||
return !input.version.equals("") && !input.version.equals("5.5");
|
||||
return input.version.equals("") || input.version.equals("5.5");
|
||||
case WINDOWS:
|
||||
return !(input.version.equals("") && input.is64Bit)
|
||||
&& !(input.version.equals("2008 R2") && input.is64Bit);
|
||||
return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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 SlicehostTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
|
||||
@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 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:
|
||||
return !(input.version.equals("") && input.is64Bit);
|
||||
return input.version.equals("") && input.is64Bit;
|
||||
case CENTOS:
|
||||
return !input.version.equals("") && input.version.matches("5.[23]")
|
||||
|| (input.version.equals("5.0") && !input.is64Bit);
|
||||
return input.version.equals("") || input.version.matches("5.[45]")
|
||||
|| (input.version.equals("5.0") && input.is64Bit);
|
||||
case WINDOWS:
|
||||
return !input.version.equals("")
|
||||
&& input.version.startsWith("2008")
|
||||
&& !(input.version.startsWith("2008 R2") && input.is64Bit || input.version
|
||||
.startsWith("2008 SP2")
|
||||
&& !input.is64Bit) || input.version.indexOf("2003") != -1;
|
||||
return input.version.equals("") || (input.version.equals("2008 SP2") && !input.is64Bit)
|
||||
|| input.version.equals("") || (input.version.equals("2008 R2") && input.is64Bit);
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -51,8 +51,9 @@ public class RimuHostingTemplateBuilderLiveTest extends BaseTemplateBuilderLiveT
|
|||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
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."));
|
||||
return input.version.matches("^[89].*");
|
||||
case DEBIAN:
|
||||
return false;
|
||||
case CENTOS:
|
||||
return !input.version.equals("");
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue