Search in sources :

Example 91 with MeetingBO

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());
}
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 92 with MeetingBO

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);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) Test(org.junit.Test)

Example 93 with MeetingBO

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());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) Test(org.junit.Test)

Example 94 with MeetingBO

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());
}
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 95 with MeetingBO

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());
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) Date(java.util.Date) Test(org.junit.Test)

Aggregations

MeetingBO (org.mifos.application.meeting.business.MeetingBO)355 Test (org.junit.Test)176 Date (java.util.Date)91 ArrayList (java.util.ArrayList)84 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)74 DateTime (org.joda.time.DateTime)68 LocalDate (org.joda.time.LocalDate)56 Money (org.mifos.framework.util.helpers.Money)56 CenterBuilder (org.mifos.domain.builders.CenterBuilder)54 CenterBO (org.mifos.customers.center.business.CenterBO)46 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)44 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)42 Date (java.sql.Date)40 UserContext (org.mifos.security.util.UserContext)34 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)33 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)30 OfficeBO (org.mifos.customers.office.business.OfficeBO)27 CustomerBO (org.mifos.customers.business.CustomerBO)23 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)22 MifosUser (org.mifos.security.MifosUser)20