Examples of IMachine


Examples of org.jamesii.perfdb.entities.IMachine

    perfDB.newHardwareSetup("TestSetup", "which is unique!", "Disconnected :)",
        0, new HashSet<>(machines));
    perfDB.newHardwareSetup("TestSetup", "which is unique!", "Disconnected :)",
        0, new HashSet<>(machines));
    HashSet<IMachine> otherMachines = new HashSet<>(machines);
    IMachine hal9000 =
        perfDB.newMachine("HAL 9000", "I'm sorry, Dave...",
            Strings.getMACAddressString(new byte[] { 2, 0, 0, 1 }), -1);
    otherMachines.add(hal9000);
    IHardwareSetup halSetup =
        perfDB.newHardwareSetup("TestSetup2", "which also is unique!",
View Full Code Here

Examples of org.virtualbox_4_0.IMachine

    VirtualBoxManager vboxMgr = null;
    try {
      vboxMgr = this.connect();
      IVirtualBox vbox = vboxMgr.getVBox();
      ISession s = vboxMgr.getSessionObject();
      IMachine machine = this.importAppliance(vbox, s);
      /* TODO Headless */
      IProgress p = machine.launchVMProcess(s, "gui", "");
      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

   public void testDoNothingIfAlreadyTakenSnapshot() throws Exception {
      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);
      expect(machine.getCurrentSnapshot()).andReturn(null).anyTimes();
      expect(manager.openMachineSession(machine)).andReturn(session);
      expect(machine.getState()).andReturn(MachineState.PoweredOff).anyTimes();

      expect(machine.getName()).andReturn("machine").anyTimes();
      expect(session.getConsole()).andReturn(console);
      expect(console.takeSnapshot(snapshotName, snapshotDesc)).andReturn(
            progress);

      session.unlockMachine();
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

@Test(groups = "unit", testName = "AddIDEControllerIfNotExistsTest")
public class AddIDEControllerIfNotExistsTest {

   @Test
   public void testFine() throws Exception {
      IMachine vm = createMock(IMachine.class);

      String controllerName = "IDE Controller";
      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();

      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andReturn(
              createNiceMock(IStorageController.class));
      vm.saveSettings();

      replay(vm);

      new AddIDEControllerIfNotExists(storageController).apply(vm);
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

      verify(vm);
   }

   @Test
   public void testAcceptableException() throws Exception {
      IMachine vm = createMock(IMachine.class);

      String controllerName = "IDE Controller";
      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();

      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andThrow(
              new VBoxException(createNiceMock(Throwable.class),
                      "VirtualBox error: Storage controller named 'IDE Controller' already exists (0x80BB000C)"));

      replay(vm);
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

      verify(vm);
   }

   @Test(expectedExceptions = VBoxException.class)
   public void testUnacceptableException() throws Exception {
      IMachine vm = createMock(IMachine.class);

      String controllerName = "IDE Controller";
      StorageController storageController = StorageController.builder().bus(StorageBus.IDE).name(controllerName).build();

      expect(vm.addStorageController(controllerName, StorageBus.IDE)).andThrow(
              new VBoxException(createNiceMock(Throwable.class), "VirtualBox error: General Error"));

      replay(vm);

      new AddIDEControllerIfNotExists(storageController).apply(vm);
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

                              .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());

   }
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

      }
   }

   private ISession lockSession(String machineId, LockType type, int retries) {
      int count = 0;
      IMachine immutableMachine = manager.get().getVBox().findMachine(machineId);
      ISession session;
      while (true) {
         try {
            session = manager.get().getSessionObject();
            immutableMachine.lockMachine(session, type);
            break;
         } catch (VBoxException e) {
            VBoxException vbex = Throwables2.getFirstThrowableOfType(e, VBoxException.class);
            if (vbex != null && machineNotFoundException(vbex)) {
               return null;
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

    * @param machineId
    * @param function
    * @return
    */
   public <T> T applyForMachine(final String machineId, final Function<IMachine, T> function) {
      final IMachine immutableMachine = manager.get().getVBox().findMachine(machineId);
      return new Function<IMachine, T>() {
         @Override
         public T apply(IMachine machine) {
            return function.apply(machine);
         }
View Full Code Here

Examples of org.virtualbox_4_2.IMachine

      this.executionType = executionType;
   }

   public ISession ensureMachineIsLaunched(String vmName) {
      ISession session = null;
      IMachine machine = manager.get().getVBox().findMachine(vmName);
      while (!machine.getState().equals(MachineState.Running)) {
         try {
            session = machineUtils.applyForMachine(vmName, new LaunchMachineIfNotAlreadyRunning(manager.get(),
                  executionType, ""));
         } catch (RuntimeException e) {
            if (e.getMessage().contains(
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.