issue 384: fix IsoToIMachineLiveTest

This commit is contained in:
andreaturli 2011-10-21 22:47:43 +01:00
parent 572e05d631
commit 53b652cafe
4 changed files with 7 additions and 4 deletions

View File

@ -76,6 +76,7 @@ public class IMachineToImage implements Function<IMachine, Image> {
@Override @Override
public OsFamily apply(String osDescription) { public OsFamily apply(String osDescription) {
if (osDescription.startsWith("linux")) return OsFamily.LINUX; if (osDescription.startsWith("linux")) return OsFamily.LINUX;
if (osDescription.startsWith("Ubuntu")) return OsFamily.LINUX;
return OsFamily.UNRECOGNIZED; return OsFamily.UNRECOGNIZED;
} }
}; };
@ -91,7 +92,7 @@ public class IMachineToImage implements Function<IMachine, Image> {
@Override @Override
public String apply(String osDescription) { public String apply(String osDescription) {
OsFamily family = osFamily().apply(osDescription); OsFamily family = osFamily().apply(osDescription);
if (family.equals(OsFamily.UBUNTU)) if (family.equals(OsFamily.LINUX))
return parseVersion(osDescription, UBUNTU); return parseVersion(osDescription, UBUNTU);
else else
return ""; return "";

View File

@ -66,7 +66,7 @@ public class IMachineToImageTest {
assertEquals(image.getDescription(), "my-ubuntu-machine"); assertEquals(image.getDescription(), "my-ubuntu-machine");
assertEquals(image.getOperatingSystem().getDescription(), linuxDescription); assertEquals(image.getOperatingSystem().getDescription(), linuxDescription);
assertTrue(image.getOperatingSystem().is64Bit()); assertTrue(image.getOperatingSystem().is64Bit());
assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(image.getOperatingSystem().getFamily(), OsFamily.LINUX);
assertEquals(image.getOperatingSystem().getVersion(), "10.04"); assertEquals(image.getOperatingSystem().getVersion(), "10.04");
} }

View File

@ -48,7 +48,7 @@ public class IsoToIMachineLiveTest extends BaseVirtualBoxClientLiveTest {
private String settingsFile = null; private String settingsFile = null;
private boolean forceOverwrite = true; private boolean forceOverwrite = true;
private String vmId = "jclouds-image-1"; private String vmId = "jclouds-image-iso-1";
private String osTypeId = ""; private String osTypeId = "";
private String controllerIDE = "IDE Controller"; private String controllerIDE = "IDE Controller";
private String diskFormat = ""; private String diskFormat = "";
@ -85,6 +85,7 @@ public class IsoToIMachineLiveTest extends BaseVirtualBoxClientLiveTest {
IMachineToImage iMachineToImage = new IMachineToImage(manager); IMachineToImage iMachineToImage = new IMachineToImage(manager);
Image newImage = iMachineToImage.apply(imageMachine); Image newImage = iMachineToImage.apply(imageMachine);
//TODO add the description to the cache of the images or serialize to YAML the image desc
Set<? extends Image> images = context.getComputeService().listImages(); Set<? extends Image> images = context.getComputeService().listImages();
assertTrue(any(images, equalTo(newImage))); assertTrue(any(images, equalTo(newImage)));

View File

@ -35,7 +35,8 @@ import com.google.common.collect.ImmutableMap;
* *
* @author Andrea Turli * @author Andrea Turli
*/ */
public class ImageFromYamlStreamTest extends BaseVirtualBoxClientLiveTest { @Test(groups = "unit")
public class ImageFromYamlStreamTest {
public static final Image TEST1 = new ImageBuilder() public static final Image TEST1 = new ImageBuilder()
.id("myTestId") .id("myTestId")