use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm 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.struts.actionforms.MeetingActionForm in project head by mifos.
the class MeetingActionStrutsTest method testLoadForCenter.
@Test
public void testLoadForCenter() throws Exception {
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "load");
addRequestParameter("customerLevel", CustomerLevel.CENTER.getValue().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
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());
}
use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm 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.struts.actionforms.MeetingActionForm in project head by mifos.
the class MeetingActionStrutsTest method testLoadForClient.
@Test
public void testLoadForClient() throws Exception {
setRequestPathInfo("/meetingAction.do");
addRequestParameter("method", "load");
addRequestParameter("customerLevel", CustomerLevel.CLIENT.getValue().toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
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.CLIENT, actionForm.getCustomerLevelValue());
}
use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.
the class MeetingAction method edit.
@TransactionDemarcate(conditionToken = true)
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
MeetingActionForm actionForm = (MeetingActionForm) form;
clearActionForm(actionForm);
CustomerBO customerInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerBO customer = this.customerDao.findCustomerById(customerInSession.getCustomerId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customer, request);
List<WeekDay> workingDays = getLocalizedWorkingDays();
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKDAYSLIST, workingDays, request);
SessionUtils.setCollectionAttribute(MeetingConstants.WEEKRANKLIST, RankOfDay.getRankOfDayList(), request);
ActionForward forward = null;
if (customer.getCustomerMeeting() != null) {
MeetingBO meeting = customer.getCustomerMeeting().getMeeting();
setValuesInActionForm(actionForm, meeting);
forward = mapping.findForward(ActionForwards.edit_success.toString());
actionForm.setInput(MeetingConstants.INPUT_EDIT);
} else {
actionForm.setInput(MeetingConstants.INPUT_CREATE);
forward = mapping.findForward(ActionForwards.createMeeting_success.toString());
}
return forward;
}
Aggregations