use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class SavingsOfferingBOIntegrationTest method testCreateSavingsOffering.
@Test
public void testCreateSavingsOffering() throws SystemException, ProductDefinitionException {
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(7);
savingsProduct = 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);
savingsProduct.save();
StaticHibernateUtil.flushSession();
savingsProduct = (SavingsOfferingBO) TestObjectFactory.getObject(SavingsOfferingBO.class, savingsProduct.getPrdOfferingId());
Assert.assertEquals("Savings Offering", savingsProduct.getPrdOfferingName());
Assert.assertEquals("Savi", savingsProduct.getPrdOfferingShortName());
Assert.assertNotNull(savingsProduct.getGlobalPrdOfferingNum());
Assert.assertEquals(PrdStatus.SAVINGS_ACTIVE, savingsProduct.getStatus());
Assert.assertEquals(ApplicableTo.CLIENTS, savingsProduct.getPrdApplicableMasterEnum());
Assert.assertEquals(SavingsType.MANDATORY, savingsProduct.getSavingsTypeAsEnum());
Assert.assertEquals(InterestCalcType.AVERAGE_BALANCE.getValue(), savingsProduct.getInterestCalcType().getId());
}
use of org.mifos.accounts.financial.business.GLCodeEntity in project head by mifos.
the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithShortNameGreaterThanFourDig.
@Test
public void testBuildSavingsOfferingWithShortNameGreaterThanFourDig() 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);
try {
new SavingsOfferingBO(TestUtils.makeUser(), "Savings Offering", "Savings", productCategory, prdApplicableMaster, new Date(System.currentTimeMillis()), savingsType, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 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 testBuildSavingsOfferingWithoutSavingsType.
@Test
public void testBuildSavingsOfferingWithoutSavingsType() throws SystemException {
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(ApplicableTo.CLIENTS);
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);
try {
new SavingsOfferingBO(TestUtils.makeUser(), "Savings offering", "S", productCategory, prdApplicableMaster, new Date(System.currentTimeMillis()), null, intCalType, intCalcMeeting, intPostMeeting, new Money(getCurrency(), "10"), 10.0, depglCodeEntity, intglCodeEntity);
Assert.fail();
} catch (ProductDefinitionException e) {
Assert.assertTrue(true);
}
}
Aggregations