use of java.sql.Date in project head by mifos.
the class SavingsOfferingBOIntegrationTest method testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering.
@Test
public void testBuildSavingsOfferingWithNoRecommendedAmountForMandatoryOffering() 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(-2);
try {
new SavingsOfferingBO(TestUtils.makeUser(), "Savings Product1", "SAVP", productCategory, prdApplicableMaster, startDate, savingsType, intCalType, intCalcMeeting, intPostMeeting, null, 10.0, depglCodeEntity, intglCodeEntity);
Assert.fail();
} catch (ProductDefinitionException e) {
Assert.assertTrue(true);
}
}
use of java.sql.Date in project head by mifos.
the class LoanPrdBusinessServiceIntegrationTest method createLoanOfferingBO.
private LoanOfferingBO createLoanOfferingBO(String prdOfferingName, String shortName) {
Date startDate = new Date(System.currentTimeMillis());
MeetingBO frequency = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
return TestObjectFactory.createLoanOffering(prdOfferingName, shortName, ApplicableTo.GROUPS, startDate, PrdStatus.LOAN_ACTIVE, 300.0, 1.2, 3, InterestType.FLAT, frequency);
}
use of java.sql.Date in project head by mifos.
the class ClientTransferActionStrutsTest method createObjectsForTransferringClientInGroup.
private void createObjectsForTransferringClientInGroup() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
MeetingBO meeting1 = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
center1 = TestObjectFactory.createWeeklyFeeCenter("Center1", meeting1);
group1 = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group2", CustomerStatus.GROUP_ACTIVE, center1);
client = TestObjectFactory.createClient("Client11", CustomerStatus.CLIENT_ACTIVE, group, null, (String) null, new Date(1222333444000L));
StaticHibernateUtil.flushSession();
}
use of java.sql.Date in project head by mifos.
the class ClientIntegrationTest method testGenerateScheduleForClient_OnClientCreate.
@Test
public void testGenerateScheduleForClient_OnClientCreate() throws Exception {
SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct("Offering1", "s1", SavingsType.MANDATORY, ApplicableTo.GROUPS, new Date(System.currentTimeMillis()));
createParentObjects(CustomerStatus.GROUP_ACTIVE);
accountBO = TestObjectFactory.createSavingsAccount("globalNum", center, AccountState.SAVINGS_ACTIVE, new java.util.Date(), savingsOffering, TestObjectFactory.getContext());
Assert.assertEquals(0, accountBO.getAccountActionDates().size());
client = createClient(CustomerStatus.CLIENT_ACTIVE);
StaticHibernateUtil.flushSession();
accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());
Assert.assertEquals(1, accountBO.getAccountCustomFields().size());
Assert.assertEquals(10, accountBO.getAccountActionDates().size());
for (AccountActionDateEntity actionDate : accountBO.getAccountActionDates()) {
Assert.assertEquals(client.getCustomerId(), actionDate.getCustomer().getCustomerId());
Assert.assertTrue(true);
}
client = TestObjectFactory.getClient(client.getCustomerId());
group = TestObjectFactory.getGroup(group.getCustomerId());
center = TestObjectFactory.getCenter(center.getCustomerId());
}
use of java.sql.Date in project head by mifos.
the class ClientIntegrationTest method testSuccessfulCreateInActiveState_WithAssociatedSavingsOffering.
@Test
public void testSuccessfulCreateInActiveState_WithAssociatedSavingsOffering() throws Exception {
savingsOffering1 = TestObjectFactory.createSavingsProduct("offering1", "s1", SavingsType.MANDATORY, ApplicableTo.CLIENTS, new Date(System.currentTimeMillis()));
StaticHibernateUtil.flushSession();
List<SavingsOfferingBO> selectedOfferings = new ArrayList<SavingsOfferingBO>();
selectedOfferings.add(savingsOffering1);
String name = "Client 1";
Short povertyStatus = Short.valueOf("41");
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "Client", "", "1", "");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
spouseNameDetailView.setNames(ClientRules.getNameSequence());
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), povertyStatus);
client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.CLIENT_ACTIVE, null, null, null, null, null, selectedOfferings, personnel, new OfficePersistence().getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE), getMeeting(), personnel, null, null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
legacyClientDao.saveClient(client);
StaticHibernateUtil.flushSession();
client = TestObjectFactory.getClient(client.getCustomerId());
Assert.assertEquals(name, client.getDisplayName());
Assert.assertEquals(1, client.getOfferingsAssociatedInCreate().size());
Assert.assertEquals(2, client.getAccounts().size());
for (AccountBO account : client.getAccounts()) {
if (account instanceof SavingsBO) {
Assert.assertEquals(savingsOffering1.getPrdOfferingId(), ((SavingsBO) account).getSavingsOffering().getPrdOfferingId());
Assert.assertNotNull(account.getGlobalAccountNum());
Assert.assertTrue(true);
}
}
StaticHibernateUtil.flushSession();
client = TestObjectFactory.getClient(client.getCustomerId());
savingsOffering1 = null;
}
Aggregations