use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class CustomerDaoHibernateIntegrationTest method shouldFindGroupWithParentInitialisedBySystemId.
@Test
public void shouldFindGroupWithParentInitialisedBySystemId() {
// exercise test
GroupBO activeGroup = customerDao.findGroupBySystemId(group.getGlobalCustNum());
// verification
assertThat(activeGroup, is(notNullValue()));
assertThat(activeGroup.getParentCustomer(), is(notNullValue()));
assertThat(activeGroup.getParentCustomer().getDisplayName(), is(notNullValue()));
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class ClientStatusChangeIntegrationTest method givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive.
@Test
public void givenGroupIsInCancelledStateShouldNotPassValidationWhenTryingToTranistionClientToActive() throws Exception {
// setup
CenterBO existingCenter = new CenterBuilder().with(existingMeeting).withName("Center-IntegrationTest").with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
GroupBO existingCancelledGroup = new GroupBuilder().withName("newGroup").withStatus(CustomerStatus.GROUP_CANCELLED).withParentCustomer(existingCenter).formedBy(existingUser).build();
IntegrationTestObjectMother.createGroup(existingCancelledGroup, existingMeeting);
ClientBO existingPartialClient = new ClientBuilder().withStatus(CustomerStatus.CLIENT_PARTIAL).withParentCustomer(existingCancelledGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingPartialClient, existingMeeting);
existingCancelledGroup = this.customerDao.findGroupBySystemId(existingCancelledGroup.getGlobalCustNum());
existingPartialClient = this.customerDao.findClientBySystemId(existingPartialClient.getGlobalCustNum());
existingPartialClient.setUserContext(TestUtils.makeUser());
CustomerStatusFlag customerStatusFlag = null;
CustomerNoteEntity customerNote = new CustomerNoteEntity("go active", new Date(), existingPartialClient.getPersonnel(), existingPartialClient);
// exercise test
try {
customerService.updateClientStatus(existingPartialClient, existingPartialClient.getStatus(), CustomerStatus.CLIENT_ACTIVE, customerStatusFlag, customerNote);
fail("should fail validation");
} catch (CustomerException expected) {
assertThat(expected.getKey(), is(ClientConstants.ERRORS_GROUP_CANCELLED));
assertThat(existingPartialClient.getStatus(), is(CustomerStatus.CLIENT_PARTIAL));
}
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class TestObjectFactory method createGroupUnderBranch.
public static GroupBO createGroupUnderBranch(final String customerName, final CustomerStatus customerStatus, final String externalId, final boolean trained, final Date trainedDate, final Address address, final List<CustomFieldDto> customFields, final List<FeeDto> fees, final Short formedById, final Short officeId, final MeetingBO meeting, final Short loanOfficerId) {
GroupBO group;
PersonnelBO loanOfficer = null;
try {
if (loanOfficerId != null) {
loanOfficer = getPersonnel(loanOfficerId);
}
group = new GroupBO(TestUtils.makeUserWithLocales(), customerName, customerStatus, externalId, trained, trainedDate, address, customFields, fees, getPersonnel(formedById), new OfficePersistence().getOffice(officeId), meeting, loanOfficer);
new GroupPersistence().saveGroup(group);
StaticHibernateUtil.flushSession();
} catch (Exception e) {
throw new RuntimeException(e);
}
return group;
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class IntegrationTestObjectMotherBuilderDsl method anExistingGroupUnderCenterInDifferentBranchAs.
public static GroupBO anExistingGroupUnderCenterInDifferentBranchAs(CenterBuilder centerBuilder) {
OfficeBO office = new OfficeBuilder().withGlobalOfficeNum("xxxx-123").withName("newOffice").build();
IntegrationTestObjectMother.createOffice(office);
CenterBO centerAsParent = centerBuilder.build();
IntegrationTestObjectMother.createCenter(centerAsParent, centerAsParent.getCustomerMeetingValue());
GroupBO group = anActiveGroup().withParentCustomer(centerAsParent).formedBy(anExistingApplicationUser()).build();
IntegrationTestObjectMother.createGroup(group, group.getCustomerMeetingValue());
return group;
}
Aggregations