use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class CenterServiceFacadeWebTierIntegrationTest method shouldCreateCenterWithExpectedSearchId.
@Test
public void shouldCreateCenterWithExpectedSearchId() {
MeetingBO meeting = new MeetingBuilder().withStartDate(new DateTime().minusWeeks(2)).build();
MeetingDto meetingDto = meeting.toDto();
String displayName = "testCenter";
String externalId = null;
AddressDto addressDto = new AddressDto("here", "", "", "", "", "", "", "");
PersonnelBO user = IntegrationTestObjectMother.findPersonnelById(Short.valueOf("1"));
Short loanOfficerId = user.getPersonnelId();
List<CreateAccountFeeDto> feesToApply = new ArrayList<CreateAccountFeeDto>();
CustomerStatus.GROUP_ACTIVE.getValue();
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
// setup
createOfficeHierarchyUnderHeadOffice(headOffice);
Short officeId = branch1.getOfficeId();
DateTime mfiJoiningDate = new DateTime().minusWeeks(2);
new DateTime().minusWeeks(1);
CenterCreationDetail centerCreationDetail = new CenterCreationDetail(mfiJoiningDate.toLocalDate(), displayName, externalId, addressDto, loanOfficerId, officeId, feesToApply);
// exercise test
CustomerDetailsDto newlyCreatedCenterDetails = centerServiceFacade.createNewCenter(centerCreationDetail, meetingDto);
// verification
CenterBO center = customerDao.findCenterBySystemId(newlyCreatedCenterDetails.getGlobalCustNum());
Assert.assertThat(center.getSearchId(), is("1." + center.getCustomerId()));
}
use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class MeetingActionStrutsTest method testEditForCenter.
@Test
public void testEditForCenter() throws Exception {
setMifosUserFromContext();
MeetingBO meeting = createWeeklyMeeting(WeekDay.WEDNESDAY, Short.valueOf("5"), new Date());
center = createCenter(meeting);
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "get");
addRequestParameter("globalCustNum", center.getGlobalCustNum());
actionPerform();
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "edit");
addRequestParameter("customerLevel", CustomerLevel.CENTER.getValue().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyForward(ActionForwards.edit_success.toString());
Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKDAYSLIST, request));
Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKRANKLIST, request));
verifyNoActionErrors();
verifyNoActionMessages();
MeetingActionForm actionForm = (MeetingActionForm) request.getSession().getAttribute("meetingActionForm");
Assert.assertEquals(CustomerLevel.CENTER, actionForm.getCustomerLevelValue());
center = TestObjectFactory.getCenter(center.getCustomerId());
}
use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class MeetingActionStrutsTest method testFailureCreateWeeklyMeeting_WeekDayAndRecurAfterIsNull.
@Test
public void testFailureCreateWeeklyMeeting_WeekDayAndRecurAfterIsNull() throws Exception {
loadMeetingPage();
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "create");
addRequestParameter("frequency", RecurrenceType.WEEKLY.getValue().toString());
addRequestParameter("weekDay", "");
addRequestParameter("recurWeek", "");
addRequestParameter("meetingPlace", "");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("input", "create");
actionPerform();
Assert.assertEquals("Week Recurrence", 1, getErrorSize(MeetingConstants.ERRORS_SPECIFY_WEEKDAY_AND_RECURAFTER));
Assert.assertEquals("Meeting Place", 1, getErrorSize(MeetingConstants.INVALID_MEETINGPLACE));
verifyInputForward();
MeetingBO meeting = (MeetingBO) SessionUtils.getAttribute(CustomerConstants.CUSTOMER_MEETING, request);
Assert.assertNull(meeting);
}
use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class MeetingActionStrutsTest method testSuccessfulCreateMonthlyMeetingOnDate.
@Test
public void testSuccessfulCreateMonthlyMeetingOnDate() throws Exception {
loadMeetingPage();
String meetingPlace = "Delhi";
Short dayNumber = Short.valueOf("5");
Short recurAfter = Short.valueOf("1");
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "create");
addRequestParameter("frequency", RecurrenceType.MONTHLY.getValue().toString());
addRequestParameter("monthType", MeetingConstants.MONTHLY_ON_DATE);
addRequestParameter("monthDay", dayNumber.toString());
addRequestParameter("dayRecurMonth", recurAfter.toString());
addRequestParameter("meetingPlace", meetingPlace);
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("input", "create");
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.loadCreateCenter.toString());
MeetingBO meeting = (MeetingBO) SessionUtils.getAttribute(CustomerConstants.CUSTOMER_MEETING, request);
Assert.assertTrue(meeting.isMonthly());
Assert.assertTrue(meeting.isMonthlyOnDate());
Assert.assertEquals(meetingPlace, meeting.getMeetingPlace());
Assert.assertEquals(recurAfter, meeting.getMeetingDetails().getRecurAfter());
Assert.assertEquals(dayNumber, meeting.getMeetingDetails().getDayNumber());
}
use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class MeetingActionStrutsTest method testLoad_MonthlyOnDateMeetingExists.
@Test
public void testLoad_MonthlyOnDateMeetingExists() throws Exception {
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
actionPerform();
Short recurAfter = Short.valueOf("2");
Short dayNumber = Short.valueOf("5");
MeetingBO meeting = createMonthlyMeetingOnDate(dayNumber, recurAfter, new Date());
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, meeting, request);
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "load");
addRequestParameter("customerLevel", CustomerLevel.CENTER.getValue().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("input", "create");
actionPerform();
verifyForward(ActionForwards.load_success.toString());
Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKDAYSLIST, request));
Assert.assertNotNull(SessionUtils.getAttribute(MeetingConstants.WEEKRANKLIST, request));
verifyNoActionErrors();
verifyNoActionMessages();
MeetingActionForm actionForm = (MeetingActionForm) request.getSession().getAttribute("meetingActionForm");
Assert.assertEquals(CustomerLevel.CENTER, actionForm.getCustomerLevelValue());
Assert.assertEquals("1", actionForm.getMonthType());
Assert.assertEquals(dayNumber, actionForm.getMonthDayValue());
Assert.assertEquals(recurAfter, actionForm.getDayRecurMonthValue());
Assert.assertEquals(RecurrenceType.MONTHLY, actionForm.getRecurrenceType());
}
Aggregations