use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class ClientServiceFacadeWebTierIntegrationTest method shouldCreateGroupWithExpectedSearchId.
@Test
public void shouldCreateGroupWithExpectedSearchId() {
// setup
boolean centerHierarchyExistsOriginal = ClientRules.getCenterHierarchyExists();
MeetingBO meeting = new MeetingBuilder().withStartDate(new DateTime().minusWeeks(2)).build();
MeetingDto meetingDto = meeting.toDto();
String externalId = null;
AddressDto addressDto = new AddressDto("here", "", "", "", "", "", "", "");
PersonnelBO user = IntegrationTestObjectMother.findPersonnelById(Short.valueOf("1"));
Short loanOfficerId = user.getPersonnelId();
List<ApplicableAccountFeeDto> feesToApply = new ArrayList<ApplicableAccountFeeDto>();
CustomerStatus.CLIENT_ACTIVE.getValue();
boolean trained = false;
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
// setup
createOfficeHierarchyUnderHeadOffice(headOffice);
Short officeId = branch1.getOfficeId();
DateTime mfiJoiningDate = new DateTime().minusWeeks(2);
DateTime activationDate = new DateTime().minusWeeks(1);
List<Short> selectedSavingProducts = new ArrayList<Short>();
String clientName = "client";
Short formedBy = loanOfficerId;
Date dateOfBirth = new LocalDate(1990, 1, 1).toDateMidnight().toDate();
String governmentId = "";
Date trainedDate = new LocalDate(2000, 1, 1).toDateMidnight().toDate();
;
// not in a group
Short groupFlag = YesNoFlag.NO.getValue();
Integer salutation = 1;
String firstName = "first";
String middleName = null;
String lastName = "last";
String secondLastName = null;
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), salutation, firstName, middleName, lastName, secondLastName);
// magic numbers from default data
Integer ethnicity = 218;
Integer citizenship = 130;
Integer handicapped = 138;
Integer businessActivities = 225;
Integer educationLevel = 226;
Short numChildren = 0;
Short gender = 49;
Short povertyStatus = 41;
Integer maritalStatus = ClientPersonalDetailDto.MARRIED;
// active
Short clientStatus = 3;
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(ethnicity, citizenship, handicapped, businessActivities, maritalStatus, educationLevel, numChildren, gender, povertyStatus);
ClientNameDetailDto spouseFatherName = new ClientNameDetailDto(NameType.SPOUSE.getValue(), salutation, firstName, middleName, lastName, secondLastName);
InputStream picture = null;
String parentGroupId = null;
List<ClientNameDetailDto> familyNames = null;
List<ClientFamilyDetailDto> familyDetails = null;
ClientCreationDetail clientCreationDetail = new ClientCreationDetail(selectedSavingProducts, clientName, clientStatus, mfiJoiningDate.toDate(), externalId, addressDto, formedBy, dateOfBirth, governmentId, trained, trainedDate, groupFlag, clientNameDetailDto, clientPersonalDetailDto, spouseFatherName, picture, feesToApply, parentGroupId, familyNames, familyDetails, loanOfficerId, officeId, activationDate.toLocalDate());
// exercise test
ClientRules.setCenterHierarchyExists(false);
List<SavingsDetailDto> allowedSavingProducts = new ArrayList<SavingsDetailDto>();
CustomerDetailsDto newlyCreatedCustomerDetails = clientServiceFacade.createNewClient(clientCreationDetail, meetingDto, allowedSavingProducts);
// verification
ClientRules.setCenterHierarchyExists(centerHierarchyExistsOriginal);
ClientBO client = customerDao.findClientBySystemId(newlyCreatedCustomerDetails.getGlobalCustNum());
Assert.assertThat(client.getSearchId(), is("1." + client.getCustomerId()));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class MeetingBOTest method testBiMonthlyOnDayOfMonthMeetingInterval.
@Test
public void testBiMonthlyOnDayOfMonthMeetingInterval() throws MeetingException {
MeetingBO meeting = new MeetingBuilder().monthly().every(2).buildMonthlyForDayNumber(20);
meeting.setFiscalCalendarRules(fiscalCalendarRules);
when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY);
LocalDate paymentDate = new LocalDate(2010, 2, 3);
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 3, 31), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 4, 1), paymentDate), is(false));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class MeetingBOTest method testBiMonthlyMeetingInterval.
@Test
public void testBiMonthlyMeetingInterval() throws MeetingException {
MeetingBO meeting = new MeetingBuilder().monthly().every(2).buildMonthlyFor(RankOfDay.THIRD, WeekDay.FRIDAY);
meeting.setFiscalCalendarRules(fiscalCalendarRules);
when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY);
LocalDate paymentDate = new LocalDate(2010, 2, 19);
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 3, 31), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 4, 1), paymentDate), is(false));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class MeetingBOTest method testBiWeeklyMeetingInterval.
@Test
public void testBiWeeklyMeetingInterval() {
MeetingBO meeting = new MeetingBuilder().weekly().every(2).occuringOnA(WeekDay.THURSDAY).build();
meeting.setFiscalCalendarRules(fiscalCalendarRules);
when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY);
LocalDate paymentDate = new LocalDate(2010, 2, 4);
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 14), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 15), paymentDate), is(false));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class MeetingBOTest method testMonthlyMeetingInterval.
@Test
public void testMonthlyMeetingInterval() throws MeetingException {
MeetingBO meeting = new MeetingBuilder().monthly().every(1).buildMonthlyFor(RankOfDay.THIRD, WeekDay.FRIDAY);
meeting.setFiscalCalendarRules(fiscalCalendarRules);
when(fiscalCalendarRules.getStartOfWeekWeekDay()).thenReturn(WeekDay.MONDAY);
LocalDate paymentDate = new LocalDate(2010, 2, 19);
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 1, 31), paymentDate), is(false));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 1), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 2, 28), paymentDate), is(true));
assertThat(meeting.queryDateIsInMeetingIntervalForFixedDate(new LocalDate(2010, 3, 1), paymentDate), is(false));
}
Aggregations