Search in sources :

Example 1 with DiskProfile

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);
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) DiskProfile(org.ovirt.engine.api.model.DiskProfile) Test(org.junit.Test)

Example 2 with DiskProfile

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;
}
Also used : DiskProfile(org.ovirt.engine.api.model.DiskProfile)

Example 3 with DiskProfile

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());
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) DiskProfile(org.ovirt.engine.api.model.DiskProfile) Test(org.junit.Test)

Example 4 with DiskProfile

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);
    }
}
Also used : DiskProfileParameters(org.ovirt.engine.core.common.action.DiskProfileParameters) StorageDomain(org.ovirt.engine.api.model.StorageDomain) WebApplicationException(javax.ws.rs.WebApplicationException) DiskProfile(org.ovirt.engine.api.model.DiskProfile)

Example 5 with DiskProfile

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;
}
Also used : DiskProfile(org.ovirt.engine.api.model.DiskProfile)

Aggregations

DiskProfile (org.ovirt.engine.api.model.DiskProfile)10 StorageDomain (org.ovirt.engine.api.model.StorageDomain)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 Test (org.junit.Test)3 Qos (org.ovirt.engine.api.model.Qos)2 Guid (org.ovirt.engine.core.compat.Guid)2 HashMap (java.util.HashMap)1 Response (javax.ws.rs.core.Response)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 DiskProfiles (org.ovirt.engine.api.model.DiskProfiles)1 OpenStackVolumeType (org.ovirt.engine.api.model.OpenStackVolumeType)1 Quota (org.ovirt.engine.api.model.Quota)1 Snapshot (org.ovirt.engine.api.model.Snapshot)1 StorageDomains (org.ovirt.engine.api.model.StorageDomains)1 DiskProfileParameters (org.ovirt.engine.core.common.action.DiskProfileParameters)1 StorageQos (org.ovirt.engine.core.common.businessentities.qos.StorageQos)1