Search in sources :

Example 11 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingActionStrutsTest method testLoad_MonthlyOnWeekMeetingExists.

@Test
public void testLoad_MonthlyOnWeekMeetingExists() throws Exception {
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    actionPerform();
    Short recurAfter = Short.valueOf("2");
    MeetingBO meeting = createMonthlyMeetingOnWeekDay(WeekDay.FRIDAY, RankOfDay.SECOND, 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("2", actionForm.getMonthType());
    Assert.assertEquals(WeekDay.FRIDAY, actionForm.getMonthWeekValue());
    Assert.assertEquals(RankOfDay.SECOND, actionForm.getMonthRankValue());
    Assert.assertEquals(recurAfter, actionForm.getRecurMonthValue());
    Assert.assertEquals(RecurrenceType.MONTHLY, actionForm.getRecurrenceType());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) Date(java.util.Date) Test(org.junit.Test)

Example 12 with MeetingActionForm

use of org.mifos.application.meeting.struts.actionforms.MeetingActionForm in project head by mifos.

the class MeetingActionStrutsTest method testLoad_WeeklyMeetingExists.

@Test
public void testLoad_WeeklyMeetingExists() throws Exception {
    setRequestPathInfo("/centerCustAction.do");
    addRequestParameter("method", "load");
    addRequestParameter("officeId", "3");
    actionPerform();
    Short recurAfter = Short.valueOf("1");
    MeetingBO meeting = createWeeklyMeeting(WeekDay.MONDAY, 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(WeekDay.MONDAY, actionForm.getWeekDayValue());
    Assert.assertEquals(recurAfter, actionForm.getRecurWeekValue());
    Assert.assertEquals(RecurrenceType.WEEKLY, actionForm.getRecurrenceType());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingActionForm(org.mifos.application.meeting.struts.actionforms.MeetingActionForm) Date(java.util.Date) Test(org.junit.Test)

Aggregations

MeetingActionForm (org.mifos.application.meeting.struts.actionforms.MeetingActionForm)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)8 Test (org.junit.Test)7 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)5 Date (java.util.Date)4 WeekDay (org.mifos.application.meeting.util.helpers.WeekDay)2 CustomerBO (org.mifos.customers.business.CustomerBO)2 ActionForward (org.apache.struts.action.ActionForward)1 ActionForwards (org.mifos.application.util.helpers.ActionForwards)1 MeetingDto (org.mifos.dto.domain.MeetingDto)1 CloseSession (org.mifos.framework.util.helpers.CloseSession)1