use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class ClientCustActionStrutsTest method testCreateSuccessWithoutGroup.
@Test
public void testCreateSuccessWithoutGroup() throws Exception {
SecurityContext securityContext = new SecurityContextImpl();
MifosUser principal = new MifosUserBuilder().nonLoanOfficer().withAdminRole().build();
Authentication authentication = new TestingAuthenticationToken(principal, principal);
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
// List<FeeDto> feesToRemove = getFees(RecurrenceType.WEEKLY);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter("groupFlag", "0");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
flowKey = (String) request.getAttribute(Constants.CURRENTFLOWKEY);
List<BusinessActivityEntity> povertyStatus = (List<BusinessActivityEntity>) SessionUtils.getAttribute(ClientConstants.POVERTY_STATUS, request);
List<CustomFieldDto> customFieldDefs = getCustomFieldFromSession();
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "next");
addRequestParameter("officeId", "3");
addRequestParameter("clientName.salutation", "1");
addRequestParameter("clientName.firstName", "Client");
addRequestParameter("clientName.lastName", "LastName");
addRequestParameter("spouseName.firstName", "Spouse");
addRequestParameter("spouseName.lastName", "LastName");
addRequestParameter("spouseName.nameType", "1");
addRequestDateParameter("dateOfBirth", "20/3/1987");
addRequestParameter("clientDetailView.gender", "1");
addRequestParameter("input", "personalInfo");
addRequestParameter("customerDetail.povertyStatus", povertyStatus.get(0).getId().toString());
int i = 0;
for (CustomFieldDto customFieldDef : customFieldDefs) {
addRequestParameter("customField[" + i + "].fieldId", customFieldDef.getFieldId().toString());
addRequestParameter("customField[" + i + "].fieldValue", "Req");
i++;
}
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
MeetingBO weeklyMeeting = new MeetingBuilder().weekly().every(1).occuringOnA(WeekDay.WEDNESDAY).build();
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("input", "mfiInfo");
addRequestParameter("loanOfficerId", "1");
addRequestParameter("formedByPersonnel", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.preview_success.toString());
setRequestPathInfo("/clientCustAction.do");
addRequestParameter("method", "create");
addRequestParameter("input", "create");
addRequestParameter("status", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.create_success.toString());
ClientCustActionForm actionForm = (ClientCustActionForm) request.getSession().getAttribute("clientCustActionForm");
client = TestObjectFactory.getClient(actionForm.getCustomerIdAsInt());
// removeFees(feesToRemove);
}
use of org.mifos.domain.builders.MeetingBuilder 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.domain.builders.MeetingBuilder in project head by mifos.
the class GroupValidationTest method givenGroupWithNullParentShouldThrowIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void givenGroupWithNullParentShouldThrowIllegalArgumentException() {
OfficeBO office = new OfficeBuilder().build();
PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
MeetingBO meeting = new MeetingBuilder().customerMeeting().build();
group = new GroupBuilder().withName("group-On-center").withOffice(office).withLoanOfficer(loanOfficer).withMeeting(meeting).withParentCustomer(null).build();
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class GroupValidationTest method givenCenterHasMeetingWithDifferentPeriodicityGroupTransferToCenterShouldFailValidation.
@Test
public void givenCenterHasMeetingWithDifferentPeriodicityGroupTransferToCenterShouldFailValidation() {
// setup
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
CenterBO toCenter = new CenterBuilder().withName("receivingCenter").with(weeklyMeeting).build();
MeetingBO monthlyMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).onDayOfMonth(1).build();
CenterBO oldCenter = new CenterBuilder().withName("oldCenter").with(monthlyMeeting).build();
GroupBO group = new GroupBuilder().withParentCustomer(oldCenter).build();
// exercise test
try {
group.validateReceivingCenter(toCenter);
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_MEETING_FREQUENCY_MISMATCH));
}
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class GroupValidationTest method setupDependencies.
@Before
public void setupDependencies() {
OfficeBO office = new OfficeBuilder().build();
PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
MeetingBO meeting = new MeetingBuilder().customerMeeting().build();
center = new CenterBuilder().with(office).withLoanOfficer(loanOfficer).with(meeting).build();
}
Aggregations