Exemplo n.º 1
0
  /** Mock a VM. */
  private VM mockVm() {
    VM vm = new VM();
    vm.setStatus(VMStatus.Down);
    vm.setStoragePoolId(Guid.newGuid());
    when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);

    return vm;
  }
 /** Mock a VM in status Up */
 protected VM mockVmStatusUp() {
   vm.setStatus(VMStatus.Up);
   vm.setVmOs(8);
   vm.setId(vmId);
   vm.setRunOnVds(Guid.newGuid());
   when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);
   return vm;
 }
 private void mockToUpdateDiskVm(List<VM> vms) {
   for (VM vm : vms) {
     if (vm.getId().equals(command.getParameters().getVmId())) {
       when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);
       break;
     }
   }
 }
 private void mockNullVm() {
   mockGetForDisk((VM) null);
   mockGetVmsListForDisk(null);
   when(vmDao.get(command.getParameters().getVmId())).thenReturn(null);
 }
Exemplo n.º 5
0
 private void initializeVmDaoMock(VM vm) {
   when(vmDao.get(any(Guid.class))).thenReturn(vm);
 }