Search in sources :

Example 16 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class ChartOfAccountsCacheTest method testTopLevelAccountCached.

public void testTopLevelAccountCached() throws Exception {
    LegacyAccountDao ap = createMockAccountPersistance();
    COABO income = ap.getCategory(GLCategoryType.INCOME);
    COABO cachedIncome = ChartOfAccountsCache.get(INCOME_GL_ACCOUNT_CODE);
    Assert.assertEquals(income, cachedIncome);
}
Also used : LegacyAccountDao(org.mifos.accounts.persistence.LegacyAccountDao) COABO(org.mifos.accounts.financial.business.COABO)

Example 17 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class FinancialInitializerIntegrationTest method testAssetsCategoryIsCached.

@Test
public void testAssetsCategoryIsCached() throws Exception {
    String assetsGlCode = "10000";
    COABO account1 = ChartOfAccountsCache.get(assetsGlCode);
    Assert.assertEquals(GLCategoryType.ASSET, account1.getCategoryType());
}
Also used : COABO(org.mifos.accounts.financial.business.COABO) Test(org.junit.Test)

Example 18 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class InterestPostingAccountingEntryTest method makeChildCoaboOf.

/**
     * Establish child-parent relationship between two COABO instances.
     *
     * <p>
     * ASSUMPTION: the parentCoa's hierarchy has been created. In other words, build the hierarchy from top down.
     *
     * @throws RuntimeException  if parentCoa has no associated COAHierarchy.
     */
protected COABO makeChildCoaboOf(COABO parentCoa, Short accountId, String accountName, String glCode) {
    COAHierarchyEntity parentCoah = parentCoa.getCoaHierarchy();
    if (parentCoah == null) {
        throw new RuntimeException("ParentCoa.coaHierarchy has not been defined");
    }
    COABO childCoa = new COABO(accountId, accountName, new GLCodeEntity(accountId, glCode));
    COAHierarchyEntity hierarchy = new COAHierarchyEntity(childCoa, parentCoa.getCoaHierarchy());
    childCoa.setCoaHierarchy(hierarchy);
    return childCoa;
}
Also used : COABO(org.mifos.accounts.financial.business.COABO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) COAHierarchyEntity(org.mifos.accounts.financial.business.COAHierarchyEntity)

Example 19 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testTopLevelAccountPersisted.

@Test
public void testTopLevelAccountPersisted() throws Exception {
    COABO incomeCategory = legacyAccountDao.getCategory(GLCategoryType.INCOME);
    Assert.assertEquals(GLCategoryType.INCOME, incomeCategory.getCategoryType());
}
Also used : COABO(org.mifos.accounts.financial.business.COABO) Test(org.junit.Test)

Example 20 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testAddGlAccount.

@Test
public void testAddGlAccount() {
    String name = "New Account Name";
    String glCode = "999999";
    String parentGlCode = ASSETS_GL_ACCOUNT_CODE;
    COABO coa = legacyAccountDao.addGeneralLedgerAccount(name, glCode, parentGlCode, null);
    Assert.assertEquals(coa.getAccountId(), legacyAccountDao.getAccountIdFromGlCode(glCode));
}
Also used : COABO(org.mifos.accounts.financial.business.COABO) Test(org.junit.Test)

Aggregations

COABO (org.mifos.accounts.financial.business.COABO)28 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)10 FinancialActionTypeEntity (org.mifos.accounts.financial.business.FinancialActionTypeEntity)6 Query (org.hibernate.Query)5 ArrayList (java.util.ArrayList)4 COAHierarchyEntity (org.mifos.accounts.financial.business.COAHierarchyEntity)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 PersistenceException (org.mifos.framework.exceptions.PersistenceException)4 Session (org.hibernate.Session)3 Test (org.junit.Test)3 FinancialActionConstants (org.mifos.accounts.financial.util.helpers.FinancialActionConstants)3 LegacyAccountDao (org.mifos.accounts.persistence.LegacyAccountDao)3 HashMap (java.util.HashMap)2 BeforeClass (org.junit.BeforeClass)2 FinancialException (org.mifos.accounts.financial.exceptions.FinancialException)2 ChartOfAccountsCache (org.mifos.accounts.financial.util.helpers.ChartOfAccountsCache)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Iterator (java.util.Iterator)1