Search in sources :

Example 51 with Quota

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);
}
Also used : Quota(org.ovirt.engine.core.common.businessentities.Quota) Test(org.junit.Test)

Example 52 with Quota

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);
}
Also used : QuotaStorage(org.ovirt.engine.core.common.businessentities.QuotaStorage) Quota(org.ovirt.engine.core.common.businessentities.Quota) Test(org.junit.Test)

Example 53 with Quota

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);
}
Also used : Quota(org.ovirt.engine.core.common.businessentities.Quota) Test(org.junit.Test)

Example 54 with Quota

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();
}
Also used : QuotaCRUDParameters(org.ovirt.engine.core.common.action.QuotaCRUDParameters) QuotaStorageLimit(org.ovirt.engine.api.model.QuotaStorageLimit) Quota(org.ovirt.engine.core.common.businessentities.Quota)

Example 55 with Quota

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;
}
Also used : Quota(org.ovirt.engine.core.common.businessentities.Quota)

Aggregations

Quota (org.ovirt.engine.core.common.businessentities.Quota)101 ArrayList (java.util.ArrayList)23 Guid (org.ovirt.engine.core.compat.Guid)22 Test (org.junit.Test)17 QuotaCluster (org.ovirt.engine.core.common.businessentities.QuotaCluster)17 QuotaStorage (org.ovirt.engine.core.common.businessentities.QuotaStorage)16 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)12 HashMap (java.util.HashMap)9 List (java.util.List)9 QueryType (org.ovirt.engine.core.common.queries.QueryType)9 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)8 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)8 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)6 QuotaCRUDParameters (org.ovirt.engine.core.common.action.QuotaCRUDParameters)6 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)6 Map (java.util.Map)5 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)5 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5