Examples of IVirtualBox


Examples of org.virtualbox_4_2.IVirtualBox

      String snapshotName = "snap";
      String snapshotDesc = "snapDesc";

      VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
      IMachine machine = createMock(IMachine.class);
      IVirtualBox vBox = createMock(IVirtualBox.class);
      ISession session = createMock(ISession.class);
      IConsole console = createNiceMock(IConsole.class);

      IProgress progress = createNiceMock(IProgress.class);
      expect(progress.getCompleted()).andReturn(true);
View Full Code Here

Examples of org.virtualbox_4_2.IVirtualBox

   public static final Pattern ATTACHED_PATTERN = Pattern.compile(".*is still attached.*: ([-0-9a-f]+) .*");

   @Override
   public IMedium apply(HardDisk hardDisk) {
      IVirtualBox vBox = manager.get().getVBox();
      try {
         String diskPath = hardDisk.getDiskPath();
         final IMedium medium = vBox.openMedium(diskPath, DeviceType.HardDisk, AccessMode.ReadWrite, false);
         if (overwriteIfExists) {
            try {
               deleteMediumAndBlockUntilComplete(medium);
            } catch (VBoxException e) {
               onAlreadyAttachedExceptionDetachOrPropagate(vBox, medium, e);
View Full Code Here

Examples of org.virtualbox_4_2.IVirtualBox

      this.workingDir = workingDir;
   }

   @Override
   public IMachine apply(MasterSpec masterSpec) {
      final IVirtualBox vBox = manager.get().getVBox();
      String vmName = masterSpec.getVmSpec().getVmName();
      String vmId = masterSpec.getVmSpec().getVmId();

      try {
         vBox.findMachine(vmId);
         throw new IllegalStateException("Machine " + vmName + " is already registered.");
      } catch (VBoxException e) {
         if (machineNotFoundException(e))
            return createMachine(vBox, masterSpec);
         else
View Full Code Here

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

   @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

Examples of org.virtualbox_4_2.IVirtualBox

      this.workingDir = workingDir;
   }

   @Override
   public IMachine apply(MasterSpec masterSpec) {
      final IVirtualBox vBox = manager.get().getVBox();
      String vmName = masterSpec.getVmSpec().getVmName();
      String vmId = masterSpec.getVmSpec().getVmId();

      try {
         vBox.findMachine(vmId);
         throw new IllegalStateException("Machine " + vmName + " is already registered.");
      } catch (VBoxException e) {
         if (machineNotFoundException(e))
            return createMachine(vBox, masterSpec);
         else
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.