use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddDiskWithStepId.
@Test
public void testAddDiskWithStepId() throws Exception {
Disk model = getModel();
setUriInfo(setUpBasicUriExpectations());
setUriInfo(setUpGetMatrixConstraintsExpectations(BackendResource.STEP_ID_CONSTRAINT, true, GUIDS[1].toString(), collection.getUriInfo()));
setUpGetDiskExpectations();
setCommonExpectations(model);
Response response = collection.add(getModel());
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.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddLunDiskMissingType.
@Test
public void testAddLunDiskMissingType() {
Disk model = createIscsiLunDisk();
model.getLunStorage().setType(null);
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
// Because of extra frame offset used current method name in test, while in real world used "add" method name
verifyIncompleteException(wae, "HostStorage", "testAddLunDiskMissingType", "type");
}
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddIncompleteParameters.
@Test
public void testAddIncompleteParameters() throws Exception {
Disk model = new Disk();
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
// Because of extra frame offset used current method name in test, while in real world used "add" method name
verifyIncompleteException(wae, "Disk", "testAddIncompleteParameters", "provisionedSize|size", "format");
}
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskResourceTest method testGet.
@Test
public void testGet() {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(QueryType.GetDiskAndSnapshotsByDiskId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DISK_ID }, getEntity(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 BackendStorageDomainDisksResourceTest method getModel.
static Disk getModel() {
Disk model = new Disk();
model.setProvisionedSize(1024 * 1024L);
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());
return model;
}
Aggregations