/** * Make Quota specific to be the same as Quota general and specific. * * @throws Exception */ @Test public void testUpdateQuota() throws Exception { Quota quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL); // Save quotaName and vdsGroup list for future check. String quotaName = "New Temporary name"; List<QuotaVdsGroup> quotaVdsGroupList = getQuotaVdsGroup(getSpecificQuotaVdsGroup(quotaGeneralToSpecific.getId())); Long newStorageLimit = new Long("2345"); // Check before the update, that the fields are not equal. assertEquals(quotaName.equals(quotaGeneralToSpecific.getQuotaName()), false); assertEquals( quotaVdsGroupList.size() == quotaGeneralToSpecific.getQuotaVdsGroups().size(), false); assertEquals( quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB().equals(newStorageLimit), false); // Update quotaGeneralToSpecific.setQuotaName(quotaName); quotaGeneralToSpecific.getGlobalQuotaStorage().setStorageSizeGB(newStorageLimit); quotaGeneralToSpecific.setQuotaVdsGroups(quotaVdsGroupList); dao.update(quotaGeneralToSpecific); quotaGeneralToSpecific = dao.getById(FixturesTool.QUOTA_GENERAL); // Check after the update, that the fields are equal now. assertEquals(quotaName.equals(quotaGeneralToSpecific.getQuotaName()), true); assertEquals( quotaVdsGroupList.size() == quotaGeneralToSpecific.getQuotaVdsGroups().size(), true); assertEquals( quotaGeneralToSpecific.getGlobalQuotaStorage().getStorageSizeGB().equals(newStorageLimit), true); }