use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class GetVmsByStorageDomainQueryTest method testExecuteQueryCommandNoDisks.
@Test
public void testExecuteQueryCommandNoDisks() {
List<VM> vmsOfDomain = new ArrayList<>();
VM vm1 = mock(VM.class);
VM vm2 = mock(VM.class);
vmsOfDomain.add(vm1);
vmsOfDomain.add(vm2);
when(vmDao.getAllForStorageDomain(domainId)).thenReturn(vmsOfDomain);
QueryReturnValue returnValue = new QueryReturnValue();
returnValue.setSucceeded(true);
List<DiskImage> diskImages = new ArrayList<>();
returnValue.setReturnValue(diskImages);
doReturn(returnValue).when(query).getAllDisksByStorageDomain(domainId);
query.executeQueryCommand();
List<VM> vms = query.getQueryReturnValue().getReturnValue();
assertEquals(2, vms.size());
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class GetUserVmsByUserIdAndGroupsQueryTest method mockDisk.
/**
* @return A disk to add to the VM
*/
private static DiskImage mockDisk() {
// Prepare the disk
Guid diskGuid = Guid.newGuid();
Guid itGuid = Guid.newGuid();
final DiskImage expectedDisk = new DiskImage();
expectedDisk.setImageId(diskGuid);
expectedDisk.setImageTemplateId(itGuid);
return expectedDisk;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class ImportValidatorTest method createVM.
protected VM createVM() {
final VM v = new VM();
v.setId(Guid.newGuid());
Guid imageGroupId = Guid.newGuid();
DiskImage baseImage = new DiskImage();
baseImage.setId(imageGroupId);
baseImage.setImageId(Guid.newGuid());
baseImage.setSizeInGigabytes(1);
baseImage.setVmSnapshotId(Guid.newGuid());
baseImage.setActive(false);
DiskImage activeImage = new DiskImage();
activeImage.setId(imageGroupId);
activeImage.setImageId(Guid.newGuid());
activeImage.setSizeInGigabytes(1);
activeImage.setVmSnapshotId(Guid.newGuid());
activeImage.setActive(true);
activeImage.setParentId(baseImage.getImageId());
v.setDiskMap(Collections.singletonMap(activeImage.getId(), activeImage));
v.setImages(new ArrayList<>(Arrays.asList(baseImage, activeImage)));
v.setClusterId(Guid.Empty);
return v;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class BlockStorageDiscardFunctionalityHelperTest method testExistingPassDiscardFunctionalityIsPreservedAllLunsHaveDiscardFunctionality.
@Test
public void testExistingPassDiscardFunctionalityIsPreservedAllLunsHaveDiscardFunctionality() {
storageDomain.setSupportsDiscard(true);
storageDomainDisks.add(new DiskImage());
assertTrue(discardHelper.isExistingPassDiscardFunctionalityPreserved(Arrays.asList(createLunWithDiscardSupport(1024L), createLunWithDiscardSupport(2048L)), storageDomain));
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DiskImagesValidatorTest method createDisk.
private static DiskImage createDisk() {
DiskImage disk = new DiskImage();
disk.setId(Guid.newGuid());
disk.setDiskAlias(RandomUtils.instance().nextString(10));
disk.setActive(true);
disk.setImageStatus(ImageStatus.OK);
ArrayList<Guid> storageDomainIds = new ArrayList<>();
storageDomainIds.add(Guid.newGuid());
disk.setStorageIds(storageDomainIds);
return disk;
}
Aggregations