Search in sources :

Example 36 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendVmsResourceTest method addStorageDomainToModel.

private void addStorageDomainToModel(Vm model) {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[1].toString());
    model.setStorageDomain(storageDomain);
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain)

Example 37 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendVmResourceTest 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, false);
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) Test(org.junit.Test)

Example 38 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain 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 39 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain 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 40 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendDisksResourceTest 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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Disk(org.ovirt.engine.api.model.Disk)

Aggregations

StorageDomain (org.ovirt.engine.api.model.StorageDomain)88 Test (org.junit.Test)41 WebApplicationException (javax.ws.rs.WebApplicationException)14 Action (org.ovirt.engine.api.model.Action)14 Response (javax.ws.rs.core.Response)13 Host (org.ovirt.engine.api.model.Host)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 Disk (org.ovirt.engine.api.model.Disk)9 StorageDomains (org.ovirt.engine.api.model.StorageDomains)9 BackendStorageDomainVmsResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain)8 HostStorage (org.ovirt.engine.api.model.HostStorage)6 BackendStorageDomainTemplatesResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain)6 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)6 DataCenter (org.ovirt.engine.api.model.DataCenter)5 Vm (org.ovirt.engine.api.model.Vm)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 DiskProfile (org.ovirt.engine.api.model.DiskProfile)4 ExportRepoImageParameters (org.ovirt.engine.core.common.action.ExportRepoImageParameters)4 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)4