Search in sources :

Example 6 with AccountStateFlagEntity

use of org.mifos.accounts.business.AccountStateFlagEntity in project head by mifos.

the class SavingsBOIntegrationTest method testSuccessfulFlagSave.

@Test
public void testSuccessfulFlagSave() throws Exception {
    Session session = StaticHibernateUtil.getSessionTL();
    StaticHibernateUtil.startTransaction();
    createInitialObjects();
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    savings = helper.createSavingsAccount("000X00000000013", savingsOffering, group, AccountStates.SAVINGS_ACC_APPROVED, userContext);
    savings.setUserContext(TestObjectFactory.getContext());
    PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
    savings.changeStatus(AccountState.SAVINGS_CANCELLED, null, "", loggedInUser);
    savings.setUserContext(this.userContext);
    AccountStateEntity state = (AccountStateEntity) session.get(AccountStateEntity.class, (short) 15);
    for (AccountStateFlagEntity flag : state.getFlagSet()) {
        AccountTestUtils.addAccountFlag(flag, savings);
    }
    savings.update();
    session = StaticHibernateUtil.getSessionTL();
    SavingsBO savingsNew = (SavingsBO) (session.get(SavingsBO.class, Integer.valueOf(savings.getAccountId())));
    Assert.assertEquals(savingsNew.getAccountFlags().size(), 3);
    session.evict(savingsNew);
}
Also used : AccountStateFlagEntity(org.mifos.accounts.business.AccountStateFlagEntity) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) Session(org.hibernate.Session) Test(org.junit.Test)

Aggregations

AccountStateFlagEntity (org.mifos.accounts.business.AccountStateFlagEntity)6 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 BigDecimal (java.math.BigDecimal)2 DateTime (org.joda.time.DateTime)2 LocalDate (org.joda.time.LocalDate)2 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)2 AccountPenaltiesEntity (org.mifos.accounts.business.AccountPenaltiesEntity)2 AccountException (org.mifos.accounts.exceptions.AccountException)2 MaxMinLoanAmount (org.mifos.accounts.loan.business.MaxMinLoanAmount)2 MaxMinNoOfInstall (org.mifos.accounts.loan.business.MaxMinNoOfInstall)2 ProductMixValidator (org.mifos.accounts.loan.struts.action.validate.ProductMixValidator)2 AmountPenaltyBO (org.mifos.accounts.penalties.business.AmountPenaltyBO)2 PenaltyBO (org.mifos.accounts.penalties.business.PenaltyBO)2 AmountRange (org.mifos.accounts.productdefinition.business.AmountRange)2 InstallmentRange (org.mifos.accounts.productdefinition.business.InstallmentRange)2 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)2