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());
}
use of org.mifos.application.meeting.business.MeetingBO in project head by mifos.
the class MeetingActionStrutsTest method testSuccessfulEditCancel.
@Test
public void testSuccessfulEditCancel() throws Exception {
setMifosUserFromContext();
MeetingBO meeting = createWeeklyMeeting(WeekDay.WEDNESDAY, Short.valueOf("5"), new Date());
center = createCenter(meeting);
StaticHibernateUtil.flushSession();
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "get");
addRequestParameter("globalCustNum", center.getGlobalCustNum());
actionPerform();
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "edit");
addRequestParameter("meetingId", center.getCustomerMeeting().getMeeting().getMeetingId().toString());
addRequestParameter("customerLevel", CustomerLevel.CENTER.getValue().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "cancelUpdate");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyForward(ActionForwards.center_detail_page.toString());
StaticHibernateUtil.flushSession();
center = TestObjectFactory.getCenter(center.getCustomerId());
Assert.assertNotNull(center.getCustomerMeeting().getMeeting());
}
Aggregations