Search in sources :

Example 46 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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 47 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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 48 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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 49 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster 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)

Example 50 with Cluster

use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.

the class BackendStorageDomainVmResourceTest 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, false, true);
}
Also used : BackendStorageDomainVmsResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Aggregations

Cluster (org.ovirt.engine.core.common.businessentities.Cluster)346 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)80 Guid (org.ovirt.engine.core.compat.Guid)77 VDS (org.ovirt.engine.core.common.businessentities.VDS)54 List (java.util.List)50 VM (org.ovirt.engine.core.common.businessentities.VM)36 HashMap (java.util.HashMap)35 Map (java.util.Map)33 HashSet (java.util.HashSet)30 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)30 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)28 Version (org.ovirt.engine.core.compat.Version)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)26 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)26 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)25 Set (java.util.Set)24 QueryType (org.ovirt.engine.core.common.queries.QueryType)23 Collections (java.util.Collections)22 Frontend (org.ovirt.engine.ui.frontend.Frontend)22