use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupTransferServiceIntegrationTest method transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren.
@Ignore
@Test
public void transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren() throws Exception {
// setup
OfficeBO branchOffice = anExistingBranchOffice(new OfficeBuilder().withGlobalOfficeNum("xxxx-003").withName("builder-branch-office1").withShortName("bf1").withSearchId("1.1.1.1."));
OfficeBO branchOffice2 = new OfficeBuilder().withParentOffice(branchOffice.getParentOffice()).branchOffice().withGlobalOfficeNum("xxxx-004").withName("builder-branch-office2").withShortName("bf1").withSearchId("1.1.1.2.").build();
IntegrationTestObjectMother.createOffice(branchOffice2);
DateTime todaySixWeeksAgo = new DateMidnight().toDateTime().minusWeeks(6);
MeetingBO weeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-sixWeeksAgo").startingFrom(todaySixWeeksAgo.toDate()).build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
CenterBuilder centerWithWeeklyMeeting = anActiveCenter().withName("center-with-no-children").with(weeklyMeeting).with(branchOffice).withActivationDate(todaySixWeeksAgo).withLoanOfficer(anExistingLoanOfficer());
CenterBO centerWithNoChildren = anExistingActiveCenter(centerWithWeeklyMeeting);
DateTime tomorrowTwoWeeksAgo = new DateMidnight().toDateTime().minusWeeks(2).plusDays(1);
MeetingBO differentWeeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-tomorrow-twoWeeksAgo").withStartDate(tomorrowTwoWeeksAgo.minusWeeks(1)).build();
IntegrationTestObjectMother.saveMeeting(differentWeeklyMeeting);
CenterBuilder centerInDifferentBranchWithDifferentMeeting = centerWithWeeklyMeeting.withName("center-with-group").with(branchOffice2).with(differentWeeklyMeeting).withActivationDate(tomorrowTwoWeeksAgo);
GroupBO groupForTransfer = anExistingGroupUnderCenterInDifferentBranchAs(centerInDifferentBranchWithDifferentMeeting);
ClientBO child1 = new ClientBuilder().active().withName("client1").withParentCustomer(groupForTransfer).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(child1, child1.getCustomerMeetingValue());
// pre-verification
ClientBO client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
// exercise test
groupForTransfer = customerDao.findGroupBySystemId(groupForTransfer.getGlobalCustNum());
groupForTransfer.setUserContext(TestUtils.makeUser());
customerService.transferGroupTo(groupForTransfer, centerWithNoChildren);
// verification
client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
TestUtils.assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
// TO-FIX TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(todaySixWeeksAgo.getDayOfWeek()));
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class ClientCustActionStrutsTest method createGroupWithoutFee.
private void createGroupWithoutFee() throws Exception {
meeting = new MeetingBO(WeekDay.MONDAY, TestObjectFactory.EVERY_WEEK, new Date(), MeetingType.CUSTOMER_MEETING, "Delhi");
group = new GroupBO(userContext, "groupName", CustomerStatus.GROUP_PENDING, "1234", false, null, null, null, null, legacyPersonnelDao.getPersonnel(Short.valueOf("3")), new OfficePersistence().getOffice(Short.valueOf("3")), meeting, legacyPersonnelDao.getPersonnel(Short.valueOf("3")));
new GroupPersistence().saveGroup(group);
StaticHibernateUtil.flushAndClearSession();
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class TestObjectFactory method createGroupUnderCenter.
public static GroupBO createGroupUnderCenter(final String customerName, final CustomerStatus customerStatus, final String externalId, final boolean trained, final Date trainedDate, final Address address, final List<CustomFieldDto> customFields, final List<FeeDto> fees, final Short formedById, final CustomerBO parentCustomer) {
GroupBO group;
try {
group = new GroupBO(TestUtils.makeUserWithLocales(), customerName, customerStatus, externalId, trained, trainedDate, address, customFields, fees, getPersonnel(formedById), parentCustomer);
new GroupPersistence().saveGroup(group);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return group;
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class TestObjectFactory method createInstanceForTest.
public static GroupBO createInstanceForTest(final UserContext userContext, final GroupTemplate template, final CenterBO center, final Date customerActivationDate) {
PersonnelBO formedBy = null;
DateTime mfiJoiningDate = new DateTime().toDateMidnight().toDateTime();
DateTime activationDate = new DateTime().toDateMidnight().toDateTime();
GroupBO group = GroupBO.createGroupWithCenterAsParent(userContext, template.getDisplayName(), formedBy, center, template.getAddress(), template.getExternalId(), template.isTrained(), new DateTime(template.getTrainedDate()), template.getCustomerStatus(), mfiJoiningDate, activationDate);
group.setCustomerActivationDate(customerActivationDate);
return group;
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class IntegrationTestObjectMotherBuilderDsl method anExistingGroupUnderCenterInSameBranchAs.
public static GroupBO anExistingGroupUnderCenterInSameBranchAs(CenterBuilder centerBuilder) {
CenterBO centerAsParent = centerBuilder.build();
IntegrationTestObjectMother.createCenter(centerAsParent, centerAsParent.getCustomerMeetingValue());
GroupBO group = anActiveGroup().withParentCustomer(centerAsParent).formedBy(anExistingApplicationUser()).build();
IntegrationTestObjectMother.createGroup(group, group.getCustomerMeetingValue());
return group;
}
Aggregations