use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testGetAllByGroupAndNetwork.
/**
* Ensures that all static vm details for the specified group and network are returned.
*/
@Test
public void testGetAllByGroupAndNetwork() {
List<VmStatic> result = dao.getAllByGroupAndNetworkName(FixturesTool.CLUSTER, "engine");
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmStatic vm : result) {
assertEquals(FixturesTool.CLUSTER, vm.getClusterId());
}
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testAllCpuProfileValuesEqualTo.
private void testAllCpuProfileValuesEqualTo(Guid clusterId, Guid cpuProfileId, boolean isAllNull) {
List<VmStatic> allByCluster = dao.getAllByCluster(clusterId);
assertNotNull(allByCluster);
assertFalse(allByCluster.isEmpty());
boolean allValues = true;
for (VmStatic vmStatic : allByCluster) {
allValues &= Objects.equals(vmStatic.getCpuProfileId(), cpuProfileId);
}
assertEquals(isAllNull, allValues);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmDaoTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getVmDao();
existingVm = dao.get(FixturesTool.VM_RHEL5_POOL_57);
existingVm.setStatus(VMStatus.Up);
VmTemplate vmtemplate = dbFacade.getVmTemplateDao().get(FixturesTool.VM_TEMPLATE_RHEL5);
existingTemplate = dbFacade.getVmTemplateDao().get(FixturesTool.VM_TEMPLATE_RHEL5);
VM newVm = new VM();
newVm.setId(Guid.newGuid());
newVm.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI);
newVm.setVmtGuid(vmtemplate.getId());
VmStatic newVmStatic = new VmStatic();
newVmStatic.setName("New Virtual Machine");
newVmStatic.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI);
newVmStatic.setVmtGuid(vmtemplate.getId());
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class StorageDomainDaoTest method testIsHostedEngineStorage.
@Test
public void testIsHostedEngineStorage() {
// create hosted engine vm
VmStatic vm = new VmStatic();
vm.setId(Guid.newGuid());
vm.setOrigin(OriginType.HOSTED_ENGINE);
dbFacade.getVmStaticDao().save(vm);
// create disk for HE
DiskImage disk = new DiskImage();
disk.setId(Guid.newGuid());
disk.setImageId(Guid.newGuid());
disk.setActive(true);
disk.setVolumeType(VolumeType.Preallocated);
disk.setVolumeFormat(VolumeFormat.RAW);
dbFacade.getImageDao().save(disk.getImage());
dbFacade.getBaseDiskDao().save(disk);
ImageStorageDomainMap map = new ImageStorageDomainMap(disk.getImageId(), existingDomain.getId(), null, null);
dbFacade.getImageStorageDomainMapDao().save(map);
// attach disk
VmDevice device = new VmDevice(new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", null, true, false, false, "", null, null, null);
dbFacade.getVmDeviceDao().save(device);
DiskVmElement diskVmElement = new DiskVmElement(device.getId());
diskVmElement.setDiskInterface(DiskInterface.IDE);
dbFacade.getDiskVmElementDao().save(diskVmElement);
// run test
StorageDomain domain = dao.get(existingDomain.getId());
assertTrue(domain.isHostedEngineStorage());
// change origin
vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
dbFacade.getVmStaticDao().update(vm);
// run test again
domain = dao.get(existingDomain.getId());
assertTrue(domain.isHostedEngineStorage());
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class BackendVmPoolsResourceTest method getVmEntity.
protected org.ovirt.engine.core.common.businessentities.VM getVmEntity() {
org.ovirt.engine.core.common.businessentities.VM entity = mock(org.ovirt.engine.core.common.businessentities.VM.class);
when(entity.getId()).thenReturn(GUIDS[0]);
when(entity.getStaticData()).thenReturn(new VmStatic());
return entity;
}
Aggregations