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