Search in sources :

Example 31 with Cluster

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

the class UpdateClusterCommandTest method oldGroupFromDb.

private Cluster oldGroupFromDb() {
    final Cluster vdsGroup = createDefaultCluster();
    when(clusterDao.get(DEFAULT_CLUSTER_ID)).thenReturn(vdsGroup);
    return vdsGroup;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 32 with Cluster

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

the class AddVmTemplateCommandTest method setUp.

@Before
public void setUp() {
    when(vmDao.get(vm.getId())).thenReturn(vm);
    // The cluster to use
    Cluster cluster = new Cluster();
    cluster.setCpuName("Intel Conroe Family");
    cluster.setArchitecture(ArchitectureType.x86_64);
    cluster.setId(vm.getClusterId());
    cluster.setStoragePoolId(vm.getStoragePoolId());
    cluster.setCompatibilityVersion(Version.getLast());
    when(clusterDao.get(vm.getClusterId())).thenReturn(cluster);
    doNothing().when(cmd).separateCustomProperties(any());
    doReturn(getDisksList(vm.getStoragePoolId())).when(cmd).getVmDisksFromDB();
    cmd.init();
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Before(org.junit.Before)

Example 33 with Cluster

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

the class MoveMacsTest method canMigrateMacsToAnotherMacPoolWithMultipleClusters.

@Test
public void canMigrateMacsToAnotherMacPoolWithMultipleClusters() {
    // we are testing 4 clusters at once, their macs to be moved has to be merged and processed at once.
    // cluster 2 and 4 will be ignored, because migration targetMacPoolId->targetMacPoolId will be skipped.
    // therefore we are actually migrating only 2 cluster, among them there's duplicate mac1 to be migrated, which
    // should be blocked, since targetMacPoolId disallows duplicates.
    List<Cluster> clusters = Arrays.asList(createClusterAndMockMacs(sourceMacPoolId, Collections.singletonList("mac1")), createClusterAndMockMacs(targetMacPoolId, Collections.singletonList("mac2")), createClusterAndMockMacs(sourceMacPoolId, Collections.singletonList("mac1")), createClusterAndMockMacs(targetMacPoolId, Collections.singletonList("mac2")));
    EngineMessage engineMessage = ACTION_TYPE_FAILED_CANNOT_MIGRATE_MACS_DUE_TO_DUPLICATES;
    Collection<String> replacements = ReplacementUtils.getListVariableAssignmentString(engineMessage, Collections.singleton("mac1"));
    assertThat(underTest.canMigrateMacsToAnotherMacPool(clusters, targetMacPoolId), ValidationResultMatchers.failsWith(engineMessage, replacements));
}
Also used : MacPoolPerCluster(org.ovirt.engine.core.bll.network.macpool.MacPoolPerCluster) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) Test(org.junit.Test)

Example 34 with Cluster

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

the class MoveMacsTest method createCluster.

private Cluster createCluster(Guid sourceMacPoolId) {
    Cluster cluster = new Cluster();
    cluster.setId(Guid.newGuid());
    cluster.setMacPoolId(sourceMacPoolId);
    return cluster;
}
Also used : MacPoolPerCluster(org.ovirt.engine.core.bll.network.macpool.MacPoolPerCluster) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 35 with Cluster

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

the class GetClusterByIdQueryTest method testExecuteQueryCommnad.

@Test
public void testExecuteQueryCommnad() {
    // Set up the expected data
    Guid clusterID = Guid.newGuid();
    Cluster expected = new Cluster();
    expected.setId(clusterID);
    // Mock the query's parameters
    when(getQueryParameters().getId()).thenReturn(clusterID);
    // Mock the Daos
    when(clusterDaoMock.get(clusterID, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(expected);
    getQuery().executeQueryCommand();
    Cluster actual = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals("wrong VDS Group", expected, actual);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid) 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