Search in sources :

Example 96 with MeetingBO

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()));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) AddressDto(org.mifos.dto.domain.AddressDto) DateTime(org.joda.time.DateTime) MeetingDto(org.mifos.dto.domain.MeetingDto) CenterCreationDetail(org.mifos.dto.domain.CenterCreationDetail) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) OfficeBO(org.mifos.customers.office.business.OfficeBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) CreateAccountFeeDto(org.mifos.dto.domain.CreateAccountFeeDto) CustomerDetailsDto(org.mifos.dto.domain.CustomerDetailsDto) Test(org.junit.Test)

Example 97 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 98 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 99 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 100 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)

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