Search in sources :

Example 51 with Cluster

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

the class BackendHostResourceTest method testUpdateWithClusterId.

@Test
public void testUpdateWithClusterId() throws Exception {
    setUpGetEntityExpectations(3);
    setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
    setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    Host host = getModel(0);
    host.setCluster(cluster);
    verifyModel(resource.update(host), 0);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Host(org.ovirt.engine.api.model.Host) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

Example 52 with Cluster

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

the class BackendHostResourceTest method getCluster.

private Cluster getCluster(String name, Guid id) {
    Cluster cluster = mock(Cluster.class);
    when(cluster.getId()).thenReturn(id);
    when(cluster.getName()).thenReturn(name);
    return cluster;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 53 with Cluster

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

the class BackendHostResourceTest method testUpdateWithClusterName.

@Test
public void testUpdateWithClusterName() throws Exception {
    String clusterName = "Default";
    setUpGetEntityExpectations(3);
    setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { clusterName }, getCluster(clusterName, GUIDS[1]));
    setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
    setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setName(clusterName);
    Host host = getModel(0);
    host.setCluster(cluster);
    verifyModel(resource.update(host), 0);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Host(org.ovirt.engine.api.model.Host) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

Example 54 with Cluster

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

the class VirtMonitoringStrategyTest method mockCluster.

private ClusterDao mockCluster() {
    ClusterDao mock = mock(ClusterDao.class);
    cluster = new Cluster();
    cluster.setEmulatedMachine("pc-1.0");
    cluster.setCompatibilityVersion(Version.getLast());
    cluster.setClusterId(clusterId);
    when(mock.get(clusterId)).thenReturn(cluster);
    return mock;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ClusterDao(org.ovirt.engine.core.dao.ClusterDao)

Example 55 with Cluster

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

the class BaseNetworkImplementationDetailsUtilsTest method setUpBefore.

@Before
public void setUpBefore() throws Exception {
    qosA = createAndMockQos(30, 30, 30);
    qosB = createAndMockQos(60, 60, 60);
    unlimitedHostNetworkQos = createQos(null, null, null);
    VdsStatic vdsStatic = new VdsStatic();
    vdsStatic.setId(VDS_ID);
    vdsStatic.setClusterId(CLUSTER_ID);
    VdsDynamic vdsDynamic = new VdsDynamic();
    cluster = new Cluster();
    cluster.setCompatibilityVersion(Version.v4_2);
    cluster.setId(CLUSTER_ID);
    when(vdsStaticDaoMock.get(eq(VDS_ID))).thenReturn(vdsStatic);
    when(vdsDynamicDaoMock.get(eq(VDS_ID))).thenReturn(vdsDynamic);
    when(clusterDaoMock.get(eq(CLUSTER_ID))).thenReturn(cluster);
    EffectiveHostNetworkQos effectiveHostNetworkQos = new EffectiveHostNetworkQos(hostNetworkQosDaoMock);
    networkImplementationDetailsUtils = new NetworkImplementationDetailsUtils(effectiveHostNetworkQos, networkAttachmentDaoMock, vdsStaticDaoMock, vdsDynamicDaoMock, clusterDaoMock, calculateBaseNic, this.defaultRouteUtil);
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Before(org.junit.Before)

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