mirror of https://github.com/apache/jclouds.git
template test predicate refactor
This commit is contained in:
parent
99bbdfce8a
commit
2d888fb18e
|
@ -1,57 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.cloudservers.compute;
|
|
||||||
|
|
||||||
import org.jclouds.compute.BaseTemplateBuilderLiveTest;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class CloudServersTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|
||||||
|
|
||||||
public CloudServersTemplateBuilderLiveTest() {
|
|
||||||
provider = "cloudservers";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
|
||||||
return (input.family != OsFamily.WINDOWS && !input.is64Bit) || //
|
|
||||||
input.family == OsFamily.RHEL || //
|
|
||||||
(input.family == OsFamily.UBUNTU && input.version.equals("11.04")) || //
|
|
||||||
(input.family == OsFamily.CENTOS && input.version.matches("5.[23]")) || //
|
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008")) || //
|
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008 R2") && !input.is64Bit);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.elasticstack.compute;
|
|
||||||
|
|
||||||
import org.jclouds.compute.BaseTemplateBuilderLiveTest;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class ElasticStackTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|
||||||
|
|
||||||
public ElasticStackTemplateBuilderLiveTest() {
|
|
||||||
provider = "elasticstack";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
|
||||||
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008") || input.version.equals("2008 R2")) && input.is64Bit)) //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.eucalyptus.compute;
|
|
||||||
|
|
||||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.jclouds.compute.BaseTemplateBuilderLiveTest;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.Template;
|
|
||||||
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class EucalyptusTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|
||||||
|
|
||||||
public EucalyptusTemplateBuilderLiveTest() {
|
|
||||||
provider = "eucalyptus";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
|
||||||
return input.family == OsFamily.RHEL || //
|
|
||||||
(input.family == OsFamily.CENTOS && !input.version.equals("5.3") || !input.is64Bit) || //
|
|
||||||
input.family == OsFamily.WINDOWS || //
|
|
||||||
input.family == OsFamily.UBUNTU;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDefaultTemplateBuilder() throws IOException {
|
|
||||||
|
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
|
||||||
assert (defaultTemplate.getImage().getProviderId().startsWith("emi-")) : defaultTemplate;
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3");
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
|
|
||||||
assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "Eucalyptus");
|
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,21 +20,14 @@
|
||||||
package org.jclouds.vcloud.compute.functions;
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
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.OperatingSystem;
|
import org.jclouds.compute.domain.OperatingSystem;
|
||||||
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.compute.util.ComputeServiceUtils;
|
|
||||||
import org.jclouds.vcloud.domain.ReferenceType;
|
import org.jclouds.vcloud.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
|
|
||||||
|
@ -46,17 +39,16 @@ import com.google.common.base.Function;
|
||||||
public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpressVAppTemplate, Image> {
|
public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpressVAppTemplate, Image> {
|
||||||
private final FindLocationForResource findLocationForResource;
|
private final FindLocationForResource findLocationForResource;
|
||||||
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
||||||
private ReferenceType parent;
|
private final Function<String, OperatingSystem> osParser;
|
||||||
|
|
||||||
private final Map<OsFamily, Map<String, String>> osVersionMap;
|
private ReferenceType parent;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource,
|
protected ImageForVCloudExpressVAppTemplate(FindLocationForResource findLocationForResource,
|
||||||
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider, Function<String, OperatingSystem> osParser) {
|
||||||
Map<OsFamily, Map<String, String>> osVersionMap) {
|
|
||||||
this.osVersionMap = osVersionMap;
|
|
||||||
this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
|
this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
|
||||||
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
|
this.credentialsProvider = checkNotNull(credentialsProvider, "credentialsProvider");
|
||||||
|
this.osParser = osParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageForVCloudExpressVAppTemplate withParent(ReferenceType parent) {
|
public ImageForVCloudExpressVAppTemplate withParent(ReferenceType parent) {
|
||||||
|
@ -72,24 +64,8 @@ public class ImageForVCloudExpressVAppTemplate implements Function<VCloudExpress
|
||||||
builder.name(from.getName());
|
builder.name(from.getName());
|
||||||
builder.location(findLocationForResource.apply(checkNotNull(parent, "parent")));
|
builder.location(findLocationForResource.apply(checkNotNull(parent, "parent")));
|
||||||
builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
|
builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
|
||||||
builder.operatingSystem(parseOs(from));
|
builder.operatingSystem(osParser.apply(from.getName()));
|
||||||
builder.defaultCredentials(credentialsProvider.execute(from));
|
builder.defaultCredentials(credentialsProvider.execute(from));
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Pattern OS_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
|
|
||||||
|
|
||||||
protected OperatingSystem parseOs(VCloudExpressVAppTemplate from) {
|
|
||||||
OperatingSystemBuilder builder = new OperatingSystemBuilder();
|
|
||||||
OsFamily osFamily = parseOsFamilyOrUnrecognized("vcloudexpress", checkNotNull(from, "vapp template").getName());
|
|
||||||
builder.family(osFamily);
|
|
||||||
builder.description(from.getName());
|
|
||||||
builder.is64Bit(from.getName().indexOf("64") != -1);
|
|
||||||
Matcher matcher = OS_PATTERN.matcher(from.getName());
|
|
||||||
if (matcher.find()) {
|
|
||||||
builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap));
|
|
||||||
}
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.jclouds.compute.util.ComputeServiceUtils.parseOsFamilyOrUnrecognized;
|
||||||
|
|
||||||
|
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.OperatingSystem;
|
||||||
|
import org.jclouds.compute.domain.OperatingSystemBuilder;
|
||||||
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
|
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseOsFromVAppTemplateName implements Function<String, OperatingSystem> {
|
||||||
|
protected static final Pattern OS_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)");
|
||||||
|
|
||||||
|
protected final Map<OsFamily, Map<String, String>> osVersionMap;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected ParseOsFromVAppTemplateName(Map<OsFamily, Map<String, String>> osVersionMap) {
|
||||||
|
this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OperatingSystem apply(String from) {
|
||||||
|
OperatingSystemBuilder builder = new OperatingSystemBuilder();
|
||||||
|
OsFamily osFamily = parseOsFamilyOrUnrecognized(checkNotNull(from, "vapp template name"));
|
||||||
|
builder.family(osFamily);
|
||||||
|
builder.description(from);
|
||||||
|
builder.is64Bit(from.indexOf("64") != -1);
|
||||||
|
Matcher matcher = OS_PATTERN.matcher(from);
|
||||||
|
if (matcher.find()) {
|
||||||
|
builder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap));
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,10 +25,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.json.Json;
|
import org.jclouds.json.Json;
|
||||||
|
@ -91,14 +92,14 @@ public abstract class BaseTemplateBuilderLiveTest {
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
||||||
setupCredentials();
|
setupCredentials();
|
||||||
context = new ComputeServiceContextFactory().createContext(provider,
|
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), setupProperties());
|
.<Module> of(new Log4JLoggingModule()), setupProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider(name = "osSupported")
|
@DataProvider(name = "osSupported")
|
||||||
public Object[][] osSupported() {
|
public Object[][] osSupported() {
|
||||||
return convertToArray(Sets.filter(provideAllOperatingSystems(),
|
return convertToArray(Sets.filter(provideAllOperatingSystems(), Predicates
|
||||||
Predicates.not(defineUnsupportedOperatingSystems())));
|
.not(defineUnsupportedOperatingSystems())));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object[][] convertToArray(Set<OsFamilyVersion64Bit> supportedOperatingSystems) {
|
protected Object[][] convertToArray(Set<OsFamilyVersion64Bit> supportedOperatingSystems) {
|
||||||
|
@ -121,7 +122,7 @@ public abstract class BaseTemplateBuilderLiveTest {
|
||||||
protected Set<OsFamilyVersion64Bit> provideAllOperatingSystems() {
|
protected Set<OsFamilyVersion64Bit> provideAllOperatingSystems() {
|
||||||
Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
|
Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
|
||||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
||||||
.getInstance(Json.class));
|
.getInstance(Json.class));
|
||||||
|
|
||||||
Set<OsFamilyVersion64Bit> supportedOperatingSystems = Sets.newHashSet();
|
Set<OsFamilyVersion64Bit> supportedOperatingSystems = Sets.newHashSet();
|
||||||
for (Entry<OsFamily, Map<String, String>> osVersions : map.entrySet()) {
|
for (Entry<OsFamily, Map<String, String>> osVersions : map.entrySet()) {
|
||||||
|
@ -135,17 +136,24 @@ public abstract class BaseTemplateBuilderLiveTest {
|
||||||
|
|
||||||
@Test(dataProvider = "osSupported")
|
@Test(dataProvider = "osSupported")
|
||||||
public void testTemplateBuilderCanFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
|
public void testTemplateBuilderCanFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
|
||||||
Template template = context.getComputeService().templateBuilder().osFamily(matrix.family)
|
TemplateBuilder builder = context.getComputeService().templateBuilder().osFamily(matrix.family).os64Bit(
|
||||||
.osVersionMatches("^" + matrix.version + "$").os64Bit(matrix.is64Bit).build();
|
matrix.is64Bit);
|
||||||
assertEquals(template.getImage().getOperatingSystem().getVersion(), matrix.version);
|
if (!matrix.version.equals(""))
|
||||||
|
builder.osVersionMatches("^" + matrix.version + "$");
|
||||||
|
Template template = builder.build();
|
||||||
|
if (!matrix.version.equals(""))
|
||||||
|
assertEquals(template.getImage().getOperatingSystem().getVersion(), matrix.version);
|
||||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), matrix.is64Bit);
|
assertEquals(template.getImage().getOperatingSystem().is64Bit(), matrix.is64Bit);
|
||||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), matrix.family);
|
assertEquals(template.getImage().getOperatingSystem().getFamily(), matrix.family);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "osNotSupported", expectedExceptions = NoSuchElementException.class)
|
@Test(dataProvider = "osNotSupported", expectedExceptions = NoSuchElementException.class)
|
||||||
public void testTemplateBuilderCannotFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
|
public void testTemplateBuilderCannotFind(OsFamilyVersion64Bit matrix) throws InterruptedException {
|
||||||
context.getComputeService().templateBuilder().osFamily(matrix.family)
|
TemplateBuilder builder = context.getComputeService().templateBuilder().osFamily(matrix.family).os64Bit(
|
||||||
.osVersionMatches("^" + matrix.version + "$").os64Bit(matrix.is64Bit).build();
|
matrix.is64Bit);
|
||||||
|
if (!matrix.version.equals(""))
|
||||||
|
builder.osVersionMatches("^" + matrix.version + "$");
|
||||||
|
builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -153,7 +161,7 @@ public abstract class BaseTemplateBuilderLiveTest {
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
|
|
||||||
Template template = context.getComputeService().templateBuilder().imageId(defaultTemplate.getImage().getId())
|
Template template = context.getComputeService().templateBuilder().imageId(defaultTemplate.getImage().getId())
|
||||||
.build();
|
.build();
|
||||||
assertEquals(template.getImage(), defaultTemplate.getImage());
|
assertEquals(template.getImage(), defaultTemplate.getImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,16 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return input.family == OsFamily.RHEL || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !input.version.matches("5.[42]")) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.WINDOWS && !input.version.matches("200[38]"));
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -75,7 +82,6 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10");
|
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10");
|
||||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
|
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
|
||||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(template.getImage().getVersion(), "20110126");
|
|
||||||
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||||
assertEquals(getCores(template.getHardware()), 1.0d);
|
assertEquals(getCores(template.getHardware()), 1.0d);
|
||||||
|
@ -120,10 +126,10 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
public void testTemplateBuilderMicro() throws IOException {
|
public void testTemplateBuilderMicro() throws IOException {
|
||||||
|
|
||||||
Template microTemplate = context.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO)
|
Template microTemplate = context.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO)
|
||||||
.osFamily(OsFamily.UBUNTU).build();
|
.osFamily(OsFamily.UBUNTU).osVersionMatches("10.10").os64Bit(true).build();
|
||||||
|
|
||||||
assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate;
|
assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate;
|
||||||
assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
|
assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
|
||||||
assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.jclouds.vcloud.bluelock.compute;
|
||||||
|
|
||||||
|
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.jclouds.compute.BaseTemplateBuilderLiveTest;
|
||||||
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
|
import org.jclouds.compute.domain.Template;
|
||||||
|
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "live")
|
||||||
|
public class BlueLockVCloudDirectorTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
|
|
||||||
|
public BlueLockVCloudDirectorTemplateBuilderLiveTest() {
|
||||||
|
provider = "bluelock-vcdirector";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||||
|
return new Predicate<OsFamilyVersion64Bit>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
|
switch (input.family) {
|
||||||
|
case UBUNTU:
|
||||||
|
return !input.version.equals("");
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testDefaultTemplateBuilder() throws IOException {
|
||||||
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,12 +47,17 @@ public class CloudServersUKTemplateBuilderLiveTest extends BaseTemplateBuilderLi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return (input.family != OsFamily.WINDOWS && !input.is64Bit) || //
|
switch (input.family) {
|
||||||
input.family == OsFamily.RHEL || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && input.version.equals("11.04")) || //
|
return input.version.equals("11.04") || input.version.equals("8.04") || !input.is64Bit;
|
||||||
(input.family == OsFamily.CENTOS && input.version.matches("5.[23]")) || //
|
case CENTOS:
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008")) || //
|
return input.version.matches("5.[023]") || !input.is64Bit;
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008 R2") && !input.is64Bit);
|
case WINDOWS:
|
||||||
|
return input.version.equals("2008") || input.version.indexOf("2003") != -1
|
||||||
|
|| (input.version.equals("2008 R2") && !input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,12 +47,17 @@ public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return (input.family != OsFamily.WINDOWS && !input.is64Bit) || //
|
switch (input.family) {
|
||||||
input.family == OsFamily.RHEL || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && input.version.equals("11.04")) || //
|
return input.version.equals("11.04") || input.version.equals("8.04") || !input.is64Bit;
|
||||||
(input.family == OsFamily.CENTOS && input.version.matches("5.[23]")) || //
|
case CENTOS:
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008")) || //
|
return input.version.matches("5.[023]") || !input.is64Bit;
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008 R2") && !input.is64Bit);
|
case WINDOWS:
|
||||||
|
return input.version.equals("2008") || input.version.indexOf("2003") != -1
|
||||||
|
|| (input.version.equals("2008 R2") && !input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,20 +46,26 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
return new Predicate<OsFamilyVersion64Bit>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.matches("10.10") && input.is64Bit)) || //
|
return !input.version.equals("") && !(input.version.equals("10.10") && input.is64Bit);
|
||||||
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008 R2") && input.is64Bit)
|
case CENTOS:
|
||||||
|| (input.version.equals("2008") && !input.is64Bit) || (input.version.equals("2003")))) //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
);
|
&& !(input.version.equals("5.5") && 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")));
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void testDefaultTemplateBuilder() throws IOException {
|
public void testDefaultTemplateBuilder() throws IOException {
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
|
|
|
@ -47,11 +47,19 @@ public class ElasticHostsBlueSquareLondonTemplateBuilderLiveTest extends BaseTem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008") || input.version.equals("2008 R2")) && input.is64Bit)) //
|
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||||
);
|
case CENTOS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(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));
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,11 +47,19 @@ public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplate
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008") || input.version.equals("2008 R2")) && input.is64Bit)) //
|
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||||
);
|
case CENTOS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(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));
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,11 +47,19 @@ public class ElasticHostsPeer1SanAntonioTemplateBuilderLiveTest extends BaseTemp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
(input.family == OsFamily.WINDOWS && !((input.version.equals("2008") || input.version.equals("2008 R2")) && input.is64Bit)) //
|
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||||
);
|
case CENTOS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(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));
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,11 +49,15 @@ public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends Bas
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return input.family == OsFamily.RHEL || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !input.version.equals("5.3") || !input.is64Bit) || //
|
case CENTOS:
|
||||||
(input.family == OsFamily.WINDOWS && !(input.version.equals("2008") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
input.family == OsFamily.UBUNTU;
|
&& !(input.version.equals("5.3") && input.is64Bit);
|
||||||
|
case WINDOWS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,17 +46,20 @@ public class GoGridTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
return new Predicate<OsFamilyVersion64Bit>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL && !input.version.equals("5.4")) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && input.version.matches("5.[542]")) || //
|
case RHEL:
|
||||||
(input.family == OsFamily.CENTOS && input.is64Bit && input.version.equals("5.[42]")) || //
|
return !input.version.equals("") && !input.version.equals("5.4");
|
||||||
(input.family == OsFamily.UBUNTU) || //
|
case CENTOS:
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008 SP2") || //
|
return !input.version.equals("") && !input.version.equals("5.3");
|
||||||
(input.family == OsFamily.WINDOWS && input.version.equals("2008 R2"))));
|
case WINDOWS:
|
||||||
|
return !input.version.equals("") && (input.is64Bit && !input.version.matches("200[38]"))
|
||||||
|
|| (input.version.matches("200[38] [RS]P?2") && !input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,16 @@ public class OpenHostingEast1TemplateBuilderLiveTest extends BaseTemplateBuilder
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.10") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
(input.family == OsFamily.WINDOWS) //
|
&& !(input.version.equals("10.10") && input.is64Bit);
|
||||||
);
|
case CENTOS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,11 +47,19 @@ public class ServerloveManchesterTemplateBuilderLiveTest extends BaseTemplateBui
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
(input.family == OsFamily.WINDOWS && !(input.version.equals("2008 R2") && input.is64Bit)) //
|
&& !(input.version.equals("10.04") && input.is64Bit);
|
||||||
);
|
case CENTOS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(input.version.equals("5.5") && input.is64Bit);
|
||||||
|
case WINDOWS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(input.version.equals("2008 R2") && input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,11 +49,17 @@ public class SkaliCloudMalaysiaTemplateBuilderLiveTest extends BaseTemplateBuild
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !input.version.equals("5.5")) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.UBUNTU && !input.version.equals("10.10")) || //
|
return !input.version.equals("") && !input.version.equals("10.10");
|
||||||
(input.family == OsFamily.WINDOWS && !(input.version.equals("2008 R2") && input.is64Bit)) //
|
case CENTOS:
|
||||||
);
|
return !input.version.equals("") && !input.version.equals("5.5");
|
||||||
|
case WINDOWS:
|
||||||
|
return !(input.version.equals("") && input.is64Bit)
|
||||||
|
&& !(input.version.equals("2008 R2") && input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,11 +49,23 @@ public class SlicehostTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return (input.family == OsFamily.RHEL || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.UBUNTU && input.version.equals("11.04")) || //
|
case UBUNTU:
|
||||||
(input.family == OsFamily.CENTOS && input.version.matches("5.[23]")) || //
|
return !input.version.equals("") && !(input.version.equals("10.04") || input.version.endsWith(".10"));
|
||||||
(input.family == OsFamily.WINDOWS && !(input.is64Bit && input.version.equals("2008 R2"))//
|
case RHEL:
|
||||||
&& !(!input.is64Bit && input.version.equals("2008 SP2"))));
|
return !(input.version.equals("") && input.is64Bit);
|
||||||
|
case CENTOS:
|
||||||
|
return !input.version.equals("") && input.version.matches("5.[23]")
|
||||||
|
|| (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;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,12 +49,23 @@ public class TerremarkECloudTemplateBuilderLiveTest extends BaseTemplateBuilderL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.CENTOS && !input.version.equals("5.5")) || //
|
case RHEL:
|
||||||
(input.family == OsFamily.UBUNTU &&( !input.version.equals("10.04")&&!input.version.equals("8.04"))) || //
|
return !input.version.equals("") && !input.version.matches("5.[50]");
|
||||||
(input.family == OsFamily.WINDOWS && (input.version.equals("2008 SP2") || input.version.equals("2008 R2"))));
|
case SOLARIS:
|
||||||
|
return !input.is64Bit;
|
||||||
|
case CENTOS:
|
||||||
|
return !input.version.equals("") && !input.version.matches("5.[50]");
|
||||||
|
case UBUNTU:
|
||||||
|
return !input.version.equals("") && !input.version.equals("10.04") && !input.version.equals("8.04");
|
||||||
|
case WINDOWS:
|
||||||
|
return !input.version.equals("") && !input.version.equals("2003 R2") //
|
||||||
|
&& !(input.version.equals("2008") && !input.is64Bit) //
|
||||||
|
&& !(input.version.matches("2008( R2)?") && input.is64Bit);
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +76,6 @@ public class TerremarkECloudTemplateBuilderLiveTest extends BaseTemplateBuilderL
|
||||||
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.CENTOS);
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -46,14 +46,22 @@ public class TerremarkVCloudExpressTemplateBuilderLiveTest extends BaseTemplateB
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
return new Predicate<OsFamilyVersion64Bit>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL || input.family == OsFamily.CENTOS) || //
|
switch (input.family) {
|
||||||
(input.family == OsFamily.UBUNTU && !input.version.equals("9.10")) || //
|
case RHEL:
|
||||||
(input.family == OsFamily.WINDOWS && (input.version.equals("2008 SP2") || input.version.equals("2008 R2"))));
|
return !input.version.equals("") && !input.version.equals("5.0");
|
||||||
|
case CENTOS:
|
||||||
|
return !input.version.equals("") && !input.version.matches("5.0");
|
||||||
|
case UBUNTU:
|
||||||
|
return !input.version.equals("") && !(input.version.equals("9.04") || input.version.equals("9.10"));
|
||||||
|
case WINDOWS:
|
||||||
|
return !input.version.equals("") && !input.version.equals("2003") //
|
||||||
|
&& !input.version.equals("2008");
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue