private VM getVm(String savedIso, String currentIso, VMStatus status) { VM vm = new VM(); vm.setId(VM_ID); vm.setIsoPath(savedIso); vm.setCurrentCd(currentIso); vm.setStatus(status); return vm; }
@Test public void testDisplayPort() { org.ovirt.engine.core.common.businessentities.VM entity = new org.ovirt.engine.core.common.businessentities.VM(); entity.setStatus(VMStatus.Up); entity.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo()); entity.getGraphicsInfos().get(GraphicsType.SPICE) .setPort(5900) .setTlsPort(9999); Vm model = VmMapper.map(entity, (Vm) null); entity.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo()); entity.getGraphicsInfos().get(GraphicsType.SPICE) .setPort(null) .setTlsPort(null); model = VmMapper.map(entity, (Vm) null); assertNull(model.getDisplay().getPort()); assertNull(model.getDisplay().getSecurePort()); }
@Test public void testMapHostId() { org.ovirt.engine.core.common.businessentities.VM entity = new org.ovirt.engine.core.common.businessentities.VM(); entity.setStatus(VMStatus.Up); Guid guid = Guid.newGuid(); entity.setRunOnVds(guid); Vm model = VmMapper.map(entity, (Vm) null); assertEquals(guid.toString(), model.getHost().getId()); }
public static Stream<Arguments> canExecute() { VM upVm = new VM(); upVm.setStatus(VMStatus.Up); VM downVm = new VM(); downVm.setStatus(VMStatus.Down); VDS upVds = new VDS(); upVds.setStatus(VDSStatus.Up); VDS downVds = new VDS(); downVds.setStatus(VDSStatus.Down); StorageDomain upStorageDomain = new StorageDomain(); upStorageDomain.setStatus(StorageDomainStatus.Active); StorageDomain downStorageDomain = new StorageDomain(); downStorageDomain.setStatus(StorageDomainStatus.Inactive); return Stream.of( Arguments.of(upVm, ActionType.MigrateVm, true), Arguments.of(downVm, ActionType.MigrateVm, false), Arguments.of(upVds, ActionType.RefreshHostCapabilities, true), Arguments.of(downVds, ActionType.RefreshHostCapabilities, false), Arguments.of(upStorageDomain, ActionType.DeactivateStorageDomainWithOvfUpdate, true), Arguments.of(downStorageDomain, ActionType.DetachStorageDomainFromPool, false), Arguments.of(new StoragePool(), ActionType.UpdateStoragePool, true) ); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); existingVm = dao.get(FixturesTool.VM_RHEL5_POOL_57); existingVm.setStatus(VMStatus.Up); VM newVm = new VM(); newVm.setId(Guid.newGuid()); newVm.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI); newVm.setVmtGuid(FixturesTool.VM_TEMPLATE_RHEL5); VmStatic newVmStatic = new VmStatic(); newVmStatic.setName("New Virtual Machine"); newVmStatic.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI); newVmStatic.setVmtGuid(FixturesTool.VM_TEMPLATE_RHEL5); }
vm.setStatus(instance.getStatus()); vm.setStoragePoolId(instance.getStoragePoolId()); vm.setStoragePoolName(instance.getStoragePoolName());