本文整理了Java中org.ovirt.engine.core.common.businessentities.Quota.setQuotaClusters
方法的一些代码示例,展示了Quota.setQuotaClusters
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.setQuotaClusters
方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.Quota
类名称:Quota
方法名:setQuotaClusters
暂无
代码示例来源:origin: oVirt/ovirt-engine
/**
* Default constructor of Quota, which initialize empty lists for specific limitations, and no user assigned.
*/
public Quota() {
setQuotaStorages(new ArrayList<QuotaStorage>());
setQuotaClusters(new ArrayList<QuotaCluster>());
id = Guid.Empty;
description = "";
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Get full {@code Quota} entity.
*/
@Override
public Quota getById(Guid quotaId) {
MapSqlParameterSource parameterSource = createQuotaIdParameterMapper(quotaId);
Quota quotaEntity =
getCallsHandler().executeRead("GetQuotaByQuotaGuid", getQuotaFromResultSet(), parameterSource);
if (quotaEntity != null) {
quotaEntity.setQuotaClusters(getQuotaClusterByQuotaGuid(quotaId));
quotaEntity.setQuotaStorages(getQuotaStorageByQuotaGuid(quotaId));
}
return quotaEntity;
}
代码示例来源:origin: oVirt/ovirt-engine
} else {
if (quota.getQuotaClusters() == null) {
quota.setQuotaClusters(new ArrayList<>());
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testListNonGlobalLimit() {
Quota quota = getQuota();
List<QuotaCluster> clusterLimits = new LinkedList<>();
QuotaCluster clusterLimit1 = new QuotaCluster();
clusterLimit1.setVirtualCpu(CPU_NUMBER);
clusterLimit1.setClusterId(CLUSTER_ID_1);
QuotaCluster clusterLimit2 = new QuotaCluster();
clusterLimit2.setVirtualCpuUsage(VIRTUAL_CPU_USAGE);
clusterLimit2.setClusterId(CLUSTER_ID_2);
clusterLimits.add(clusterLimit1);
clusterLimits.add(clusterLimit2);
quota.setQuotaClusters(clusterLimits);
setUpGetEntityExpectations(quota);
QuotaClusterLimits list = collection.list();
assertClusterLimitsFound(list, 2);
for (QuotaClusterLimit clusterLimit: list.getQuotaClusterLimits()) {
if (clusterLimit.getCluster().getId().equals(CLUSTER_ID_1.toString())) {
assertEquals(CPU_NUMBER, clusterLimit.getVcpuLimit().longValue());
}
if (clusterLimit.getCluster().getId().equals(CLUSTER_ID_2.toString())) {
assertEquals(VIRTUAL_CPU_USAGE, (int) clusterLimit.getVcpuUsage());
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Make Quota specific to be the same as Quota general and specific.
*/
@Test
public void testUpdateQuota() {
Quota quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL);
// Save quotaName and cluster list for future check.
String quotaName = "New Temporary name";
List<QuotaCluster> quotaClusterList =
getQuotaCluster(getSpecificQuotaCluster(quotaGeneralToSpecific.getId()));
Long newStorageLimit = 2345L;
// Check before the update, that the fields are not equal.
assertNotEquals(quotaName, quotaGeneralToSpecific.getQuotaName());
assertNotEquals(quotaClusterList.size(), quotaGeneralToSpecific.getQuotaClusters().size());
assertNotEquals(newStorageLimit, quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB());
// Update
quotaGeneralToSpecific.setQuotaName(quotaName);
quotaGeneralToSpecific.getGlobalQuotaStorage().setStorageSizeGB(newStorageLimit);
quotaGeneralToSpecific.setQuotaClusters(quotaClusterList);
dao.update(quotaGeneralToSpecific);
quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL);
// Check after the update, that the fields are equal now.
assertEquals(quotaName, quotaGeneralToSpecific.getQuotaName());
assertEquals(quotaClusterList.size(), quotaGeneralToSpecific.getQuotaClusters().size());
assertEquals(newStorageLimit, quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB());
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testSpecificAndGeneralQuotaLimitations() {
// Set new Quota definition.
Quota quota = createGeneralQuota();
quota.setQuotaClusters(getQuotaCluster(getSpecificQuotaCluster(quota.getId())));
quota.setQuotaStorages(getQuotaStorage(null));
quota.setGlobalQuotaStorage(new QuotaStorage(null, null, null, 10000L, 0d));
dao.save(quota);
Quota quotaEntity = dao.getById(quota.getId());
assertNotNull(quotaEntity);
assertEquals(quota, quotaEntity);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testSpecificQuotaLimitations() {
// Set new Quota definition.
Quota quota = createGeneralQuota();
quota.setQuotaClusters(getQuotaCluster(getSpecificQuotaCluster(quota.getId())));
quota.setQuotaStorages(getQuotaStorage(getSpecificQuotaStorage(quota.getId())));
dao.save(quota);
Quota quotaEntity = dao.getById(quota.getId());
assertNotNull(quotaEntity);
assertEquals(quota, quotaEntity);
}
代码示例来源:origin: oVirt/ovirt-engine
quota.setQuotaClusters(quotaClusterList);
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGeneralQuotaLimitations() {
// Set new Quota definition.
Quota quota = createGeneralQuota();
setQuotaGlobalLimitations(quota);
quota.setQuotaClusters(getQuotaCluster(null));
quota.setQuotaStorages(getQuotaStorage(null));
dao.save(quota);
Quota quotaEntity = dao.getById(quota.getId());
assertNotNull(quotaEntity);
assertEquals(quota, quotaEntity);
assertEquals("rhel6.NFS", quotaEntity.getStoragePoolName());
assertEquals(QuotaEnforcementTypeEnum.DISABLED, quotaEntity.getQuotaEnforcementType());
}
内容来源于网络,如有侵权,请联系作者删除!