You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/27 17:36:39 UTC

[3/9] JCLOUDS-758 Drop VirtualBox labs provider.

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
deleted file mode 100644
index 1f1a87c..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachMediumToMachineIfNotAlreadyAttachedTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.jclouds.virtualbox.domain.DeviceDetails;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-@Test(groups = "unit", testName = "AttachMediumToMachineIfNotAlreadyAttachedTest")
-public class AttachMediumToMachineIfNotAlreadyAttachedTest {
-
-   @Test
-   public void testAttachHardDiskIfNotAttached() throws Exception {
-
-      String controllerName = "IDE Controller";
-      String diskPath = "/Users/johndoe/jclouds-virtualbox-images/admin.vdi";
-      String diskFormat = "vdi";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.createHardDisk(diskFormat, diskPath)).andReturn(hardDisk);
-      expect(hardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      machine.saveSettings();
-      replay(manager, machine, vBox, hardDisk);
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath(diskPath)
-                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test
-   public void testDoNothingIfAlreadyAttachedAttachHardDisk() throws Exception {
-
-      String controllerName = "IDE Controller";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Medium '/Users/mattias/jclouds-virtualbox-test/testadmin.vdi' ");
-      errorBuilder.append("is already attached to port 0, device 1 of controller 'IDE Controller' ");
-      errorBuilder.append("of this virtual machine (0x80BB000C)");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class),
-              isoAlreadyAttachedException);
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(manager, machine, vBox, hardDisk);
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath("/Users/mattias/jclouds-virtualbox-test/testadmin.vdi")
-                                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxError() throws Exception {
-
-      String controllerName = "IDE Controller";
-      int controllerPort = 0;
-      int deviceSlot = 1;
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium hardDisk = createNiceMock(IMedium.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Some other VBox error");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class),
-              isoAlreadyAttachedException);
-      machine.attachDevice(controllerName, controllerPort, deviceSlot, DeviceType.HardDisk, hardDisk);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(manager, machine, vBox, hardDisk);
-
-
-      StorageController controller = StorageController.builder()
-              .name(controllerName)
-              .bus(StorageBus.IDE)
-              .attachHardDisk(HardDisk.builder().diskpath("/Users/mattias/jclouds-virtualbox-test/testadmin.vdi")
-                    .controllerPort(controllerPort).deviceSlot(deviceSlot).build())
-              .build();
-
-      DeviceDetails deviceDetails = getOnlyElement(controller.getHardDisks()).getDeviceDetails();
-      new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, hardDisk, controllerName).apply(machine);
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
deleted file mode 100644
index 9a17acb..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/AttachNATAdapterToMachineIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.virtualbox_4_2.NATProtocol.TCP;
-import static org.virtualbox_4_2.NetworkAttachmentType.NAT;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INATEngine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "AttachNATAdapterToMachineIfNotAlreadyExistsTest")
-public class AttachNATAdapterToMachineIfNotAlreadyExistsTest {
-
-	@Test
-	public void testApplyNetworkingToNonExistingAdapter() throws Exception {
-		Long slotId = 0l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		expect(machine.getNetworkAdapter(slotId)).andReturn(iNetworkAdapter);
-		iNetworkAdapter.setAttachmentType(NAT);
-		expect(iNetworkAdapter.getNATEngine()).andReturn(natEngine).anyTimes();
-
-		List<String> redirects = Lists.newArrayList();
-		expect(natEngine.getRedirects()).andReturn(redirects);
-		natEngine.addRedirect("TCP@127.0.0.1:2222->:22", TCP, "127.0.0.1",
-				2222, "", 22);
-		iNetworkAdapter.setEnabled(true);
-		machine.saveSettings();
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-	@Test
-	public void testApplySkipsWhenAlreadyExists() throws Exception {
-		Long slotId = 0l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		expect(machine.getNetworkAdapter(slotId)).andReturn(iNetworkAdapter);
-		iNetworkAdapter.setAttachmentType(NAT);
-		expect(iNetworkAdapter.getNATEngine()).andReturn(natEngine).anyTimes();
-
-		List<String> redirects = Lists.newArrayList();
-		expect(natEngine.getRedirects()).andReturn(redirects);
-
-		natEngine.addRedirect("TCP@127.0.0.1:2222->:22", TCP, "127.0.0.1",
-				2222, "", 22);
-		expectLastCall()
-				.andThrow(
-						new VBoxException(null,
-								"VirtualBox error: A NAT rule of this name already exists (0x80070057)"));
-
-		iNetworkAdapter.setEnabled(true);
-		machine.saveSettings();
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-	@Test(enabled = false, expectedExceptions = VBoxException.class)
-	public void testRethrowInvalidAdapterSlotException() throws Exception {
-		Long slotId = 30l;
-		IMachine machine = createMock(IMachine.class);
-		INetworkAdapter iNetworkAdapter = createMock(INetworkAdapter.class);
-		INATEngine natEngine = createMock(INATEngine.class);
-
-		String error = "VirtualBox error: Argument slot is invalid "
-				+ "(must be slot < RT_ELEMENTS(mNetworkAdapters)) (0x80070057)";
-
-		VBoxException invalidSlotException = new VBoxException(
-				createNiceMock(Throwable.class), error);
-		expect(machine.getNetworkAdapter(slotId))
-				.andThrow(invalidSlotException);
-
-		replay(machine, iNetworkAdapter, natEngine);
-		NetworkAdapter networkAdapter = NetworkAdapter.builder()
-				.networkAttachmentType(NetworkAttachmentType.NAT)
-				.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-		NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
-				.builder().addNetworkAdapter(networkAdapter).build();
-		new AttachNATAdapterToMachineIfNotAlreadyExists(networkInterfaceCard)
-				.apply(machine);
-
-		verify(machine, iNetworkAdapter, natEngine);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
deleted file mode 100644
index d7238e7..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/BridgedIfStringToBridgedIfTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.virtualbox.domain.BridgedIf;
-import org.testng.annotations.Test;
-
-@Test(groups = "live", singleThreaded = true, testName = "BridgedIfStringToBridgedIfTest")
-public class BridgedIfStringToBridgedIfTest {
-		
-	private static final String en0 = "Name:            en0: Ethernet\n" +
-	"GUID:            00306e65-0000-4000-8000-3c0754205d2f\n" + 
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.56.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 3c:07:54:20:5d:2f\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Up\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-en0: Ethernet\n";
-
-	private static final String en1 = "Name:            en1: Wi-Fi (AirPort)\n" +
-	"GUID:            00316e65-0000-4000-8000-28cfdaf2917a\n" +
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.57.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 28:cf:da:f2:91:7a\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Up\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-en1: Wi-Fi (AirPort)\n";
-
-	private static final String p2p0 = "Name:            p2p0\n" +
-	"GUID:            30703270-0000-4000-8000-0acfdaf2917a\n" +
-	"Dhcp:            Disabled\n" +
-	"IPAddress:       192.168.58.1\n" +
-	"NetworkMask:     255.255.255.0\n" +
-	"IPV6Address:     \n" +
-	"IPV6NetworkMaskPrefixLength: 0\n" +
-	"HardwareAddress: 0a:cf:da:f2:91:7a\n" +
-	"MediumType:      Ethernet\n" +
-	"Status:          Down\n" +
-	"VBoxNetworkName: HostInterfaceNetworking-p2p0\n";
-
-	@Test
-	public void transformRawBridgedifToBridgedIf() {
-		BridgedIf bridgedIfEn1 = new BridgedIfStringToBridgedIf().apply(en1);
-	      assertEquals(bridgedIfEn1.getName(), "en1: Wi-Fi (AirPort)");
-	}
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index b1c900e..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest")
-public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private MasterSpec machineSpec;
-   private String instanceName;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController.builder()
-                                                         .name("IDE Controller")
-                                                         .bus(StorageBus.IDE)
-                                                         .attachISO(0, 0, operatingSystemIso)
-                                                         .attachHardDisk(HardDisk.builder()
-                                                                                 .diskpath(adminDisk(instanceName))
-                                                                                 .controllerPort(0)
-                                                                                 .deviceSlot(1)
-                                                                                 .autoDelete(true)
-                                                                                 .build())
-                                                         .attachISO(1, 1, guestAdditionsIso)
-                                                         .build();
-
-      VmSpec instanceVmSpec = VmSpec.builder()
-                                    .id(instanceName)
-                                    .name(instanceName)
-                                    .osTypeId("")
-                                    .memoryMB(512)
-                                    .cleanUpMode(CleanupMode.Full)
-                                    .controller(ideController)
-                                    .forceOverwrite(true)
-                                    .build();
-
-      IsoSpec isoSpec = IsoSpec.builder()
-                               .sourcePath(operatingSystemIso)
-                               .installationScript(keystrokeSequence)
-                               .build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder()
-                                                    .networkAttachmentType(NetworkAttachmentType.NAT)
-                                                    .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder()
-                                                                      .addNetworkAdapter(networkAdapter)
-                                                                      .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder()
-                                           .addNIC(networkInterfaceCard)
-                                           .build();
-      machineSpec = MasterSpec.builder()
-                              .iso(isoSpec)
-                              .vm(instanceVmSpec)
-                              .network(networkSpec)
-                              .build();
-   }
-   
-   @Test
-   public void testCloneMachineFromAnotherMachine() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-               .master(source).linked(true).build();
-      IMachine clone = checkNotNull(
-              new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-                                .apply(cloneSpec), "clone");
-      assertEquals(clone.getName(), cloneSpec.getVmSpec().getVmName());
-
-   }
-
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         // already created
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-   
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
deleted file mode 100644
index 863158f..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.location.Provider;
-import org.jclouds.ssh.SshClient;
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.CloneSpec;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.predicates.SshResponds;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CreateAndInstallVmLiveTest")
-public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   private Injector injector;
-   private Function<IMachine, SshClient> sshClientForIMachine;
-   private Predicate<SshClient> sshResponds;
-   
-   private MasterSpec machineSpec;
-   private String instanceName;
-   
-   @Inject 
-   @Provider
-   protected Supplier<URI> providerSupplier;
-
-   @Override
-   @BeforeClass(groups = "live")
-   public void setupContext() {
-      super.setupContext();
-      instanceName = VIRTUALBOX_IMAGE_PREFIX
-               + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
-
-      StorageController ideController = StorageController
-               .builder()
-               .name("IDE Controller")
-               .bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(
-                        HardDisk.builder().diskpath(adminDisk(instanceName)).controllerPort(0).deviceSlot(1)
-                                 .autoDelete(true).build()).attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec instanceVmSpec = VmSpec.builder().id(instanceName).name(instanceName).osTypeId("").memoryMB(512)
-               .cleanUpMode(CleanupMode.Full).controller(ideController).forceOverwrite(true).build();
-
-      injector = view.utils().injector();
-      IsoSpec isoSpec = IsoSpec
-               .builder()
-               .sourcePath(operatingSystemIso)
-               .installationScript(keystrokeSequence).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
-               .build();
-      NetworkInterfaceCard networkInterfaceCard =  NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-            .addHostInterfaceName("vboxnet0").slot(0L).build();
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
-   }
-
-   @Test
-   public void testGuestAdditionsAreInstalled() throws Exception {
-      try {
-         IMachine machine = cloneFromMaster();
-         machineController.ensureMachineIsLaunched(machine.getName());
-
-         sshClientForIMachine = injector.getInstance(IMachineToSshClient.class);
-         SshClient client = sshClientForIMachine.apply(machine);
-
-         sshResponds = injector.getInstance(SshResponds.class);
-         checkState(sshResponds.apply(client), "timed out waiting for guest %s to be accessible via ssh",
-                  machine.getName());
-
-         String version = machine.getGuestPropertyValue("/VirtualBox/GuestAdd/Version");
-         
-         assertTrue(version != null && !version.isEmpty());
-      } finally {
-         for (VmSpec spec : ImmutableSet.of(machineSpec.getVmSpec())) {
-            machineController.ensureMachineIsShutdown(spec.getVmName());
-         }
-      }
-   }
-
-   private IMachine cloneFromMaster() {
-      IMachine source = getVmWithGuestAdditionsInstalled();
-      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
-               .master(source).linked(true).build();
-      return new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
-               .apply(cloneSpec);
-   }
-   
-   private IMachine getVmWithGuestAdditionsInstalled() {
-      MasterSpec masterSpecForTest = super.getMasterSpecForTest();
-      try {
-         Injector injector = view.utils().injector();
-         return injector.getInstance(CreateAndInstallVm.class).apply(masterSpecForTest);
-      } catch (IllegalStateException e) {
-         return manager.get().getVBox().findMachine(masterSpecForTest.getVmSpec().getVmId());
-      }
-   }
-
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      for (String vmName : ImmutableSet.of(instanceName)) {
-         undoVm(vmName);
-      }
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index 9a982e1..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.util.UUID;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkAdapter;
-import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-
-import com.google.inject.Injector;
-
-@Test(groups = "live", singleThreaded = true, testName = "CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest")
-public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   private String ideControllerName;
-   private CleanupMode mode;
-   private String vmName = "";
-
-   @Override
-   public void setupContext() {
-      super.setupContext();
-      ideControllerName = "IDE Controller";
-      mode = CleanupMode.Full;
-   }
-
-   @Test
-   public void testCreateNewMachine() throws Exception {
-      vmName = "jclouds-test-create-1-node";
-      String vmId = UUID.randomUUID().toString();
-
-      StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(HardDisk.builder().diskpath(adminDisk(vmName)).controllerPort(0).deviceSlot(1).build())
-               .attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).controller(ideController).cleanUpMode(mode)
-               .osTypeId("Debian").forceOverwrite(true).build();
-
-      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
-               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
-      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
-               .build();
-
-      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
-
-      MasterSpec machineSpec = MasterSpec.builder()
-               .iso(IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build()).vm(vmSpec)
-               .network(networkSpec).build();
-      IMachine debianNode = view.utils().injector()
-               .getInstance(CreateAndRegisterMachineFromIsoIfNotAlreadyExists.class).apply(machineSpec);
-      IMachine machine = manager.get().getVBox().findMachine(vmName);
-      assertEquals(debianNode.getName(), machine.getName());
-      undoVm(vmName);
-
-   }
-
-   @Test
-   public void testCreateNewMachineWithBadOsType() throws Exception {
-      vmName = "jclouds-test-create-2-node";
-      String vmId = UUID.randomUUID().toString();
-
-      StorageController ideController = StorageController.builder().name(ideControllerName).bus(StorageBus.IDE)
-               .attachISO(0, 0, operatingSystemIso)
-               .attachHardDisk(HardDisk.builder().diskpath(adminDisk(vmName)).controllerPort(0).deviceSlot(1).build())
-               .attachISO(1, 1, guestAdditionsIso).build();
-
-      VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).controller(ideController).cleanUpMode(mode)
-               .osTypeId("SomeWeirdUnknownOs").forceOverwrite(true).build();
-      IsoSpec isoSpec = IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build();
-      NetworkSpec networkSpec = NetworkSpec.builder().build();
-      MasterSpec machineSpec = MasterSpec.builder().iso(isoSpec).vm(vmSpec).network(networkSpec).build();
-      try {
-         Injector injector = view.utils().injector();
-         injector.getInstance(CreateAndRegisterMachineFromIsoIfNotAlreadyExists.class).apply(machineSpec);
-         fail();
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         // According to the documentation VBOX_E_OBJECT_NOT_FOUND
-         // if osTypeId is not found.
-         assertEquals(errorCode, ErrorCode.VBOX_E_OBJECT_NOT_FOUND);
-      }
-      undoVm(vmName);
-   }
-   
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      super.tearDownContext();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
deleted file mode 100644
index 889115c..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.jclouds.virtualbox.domain.IsoSpec;
-import org.jclouds.virtualbox.domain.MasterSpec;
-import org.jclouds.virtualbox.domain.NetworkSpec;
-import org.jclouds.virtualbox.domain.StorageController;
-import org.jclouds.virtualbox.domain.VmSpec;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.CleanupMode;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.StorageBus;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.beust.jcommander.internal.Lists;
-import com.google.common.base.Suppliers;
-
-@Test(groups = "unit", testName = "CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest")
-public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsTest {
-
-   @Test(enabled = false)
-   public void testCreateAndSetMemoryWhenNotAlreadyExists() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-      VirtualBoxManager manager = createMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      String vmName = "jclouds-image-my-ubuntu-image";
-      StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE).build();
-      VmSpec vmSpec = VmSpec.builder().id(vmName).name(vmName).osTypeId("").memoryMB(1024).controller(ideController)
-            .cleanUpMode(CleanupMode.Full).build();
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("").build()).vm(vmSpec)
-            .network(NetworkSpec.builder().build()).build();
-      IMachine createdMachine = createMock(IMachine.class);
-      ISession session = createMock(ISession.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      String flags = "";
-      List<String> groups = Lists.newArrayList();
-      String group = "";
-      expect(vBox.composeMachineFilename(vmName, group, flags, "/tmp/workingDir")).andReturn("settingsFile");
-
-      StringBuilder errorMessageBuilder = new StringBuilder();
-      errorMessageBuilder.append("VirtualBox error: Could not find a registered machine with UUID {");
-      errorMessageBuilder.append("'jclouds-image-virtualbox-iso-to-machine-test'} (0x80BB0001)");
-      String errorMessage = errorMessageBuilder.toString();
-      VBoxException vBoxException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-
-      expect(vBox.findMachine(vmName)).andThrow(vBoxException);
-
-      expect(vBox.createMachine(anyString(), eq(vmName), groups, anyString(), anyString())).andReturn(createdMachine)
-            .anyTimes();
-      vBox.registerMachine(createdMachine);
-
-      expect(vBox.findMachine(vmName)).andReturn(createdMachine).anyTimes();
-      expect(manager.getSessionObject()).andReturn(session);
-      expect(session.getMachine()).andReturn(createdMachine);
-      createdMachine.lockMachine(session, LockType.Write);
-      createdMachine.setMemorySize(1024l);
-      createdMachine.saveSettings();
-      session.unlockMachine();
-
-      // TODO: this mock test is not finished.
-      replay(manager, createdMachine, vBox, session);
-
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-
-      verify(manager, createdMachine, vBox, session);
-   }
-
-   @Test(expectedExceptions = IllegalStateException.class)
-   public void testFailIfMachineIsAlreadyRegistered() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      String vmName = "jclouds-image-my-ubuntu-image";
-
-      IMachine registeredMachine = createMock(IMachine.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.findMachine(vmName)).andReturn(registeredMachine).anyTimes();
-
-      replay(manager, vBox, machineUtils);
-
-      VmSpec launchSpecification = VmSpec.builder().id(vmName).name(vmName).osTypeId("").memoryMB(1024)
-            .cleanUpMode(CleanupMode.Full).build();
-
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("dostuff").build())
-            .vm(launchSpecification).network(NetworkSpec.builder().build()).build();
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailIfOtherVBoxExceptionIsThrown() throws Exception {
-
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      String vmName = "jclouds-image-my-ubuntu-image";
-
-      String errorMessage = "VirtualBox error: Some other VBox error";
-      VBoxException vBoxException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      vBox.findMachine(vmName);
-      expectLastCall().andThrow(vBoxException);
-
-      replay(manager, vBox, machineUtils);
-
-      VmSpec launchSpecification = VmSpec.builder().id(vmName).name(vmName).osTypeId("").cleanUpMode(CleanupMode.Full)
-            .memoryMB(1024).build();
-      MasterSpec machineSpec = MasterSpec.builder()
-            .iso(IsoSpec.builder().sourcePath("some.iso").installationScript("dostuff").build())
-            .vm(launchSpecification).network(NetworkSpec.builder().build()).build();
-
-      new CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils,
-            "/tmp/workingDir").apply(machineSpec);
-
-   }
-
-   private String anyString() {
-      return EasyMock.<String> anyObject();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
deleted file mode 100644
index 42bc5b8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsLiveTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.File;
-
-import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest;
-import org.jclouds.virtualbox.domain.ErrorCode;
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.VBoxException;
-
-public class CreateMediumIfNotAlreadyExistsLiveTest extends BaseVirtualBoxClientLiveTest {
-
-   @Test
-   public void testCreateMedium() throws Exception {
-      String path = System.getProperty("user.home") + "/jclouds-virtualbox-test/test-medium-1.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      IMedium iMedium = new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      manager.get().getVBox().openMedium(path, DeviceType.HardDisk, AccessMode.ReadWrite, true);
-      try {
-         assertFileCanBeDeleted(path);
-      } finally {
-         deleteMediumAndBlockUntilComplete(iMedium);
-      }
-   }
-
-   @Test
-   public void testCreateMediumFailWhenUsingNonFullyQualifiedPath() throws Exception {
-      String path = "test-medium-2.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      try {
-         new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-         fail();
-      } catch (VBoxException e) {
-         ErrorCode errorCode = ErrorCode.valueOf(e);
-         assertEquals(errorCode, ErrorCode.VBOX_E_FILE_ERROR);
-      }
-   }
-
-   @Test
-   public void testCreateSameMediumTwiceWhenUsingOverwrite() throws Exception {
-      String path = System.getProperty("user.home") + "/jclouds-virtualbox-test/test-medium-3.vdi";
-      HardDisk hardDisk = HardDisk.builder().diskpath(path).controllerPort(0).deviceSlot(0).build();
-      new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      IMedium iMedium = new CreateMediumIfNotAlreadyExists(manager, machineUtils, true).apply(hardDisk);
-      manager.get().getVBox().openMedium(path, DeviceType.HardDisk, AccessMode.ReadWrite, true);
-      try {
-         assertFileCanBeDeleted(path);
-      } finally {
-         deleteMediumAndBlockUntilComplete(iMedium);
-      }
-   }
-
-   private void assertFileCanBeDeleted(String path) {
-      File file = new File(path);
-      boolean mediumDeleted = file.delete();
-      assertTrue(mediumDeleted);
-   }
-
-   void deleteMediumAndBlockUntilComplete(IMedium medium) {
-      final IProgress progress = medium.deleteStorage();
-      progress.waitForCompletion(-1);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
deleted file mode 100644
index 1fbafe3..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateMediumIfNotAlreadyExistsTest.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertNotSame;
-
-import org.jclouds.virtualbox.domain.HardDisk;
-import org.jclouds.virtualbox.util.MachineUtils;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.AccessMode;
-import org.virtualbox_4_2.DeviceType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IMedium;
-import org.virtualbox_4_2.IMediumAttachment;
-import org.virtualbox_4_2.IProgress;
-import org.virtualbox_4_2.ISession;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.LockType;
-import org.virtualbox_4_2.VBoxException;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-
-public class CreateMediumIfNotAlreadyExistsTest {
-   
-   private String adminDiskPath;
-   private String diskFormat;
-
-   @BeforeMethod
-   public void setUp() throws Exception {
-      adminDiskPath = "/Users/johndoe/jclouds-virtualbox-images/admin.vdi";
-      diskFormat = "vdi";
-   }
-
-   @Test
-   public void testCreateMediumWhenDiskDoesNotExists() throws Exception {
-
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("org.virtualbox_4_2.VBoxException: VirtualBox error: ");
-      errorBuilder.append("Could not find file for the medium ");
-      errorBuilder.append("'/Users/johndoe/jclouds-virtualbox-test/testadmin.vdi' (0x80BB0001)");
-      String errorMessage = errorBuilder.toString();
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      VBoxException notFoundException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andThrow(notFoundException);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(medium);
-      expect(medium.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-      //expect(machineUtils.writeLockMachineAndApply(anyString(), new DetachDistroMediumFromMachine(anyString(), anyInt() , anyInt()))).andReturn().anyTimes();
-
-      replay(manager, machine, vBox, medium, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, vBox);
-
-   }
-
-   @Test
-   public void testDeleteAndCreateNewStorageWhenMediumExistsAndUsingOverwrite() throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      expect(medium.deleteStorage()).andReturn(progress);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(newHardDisk);
-      expect(newHardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      //expect(machineUtils.writeLockMachineAndApply(anyString(), new DetachDistroMediumFromMachine(anyString(), anyInt() , anyInt()))).andReturn(v).anyTimes();
-
-      replay(manager, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      IMedium newDisk =  new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, vBox, medium);
-      assertNotSame(newDisk, medium);
-   }
-
-   @Test(enabled = false)
-   public void testDeleteAndCreateNewStorageWhenMediumExistsAndUsingOverwriteAndStillAttachedDetachesOldThing()
-            throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      String oldMachineId = "a1e03931-29f3-4370-ada3-9547b1009212";
-      String oldMachineName = "oldMachine";
-      IMachine oldMachine = createMock(IMachine.class);
-      IMediumAttachment oldAttachment = createMock(IMediumAttachment.class);
-      String oldAttachmentController = "oldAttachmentController";
-      int oldAttachmentDevice = 1;
-      int oldAttachmentPort = 2;
-      IMedium oldMedium = createMock(IMedium.class);
-      String oldMediumId = "oldMediumId";
-      ISession detachSession = createNiceMock(ISession.class);
-
-      StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("org.virtualbox_4_2.VBoxException: VirtualBox error: ");
-      errorBuilder.append("Cannot delete storage: medium '/Users/adriancole/jclouds-virtualbox-test/testadmin.vdi ");
-      errorBuilder.append("is still attached to the following 1 virtual machine(s): ");
-      errorBuilder.append(oldMachineId + " (0x80BB000C)");
-      String errorMessage = errorBuilder.toString();
-
-      VBoxException stillAttached = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(medium.deleteStorage()).andThrow(stillAttached);
-
-      expect(vBox.findMachine(oldMachineId)).andReturn(oldMachine);
-      expect(oldMachine.getMediumAttachments()).andReturn(ImmutableList.of(oldAttachment));
-      expect(oldAttachment.getMedium()).andReturn(oldMedium);
-      expect(oldMedium.getId()).andReturn(oldMediumId);
-      // in this case, they are the same medium, so safe to detach
-      expect(medium.getId()).andReturn(oldMediumId);
-      expect(oldMachine.getName()).andReturn(oldMachineName);
-      expect(oldAttachment.getController()).andReturn(oldAttachmentController);
-      expect(oldAttachment.getDevice()).andReturn(oldAttachmentDevice);
-      expect(oldAttachment.getPort()).andReturn(oldAttachmentPort);
-      // TODO: is this ok that we searched by ID last time?
-      expect(vBox.findMachine(oldMachineName)).andReturn(oldMachine);
-      expect(manager.getSessionObject()).andReturn(detachSession);
-      oldMachine.lockMachine(detachSession, LockType.Write);
-      expect(detachSession.getMachine()).andReturn(oldMachine);
-      oldMachine.detachDevice(oldAttachmentController, oldAttachmentPort, oldAttachmentDevice);
-      oldMachine.saveSettings();
-
-      expect(medium.deleteStorage()).andReturn(progress);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(newHardDisk);
-      expect(newHardDisk.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      replay(manager, oldMachine, oldAttachment, oldMedium, detachSession, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      IMedium newDisk = new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-
-      verify(machine, oldMachine, oldAttachment, detachSession, oldMedium, vBox, medium);
-      assertNotSame(newDisk, medium);
-   }
-
-   @Test(expectedExceptions = IllegalStateException.class)
-   public void testFailWhenMediumExistsAndNotUsingOverwrite() throws Exception {
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IMedium newHardDisk = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andReturn(medium);
-
-      replay(manager, machine, vBox, medium, newHardDisk, progress, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, false).apply(hardDisk);
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxException() throws Exception {
-
-      HardDisk hardDisk = createTestHardDisk();
-
-      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
-      MachineUtils machineUtils = createMock(MachineUtils.class);
-
-      IMachine machine = createMock(IMachine.class);
-      IVirtualBox vBox = createMock(IVirtualBox.class);
-      IMedium medium = createMock(IMedium.class);
-      IProgress progress = createNiceMock(IProgress.class);
-
-      String errorMessage = "VirtualBox error: Some other VBox error";
-
-      expect(manager.getVBox()).andReturn(vBox).anyTimes();
-
-      VBoxException notFoundException = new VBoxException(createNiceMock(Throwable.class), errorMessage);
-      expect(vBox.openMedium(adminDiskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false)).andThrow(notFoundException);
-      expect(vBox.createHardDisk(diskFormat, adminDiskPath)).andReturn(medium);
-      expect(medium.createBaseStorage(anyLong(), anyLong())).andReturn(progress);
-
-      replay(manager, machine, vBox, medium, machineUtils);
-
-      new CreateMediumIfNotAlreadyExists(Suppliers.ofInstance(manager), machineUtils, true).apply(hardDisk);
-   }
-
-   private HardDisk createTestHardDisk() {
-      return HardDisk.builder().diskpath(adminDiskPath).controllerPort(0).deviceSlot(0).build();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
deleted file mode 100644
index 0bfbc07..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/DetachDistroMediumFromMachineTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.VBoxException;
-
-@Test(groups = "unit", testName = "DetachDistroMediumFromMachineTest")
-public class DetachDistroMediumFromMachineTest {
-
-   @Test
-   public void testDetachDistroMedium() throws Exception {
-
-      String controller = "IDE Controller";
-      IMachine machine = createMock(IMachine.class);
-
-      int controllerPort = 0;
-      int device = 1;
-
-      machine.saveSettings();
-      machine.detachDevice(controller, controllerPort, device);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controller, controllerPort, device).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test
-   public void testAcceptAlreadyDetachedDistroMedium() throws Exception {
-
-      String controller = "IDE Controller";
-
-      IMachine machine = createNiceMock(IMachine.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Medium '/Users/johndoe/jclouds-virtualbox-test/ubuntu-11.04-server-i386.iso' ");
-      errorBuilder.append("is already detached from port 0, device 0 of controller 'IDE Controller' ");
-      errorBuilder.append("of this virtual machine (0x80BB000C)");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      int controllerPort = 0;
-      int device = 1;
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class), isoAlreadyAttachedException);
-      machine.detachDevice(controller, controllerPort, device);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controller, controllerPort, device).apply(machine);
-
-      verify(machine);
-
-   }
-
-   @Test(expectedExceptions = VBoxException.class)
-   public void testFailOnOtherVBoxErrors() throws Exception {
-
-      String controllerName = "IDE Controller";
-
-      IMachine machine = createNiceMock(IMachine.class);
-
-      final StringBuilder errorBuilder = new StringBuilder();
-      errorBuilder.append("VirtualBox error: ");
-      errorBuilder.append("Some other VBox error");
-      String isoAlreadyAttachedException = errorBuilder.toString();
-
-      int controllerPort = 0;
-      int device = 1;
-
-      VBoxException isoAttachedException = new VBoxException(createNiceMock(Throwable.class), isoAlreadyAttachedException);
-      machine.detachDevice(controllerName, controllerPort, device);
-      expectLastCall().andThrow(isoAttachedException);
-
-      replay(machine);
-
-      new DetachDistroMediumFromMachine(controllerName, controllerPort, device).apply(machine);
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
deleted file mode 100644
index 2475815..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToHardwareTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-
-@Test(groups = "unit")
-public class IMachineToHardwareTest {
-
-   @Test
-   public void testConvert() throws Exception {
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-
-      String linuxDescription = "Ubuntu Linux 10.04";
-      String machineName = "hw-machineId";
-
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getName()).andReturn(machineName).anyTimes();
-
-      expect(vm.getDescription()).andReturn(linuxDescription).anyTimes();
-
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vbm.getVBox()).andReturn(vBox);
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      Hardware hardware = new IMachineToHardware(Suppliers.ofInstance(vbm)).apply(vm);
-
-      assertEquals(hardware.getId(), machineName);
-      assertEquals(hardware.getProviderId(), machineName);
-      // for starters assume 1-to-1 relationship hardware to image (which
-      // correlate to a single source IMachine)
-      assertEquals(hardware.supportsImage().toString(), ImagePredicates.idEquals(machineName).toString());
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
deleted file mode 100644
index 3f9f7e8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToImageTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Map;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-import org.jclouds.virtualbox.config.VirtualBoxConstants;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.inject.Guice;
-
-@Test(groups = "unit", testName = "IMachineToImageTest")
-public class IMachineToImageTest {
-
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   @Test
-   public void testConvert() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-      String linuxDescription = "Ubuntu 10.04";
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getDescription()).andReturn("my-ubuntu-machine").anyTimes();
-      expect(guestOsType.getDescription()).andReturn(linuxDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vm.getState()).andReturn(MachineState.PoweredOff);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getDescription(), "my-ubuntu-machine");
-      assertEquals(image.getOperatingSystem().getDescription(), linuxDescription);
-      assertTrue(image.getOperatingSystem().is64Bit());
-      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
-      assertEquals(image.getOperatingSystem().getVersion(), "10.04");
-      assertEquals(image.getId(), "my-vm-id");
-      assertEquals(image.getStatus(), Image.Status.AVAILABLE);
-
-   }
-
-   @Test
-   public void testConvert1() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-      String guestOsDescription = "ubuntu 11.04 server (i386)";
-      String vmDescription = "ubuntu-11.04-server-i386";
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getDescription()).andReturn(vmDescription).anyTimes();
-      expect(guestOsType.getDescription()).andReturn(guestOsDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vm.getState()).andReturn(MachineState.Running);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getDescription(), vmDescription);
-      assertEquals(image.getOperatingSystem().getDescription(), guestOsDescription);
-      assertTrue(image.getOperatingSystem().is64Bit());
-      assertEquals(image.getOperatingSystem().getFamily(), OsFamily.UBUNTU);
-      assertEquals(image.getOperatingSystem().getVersion(), "11.04");
-      assertEquals(image.getId(), "my-vm-id");
-      assertEquals(image.getStatus(), Image.Status.PENDING);
-
-   }
-
-   @Test
-   public void testUnparseableOsString() throws Exception {
-
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IMachine vm = createNiceMock(IMachine.class);
-      IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
-
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-
-      expect(vm.getName()).andReturn(VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX + "my-vm-id").anyTimes();
-      String unknownOsDescription = "SomeOtherOs 2.04";
-      expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
-      expect(vm.getDescription()).andReturn("my-unknown-machine").anyTimes();
-      expect(guestOsType.getDescription()).andReturn(unknownOsDescription).anyTimes();
-      expect(guestOsType.getIs64Bit()).andReturn(true);
-      expect(vBox.getGuestOSType(eq("os-type"))).andReturn(guestOsType);
-      expect(vm.getState()).andReturn(MachineState.PoweredOff);
-
-      replay(vbm, vBox, vm, guestOsType);
-
-      IMachineToImage fn = new IMachineToImage(VirtualBoxComputeServiceContextModule.toPortableImageStatus, Suppliers
-               .ofInstance(vbm), map);
-
-      Image image = fn.apply(vm);
-
-      assertEquals(image.getOperatingSystem().getDescription(), "SomeOtherOs 2.04");
-      assertEquals(image.getOperatingSystem().getVersion(), "");
-      assertEquals(image.getId(), "my-vm-id");
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/75178c77/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java b/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
deleted file mode 100644
index 66288f8..0000000
--- a/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.virtualbox.functions;
-
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_NAME_SEPARATOR;
-import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.jclouds.compute.config.BaseComputeServiceContextModule;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.json.Json;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
-import org.jclouds.virtualbox.util.NetworkUtils;
-import org.testng.annotations.Test;
-import org.virtualbox_4_2.IGuestOSType;
-import org.virtualbox_4_2.IMachine;
-import org.virtualbox_4_2.INATEngine;
-import org.virtualbox_4_2.INetworkAdapter;
-import org.virtualbox_4_2.IVirtualBox;
-import org.virtualbox_4_2.MachineState;
-import org.virtualbox_4_2.NetworkAttachmentType;
-import org.virtualbox_4_2.VirtualBoxManager;
-
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.inject.Guice;
-
-public class IMachineToNodeMetadataTest {
-
-   private static final String MASTER_NAME = "mock-image-of-a-server";
-   Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
-   }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
-            .getInstance(Json.class));
-
-   @Test(enabled = false)
-   public void testCreateFromMaster() throws Exception {
-
-      IMachine vm = createNiceMock(IMachine.class);
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      IGuestOSType iGuestOSType = createNiceMock(IGuestOSType.class);
-      INetworkAdapter nat = createNiceMock(INetworkAdapter.class);
-      INATEngine natEng = createNiceMock(INATEngine.class);
-
-      expect(vm.getName()).andReturn(VIRTUALBOX_IMAGE_PREFIX + MASTER_NAME).anyTimes();
-      expect(vm.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-      expect(vm.getNetworkAdapter(eq(0l))).andReturn(nat).once();
-      expect(vm.getNetworkAdapter(eq(1l))).andReturn(null).once();
-      expect(nat.getAttachmentType()).andReturn(NetworkAttachmentType.NAT).once();
-      expect(nat.getNATEngine()).andReturn(natEng).anyTimes();
-      expect(natEng.getHostIP()).andReturn("127.0.0.1").once();
-      expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,2222,,22"));
-      
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-      expect(vm.getOSTypeId()).andReturn("RedHat_64").anyTimes();
-      expect(vBox.getGuestOSType(vm.getOSTypeId())).andReturn(iGuestOSType);
-      
-      INetworkAdapter hostOnly = createNiceMock(INetworkAdapter.class);
-      NetworkUtils networkUtils = createNiceMock(NetworkUtils.class);
-
-      replay(vm, vBox, iGuestOSType, nat, natEng, hostOnly, networkUtils);
-
-      NodeMetadata node = new IMachineToNodeMetadata(Suppliers
-              .ofInstance(vbm), VirtualBoxComputeServiceContextModule.toPortableNodeStatus,
-            networkUtils, map).apply(vm);
-
-      assertEquals(MASTER_NAME, node.getName());
-      assertEquals(1, node.getPrivateAddresses().size());
-      assertEquals(1, node.getPublicAddresses().size());
-      assertEquals("127.0.0.1", Iterables.get(node.getPublicAddresses(), 0));
-      assertEquals(NetworkUtils.MASTER_PORT, node.getLoginPort());
-      assertEquals("", node.getGroup());
-   }
-
-   @Test(enabled = false)
-   public void testCreateFromNode() throws Exception {
-
-      IMachine vm = createNiceMock(IMachine.class);
-      VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
-      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
-      expect(vbm.getVBox()).andReturn(vBox).anyTimes();
-      String group = "my-cluster-group";
-      String name = "a-name-with-a-code-338";
-
-      expect(vm.getName()).andReturn(
-               VIRTUALBOX_NODE_PREFIX + MASTER_NAME + VIRTUALBOX_NODE_NAME_SEPARATOR + group
-                        + VIRTUALBOX_NODE_NAME_SEPARATOR + name).anyTimes();
-      expect(vm.getState()).andReturn(MachineState.PoweredOff).anyTimes();
-
-      INetworkAdapter nat = createNiceMock(INetworkAdapter.class);
-      INATEngine natEng = createNiceMock(INATEngine.class);
-      
-      INetworkAdapter hostOnly = createNiceMock(INetworkAdapter.class);
-
-
-
-      expect(vm.getNetworkAdapter(eq(0l))).andReturn(nat).once();
-      expect(vm.getNetworkAdapter(eq(1l))).andReturn(hostOnly).once();
-      expect(nat.getAttachmentType()).andReturn(NetworkAttachmentType.NAT).once();
-      expect(nat.getNATEngine()).andReturn(natEng).anyTimes();
-      expect(natEng.getHostIP()).andReturn("127.0.0.1").once();
-      expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,3000,,22"));
-      NetworkUtils networkUtils = createNiceMock(NetworkUtils.class);
-
-      replay(vm, nat, natEng, hostOnly, networkUtils);
-
-      NodeMetadata node = new IMachineToNodeMetadata(Suppliers
-              .ofInstance(vbm), VirtualBoxComputeServiceContextModule.toPortableNodeStatus,
-            networkUtils, map).apply(vm);
-
-      assertEquals(name, node.getName());
-      assertEquals(group, node.getGroup());
-      assertEquals(1, node.getPublicAddresses().size());
-   }
-}