use of org.mifos.customers.office.business.OfficeBO in project head by mifos.
the class HolidayDaoHibernateIntegrationTest method shouldNotThrowExceptionWhenFutureHolidaysApplicableToNewParentOfficeDoNotDifferFromPreviousParentOffice.
@Test
public void shouldNotThrowExceptionWhenFutureHolidaysApplicableToNewParentOfficeDoNotDifferFromPreviousParentOffice() throws Exception {
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
// setup
createOfficeHierarchyUnderHeadOffice(headOffice);
DateTime tomorrow = new DateTime().plusDays(1);
HolidayDetails holidayDetails = new HolidayBuilder().withName("areaOffice2Holiday").from(tomorrow).to(tomorrow).buildDto();
IntegrationTestObjectMother.createHoliday(holidayDetails, Arrays.asList(areaOffice2.getOfficeId(), areaOffice1.getOfficeId()));
HolidayDetails branchOnlyHolidayDetails = new HolidayBuilder().withName("branchOnlyHoliday").from(tomorrow).to(tomorrow).buildDto();
IntegrationTestObjectMother.createHoliday(branchOnlyHolidayDetails, Arrays.asList(branch1.getOfficeId()));
// refetch
branch1 = IntegrationTestObjectMother.findOfficeById(branch1.getOfficeId());
// exercise test
holidayDao.validateNoExtraFutureHolidaysApplicableOnParentOffice(branch1.getParentOffice().getOfficeId(), areaOffice2.getOfficeId());
}
use of org.mifos.customers.office.business.OfficeBO in project head by mifos.
the class ClientCustActionStrutsTest method createAndSetClientInSession.
private void createAndSetClientInSession() throws Exception {
OfficeBO office = new OfficePersistence().getOffice(TestObjectFactory.HEAD_OFFICE);
PersonnelBO personnel = legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER);
meeting = getMeeting();
ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), 1, "Client", "", "1", "");
clientNameDetailDto.setNames(ClientRules.getNameSequence());
ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), 1, "first", "middle", "last", "secondLast");
spouseNameDetailView.setNames(ClientRules.getNameSequence());
ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
Calendar dob = new GregorianCalendar();
dob.set(Calendar.YEAR, 1970);
client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, new Address(), getCustomFields(), null, null, personnel, office, meeting, personnel, dob.getTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
legacyClientDao.saveClient(client);
StaticHibernateUtil.flushAndClearSession();
client = TestObjectFactory.getClient(Integer.valueOf(client.getCustomerId()).intValue());
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
use of org.mifos.customers.office.business.OfficeBO in project head by mifos.
the class CustomerPersistenceIntegrationTest method testSearchWithGovernmentId.
@Test
public void testSearchWithGovernmentId() throws Exception {
OfficeBO office = IntegrationTestObjectMother.sampleBranchOffice();
PersonnelBO testUser = IntegrationTestObjectMother.testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).onDayOfMonth(1).build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
center = new CenterBuilder().with(weeklyMeeting).withName(this.getClass().getSimpleName() + " Center").with(office).withLoanOfficer(testUser).build();
IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(office).withLoanOfficer(testUser).withParentCustomer(center).withStatus(CustomerStatus.GROUP_ACTIVE).build();
IntegrationTestObjectMother.createGroup((GroupBO) group, weeklyMeeting);
String clientGovernmentId = "76346793216";
client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(office).withLoanOfficer(testUser).withParentCustomer(group).withStatus(CustomerStatus.CLIENT_ACTIVE).withGovernmentId(clientGovernmentId).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, weeklyMeeting);
QueryResult queryResult = new CustomerPersistence().search(clientGovernmentId, office.getOfficeId(), testUser.getPersonnelId(), testUser.getOffice().getOfficeId(), filters);
Assert.assertNotNull(queryResult);
Assert.assertEquals(1, queryResult.getSize());
Assert.assertEquals(1, queryResult.get(0, 10).size());
}
use of org.mifos.customers.office.business.OfficeBO in project head by mifos.
the class OfficePersistenceIntegrationTest method testGetBranchesUnderUser.
@Test
public void testGetBranchesUnderUser() throws Exception {
OfficeBO parent = TestObjectFactory.getOffice(TestObjectFactory.HEAD_OFFICE);
OfficeBO branchOffice = TestObjectFactory.createOffice(OfficeLevel.BRANCHOFFICE, parent, "abcd", "abcd");
List<OfficeBO> officeList = getOfficePersistence().getActiveBranchesUnderUser("1.1");
Assert.assertNotNull(officeList);
Assert.assertEquals(2, officeList.size());
Assert.assertEquals(branchOffice.getOfficeName(), officeList.get(0).getOfficeName());
Assert.assertEquals("TestBranchOffice", officeList.get(1).getOfficeName());
}
use of org.mifos.customers.office.business.OfficeBO in project head by mifos.
the class OfficeActionStrutsTest method testEditPreviewHO.
@Test
public void testEditPreviewHO() throws Exception {
addActionMethod(Methods.editpreview.toString());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
OfficeBO headoffice = TestObjectFactory.getOffice(TestObjectFactory.HEAD_OFFICE);
addRequestParameter("officeName", "RAJOFFICE");
addRequestParameter("shortName", headoffice.getShortName());
addRequestParameter("officeLevel", headoffice.getOfficeLevel().getValue().toString());
addRequestParameter("parentOfficeId", "");
addRequestParameter("officeStatus", headoffice.getOfficeStatus().getValue().toString());
actionPerform();
verifyNoActionErrors();
verifyForward(ActionForwards.editpreview_success.toString());
}
Aggregations