mirror of https://github.com/apache/jclouds.git
test expectations
This commit is contained in:
parent
0424274259
commit
b5558a25e9
|
@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -41,6 +42,7 @@ import com.google.common.base.Objects;
|
|||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Bytes;
|
||||
|
||||
/**
|
||||
* Contains options supported in the {@code ComputeService#runNode} operation on
|
||||
|
@ -88,7 +90,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
private Set<String> groupNames = ImmutableSet.of();
|
||||
private String keyPair = null;
|
||||
private boolean noKeyPair;
|
||||
private byte[] userData;
|
||||
private List<Byte> userData;
|
||||
private ImmutableSet.Builder<BlockDeviceMapping> blockDeviceMappings = ImmutableSet.builder();
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +153,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
public EC2TemplateOptions userData(byte[] unencodedData) {
|
||||
checkArgument(checkNotNull(unencodedData, "unencodedData").length <= 16 * 1024,
|
||||
"userData cannot be larger than 16kb");
|
||||
this.userData = unencodedData;
|
||||
this.userData = Bytes.asList(unencodedData);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -509,7 +511,7 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
* @return unencoded user data.
|
||||
*/
|
||||
public byte[] getUserData() {
|
||||
return userData;
|
||||
return userData == null ? null : Bytes.toArray(userData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,7 +78,8 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
|
|||
case DEBIAN:
|
||||
return true;
|
||||
case RHEL:
|
||||
return input.version.matches("5.[06]") || input.version.equals("");
|
||||
return input.version.equals("5.6") || input.version.equals("")
|
||||
|| (input.version.equals("5.0") && input.is64Bit);
|
||||
case CENTOS:
|
||||
return input.version.matches("5.[0246]") || (input.version.equals("6.0") && input.is64Bit)
|
||||
|| input.version.equals("");
|
||||
|
@ -199,26 +200,26 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
|
|||
Template fastestTemplate = view.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX)
|
||||
.build();
|
||||
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
|
||||
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2");
|
||||
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.HI1_4XLARGE);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "pv-2012.03.3");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
|
||||
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||
assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
|
||||
assertEquals(getCores(fastestTemplate.getHardware()), 16.0d);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||
|
||||
fastestTemplate = view.getComputeService().templateBuilder().fastest().build();
|
||||
System.out.println(fastestTemplate.getImage());
|
||||
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
|
||||
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "12.04");
|
||||
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.HI1_4XLARGE);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||
assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
|
||||
assertEquals(getCores(fastestTemplate.getHardware()), 16.0d);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue