use of org.mifos.framework.business.util.Address in project head by mifos.
the class CustomerCreationDaoHibernateIntegrationTest method testShouldCreateCustomerAndCustomerAccount.
@Test
public void testShouldCreateCustomerAndCustomerAccount() throws Exception {
String displayName = "centerCascade";
Address address = null;
final List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
final List<FeeDto> fees = new ArrayList<FeeDto>();
final String externalId = null;
final Date mfiJoiningDate = new DateTime().minusDays(1).toDate();
final OfficeBO existingOffice = IntegrationTestObjectMother.sampleBranchOffice();
final PersonnelBO loanOfficer = IntegrationTestObjectMother.testUser();
UserContext userContext = new UserContext();
userContext.setId(loanOfficer.getPersonnelId());
userContext.setBranchId(existingOffice.getOfficeId());
userContext.setBranchGlobalNum(existingOffice.getGlobalOfficeNum());
center = new CenterBO(userContext, displayName, address, customFields, fees, externalId, mfiJoiningDate, existingOffice, weeklyMeeting, loanOfficer, new CustomerPersistence());
StaticHibernateUtil.startTransaction();
customerDao.save(center);
StaticHibernateUtil.flushSession();
assertThat(center.getCustomerAccount(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(nullValue()));
}
use of org.mifos.framework.business.util.Address 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.framework.business.util.Address 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.framework.business.util.Address 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.framework.business.util.Address in project head by mifos.
the class PersonnelNoteActionStrutsTest method createPersonnelAndSetInSession.
private void createPersonnelAndSetInSession(OfficeBO office, PersonnelLevel personnelLevel) throws Exception {
List<CustomFieldDto> customFieldDto = new ArrayList<CustomFieldDto>();
customFieldDto.add(new CustomFieldDto(Short.valueOf("9"), "123456", CustomFieldType.NUMERIC.getValue()));
Address address = new Address("abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd");
Name name = new Name("XYZ", null, null, "Last Name");
Date date = new Date();
personnel = new PersonnelBO(personnelLevel, office, Integer.valueOf("1"), Short.valueOf("1"), "ABCD", "XYZ", "xyz@yahoo.com", null, customFieldDto, name, "111111", date, Integer.valueOf("1"), Integer.valueOf("1"), date, date, address, userContext.getId(), null, null);
IntegrationTestObjectMother.createPersonnel(personnel);
personnel = IntegrationTestObjectMother.findPersonnelById(personnel.getPersonnelId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, personnel, request);
}
Aggregations