use of org.ovirt.engine.api.model.QuotaStorageLimits in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitsResourceTest method testListGlobalLimit.
@Test
public void testListGlobalLimit() throws Exception {
Quota quota = getQuota();
quota.setGlobalQuotaStorage(getStorageGlobalCpuLimit());
setUpGetEntityExpectations(quota);
QuotaStorageLimits storageLimits = collection.list();
assertStorageLimitsFound(storageLimits, 1);
QuotaStorageLimit storageLimit = storageLimits.getQuotaStorageLimits().get(0);
assertEquals(STORAGE_SIZE_GB, storageLimit.getLimit());
}
use of org.ovirt.engine.api.model.QuotaStorageLimits in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitsResource method list.
@Override
public QuotaStorageLimits list() {
Quota quota = getQuota();
QuotaStorageLimits limits = new QuotaStorageLimits();
if (quota.getGlobalQuotaStorage() != null) {
addLimit(quotaId.toString(), limits, quota);
} else if (quota.getQuotaStorages() != null) {
for (QuotaStorage quotaStorage : quota.getQuotaStorages()) {
addLimit(quotaStorage.getStorageId().toString(), limits, quota);
}
}
return limits;
}
use of org.ovirt.engine.api.model.QuotaStorageLimits in project ovirt-engine by oVirt.
the class V3QuotaStorageLimitsInAdapter method adapt.
@Override
public QuotaStorageLimits adapt(V3QuotaStorageLimits from) {
QuotaStorageLimits to = new QuotaStorageLimits();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getQuotaStorageLimits().addAll(adaptIn(from.getQuotaStorageLimits()));
return to;
}
use of org.ovirt.engine.api.model.QuotaStorageLimits in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitsResourceTest method testListNonGlobalLimit.
@Test
public void testListNonGlobalLimit() throws Exception {
Quota quota = getQuota();
List<QuotaStorage> storageLimits = new LinkedList<>();
QuotaStorage storageLimit1 = new QuotaStorage();
storageLimit1.setStorageSizeGB(STORAGE_SIZE_GB);
storageLimit1.setStorageId(STORAGE_ID_1);
QuotaStorage storageLimit2 = new QuotaStorage();
storageLimit2.setStorageSizeGBUsage(STORAGE_SIZE_GB_USAGE);
storageLimit2.setStorageId(STORAGE_ID_2);
storageLimits.add(storageLimit1);
storageLimits.add(storageLimit2);
quota.setQuotaStorages(storageLimits);
setUpGetEntityExpectations(quota);
QuotaStorageLimits list = collection.list();
assertStorageLimitsFound(list, 2);
for (QuotaStorageLimit storageLimit : list.getQuotaStorageLimits()) {
if (storageLimit.getStorageDomain().getId().equals(STORAGE_ID_1.toString())) {
assertEquals(STORAGE_SIZE_GB, storageLimit.getLimit());
}
if (storageLimit.getStorageDomain().getId().equals(STORAGE_ID_2.toString())) {
assertTrue(storageLimit.getUsage() == STORAGE_SIZE_GB_USAGE);
}
}
}
Aggregations