use of org.ovirt.engine.core.common.businessentities.Quota in project ovirt-engine by oVirt.
the class QuotaDaoTest method testGetQuotaWithNoExistingName.
/**
* Test get Quota by Name, with not existing name.
*/
@Test
public void testGetQuotaWithNoExistingName() throws Exception {
Quota quotaGeneralToSpecific = dao.getQuotaByQuotaName("Any name", FixturesTool.STORAGE_POOL_NFS);
assertNull(quotaGeneralToSpecific);
}
use of org.ovirt.engine.core.common.businessentities.Quota in project ovirt-engine by oVirt.
the class QuotaDaoTest method testSpecificAndGeneralQuotaLimitations.
@Test
public void testSpecificAndGeneralQuotaLimitations() throws Exception {
// 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);
}
use of org.ovirt.engine.core.common.businessentities.Quota in project ovirt-engine by oVirt.
the class QuotaDaoTest method testSpecificQuotaLimitations.
@Test
public void testSpecificQuotaLimitations() throws Exception {
// 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);
}
use of org.ovirt.engine.core.common.businessentities.Quota 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.core.common.businessentities.Quota in project ovirt-engine by oVirt.
the class BaseVmListModelTest method mockQuotaListModel.
protected ListModel<Quota> mockQuotaListModel() {
final Quota quota = new Quota();
quota.setId(QUOTA_ID);
final ListModel<Quota> model = mockListModel(quota);
when(model.getIsAvailable()).thenReturn(true);
return model;
}
Aggregations