Search in sources :

Example 1 with IndirectCostRecoveryAccountChange

use of edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRuleTest method testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillNotBe100PercentAfterUpdateTwoSameAccounts_Pass.

@Test
public void testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillNotBe100PercentAfterUpdateTwoSameAccounts_Pass() {
    LOG.debug("enter testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass");
    CuAccountGlobal accountGlobal = (CuAccountGlobal) AccountGlobalFixture.ACCT_GLOBAL_1111111_2222222_98_2_ACTIVE_3333333_100_INACTIVE.getAccountGlobal();
    AccountGlobalDetail accountGlobalDetail = AccountGlobalDetailFixture.ACCOUNT_GLOBAL_DETAIL_3333333_100_ACTIVE_1111111_98_INACTIVE_98_INACTIVE.getAccountGlobalDetail();
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = accountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    List<IndirectCostRecoveryAccount> existing = accountGlobalDetail.getAccount().getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccounts(existing);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existing, accountGlobalDetail, accountGlobal);
    assertTrue("Updated Account Global ICR account distribution should have been 100%", result);
}
Also used : IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) CuAccountGlobal(edu.cornell.kfs.coa.businessobject.CuAccountGlobal) Test(org.junit.Test)

Example 2 with IndirectCostRecoveryAccountChange

use of edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_1111111_2222222_3333333_98_2_ACTIVE_100_INACTIVE.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_98_INACTIVE_98_INACTIVE_3333333_100_PERCENT_ACTIVE.getSubAccountGlobalDetail();
    List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
    existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
    assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with IndirectCostRecoveryAccountChange

use of edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRuleTest method testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail.

@Test
public void testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail() {
    LOG.info("enter testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail");
    CuAccountGlobal accountGlobal = (CuAccountGlobal) AccountGlobalFixture.ACCT_GLOBAL_1111111_98_ACTIVE.getAccountGlobal();
    AccountGlobalDetail accountGlobalDetail = AccountGlobalDetailFixture.ACCOUNT_GLOBAL_DETAIL_3333333_100_ACTIVE_1111111_98_INACTIVE_2222222_2_INACTIVE.getAccountGlobalDetail();
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = accountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    List<IndirectCostRecoveryAccount> existing = accountGlobalDetail.getAccount().getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccounts(existing);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existing, accountGlobalDetail, accountGlobal);
    assertFalse("Updated Account Global ICR account distribution should NOT have been 100%", result);
}
Also used : IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) CuAccountGlobal(edu.cornell.kfs.coa.businessobject.CuAccountGlobal) Test(org.junit.Test)

Example 4 with IndirectCostRecoveryAccountChange

use of edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_3333333_100_ACTIVE_1111111_2222222_98_2_INACTIVE.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_2222222_98_2.getSubAccountGlobalDetail();
    List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
    existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
    assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 5 with IndirectCostRecoveryAccountChange

use of edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRule method processCustomAddCollectionLineBusinessRules.

/**
 * @see org.kuali.kfs.kns.maintenance.rules.MaintenanceDocumentRuleBase#processCustomAddCollectionLineBusinessRules(org.kuali.kfs.kns.document.MaintenanceDocument, java.lang.String, org.kuali.kfs.krad.bo.PersistableBusinessObject)
 */
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject line) {
    boolean success = true;
    success &= super.processCustomAddCollectionLineBusinessRules(document, collectionName, line);
    line.refreshNonUpdateableReferences();
    if (line instanceof IndirectCostRecoveryAccountChange) {
        IndirectCostRecoveryAccountChange account = (IndirectCostRecoveryAccountChange) line;
        success &= validateIndirectCostRecoveryAccount(account);
    }
    return success;
}
Also used : IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)

Aggregations

IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)12 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)8 SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)4 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)3 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)3 HashMap (java.util.HashMap)2 A21SubAccountChange (edu.cornell.kfs.coa.businessobject.A21SubAccountChange)1 Account (org.kuali.kfs.coa.businessobject.Account)1 IndirectCostRecoveryRateDetail (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryRateDetail)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1