use of org.ovirt.engine.api.model.QuotaStorageLimit 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.QuotaStorageLimit in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitResource method createQuotaLimit.
@Override
protected QuotaStorageLimit createQuotaLimit() {
QuotaStorageLimit limit = new QuotaStorageLimit();
limit.setId(id);
return limit;
}
use of org.ovirt.engine.api.model.QuotaStorageLimit in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitsResource method addLimit.
private void addLimit(String id, QuotaStorageLimits limits, Quota quota) {
QuotaStorageLimit limit = new QuotaStorageLimit();
limit.setId(id);
limits.getQuotaStorageLimits().add(addLinks(map(quota, limit)));
}
use of org.ovirt.engine.api.model.QuotaStorageLimit in project ovirt-engine by oVirt.
the class BackendQuotaStorageLimitsResource method add.
public Response add(QuotaStorageLimit incoming) {
Quota entity = getQuota();
QuotaCRUDParameters parameters = new QuotaCRUDParameters(map(incoming, entity));
performAction(ActionType.UpdateQuota, parameters);
entity = getQuota();
updateIncomingId(incoming, entity);
QuotaStorageLimit model = map(entity, incoming);
model = addLinks(doPopulate(model, entity));
return Response.ok(model).build();
}
use of org.ovirt.engine.api.model.QuotaStorageLimit 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