Search in sources :

Example 41 with StorageDomain

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

the class BackendAttachedStorageDomainsResourceTest method testAddByName.

@Test
public void testAddByName() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpGetConnection(1);
    setUpEntityQueryExpectations(QueryType.GetStorageDomainByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[0] }, getEntityStatic(0));
    setUpCreationExpectations(ActionType.AttachStorageDomainToPool, AttachStorageDomainToPoolParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, true, true, null, QueryType.GetStorageDomainByIdAndStoragePoolId, StorageDomainAndPoolQueryParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, getEntity(0));
    StorageDomain model = new StorageDomain();
    model.setName(NAMES[0]);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageDomain);
    verifyModel((StorageDomain) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Test(org.junit.Test)

Example 42 with StorageDomain

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

the class BackendAttachedStorageDomainsResourceTest method testAddIncompleteParameters.

@Test
public void testAddIncompleteParameters() throws Exception {
    StorageDomain model = new StorageDomain();
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "StorageDomain", "add", "id|name");
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 43 with StorageDomain

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

the class BackendAttachedStorageDomainsResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpGetConnection(1);
    setUpCreationExpectations(ActionType.AttachStorageDomainToPool, AttachStorageDomainToPoolParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, true, true, null, QueryType.GetStorageDomainByIdAndStoragePoolId, StorageDomainAndPoolQueryParameters.class, new String[] { "StorageDomainId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[NAMES.length - 1] }, getEntity(0));
    StorageDomain model = new StorageDomain();
    model.setId(GUIDS[0].toString());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageDomain);
    verifyModel((StorageDomain) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Test(org.junit.Test)

Example 44 with StorageDomain

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

the class BackendDiskResourceTest method testExport.

@Test
public void testExport() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { DISK_ID, GUIDS[3] }, true, true, null, null, true));
    Action action = new Action();
    action.setStorageDomain(new StorageDomain());
    action.getStorageDomain().setId(GUIDS[3].toString());
    verifyActionResponse(resource.export(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain) ExportRepoImageParameters(org.ovirt.engine.core.common.action.ExportRepoImageParameters) Test(org.junit.Test)

Example 45 with StorageDomain

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

the class BackendDiskResourceTest method setUpParams.

private Action setUpParams(boolean byName) {
    Action action = new Action();
    StorageDomain sd = new StorageDomain();
    if (byName) {
        sd.setName(NAMES[2]);
    } else {
        sd.setId(GUIDS[3].toString());
    }
    action.setStorageDomain(sd);
    return action;
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain)

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