use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class LoanPrdActionStrutsTest method testLoad.
@Test
public void testLoad() throws Exception {
setRequestPathInfo("/loanproductaction.do");
addRequestParameter("method", "load");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.load_success.toString());
List<ProductCategoryBO> productCategories = (List<ProductCategoryBO>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRODUCTCATEGORYLIST, request);
Assert.assertEquals("The size of master data for categories", 1, productCategories.size());
for (ProductCategoryBO productCategory : productCategories) {
Assert.assertNotNull(productCategory.getProductType());
}
Assert.assertEquals("The size of applicable list", 2, ((List<MasterDataEntity>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANAPPLFORLIST, request)).size());
Assert.assertEquals("The size of grace period types list", 3, ((List<MasterDataEntity>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANGRACEPERIODTYPELIST, request)).size());
Assert.assertEquals("The size of interest types list", 4, ((List<MasterDataEntity>) SessionUtils.getAttribute(ProductDefinitionConstants.INTERESTTYPESLIST, request)).size());
Assert.assertEquals("The size of applicable list", 10, ((List<GLCodeEntity>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRICIPALGLCODELIST, request)).size());
Assert.assertEquals("The size of applicable list", 3, ((List<GLCodeEntity>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANINTERESTGLCODELIST, request)).size());
List<FundBO> funds = (List<FundBO>) SessionUtils.getAttribute(ProductDefinitionConstants.SRCFUNDSLIST, request);
Assert.assertNotNull(funds);
List<FeeDto> loanFees = (List<FeeDto>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANFEESLIST, request);
Assert.assertNull(loanFees);
List<FeeBO> productFees = (List<FeeBO>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDFEE, request);
Assert.assertNotNull(productFees);
List<FeeDto> selectedFees = (List<FeeDto>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDFEESELECTEDLIST, request);
Assert.assertNotNull(selectedFees);
List<FundBO> selectedFunds = (List<FundBO>) SessionUtils.getAttribute(ProductDefinitionConstants.LOANPRDFUNDSELECTEDLIST, request);
Assert.assertNotNull(selectedFunds);
Assert.assertEquals(0, (selectedFees).size());
Assert.assertEquals(0, (selectedFunds).size());
}
use of org.mifos.accounts.financial.business.GLCodeEntity 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());
}
use of org.mifos.accounts.financial.business.GLCodeEntity 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);
}
}
use of org.mifos.accounts.financial.business.GLCodeEntity 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);
}
}
use of org.mifos.accounts.financial.business.GLCodeEntity 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());
}
}
Aggregations