Search in sources :

Example 41 with Cluster

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

the class UpdateStoragePoolCommandTest method addNonDefaultClusterToPool.

private void addNonDefaultClusterToPool() {
    Cluster defaultCluster = new Cluster();
    defaultCluster.setCompatibilityVersion(VERSION_1_1);
    defaultCluster.setId(NON_DEFAULT_CLUSTER_ID);
    List<Cluster> clusters = new ArrayList<>();
    clusters.add(defaultCluster);
    when(clusterDao.getAllForStoragePool(any())).thenReturn(clusters);
}
Also used : ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 42 with Cluster

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

the class UpdateStoragePoolCommandTest method testValidateAllClustersLevel.

@Test
public void testValidateAllClustersLevel() {
    cmd.getStoragePool().setCompatibilityVersion(VERSION_1_2);
    List<Cluster> clusterList = createClusterList();
    // Create new supported cluster.
    Cluster secondCluster = new Cluster();
    secondCluster.setCompatibilityVersion(VERSION_1_2);
    secondCluster.setName("secondCluster");
    clusterList.add(secondCluster);
    // Create new unsupported cluster.
    Cluster thirdCluster = new Cluster();
    thirdCluster.setCompatibilityVersion(VERSION_1_1);
    thirdCluster.setName("thirdCluster");
    clusterList.add(thirdCluster);
    // Test upgrade
    when(clusterDao.getAllForStoragePool(any())).thenReturn(clusterList);
    assertFalse(cmd.checkAllClustersLevel());
    List<String> messages = cmd.getReturnValue().getValidationMessages();
    assertTrue(messages.contains(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_COMPATIBILITY_VERSION_BIGGER_THAN_CLUSTERS.toString()));
    assertTrue(messages.get(1).contains("firstCluster"));
    assertFalse(messages.get(1).contains("secondCluster"));
    assertTrue(messages.get(1).contains("thirdCluster"));
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 43 with Cluster

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

the class EmulatedMachineUtilsTest method testEffectiveEmulatedMachineWithCustomSet.

@Test
public void testEffectiveEmulatedMachineWithCustomSet() {
    final VmBase vmBase = new VmBase();
    final Cluster cluster = new Cluster();
    cluster.setEmulatedMachine("cluster-pc-i440fx-rhel7.3.0");
    vmBase.setCustomEmulatedMachine("testpc-i440fx-rhel7.3.0");
    assertEquals("testpc-i440fx-rhel7.3.0", EmulatedMachineUtils.getEffective(vmBase, () -> cluster));
}
Also used : VmBase(org.ovirt.engine.core.common.businessentities.VmBase) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 44 with Cluster

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

the class EmulatedMachineUtilsTest method testEffectiveEmulatedMachineWithoutCustomSet.

@Test
public void testEffectiveEmulatedMachineWithoutCustomSet() {
    final VmBase vmBase = new VmBase();
    final Cluster cluster = new Cluster();
    cluster.setEmulatedMachine("cluster-pc-i440fx-rhel7.3.0");
    assertEquals("cluster-pc-i440fx-rhel7.3.0", EmulatedMachineUtils.getEffective(vmBase, () -> cluster));
}
Also used : VmBase(org.ovirt.engine.core.common.businessentities.VmBase) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 45 with Cluster

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

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