mirror of https://github.com/apache/jclouds.git
refactored configuration and setup to test with build 4.1.8
This commit is contained in:
parent
af598ffeb0
commit
013c0eaf83
|
@ -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)
|
(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)
|
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.
|
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
|
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
|
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:
|
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>,
|
and choose the numberOfVirtualMachine you need using -Dtest.virtualbox.numberOfVirtualMachine=<#ofVMs>,
|
||||||
These VMs will be cloned starting from the golden template VM created before
|
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.
|
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.
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<test.virtualbox.build-version>4.1.8r75467</test.virtualbox.build-version>
|
<test.virtualbox.build-version>4.1.8r75467</test.virtualbox.build-version>
|
||||||
<test.virtualbox.identity>administrator</test.virtualbox.identity>
|
<test.virtualbox.identity>administrator</test.virtualbox.identity>
|
||||||
<test.virtualbox.credential>12345</test.virtualbox.credential>
|
<test.virtualbox.credential>12345</test.virtualbox.credential>
|
||||||
<test.virtualbox.image-id></test.virtualbox.image-id>
|
<test.virtualbox.image-id>ubuntu-11.04-server-i386</test.virtualbox.image-id>
|
||||||
<test.virtualbox.image.login-user></test.virtualbox.image.login-user>
|
<test.virtualbox.image.login-user></test.virtualbox.image.login-user>
|
||||||
<test.virtualbox.image.authenticate-sudo></test.virtualbox.image.authenticate-sudo>
|
<test.virtualbox.image.authenticate-sudo></test.virtualbox.image.authenticate-sudo>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.jclouds.virtualbox;
|
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_CREDENTIAL;
|
||||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||||
|
@ -47,9 +49,12 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
|
||||||
@Override
|
@Override
|
||||||
protected Properties defaultProperties() {
|
protected Properties defaultProperties() {
|
||||||
Properties properties = super.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_IDENTITY, "administrator");
|
||||||
properties.put(PROPERTY_CREDENTIAL, "12345");
|
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_PRESEED_URL, "http://dl.dropbox.com/u/693111/preseed.cfg");
|
||||||
properties.put(VirtualBoxConstants.VIRTUALBOX_SNAPSHOT_DESCRIPTION, "jclouds-virtualbox-snaphot");
|
properties.put(VirtualBoxConstants.VIRTUALBOX_SNAPSHOT_DESCRIPTION, "jclouds-virtualbox-snaphot");
|
||||||
properties.put(VirtualBoxConstants.VIRTUALBOX_HOSTNAME, "jclouds-virtualbox-kickstart-admin");
|
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
|
properties.put(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR, System.getProperty("user.home") + File.separator
|
||||||
+ System.getProperty("test.virtualbox.workingDir", "jclouds-virtualbox-test"));
|
+ 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");
|
properties.put(VirtualBoxConstants.VIRTUALBOX_JETTY_PORT, "8080");
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
|
|
|
@ -51,8 +51,6 @@ public interface VirtualBoxConstants {
|
||||||
|
|
||||||
public static final String VIRTUALBOX_HOST_ID = "jclouds.virtualbox.hostid";
|
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_PORT = "jclouds.virtualbox.jetty.port";
|
||||||
|
|
||||||
public static final String VIRTUALBOX_JETTY_BASE_RESOURCE = "jclouds.virtualbox.jetty.baseresource";
|
public static final String VIRTUALBOX_JETTY_BASE_RESOURCE = "jclouds.virtualbox.jetty.baseresource";
|
||||||
|
|
|
@ -22,8 +22,10 @@ package org.jclouds.virtualbox;
|
||||||
import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest;
|
import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
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.config.VirtualBoxConstants;
|
||||||
import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning;
|
import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning;
|
||||||
import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
|
import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.jclouds.virtualbox.util.PropertyUtils;
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.AfterClass;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.SessionState;
|
import org.virtualbox_4_1.SessionState;
|
||||||
import org.virtualbox_4_1.VirtualBoxManager;
|
import org.virtualbox_4_1.VirtualBoxManager;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,16 +62,42 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
|
||||||
protected ComputeServiceContext context;
|
protected ComputeServiceContext context;
|
||||||
protected VirtualBoxManager manager;
|
protected VirtualBoxManager manager;
|
||||||
protected Server jetty;
|
protected Server jetty;
|
||||||
|
protected String hostVersion;
|
||||||
@BeforeGroups(groups = { "live" })
|
protected String operatingSystemIso;
|
||||||
public void setupClient() {
|
protected String guestAdditionsIso;
|
||||||
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
|
protected String adminDisk;
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), setupProperties());
|
|
||||||
jetty = new StartJettyIfNotAlreadyRunning(port).apply(basebaseResource);
|
@Override
|
||||||
startVboxIfNotAlreadyRunning();
|
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.<Module> 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 {
|
protected void tearDown() throws Exception {
|
||||||
if (context != null)
|
if (context != null)
|
||||||
context.close();
|
context.close();
|
||||||
|
|
|
@ -42,8 +42,6 @@ import org.jclouds.net.IPSocket;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
|
import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
|
||||||
import org.jclouds.virtualbox.functions.IMachineToImage;
|
import org.jclouds.virtualbox.functions.IMachineToImage;
|
||||||
import org.testng.annotations.AfterGroups;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
import org.virtualbox_4_1.VirtualBoxManager;
|
import org.virtualbox_4_1.VirtualBoxManager;
|
||||||
|
@ -62,7 +60,7 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien
|
||||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
||||||
.getInstance(Json.class));
|
.getInstance(Json.class));
|
||||||
|
|
||||||
@BeforeGroups(groups = { "live" })
|
@Override
|
||||||
public void setupClient() {
|
public void setupClient() {
|
||||||
super.setupClient();
|
super.setupClient();
|
||||||
final VirtualBoxManager manager = getManager();
|
final VirtualBoxManager manager = getManager();
|
||||||
|
@ -132,8 +130,8 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien
|
||||||
}
|
}
|
||||||
// check state;
|
// check state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterGroups(groups = "live")
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
if (machine != null)
|
if (machine != null)
|
||||||
adapter.destroyNode(machine.getNodeId() + "");
|
adapter.destroyNode(machine.getNodeId() + "");
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.jclouds.virtualbox.domain.HardDisk;
|
||||||
import org.jclouds.virtualbox.domain.StorageController;
|
import org.jclouds.virtualbox.domain.StorageController;
|
||||||
import org.jclouds.virtualbox.domain.VmSpec;
|
import org.jclouds.virtualbox.domain.VmSpec;
|
||||||
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
||||||
import org.jclouds.virtualbox.util.PropertyUtils;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
@ -87,16 +86,15 @@ public class CloneAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends
|
||||||
private IMachine getMasterNode(VirtualBoxManager manager,
|
private IMachine getMasterNode(VirtualBoxManager manager,
|
||||||
ComputeServiceContext localHostContext) {
|
ComputeServiceContext localHostContext) {
|
||||||
try {
|
try {
|
||||||
String workingDir = PropertyUtils.getWorkingDirFromProperty();
|
|
||||||
StorageController ideController = StorageController
|
StorageController ideController = StorageController
|
||||||
.builder()
|
.builder()
|
||||||
.name(ideControllerName)
|
.name(ideControllerName)
|
||||||
.bus(StorageBus.IDE)
|
.bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, operatingSystemIso)
|
||||||
.attachHardDisk(
|
.attachHardDisk(
|
||||||
HardDisk.builder().diskpath(workingDir + "/testadmin.vdi")
|
HardDisk.builder().diskpath(adminDisk)
|
||||||
.controllerPort(0).deviceSlot(1).build())
|
.controllerPort(0).deviceSlot(1).build())
|
||||||
.attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso")
|
.attachISO(1, 1, guestAdditionsIso)
|
||||||
.build();
|
.build();
|
||||||
VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName)
|
VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName)
|
||||||
.osTypeId(osTypeId).memoryMB(512).cleanUpMode(CleanupMode.Full)
|
.osTypeId(osTypeId).memoryMB(512).cleanUpMode(CleanupMode.Full)
|
||||||
|
|
|
@ -49,8 +49,7 @@ import org.jclouds.virtualbox.domain.NatAdapter;
|
||||||
import org.jclouds.virtualbox.domain.StorageController;
|
import org.jclouds.virtualbox.domain.StorageController;
|
||||||
import org.jclouds.virtualbox.domain.VmSpec;
|
import org.jclouds.virtualbox.domain.VmSpec;
|
||||||
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
||||||
import org.jclouds.virtualbox.util.PropertyUtils;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
@ -80,18 +79,16 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
private StorageController ideController;
|
private StorageController ideController;
|
||||||
private VmSpec vmSpecification;
|
private VmSpec vmSpecification;
|
||||||
|
|
||||||
@BeforeGroups(groups = {"live"})
|
@Override
|
||||||
public void setUp() throws Exception {
|
@BeforeClass(groups = "live")
|
||||||
identity = "toor";
|
public void setupClient() {
|
||||||
credential = "password";
|
super.setupClient();
|
||||||
|
HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true)
|
||||||
String workingDir = PropertyUtils.getWorkingDirFromProperty();
|
|
||||||
HardDisk hardDisk = HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").autoDelete(true)
|
|
||||||
.controllerPort(0).deviceSlot(1).build();
|
.controllerPort(0).deviceSlot(1).build();
|
||||||
ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
|
ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, operatingSystemIso)
|
||||||
.attachHardDisk(hardDisk)
|
.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)
|
vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId)
|
||||||
.controller(ideController)
|
.controller(ideController)
|
||||||
.forceOverwrite(true)
|
.forceOverwrite(true)
|
||||||
|
|
|
@ -28,8 +28,6 @@ import org.jclouds.virtualbox.domain.HardDisk;
|
||||||
import org.jclouds.virtualbox.domain.StorageController;
|
import org.jclouds.virtualbox.domain.StorageController;
|
||||||
import org.jclouds.virtualbox.domain.VmSpec;
|
import org.jclouds.virtualbox.domain.VmSpec;
|
||||||
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
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.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
@ -47,20 +45,20 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends
|
||||||
private CleanupMode mode;
|
private CleanupMode mode;
|
||||||
private StorageController ideController;
|
private StorageController ideController;
|
||||||
|
|
||||||
@BeforeMethod
|
@Override
|
||||||
public void setUp() {
|
public void setupClient() {
|
||||||
|
super.setupClient();
|
||||||
ideControllerName = "IDE Controller";
|
ideControllerName = "IDE Controller";
|
||||||
mode = CleanupMode.Full;
|
mode = CleanupMode.Full;
|
||||||
String workingDir = PropertyUtils.getWorkingDirFromProperty();
|
|
||||||
ideController = StorageController
|
ideController = StorageController
|
||||||
.builder()
|
.builder()
|
||||||
.name(ideControllerName)
|
.name(ideControllerName)
|
||||||
.bus(StorageBus.IDE)
|
.bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, operatingSystemIso)
|
||||||
.attachHardDisk(
|
.attachHardDisk(
|
||||||
HardDisk.builder().diskpath(workingDir + "/testadmin.vdi")
|
HardDisk.builder().diskpath(adminDisk)
|
||||||
.controllerPort(0).deviceSlot(1).build())
|
.controllerPort(0).deviceSlot(1).build())
|
||||||
.attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso")
|
.attachISO(1, 1, guestAdditionsIso)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.jclouds.virtualbox.domain.HardDisk;
|
||||||
import org.jclouds.virtualbox.domain.NatAdapter;
|
import org.jclouds.virtualbox.domain.NatAdapter;
|
||||||
import org.jclouds.virtualbox.domain.StorageController;
|
import org.jclouds.virtualbox.domain.StorageController;
|
||||||
import org.jclouds.virtualbox.domain.VmSpec;
|
import org.jclouds.virtualbox.domain.VmSpec;
|
||||||
import org.jclouds.virtualbox.util.PropertyUtils;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
@ -61,11 +60,10 @@ public class UnregisterMachineIfExistsAndDeleteItsMediaTest {
|
||||||
List<IMedium> media = new ArrayList<IMedium>();
|
List<IMedium> media = new ArrayList<IMedium>();
|
||||||
List<IMedium> mediums = Collections.unmodifiableList(media);
|
List<IMedium> mediums = Collections.unmodifiableList(media);
|
||||||
|
|
||||||
String workingDir = PropertyUtils.getWorkingDirFromProperty();
|
|
||||||
StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
|
StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, "/tmp/ubuntu-11.04-server-i386.iso")
|
||||||
.attachHardDisk(HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").controllerPort(0).deviceSlot(1).build())
|
.attachHardDisk(HardDisk.builder().diskpath("/tmp/testadmin.vdi").controllerPort(0).deviceSlot(1).build())
|
||||||
.attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso").build();
|
.attachISO(1, 1, "/tmp/VBoxGuestAdditions_4.1.2.iso").build();
|
||||||
VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId)
|
VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).osTypeId(osTypeId)
|
||||||
.controller(ideController)
|
.controller(ideController)
|
||||||
.forceOverwrite(true)
|
.forceOverwrite(true)
|
||||||
|
|
|
@ -30,8 +30,7 @@ import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNot
|
||||||
import org.jclouds.virtualbox.functions.CreateAndRegisterMachineFromIsoIfNotAlreadyExists;
|
import org.jclouds.virtualbox.functions.CreateAndRegisterMachineFromIsoIfNotAlreadyExists;
|
||||||
import org.jclouds.virtualbox.functions.IMachineToVmSpec;
|
import org.jclouds.virtualbox.functions.IMachineToVmSpec;
|
||||||
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDeleteItsMedia;
|
||||||
import org.jclouds.virtualbox.util.PropertyUtils;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.CleanupMode;
|
import org.virtualbox_4_1.CleanupMode;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
|
@ -55,21 +54,20 @@ public class IsLinkedClonesLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
private StorageController masterStorageController;
|
private StorageController masterStorageController;
|
||||||
private VmSpec masterSpec;
|
private VmSpec masterSpec;
|
||||||
private VmSpec cloneSpec;
|
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()
|
HardDisk hardDisk = HardDisk.builder()
|
||||||
.diskpath(workingDir + "/testadmin.vdi").autoDelete(true)
|
.diskpath(adminDisk).autoDelete(true)
|
||||||
.controllerPort(0).deviceSlot(1).build();
|
.controllerPort(0).deviceSlot(1).build();
|
||||||
masterStorageController = StorageController.builder()
|
masterStorageController = StorageController.builder()
|
||||||
.name(ideControllerName).bus(StorageBus.IDE)
|
.name(ideControllerName).bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, operatingSystemIso)
|
||||||
.attachHardDisk(hardDisk)
|
.attachHardDisk(hardDisk)
|
||||||
.attachISO(1, 1, workingDir + "/VBoxGuestAdditions_4.1.2.iso")
|
.attachISO(1, 1, guestAdditionsIso)
|
||||||
.build();
|
.build();
|
||||||
masterSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512)
|
masterSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512)
|
||||||
.osTypeId(osTypeId).controller(masterStorageController)
|
.osTypeId(osTypeId).controller(masterStorageController)
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.jclouds.virtualbox.domain.StorageController;
|
||||||
import org.jclouds.virtualbox.domain.VmSpec;
|
import org.jclouds.virtualbox.domain.VmSpec;
|
||||||
import org.jclouds.virtualbox.functions.CreateAndInstallVm;
|
import org.jclouds.virtualbox.functions.CreateAndInstallVm;
|
||||||
import org.jclouds.virtualbox.functions.LaunchMachineIfNotAlreadyRunning;
|
import org.jclouds.virtualbox.functions.LaunchMachineIfNotAlreadyRunning;
|
||||||
import org.jclouds.virtualbox.util.PropertyUtils;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.virtualbox_4_1.IMachine;
|
import org.virtualbox_4_1.IMachine;
|
||||||
import org.virtualbox_4_1.IProgress;
|
import org.virtualbox_4_1.IProgress;
|
||||||
|
@ -71,10 +70,9 @@ public class SshAvailableLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||||
new InetSocketAddressConnect(), 10, 1, TimeUnit.SECONDS);
|
new InetSocketAddressConnect(), 10, 1, TimeUnit.SECONDS);
|
||||||
String vmId = "jclouds-image-iso-2";
|
String vmId = "jclouds-image-iso-2";
|
||||||
|
|
||||||
String workingDir = PropertyUtils.getWorkingDirFromProperty();
|
|
||||||
StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
|
StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
|
||||||
.attachISO(0, 0, workingDir + "/ubuntu-11.04-server-i386.iso")
|
.attachISO(0, 0, operatingSystemIso)
|
||||||
.attachHardDisk(HardDisk.builder().diskpath(workingDir + "/testadmin.vdi").controllerPort(0).deviceSlot(1).build()).build();
|
.attachHardDisk(HardDisk.builder().diskpath(adminDisk).controllerPort(0).deviceSlot(1).build()).build();
|
||||||
VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).osTypeId("")
|
VmSpec vmSpecification = VmSpec.builder().id(vmId).name(vmName).osTypeId("")
|
||||||
.memoryMB(512)
|
.memoryMB(512)
|
||||||
.controller(ideController)
|
.controller(ideController)
|
||||||
|
|
Loading…
Reference in New Issue