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