use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method getModel.
static Disk getModel() {
Disk model = new Disk();
model.setFormat(DiskFormat.COW);
model.setSparse(true);
model.setShareable(false);
model.setPropagateErrors(true);
model.setStorageDomains(new StorageDomains());
model.getStorageDomains().getStorageDomains().add(new StorageDomain());
model.getStorageDomains().getStorageDomains().get(0).setId(GUIDS[2].toString());
model.setProvisionedSize(1000000000L);
return model;
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddDiskWithinStorageDomain.
@Test
public void testAddDiskWithinStorageDomain() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpHttpHeaderExpectations("Expect", "201-created");
setUpGetDiskExpectations();
setUpEntityQueryExpectations(QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[3] }, getStorageDomain(GUIDS[3]));
setUpCreationExpectations(ActionType.AddDisk, AddDiskParameters.class, new String[] { "VmId", "StorageDomainId" }, new Object[] { VM_ID, GUIDS[3] }, 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.setStorageDomains(new StorageDomains());
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(GUIDS[3].toString());
model.getStorageDomains().getStorageDomains().add(storageDomain);
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());
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendTemplateResourceTest method testExportWithStorageDomainId.
protected void testExportWithStorageDomainId(boolean exclusive) throws Exception {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(GUIDS[2].toString());
doTestExport(storageDomain, exclusive);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendTemplateResourceTest method doTestExportAsync.
private void doTestExportAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.ExportVmTemplate, MoveOrCopyParameters.class, new String[] { "ContainerId", "StorageDomainId", "ForceOverride" }, new Object[] { GUIDS[0], GUIDS[2], false }, asList(GUIDS[1]), asList(new AsyncTaskStatus(asyncStatus))));
Action action = new Action();
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(GUIDS[2].toString());
action.setStorageDomain(storageDomain);
Response response = resource.export(action);
verifyActionResponse(response, "templates/" + GUIDS[0], true, null);
action = (Action) response.getEntity();
assertTrue(action.isSetStatus());
assertEquals(actionStatus.value(), action.getStatus());
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendTemplateResourceTest method testExportWithStorageDomainName.
@Test
public void testExportWithStorageDomainName() throws Exception {
setUpEntityQueryExpectations(QueryType.GetStorageDomainByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[2] }, getStorageDomainStatic(2));
StorageDomain storageDomain = new StorageDomain();
storageDomain.setName(NAMES[2]);
doTestExport(storageDomain, false);
}
Aggregations