Search in sources :

Example 71 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithStartDateGreaterThanCurrentDate.

@Test
public void testBuildSavingsOfferingWithStartDateGreaterThanCurrentDate() throws SystemException, ApplicationException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(2);
    SavingsOfferingBO product = new SavingsOfferingBO(TestUtils.makeUser(), "Savings Offering", "Savi", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
    Assert.assertNotNull(product.getGlobalPrdOfferingNum());
    Assert.assertEquals(PrdStatus.SAVINGS_INACTIVE, product.getStatus());
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 72 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithEndDateLessThanStartDate.

@Test
public void testBuildSavingsOfferingWithEndDateLessThanStartDate() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(0);
    Date endDate = offSetCurrentDate(-2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Offering", "Savi", productCategory, prdApplicableMaster, startDate, endDate, "dssf", null, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), new Money(getCurrency()), new Money(getCurrency()), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 73 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithNoRecommendedAmountUnitForGroupOffering.

@Test
public void testBuildSavingsOfferingWithNoRecommendedAmountUnitForGroupOffering() throws SystemException {
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.GROUPS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(-2);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product1", "SAVP", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10.0"), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException e) {
        Assert.assertTrue(true);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Example 74 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testUpdateSavingsOfferingFailureWithStartDateInFuture.

@Test
public void testUpdateSavingsOfferingFailureWithStartDateInFuture() throws Exception {
    String name = "Savings_offering";
    String newName = "Savings_offeringChanged";
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(0);
    Date endDate = offSetCurrentDate(10);
    savingsProduct = createSavingsOfferingBO(name, "S", ApplicableTo.CLIENTS, startDate, PrdStatus.SAVINGS_INACTIVE, SavingsType.VOLUNTARY, InterestCalcType.AVERAGE_BALANCE);
    savingsProduct.setStartDate(reduceCurrentDate(1));
    Date newStartDate = offSetCurrentDate(1);
    try {
        savingsProduct.update(Short.valueOf("1"), newName, "S1", productCategory, prdApplicableMaster, newStartDate, endDate, "Desc", PrdStatus.SAVINGS_INACTIVE, null, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), new Money(getCurrency(), "100"), new Money(getCurrency(), "1"), 10.0);
        Assert.fail();
    } catch (ProductDefinitionException pde) {
        Assert.assertTrue(true);
        Assert.assertEquals(ProductDefinitionConstants.STARTDATEUPDATEEXCEPTION, pde.getKey());
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) Date(java.sql.Date) Test(org.junit.Test)

Example 75 with MeetingBO

use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.

the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithDuplicatePrdOfferingShortName.

@Test
public void testBuildSavingsOfferingWithDuplicatePrdOfferingShortName() throws SystemException {
    savingsProduct = createSavingsOfferingBO("Savings Product", "SAVP");
    PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
    SavingsTypeEntity savingsType = new SavingsTypeEntity(SavingsType.MANDATORY);
    InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(InterestCalcType.AVERAGE_BALANCE);
    MeetingBO intCalcMeeting = getMeeting();
    MeetingBO intPostMeeting = getMeeting();
    GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, (short) 7);
    ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, (short) 2);
    Date startDate = offSetCurrentDate(0);
    try {
        new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product1", "SAVP", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
        Assert.fail();
    } catch (ProductDefinitionException pde) {
        Assert.assertTrue(true);
        Assert.assertEquals(ProductDefinitionConstants.DUPLPRDINSTSHORTNAME, pde.getKey());
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) Date(java.sql.Date) Test(org.junit.Test)

Aggregations

MeetingBO (org.mifos.application.meeting.business.MeetingBO)355 Test (org.junit.Test)176 Date (java.util.Date)91 ArrayList (java.util.ArrayList)84 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)74 DateTime (org.joda.time.DateTime)68 LocalDate (org.joda.time.LocalDate)56 Money (org.mifos.framework.util.helpers.Money)56 CenterBuilder (org.mifos.domain.builders.CenterBuilder)54 CenterBO (org.mifos.customers.center.business.CenterBO)46 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)44 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)42 Date (java.sql.Date)40 UserContext (org.mifos.security.util.UserContext)34 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)33 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)30 OfficeBO (org.mifos.customers.office.business.OfficeBO)27 CustomerBO (org.mifos.customers.business.CustomerBO)23 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)22 MifosUser (org.mifos.security.MifosUser)20