use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddIscsiLunDiskIncompleteParametersConnectionPort.
@Test
public void testAddIscsiLunDiskIncompleteParametersConnectionPort() {
Disk model = createIscsiLunDisk();
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(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, "LogicalUnit", "testAddIscsiLunDiskIncompleteParametersConnectionPort", "port");
}
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddLunDisk.
@Test
public /**
* This test checks that addition of LUN-Disk is successful. There is no real difference in the
* implementation of adding regular disk and adding a lun-disk; in both cases the disk entity
* is mapped and passed to the Backend, and Backend infers the type of disk from the entity and creates it.
*
* So what this test actually checks is that it's OK for the user not to specify size|provisionedSize
* when creating a LUN-Disk
*/
void testAddLunDisk() {
Disk model = createIscsiLunDisk();
testAddDiskImpl(model);
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddIscsiLunDiskIncompleteParametersConnectionTarget.
@Test
public void testAddIscsiLunDiskIncompleteParametersConnectionTarget() {
Disk model = createIscsiLunDisk();
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setTarget(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, "LogicalUnit", "testAddIscsiLunDiskIncompleteParametersConnectionTarget", "target");
}
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAttachDisk.
@Test
public void testAttachDisk() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AttachDiskToVm, AttachDetachVmDiskParameters.class, new String[] { "VmId", "EntityInfo" }, new Object[] { VM_ID, new EntityInfo(VdcObjectType.Disk, DISK_ID) }, true, true, null, null, null, QueryType.GetDiskByDiskId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DISK_ID }, asList(getEntity(0)));
Disk model = getModel();
// means this is an existing disk --> attach
model.setId(DISK_ID.toString());
model.setProvisionedSize(1024 * 1024L);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
}
use of org.ovirt.engine.api.model.Disk in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method doTestBadAddDisk.
private void doTestBadAddDisk(boolean valid, boolean success, String detail) throws Exception {
setUpEntityQueryExpectations(QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getStorageDomain(GUIDS[2]));
setUriInfo(setUpActionExpectations(ActionType.AddDisk, AddDiskParameters.class, new String[] { "VmId" }, new Object[] { VM_ID }, valid, success));
Disk model = getModel();
model.setProvisionedSize(1024 * 1024L);
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
Aggregations