use of org.ovirt.engine.api.model.DiskProfile in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfilesResourceTest method testAddDiskProfile.
@Test
public void testAddDiskProfile() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpStorageDomainQueryExpectations();
setUpCreationExpectations(ActionType.AddDiskProfile, DiskProfileParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetDiskProfileById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, getEntity(0));
DiskProfile model = getModel(0);
model.setStorageDomain(new StorageDomain());
model.getStorageDomain().setId(STORAGE_DOMAIN_ID.toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof DiskProfile);
verifyModel((DiskProfile) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.DiskProfile in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfilesResourceTest method getModel.
static DiskProfile getModel(int index) {
DiskProfile model = new DiskProfile();
model.setId(GUIDS[index].toString());
model.setName(NAMES[index]);
model.setDescription(DESCRIPTIONS[index]);
return model;
}
use of org.ovirt.engine.api.model.DiskProfile in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfilesResourceTest method testAddIncompleteParameters.
@Test
public void testAddIncompleteParameters() throws Exception {
DiskProfile model = createIncompleteDiskProfile();
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "DiskProfile", "validateParameters", getIncompleteFields());
}
}
use of org.ovirt.engine.api.model.DiskProfile in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfilesResourceTest method doTestBadAddDiskProfile.
private void doTestBadAddDiskProfile(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddDiskProfile, DiskProfileParameters.class, new String[] {}, new Object[] {}, valid, success));
DiskProfile model = getModel(0);
model.setStorageDomain(new StorageDomain());
model.getStorageDomain().setId(STORAGE_DOMAIN_ID.toString());
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.DiskProfile in project ovirt-engine by oVirt.
the class BackendDiskProfilesResourceTest method createIncompleteDiskProfile.
@Override
protected DiskProfile createIncompleteDiskProfile() {
DiskProfile diskProfile = super.createIncompleteDiskProfile();
diskProfile.setName(NAMES[0]);
return diskProfile;
}
Aggregations