Search in sources :

Example 6 with StorageDomain

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

the class BackendStorageDomainTemplateResourceTest method testImportWithStorageDomainName.

@Test
public void testImportWithStorageDomainName() throws Exception {
    setUpEntityQueryExpectations(QueryType.GetStorageDomainByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[2] }, getStorageDomainStatic(2));
    setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setName(NAMES[2]);
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    doTestImport(storageDomain, cluster, false);
}
Also used : BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 7 with StorageDomain

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

the class BackendStorageDomainTemplateResourceTest method testImport.

@Test
public void testImport() throws Exception {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
    doTestImport(storageDomain, cluster, false);
}
Also used : BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 8 with StorageDomain

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

the class BackendStorageDomainTemplateResourceTest method doTestImportAsync.

private void doTestImportAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
    setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
    setUpGetDataCenterByStorageDomainExpectations(GUIDS[3]);
    setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplate, ImportVmTemplateParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId" }, new Object[] { TEMPLATE_ID, GUIDS[2], STORAGE_DOMAIN_ID, GUIDS[2], DATA_CENTER_ID, GUIDS[1] }, asList(GUIDS[1]), asList(new AsyncTaskStatus(asyncStatus))));
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    Action action = new Action();
    action.setStorageDomain(storageDomain);
    action.setCluster(cluster);
    Response response = resource.doImport(action);
    verifyActionResponse(response, URL_BASE, true, null);
    action = (Action) response.getEntity();
    assertTrue(action.isSetStatus());
    assertEquals(actionStatus.value(), action.getStatus());
}
Also used : Action(org.ovirt.engine.api.model.Action) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Response(javax.ws.rs.core.Response) BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) ImportVmTemplateParameters(org.ovirt.engine.core.common.action.ImportVmTemplateParameters)

Example 9 with StorageDomain

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

the class BackendStorageDomainTemplateResourceTest method testImportAsNewEntity.

@Test
public void testImportAsNewEntity() throws Exception {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
    doTestImport(storageDomain, cluster, true);
}
Also used : BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 10 with StorageDomain

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

the class BackendStorageDomainTemplateResourceTest method testImportWithClusterName.

@Test
public void testImportWithClusterName() throws Exception {
    setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, getCluster(1));
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setName(NAMES[1]);
    setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
    doTestImport(storageDomain, cluster, false);
}
Also used : BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

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