use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithExternalIdThatAlreadyExistsForAnotherCenter.
@Test
public void canCreateCenterWithExternalIdThatAlreadyExistsForAnotherCenter() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
String externalId = "xxx111";
CenterBO existingCenter = new CenterBuilder().withName("existingCenterName").withExternalId(externalId).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingCenter.getCustomerMeetingValue());
CenterBO newCenter = new CenterBuilder().withName("newCenterName").withExternalId(externalId).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
// setup
List<AccountFeesEntity> noCenterAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(newCenter, newCenter.getCustomerMeetingValue(), noCenterAccountFees);
// verification
assertThat(existingCenter.getGlobalCustNum(), is(not(newCenter.getGlobalCustNum())));
assertThat(existingCenter.getExternalId(), is(newCenter.getExternalId()));
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMfiJoiningDateInPast.
@Test
public void canCreateCenterWithMfiJoiningDateInPast() throws Exception {
// setup
// minimal details
String centerName = "Center-IntegrationTest";
OfficeBO existingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
DateTime aWeekAgo = new DateTime().minusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekAgo).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, weeklyMeeting, noAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMinimalDetails.
@Test
public void canCreateCenterWithMinimalDetails() throws Exception {
// setup
// minimal details
String centerName = "Center-IntegrationTest";
OfficeBO existingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
DateTime today = new DateTime();
Address noAddress = null;
String noExternalId = null;
CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(today).with(noAddress).withExternalId(noExternalId).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, weeklyMeeting, noAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
assertThat(center.getExternalId(), is(nullValue()));
assertThat(center.getAddress(), is(nullValue()));
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterHierarchyCustomerServiceIntegrationTest method cleanDatabaseTables.
@Before
public void cleanDatabaseTables() {
databaseCleaner.clean();
// setup
String centerName = "Center-IntegrationTest";
OfficeBO existingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
DateTime today = new DateTime();
Address noAddress = null;
String noExternalId = null;
center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(today).with(noAddress).withExternalId(noExternalId).withUserContext().build();
IntegrationTestObjectMother.createCenter(center, center.getCustomerMeetingValue());
group = new GroupBuilder().withName("group1").withParentCustomer(center).active().formedBy(center.getPersonnel()).build();
IntegrationTestObjectMother.createGroup(group, group.getCustomerMeetingValue());
group2 = new GroupBuilder().withName("group2").withParentCustomer(center).active().formedBy(center.getPersonnel()).build();
IntegrationTestObjectMother.createGroup(group2, group2.getCustomerMeetingValue());
otherLoanOfficer = new PersonnelBuilder().withDisplayName("otherLoanOfficer").with(existingBranch).build();
IntegrationTestObjectMother.createPersonnel(otherLoanOfficer);
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInSameDayHoliday.
@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInSameDayHoliday() throws Exception {
DateTime startDate = date(2010, 4, 5);
//Monday
DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
// setup
saveHoliday(startDate.plusWeeks(2), startDate.plusWeeks(2).plusDays(3), RepaymentRuleTypes.SAME_DAY);
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
CenterBO center = new CenterBuilder().with(weeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, weeklyMeeting, noAccountFees);
validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(1), startDate.plusWeeks(2), startDate.plusWeeks(3), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9));
}
Aggregations