From 013c0eaf83486229acb7640a54b81302a2eb4b8d Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 5 Jan 2012 18:57:15 -0800 Subject: [PATCH] refactored configuration and setup to test with build 4.1.8 --- sandbox-apis/virtualbox/README.md | 4 +- sandbox-apis/virtualbox/pom.xml | 2 +- .../VirtualBoxPropertiesBuilder.java | 10 ++-- .../config/VirtualBoxConstants.java | 2 - .../BaseVirtualBoxClientLiveTest.java | 51 +++++++++++++++---- ...rtualBoxComputeServiceAdapterLiveTest.java | 8 ++- ...hineFromIsoIfNotAlreadyExistsLiveTest.java | 8 ++- .../functions/CreateAndInstallVmLiveTest.java | 19 +++---- ...hineFromIsoIfNotAlreadyExistsLiveTest.java | 14 +++-- ...rMachineIfExistsAndDeleteItsMediaTest.java | 8 ++- .../predicates/IsLinkedClonesLiveTest.java | 20 ++++---- .../predicates/SshAvailableLiveTest.java | 6 +-- 12 files changed, 84 insertions(+), 68 deletions(-) diff --git a/sandbox-apis/virtualbox/README.md b/sandbox-apis/virtualbox/README.md index 85aa024533..8dd154a27b 100644 --- a/sandbox-apis/virtualbox/README.md +++ b/sandbox-apis/virtualbox/README.md @@ -14,7 +14,7 @@ The "VirtualboxAdministrationTest" helper will run these preliminary steps: (this value can be overwritten directly on the commandline using -Dtest.virtualbox.workingDir) 2. Install Virtualbox from the internet (mac os x lion and ubuntu host are supported at the moment) 3. Download by default an ubuntu 11.04 server i386 ISO into "jclouds-virtualbox-test" from http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso. -4. Download VirtualBox Guest Additions ISO (tested with VBoxGuestAdditions_4.0.2-update-69551.iso) into "jclouds-virtualbox-test" +4. Download VirtualBox Guest Additions ISO into "jclouds-virtualbox-test" from http://download.virtualbox.org/virtualbox/4.1.8/VBoxGuestAdditions_4.1.8.iso 5. Disable login credential: $ VBoxManage setproperty websrvauthlibrary null 6. Start an embedded jetty server that serves a preseed file specifically written for ubuntu 11.04 7. Start webservice with increasead timeout: $ /usr/bin/vboxwebsrv --timeout 10000 and then will: @@ -36,4 +36,4 @@ To use this helper, you have to specify the name of the VM (-Dtest.virtualbox.vm and choose the numberOfVirtualMachine you need using -Dtest.virtualbox.numberOfVirtualMachine=<#ofVMs>, These VMs will be cloned starting from the golden template VM created before -It will create a "numberOfVirtualMachine" in a vbox default machine folder with 'VMName_i' name, by cloning the golden template in linked mode with a bridged NIC. \ No newline at end of file +It will create a "numberOfVirtualMachine" in a vbox default machine folder with 'VMName_i' name, by cloning the golden template in linked mode with a bridged NIC. diff --git a/sandbox-apis/virtualbox/pom.xml b/sandbox-apis/virtualbox/pom.xml index 5d3706ca4c..cdc25af787 100644 --- a/sandbox-apis/virtualbox/pom.xml +++ b/sandbox-apis/virtualbox/pom.xml @@ -39,7 +39,7 @@ 4.1.8r75467 administrator 12345 - + ubuntu-11.04-server-i386 diff --git a/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java b/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java index 91877c3d5c..83c4a435fa 100644 --- a/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java +++ b/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java @@ -19,6 +19,8 @@ package org.jclouds.virtualbox; +import static org.jclouds.Constants.PROPERTY_API_VERSION; +import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; import static org.jclouds.Constants.PROPERTY_CREDENTIAL; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_IDENTITY; @@ -47,9 +49,12 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder { @Override protected Properties defaultProperties() { Properties properties = super.defaultProperties(); + properties.put(PROPERTY_ENDPOINT, "http://localhost:18083/"); + // later version not in maven, yet + properties.put(PROPERTY_API_VERSION, "4.1.4"); + properties.put(PROPERTY_BUILD_VERSION, "4.1.8r75467"); properties.put(PROPERTY_IDENTITY, "administrator"); properties.put(PROPERTY_CREDENTIAL, "12345"); - properties.put(PROPERTY_ENDPOINT, "http://localhost:18083/"); properties.put(VirtualBoxConstants.VIRTUALBOX_PRESEED_URL, "http://dl.dropbox.com/u/693111/preseed.cfg"); properties.put(VirtualBoxConstants.VIRTUALBOX_SNAPSHOT_DESCRIPTION, "jclouds-virtualbox-snaphot"); properties.put(VirtualBoxConstants.VIRTUALBOX_HOSTNAME, "jclouds-virtualbox-kickstart-admin"); @@ -68,9 +73,6 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder { properties.put(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR, System.getProperty("user.home") + File.separator + System.getProperty("test.virtualbox.workingDir", "jclouds-virtualbox-test")); - // TODO: Add more properties and use the wired properties from test code. - properties.put(VirtualBoxConstants.VIRTUALBOX_DISTRO_ISO_NAME, "ubuntu-11.04-server-i386.iso"); - properties.put(VirtualBoxConstants.VIRTUALBOX_JETTY_PORT, "8080"); return properties; diff --git a/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java b/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java index 804718e6ab..6db1f1c237 100644 --- a/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java +++ b/sandbox-apis/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxConstants.java @@ -51,8 +51,6 @@ public interface VirtualBoxConstants { public static final String VIRTUALBOX_HOST_ID = "jclouds.virtualbox.hostid"; - public static final String VIRTUALBOX_DISTRO_ISO_NAME = "jclouds.virtualbox.distroisoname"; - public static final String VIRTUALBOX_JETTY_PORT = "jclouds.virtualbox.jetty.port"; public static final String VIRTUALBOX_JETTY_BASE_RESOURCE = "jclouds.virtualbox.jetty.baseresource"; diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index ada7ffe49b..64d70c73ff 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -22,8 +22,10 @@ package org.jclouds.virtualbox; import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest; import java.net.URI; +import java.util.Properties; import org.eclipse.jetty.server.Server; +import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContextFactory; @@ -34,13 +36,16 @@ import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.virtualbox.config.VirtualBoxConstants; import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning; import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; +import org.jclouds.virtualbox.util.PropertyUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.SessionState; import org.virtualbox_4_1.VirtualBoxManager; +import com.google.common.base.Splitter; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import com.google.inject.Module; /** @@ -57,16 +62,42 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { protected ComputeServiceContext context; protected VirtualBoxManager manager; protected Server jetty; - - @BeforeGroups(groups = { "live" }) - public void setupClient() { - context = new ComputeServiceContextFactory().createContext(provider, identity, credential, - ImmutableSet. of(new Log4JLoggingModule(), new SshjSshClientModule()), setupProperties()); - jetty = new StartJettyIfNotAlreadyRunning(port).apply(basebaseResource); - startVboxIfNotAlreadyRunning(); + protected String hostVersion; + protected String operatingSystemIso; + protected String guestAdditionsIso; + protected String adminDisk; + + @Override + protected void setupCredentials() { + // default behavior is to bomb when no user is configured, but we know the default user of vbox + Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build(); + if (!System.getProperties().containsKey("test." + provider + ".identity")) + System.setProperty("test." + provider + ".identity", defaultVBoxProperties + .getProperty(Constants.PROPERTY_IDENTITY)); + super.setupCredentials(); + // add in other properties we may need that are in defaults. + if (endpoint == null) + endpoint = defaultVBoxProperties.getProperty(Constants.PROPERTY_ENDPOINT); + if (buildVersion == null) + buildVersion = defaultVBoxProperties.getProperty(Constants.PROPERTY_BUILD_VERSION); } - @AfterGroups(groups = "live") + @BeforeClass(groups = "live") + public void setupClient() { + setupCredentials(); + Properties overrides = setupProperties(); + context = new ComputeServiceContextFactory().createContext(provider, identity, credential, + ImmutableSet. of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides); + jetty = new StartJettyIfNotAlreadyRunning(port).apply(basebaseResource); + startVboxIfNotAlreadyRunning(); + hostVersion = Iterables.get(Splitter.on('r').split(buildVersion), 0); + String workingDir = PropertyUtils.getWorkingDirFromProperty(); + adminDisk = workingDir + "/testadmin.vdi"; + operatingSystemIso = String.format("%s/%s.iso", workingDir, imageId); + guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", workingDir, hostVersion); + } + + @AfterClass(groups = "live") protected void tearDown() throws Exception { if (context != null) context.close(); diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java index 0bb1f6868b..8d899114f7 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java @@ -42,8 +42,6 @@ import org.jclouds.net.IPSocket; import org.jclouds.ssh.SshClient; import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest; import org.jclouds.virtualbox.functions.IMachineToImage; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; import org.virtualbox_4_1.IMachine; import org.virtualbox_4_1.VirtualBoxManager; @@ -62,7 +60,7 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule()) .getInstance(Json.class)); - @BeforeGroups(groups = { "live" }) + @Override public void setupClient() { super.setupClient(); final VirtualBoxManager manager = getManager(); @@ -132,8 +130,8 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien } // check state; } - - @AfterGroups(groups = "live") + + @Override protected void tearDown() throws Exception { if (machine != null) adapter.destroyNode(machine.getNodeId() + ""); diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java index 7b800eac19..f75fe09955 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java @@ -29,7 +29,6 @@ import org.jclouds.virtualbox.domain.HardDisk; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia; -import org.jclouds.virtualbox.util.PropertyUtils; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -87,16 +86,15 @@ public class CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends private IMachine getMasterNode(VirtualBoxManager manager, ComputeServiceContext localHostContext) { try { - String workingDir = PropertyUtils.getWorkingDirFromProperty(); StorageController ideController = StorageController .builder() .name(ideControllerName) .bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") + .attachISO(0, 0, operatingSystemIso) .attachHardDisk( - HardDisk.builder().diskpath(workingDir + "/testadmin.vdi") + HardDisk.builder().diskpath(adminDisk) .controllerPort(0).deviceSlot(1).build()) - .attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso") + .attachISO(1, 1, guestAdditionsIso) .build(); VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName) .osTypeId(osTypeId).memoryMB(512).cleanUpMode(CleanupMode.Full) diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 3be5c1a18f..c0ae64252b 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -49,8 +49,7 @@ import org.jclouds.virtualbox.domain.NatAdapter; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia; -import org.jclouds.virtualbox.util.PropertyUtils; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -80,18 +79,16 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { private StorageController ideController; private VmSpec vmSpecification; - @BeforeGroups(groups = {"live"}) - public void setUp() throws Exception { - identity = "toor"; - credential = "password"; - - String workingDir = PropertyUtils.getWorkingDirFromProperty(); - HardDisk hardDisk = HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").autoDelete(true) + @Override + @BeforeClass(groups = "live") + public void setupClient() { + super.setupClient(); + HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true) .controllerPort(0).deviceSlot(1).build(); ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") + .attachISO(0, 0, operatingSystemIso) .attachHardDisk(hardDisk) - .attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso").build(); + .attachISO(1, 1, guestAdditionsIso).build(); vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId) .controller(ideController) .forceOverwrite(true) diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java index f55ed62e75..5823d0c9f1 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java @@ -28,8 +28,6 @@ import org.jclouds.virtualbox.domain.HardDisk; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia; -import org.jclouds.virtualbox.util.PropertyUtils; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -47,20 +45,20 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends private CleanupMode mode; private StorageController ideController; - @BeforeMethod - public void setUp() { + @Override + public void setupClient() { + super.setupClient(); ideControllerName = "IDE Controller"; mode = CleanupMode.Full; - String workingDir = PropertyUtils.getWorkingDirFromProperty(); ideController = StorageController .builder() .name(ideControllerName) .bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") + .attachISO(0, 0, operatingSystemIso) .attachHardDisk( - HardDisk.builder().diskpath(workingDir + "/testadmin.vdi") + HardDisk.builder().diskpath(adminDisk) .controllerPort(0).deviceSlot(1).build()) - .attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso") + .attachISO(1, 1, guestAdditionsIso) .build(); } diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java index fb38eabadd..403012238a 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/functions/admin/UnregisterMachineIfExistsAndDeleteItsMediaTest.java @@ -33,7 +33,6 @@ import org.jclouds.virtualbox.domain.HardDisk; import org.jclouds.virtualbox.domain.NatAdapter; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; -import org.jclouds.virtualbox.util.PropertyUtils; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -61,11 +60,10 @@ public class UnregisterMachineIfExistsAndDeleteItsMediaTest { List media = new ArrayList(); List mediums = Collections.unmodifiableList(media); - String workingDir = PropertyUtils.getWorkingDirFromProperty(); StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") - .attachHardDisk(HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").controllerPort(0).deviceSlot(1).build()) - .attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso").build(); + .attachISO(0, 0, "/tmp/ubuntu-11.04-server-i386.iso") + .attachHardDisk(HardDisk.builder().diskpath("/tmp/testadmin.vdi").controllerPort(0).deviceSlot(1).build()) + .attachISO(1, 1, "/tmp/VBoxGuestAdditions_4.1.2.iso").build(); VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId) .controller(ideController) .forceOverwrite(true) diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IsLinkedClonesLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IsLinkedClonesLiveTest.java index 0c674cd48e..3c6bcc5ccf 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IsLinkedClonesLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IsLinkedClonesLiveTest.java @@ -30,8 +30,7 @@ import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNot import org.jclouds.virtualbox.functions.CreateAndRegisterMachineFromIsoIfNotAlreadyExists; import org.jclouds.virtualbox.functions.IMachineToVmSpec; import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia; -import org.jclouds.virtualbox.util.PropertyUtils; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -55,21 +54,20 @@ public class IsLinkedClonesLiveTest extends BaseVirtualBoxClientLiveTest { private StorageController masterStorageController; private VmSpec masterSpec; private VmSpec cloneSpec; + + @Override + @BeforeClass(groups = "live") + public void setupClient() { + super.setupClient(); - @BeforeGroups(groups = { "live" }) - public void setUp() throws Exception { - identity = "toor"; - credential = "password"; - - String workingDir = PropertyUtils.getWorkingDirFromProperty(); HardDisk hardDisk = HardDisk.builder() - .diskpath(workingDir + "/testadmin.vdi").autoDelete(true) + .diskpath(adminDisk).autoDelete(true) .controllerPort(0).deviceSlot(1).build(); masterStorageController = StorageController.builder() .name(ideControllerName).bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") + .attachISO(0, 0, operatingSystemIso) .attachHardDisk(hardDisk) - .attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso") + .attachISO(1, 1, guestAdditionsIso) .build(); masterSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512) .osTypeId(osTypeId).controller(masterStorageController) diff --git a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/SshAvailableLiveTest.java b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/SshAvailableLiveTest.java index cb629181d9..32e636b808 100644 --- a/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/SshAvailableLiveTest.java +++ b/sandbox-apis/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/SshAvailableLiveTest.java @@ -21,7 +21,6 @@ import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.CreateAndInstallVm; import org.jclouds.virtualbox.functions.LaunchMachineIfNotAlreadyRunning; -import org.jclouds.virtualbox.util.PropertyUtils; import org.testng.annotations.Test; import org.virtualbox_4_1.IMachine; import org.virtualbox_4_1.IProgress; @@ -71,10 +70,9 @@ public class SshAvailableLiveTest extends BaseVirtualBoxClientLiveTest { new InetSocketAddressConnect(), 10, 1, TimeUnit.SECONDS); String vmId = "jclouds-image-iso-2"; - String workingDir = PropertyUtils.getWorkingDirFromProperty(); StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE) - .attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso") - .attachHardDisk(HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").controllerPort(0).deviceSlot(1).build()).build(); + .attachISO(0, 0, operatingSystemIso) + .attachHardDisk(HardDisk.builder().diskpath(adminDisk).controllerPort(0).deviceSlot(1).build()).build(); VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).osTypeId("") .memoryMB(512) .controller(ideController)