use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class CustomerDaoHibernateIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
databaseCleaner.clean();
weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
weeklyPeriodicFeeForGroupOnly = new FeeBuilder().appliesToGroupsOnly().withFeeAmount("50.0").withName("Group Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForGroupOnly);
group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withFee(weeklyPeriodicFeeForGroupOnly).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
weeklyPeriodicFeeForClientsOnly = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Client Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForClientsOnly);
activeClient = new ClientBuilder().active().withMeeting(weeklyMeeting).withName("Active Client").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
Address address = new Address("a", "b", "c", "gdynia", "pomorskie", "PL", "81-661", "0-89 222 33");
activeClient.setCustomerAddressDetail(new CustomerAddressDetailEntity(activeClient, address));
IntegrationTestObjectMother.createClient(activeClient, weeklyMeeting);
weeklyPeriodicFeeForSecondClient = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Inactive Client Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForSecondClient);
pendingClient = new ClientBuilder().pendingApproval().withMeeting(weeklyMeeting).withName("Pending Client").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(pendingClient, weeklyMeeting);
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class CenterStatusChangeIntegrationTest method auditLogingTracksStatusChangeOfCenterFromActiveToInactive.
@Test
public void auditLogingTracksStatusChangeOfCenterFromActiveToInactive() throws Exception {
// setup
CenterBO existingCenter = new CenterBuilder().withName("Center-IntegrationTest").with(existingMeeting).with(existingOffice).withLoanOfficer(existingLoanOfficer).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingMeeting);
GroupBO existingPendingGroup = new GroupBuilder().withName("newGroup").withStatus(CustomerStatus.GROUP_CANCELLED).withParentCustomer(existingCenter).formedBy(existingUser).build();
IntegrationTestObjectMother.createGroup(existingPendingGroup, existingMeeting);
ClientBO existingCancelledClient = new ClientBuilder().withStatus(CustomerStatus.CLIENT_CANCELLED).withParentCustomer(existingPendingGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(existingCancelledClient, existingMeeting);
existingCenter = this.customerDao.findCenterBySystemId(existingCenter.getGlobalCustNum());
existingPendingGroup = this.customerDao.findGroupBySystemId(existingPendingGroup.getGlobalCustNum());
existingCancelledClient = this.customerDao.findClientBySystemId(existingCancelledClient.getGlobalCustNum());
existingCenter.setUserContext(TestUtils.makeUserWithLocales());
CustomerStatusFlag customerStatusFlag = null;
CustomerNoteEntity customerNote = new CustomerNoteEntity("go inactive", new Date(), existingCenter.getPersonnel(), existingCenter);
// exercise test
customerService.updateCenterStatus(existingCenter, CustomerStatus.CENTER_INACTIVE, customerStatusFlag, customerNote);
// verification
StaticHibernateUtil.getInterceptor().afterTransactionCompletion(new AuditTransactionForTests());
List<AuditLog> auditLogList = TestObjectFactory.getChangeLog(EntityType.CENTER, existingCenter.getCustomerId());
assertThat(auditLogList.size(), is(1));
assertThat(auditLogList.get(0).getEntityTypeAsEnum(), is(EntityType.CENTER));
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class CustomerStatusUpdateTest method updatesPendingChildrenToPartialWhenTransitioningGroupFromPendingToCancelled.
@Test
public void updatesPendingChildrenToPartialWhenTransitioningGroupFromPendingToCancelled() throws Exception {
// setup
UserContext userContext = TestUtils.makeUser();
CustomerStatusUpdate customerStatusUpdate = new CustomerStatusUpdateBuilder().with(CustomerStatus.GROUP_CANCELLED).build();
PersonnelBO loanOfficer = PersonnelBuilder.anyLoanOfficer();
CenterBO existingCenter = new CenterBuilder().withLoanOfficer(loanOfficer).active().build();
GroupBO existingGroup = new GroupBuilder().pendingApproval().withParentCustomer(existingCenter).withVersion(customerStatusUpdate.getVersionNum()).build();
ClientBO existingClient = new ClientBuilder().withParentCustomer(existingGroup).pendingApproval().buildForUnitTests();
existingGroup.addChild(existingClient);
// stubbing
when(customerDao.findCustomerById(customerStatusUpdate.getCustomerId())).thenReturn(existingGroup);
// exercise test
customerService.updateCustomerStatus(userContext, customerStatusUpdate);
// verification
assertThat(existingGroup.getStatus(), is(CustomerStatus.GROUP_CANCELLED));
assertThat(existingClient.getUserContext(), is(userContext));
assertThat(existingClient.getStatus(), is(CustomerStatus.CLIENT_PARTIAL));
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class SavingsIntPostingHelperIntegrationTest method createCenterGroupClientHierarchy.
private void createCenterGroupClientHierarchy(MeetingBO meetingFrequency) throws CustomerException {
center = new CenterBuilder().withName("Savings Center").with(meetingFrequency).with(sampleBranchOffice()).withLoanOfficer(testUser()).withActivationDate(mondayTwoWeeksAgo()).build();
IntegrationTestObjectMother.createCenter(center, meetingFrequency);
group = new GroupBuilder().withName("Group").withMeeting(meetingFrequency).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, meetingFrequency);
client = new ClientBuilder().withName("Client 1").active().withMeeting(meetingFrequency).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, meetingFrequency);
}
use of org.mifos.domain.builders.ClientBuilder in project head by mifos.
the class ClientPhotoServiceDatabaseIntegrationTest method setUp.
@Before
public void setUp() throws CustomerException {
this.clientPhotoService = new ClientPhotoServiceDatabase();
this.clientPhotoService.setGenericDao(this.genericDao);
this.clientPhotoService.setHibernateTransactionHelper(this.hibernateTransactionHelper);
this.weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
this.testCenter = new CenterBuilder().with(this.weeklyMeeting).withName("Center Photo").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter(this.testCenter, this.weeklyMeeting);
this.testGroup = new GroupBuilder().withMeeting(this.weeklyMeeting).withName("Group Photo").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(this.testCenter).build();
IntegrationTestObjectMother.createGroup(this.testGroup, this.weeklyMeeting);
this.testClient = new ClientBuilder().withMeeting(this.weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(this.testGroup).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(this.testClient, this.weeklyMeeting);
}
Aggregations