use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class SavingsIntPostingHelperIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
databaseCleaner.clean();
DateTime startOfFiscalYear = new DateTime().withDate(2010, 1, 1);
MeetingBO meetingFrequency = new MeetingBuilder().customerMeeting().startingFrom(startOfFiscalYear.toDate()).monthly().every(1).onDayOfMonth(1).build();
createCenterGroupClientHierarchy(meetingFrequency);
MeetingBO interestCalculationFrequency = new MeetingBuilder().savingsInterestCalulationSchedule().monthly().every(2).build();
IntegrationTestObjectMother.saveMeeting(interestCalculationFrequency);
MeetingBO interestPostingFrequency = new MeetingBuilder().savingsInterestPostingSchedule().monthly().every(2).build();
IntegrationTestObjectMother.saveMeeting(interestPostingFrequency);
SavingsOfferingBO mandatoryMinimumBalance = new SavingsProductBuilder().appliesToClientsOnly().withName("mandatoryMinimumBalance1").withShortName("mm01").mandatory().minimumBalance().withInterestCalculationSchedule(interestPostingFrequency).withInterestPostingSchedule(interestPostingFrequency).withMandatoryAmount("300").withInterestRate(Double.valueOf("12")).withMaxWithdrawalAmount(TestUtils.createMoney("200")).withMinAmountRequiredForInterestCalculation("200").buildForIntegrationTests();
IntegrationTestObjectMother.saveSavingsProducts(mandatoryMinimumBalance);
DateTime nextInterestPostingDate = new DateTime().minusDays(1);
savings1 = new SavingsAccountBuilder().active().withSavingsProduct(mandatoryMinimumBalance).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).withActivationDate(startOfFiscalYear).withNextInterestPostingDateOf(nextInterestPostingDate).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("300", startOfFiscalYear).withDepositOn("200", startOfFiscalYear.plusMonths(1)).build();
IntegrationTestObjectMother.saveSavingsAccount(savings1);
}
use of org.mifos.domain.builders.MeetingBuilder 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);
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method shouldNotGoIntoRecursiveLoopWhenThroughDateOccursExactlyTenPeriodsFromStartDate.
@Test
public void shouldNotGoIntoRecursiveLoopWhenThroughDateOccursExactlyTenPeriodsFromStartDate() {
MeetingBO meeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
DateTime startDate = new DateTime().withYear(2010).withMonthOfYear(4).withDayOfMonth(1).toDateMidnight().toDateTime();
DateTime throughDate = new DateTime().withYear(2010).withMonthOfYear(6).withDayOfMonth(7).toDateMidnight().toDateTime();
scheduleGeneration.generateScheduledDatesThrough(startDate, throughDate, scheduledEvent, false);
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method shouldNotGoIntoRecursiveLoopWhenThroughDateOccursMoreThanTenPeriodsFromStartDate.
@Test
public void shouldNotGoIntoRecursiveLoopWhenThroughDateOccursMoreThanTenPeriodsFromStartDate() {
MeetingBO meeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
ScheduledEvent scheduledEvent = ScheduledEventFactory.createScheduledEventFrom(meeting);
DateTime startDate = new DateTime().withYear(2010).withMonthOfYear(4).withDayOfMonth(1).toDateMidnight().toDateTime();
DateTime throughDate = new DateTime().withYear(2010).withMonthOfYear(6).withDayOfMonth(21).toDateMidnight().toDateTime();
scheduleGeneration.generateScheduledDatesThrough(startDate, throughDate, scheduledEvent, false);
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class LoanAdjustmentsIntegrationTest method createLoan.
private LoanBO createLoan() throws Exception {
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter(center, weeklyMeeting);
group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, weeklyMeeting);
LoanOfferingBO loanOffering = new LoanProductBuilder().withName("Adjust Loan Product").withMeeting(weeklyMeeting).buildForIntegrationTests();
IntegrationTestObjectMother.createProduct(loanOffering);
AmountFeeBO periodicFee = new FeeBuilder().appliesToLoans().periodic().withFeeAmount("10.0").withName("Periodic Fee").with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(periodicFee);
BigDecimal loanAmount = BigDecimal.valueOf(Double.valueOf("1000.0"));
BigDecimal minAllowedLoanAmount = loanAmount;
BigDecimal maxAllowedLoanAmount = loanAmount;
Double interestRate = loanOffering.getDefInterestRate();
LocalDate disbursementDate = new LocalDate();
int numberOfInstallments = 10;
int minAllowedNumberOfInstallments = loanOffering.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
int maxAllowedNumberOfInstallments = loanOffering.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
int graceDuration = 0;
Integer sourceOfFundId = null;
Integer loanPurposeId = null;
Integer collateralTypeId = null;
String collateralNotes = null;
String externalId = null;
boolean repaymentScheduleIndependentOfCustomerMeeting = false;
RecurringSchedule recurringSchedule = null;
List<CreateAccountFeeDto> accountFees = new ArrayList<CreateAccountFeeDto>();
accountFees.add(new CreateAccountFeeDto(periodicFee.getFeeId().intValue(), periodicFee.getFeeAmount().toString()));
CreateLoanAccount createLoanAccount = new CreateLoanAccount(client.getCustomerId(), loanOffering.getPrdOfferingId().intValue(), AccountState.LOAN_ACTIVE_IN_GOOD_STANDING.getValue().intValue(), loanAmount, minAllowedLoanAmount, maxAllowedLoanAmount, interestRate, disbursementDate, null, numberOfInstallments, minAllowedNumberOfInstallments, maxAllowedNumberOfInstallments, graceDuration, sourceOfFundId, loanPurposeId, collateralTypeId, collateralNotes, externalId, repaymentScheduleIndependentOfCustomerMeeting, recurringSchedule, accountFees, new ArrayList<CreateAccountPenaltyDto>());
return IntegrationTestObjectMother.createClientLoan(createLoanAccount);
}
Aggregations