use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method testStatisticalQuery.
@Test
public void testStatisticalQuery() throws Exception {
DiskImage entity = setUpStatisticalExpectations();
@SuppressWarnings("unchecked") BackendStatisticsResource<Disk, DiskImage> statisticsResource = (BackendStatisticsResource<Disk, DiskImage>) resource.getStatisticsResource();
assertNotNull(statisticsResource);
verifyQuery(statisticsResource.getQuery(), entity);
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method getUpdate.
protected Disk getUpdate() {
Disk update = new Disk();
update.setWipeAfterDelete(false);
update.setReadOnly(true);
return update;
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method testGet.
@Test
public void testGet() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(1);
Disk disk = resource.get();
verifyModelSpecific(disk, 1);
verifyLinks(disk);
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method testUpdateReadOnly.
@Test
public void testUpdateReadOnly() throws Exception {
setUpGetEntityExpectations(2);
setUpDiskVmElementExpectations();
setUriInfo(setUpActionExpectations(ActionType.UpdateVmDisk, VmDiskOperationParameterBase.class, new String[] { "VmId", "DiskVmElement.ReadOnly" }, new Object[] { VM_ID, Boolean.TRUE }, true, true));
Disk disk = resource.update(getUpdate());
assertNotNull(disk);
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddDiskIdentifyStorageDomainByName.
@Test
public void testAddDiskIdentifyStorageDomainByName() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpHttpHeaderExpectations("Expect", "201-created");
setUpGetDiskExpectations();
int times = 2;
while (times-- > 0) {
setUpEntityQueryExpectations(QueryType.GetAllStorageDomains, QueryParametersBase.class, new String[] {}, new Object[] {}, getStorageDomains());
}
setUpEntityQueryExpectations(QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getStorageDomain(GUIDS[2]));
setUpCreationExpectations(ActionType.AddDisk, AddDiskParameters.class, new String[] { "VmId", "StorageDomainId" }, new Object[] { VM_ID, GUIDS[2] }, true, true, GUIDS[0], asList(GUIDS[3]), asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), QueryType.GetDiskByDiskId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DISK_ID }, asList(getEntity(0)));
Disk model = getModel();
model.getStorageDomains().getStorageDomains().get(0).setId(null);
model.getStorageDomains().getStorageDomains().get(0).setName("Storage_Domain_1");
model.setProvisionedSize(1024 * 1024L);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Disk);
verifyModel((Disk) response.getEntity(), 0);
assertNull(((Disk) response.getEntity()).getCreationStatus());
}
Aggregations