Package org.jclouds.virtualbox.domain

Examples of org.jclouds.virtualbox.domain.HardDisk


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 {
View Full Code Here


   }

   @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);
View Full Code Here

   }

   @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);
View Full Code Here

   }

   @Test
   public void testCreateMediumWhenDiskDoesNotExists() throws Exception {

      HardDisk hardDisk = createTestHardDisk();

      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
      MachineUtils machineUtils = createMock(MachineUtils.class);

      IMachine machine = createMock(IMachine.class);
View Full Code Here

   }

   @Test
   public void testDeleteAndCreateNewStorageWhenMediumExistsAndUsingOverwrite() throws Exception {
      HardDisk hardDisk = createTestHardDisk();

      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
      MachineUtils machineUtils = createMock(MachineUtils.class);

      IMachine machine = createMock(IMachine.class);
View Full Code Here

   }

   @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);
View Full Code Here

      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);
View Full Code Here

   }

   @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);
View Full Code Here

         getFilePathOrDownload(guestAdditionsUri, null);
      }
      // check if the iso is here, download if not
      String localIsoUrl = checkNotNull(getFilePathOrDownload(currentImage.iso, currentImage.iso_md5), "distro iso");
      String adminDisk = workingDir + File.separator + vmName + ".vdi";
      HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true).controllerPort(0).deviceSlot(1)
            .build();

      StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
            .attachISO(0, 0, localIsoUrl).attachHardDisk(hardDisk).build();
View Full Code Here

   }

   @Test
   public void testCreateMediumWhenDiskDoesNotExists() throws Exception {

      HardDisk hardDisk = createTestHardDisk();

      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
      MachineUtils machineUtils = createMock(MachineUtils.class);

      IMachine machine = createMock(IMachine.class);
View Full Code Here

TOP

Related Classes of org.jclouds.virtualbox.domain.HardDisk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.