use of org.ovirt.engine.core.common.businessentities.QuotaCluster in project ovirt-engine by oVirt.
the class QuotaDaoTest method testFetchClusterWithUnlimitedGlobalLimitation.
/**
* Test scenario when there is a specific limitation on a vds group, and we check if there is enough resources on it.<BR/>
* The returned value from the query, should be the specific limitation and the global usage on the storage pool.
*/
@Test
public void testFetchClusterWithUnlimitedGlobalLimitation() throws Exception {
List<QuotaCluster> quotaClusterList = dao.getQuotaClusterByClusterGuid(FixturesTool.CLUSTER_RHEL6_ISCSI, FixturesTool.QUOTA_SPECIFIC);
// Should be two rows of specific vds group
assertEquals(1, quotaClusterList.size());
// Get first specific vds group.
QuotaCluster quotaCluster = quotaClusterList.get(0);
assertNotNull(quotaCluster);
assertEquals(unlimited, quotaCluster.getMemSizeMB());
assertEquals(10, (int) quotaCluster.getVirtualCpu());
}
use of org.ovirt.engine.core.common.businessentities.QuotaCluster in project ovirt-engine by oVirt.
the class QuotaDaoTest method testQuotaClusterByQuotaGuidWithGeneralDefaultWithDefault.
/**
* Asserts that when {@link QuotaDao#getQuotaClusterByQuotaGuidWithGeneralDefault(Guid)} is called
* with a non-specific quota, the general is returned
*/
@Test
public void testQuotaClusterByQuotaGuidWithGeneralDefaultWithDefault() {
List<QuotaCluster> quotaClusterList = dao.getQuotaClusterByQuotaGuidWithGeneralDefault(FixturesTool.QUOTA_GENERAL);
assertNotNull(quotaClusterList);
assertEquals("wrong number of quotas returned", 1, quotaClusterList.size());
for (QuotaCluster group : quotaClusterList) {
assertEquals("VDS ID should be empty in general mode", Guid.Empty, group.getClusterId());
assertNull("VDS name should be null in general mode", group.getClusterName());
}
}
use of org.ovirt.engine.core.common.businessentities.QuotaCluster in project ovirt-engine by oVirt.
the class QuotaDaoTest method testFetchAllClusterForQuota.
@Test
public void testFetchAllClusterForQuota() throws Exception {
List<QuotaCluster> quotaClusterList = dao.getQuotaClusterByClusterGuid(null, FixturesTool.QUOTA_SPECIFIC);
assertNotNull(quotaClusterList);
assertEquals(2, quotaClusterList.size());
for (QuotaCluster quotaCluster : quotaClusterList) {
if (quotaCluster.getQuotaClusterId().equals(new Guid("68c96e11-0aad-4e3a-9091-12897b7f2388"))) {
assertEquals(Integer.valueOf(10), quotaCluster.getVirtualCpu());
assertEquals(unlimited, quotaCluster.getMemSizeMB());
} else if (quotaCluster.getQuotaClusterId().equals(new Guid("68c96e11-0aad-4e3a-9091-12897b7f2389"))) {
assertEquals(Integer.valueOf(1000), quotaCluster.getVirtualCpu());
assertEquals(unlimited, quotaCluster.getMemSizeMB());
}
}
}
use of org.ovirt.engine.core.common.businessentities.QuotaCluster in project ovirt-engine by oVirt.
the class QuotaDaoTest method getSpecificQuotaCluster.
private static QuotaCluster getSpecificQuotaCluster(Guid quotaId) {
QuotaCluster quotaCluster = new QuotaCluster();
quotaCluster.setQuotaClusterId(Guid.newGuid());
quotaCluster.setQuotaId(quotaId);
quotaCluster.setClusterId(FixturesTool.CLUSTER_RHEL6_NFS);
quotaCluster.setVirtualCpu(2880);
quotaCluster.setMemSizeMB(16000000L);
quotaCluster.setVirtualCpuUsage(0);
quotaCluster.setMemSizeMBUsage(0L);
return quotaCluster;
}
use of org.ovirt.engine.core.common.businessentities.QuotaCluster in project ovirt-engine by oVirt.
the class QuotaDaoTest method testFetchGlobalQuotaUsageForGlobalCluster.
/**
* Test scenario when there is a global limitation on the storage pool, and we check limitation on the entire
* storage pool.<BR/>
* The value that should be returned, is the global limitation and the global usage on the storage pool.
*/
@Test
public void testFetchGlobalQuotaUsageForGlobalCluster() throws Exception {
List<QuotaCluster> quotaClusterList = dao.getQuotaClusterByClusterGuid(null, FixturesTool.QUOTA_GENERAL);
QuotaCluster quotaCluster = quotaClusterList.get(0);
assertEquals(1, quotaClusterList.size());
assertNotNull(quotaCluster);
assertTrue(quotaCluster.getMemSizeMBUsage() > 0);
// Check if the global variable returns when null is initialization.
assertEquals(Integer.valueOf(100), quotaCluster.getVirtualCpu());
}
Aggregations