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);
}
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;
}
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);
}
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;
}
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);
}
Aggregations