Examples of IVirtualBox


Examples of org.virtualbox_4_2.IVirtualBox

   @Test
   public void testListImages() throws Exception {

      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
      IVirtualBox vBox = createNiceMock(IVirtualBox.class);
      IGuestOSType osType = createNiceMock(IGuestOSType.class);

      List<IMachine> machines = Lists.newArrayList();
      IMachine imageMachine = createNiceMock(IMachine.class);
      IMachine clonedMachine = createNiceMock(IMachine.class);
      machines.add(imageMachine);
      machines.add(clonedMachine);

      expect(clonedMachine.getName()).andReturn("My Linux Node");
      expect(clonedMachine.getDescription()).andReturn("My Linux Node");
      expect(imageMachine.getName()).andReturn(VIRTUALBOX_IMAGE_PREFIX + "ubuntu-10.04");
      expect(imageMachine.getDescription()).andReturn(VIRTUALBOX_IMAGE_PREFIX + "ubuntu-10.04");

      expect(manager.getVBox()).andReturn(vBox).anyTimes();
      expect(vBox.getMachines()).andReturn(machines).anyTimes();
      expect(vBox.getGuestOSType(EasyMock.<String> anyObject())).andReturn(osType).anyTimes();
      expect(osType.getDescription()).andReturn("Ubuntu 10.04").anyTimes();
      expect(osType.getIs64Bit()).andReturn(true).anyTimes();

      replay(manager, vBox, clonedMachine, imageMachine, osType);
View Full Code Here

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

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

Examples of org.virtualbox_4_2.IVirtualBox

   @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(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.