Search in sources :

Example 41 with GroupBuilder

use of org.mifos.domain.builders.GroupBuilder in project head by mifos.

the class TestSaveCollectionSheetUtils method getAnotherClientFromAnotherCenter.

/*
     *
     */
private ClientBO getAnotherClientFromAnotherCenter() throws Exception {
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    anotherCenter = new CenterBuilder().with(weeklyMeeting).withName("Another Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.saveCustomer(anotherCenter);
    anotherGroup = new GroupBuilder().withMeeting(weeklyMeeting).withName("Another Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(anotherCenter).build();
    IntegrationTestObjectMother.saveCustomer(anotherGroup);
    anotherClient = new ClientBuilder().withMeeting(weeklyMeeting).withName("Another Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(anotherGroup).buildForIntegrationTests();
    IntegrationTestObjectMother.saveCustomer(anotherClient);
    return anotherClient;
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder)

Example 42 with GroupBuilder

use of org.mifos.domain.builders.GroupBuilder in project head by mifos.

the class CollectionSheetDaoHibernateIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    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, weeklyPeriodicFeeForCenterOnly);
    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, weeklyPeriodicFeeForGroupOnly);
    weeklyPeriodicFeeForClientsOnly = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Client Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForClientsOnly);
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    collectionSheetDao = new CollectionSheetDaoHibernate(savingsDao);
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Example 43 with GroupBuilder

use of org.mifos.domain.builders.GroupBuilder in project head by mifos.

the class CustomerPersistenceIntegrationTest method testSearchWithGovernmentId.

@Test
public void testSearchWithGovernmentId() throws Exception {
    OfficeBO office = IntegrationTestObjectMother.sampleBranchOffice();
    PersonnelBO testUser = IntegrationTestObjectMother.testUser();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).onDayOfMonth(1).build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    center = new CenterBuilder().with(weeklyMeeting).withName(this.getClass().getSimpleName() + " Center").with(office).withLoanOfficer(testUser).build();
    IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(office).withLoanOfficer(testUser).withParentCustomer(center).withStatus(CustomerStatus.GROUP_ACTIVE).build();
    IntegrationTestObjectMother.createGroup((GroupBO) group, weeklyMeeting);
    String clientGovernmentId = "76346793216";
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(office).withLoanOfficer(testUser).withParentCustomer(group).withStatus(CustomerStatus.CLIENT_ACTIVE).withGovernmentId(clientGovernmentId).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    QueryResult queryResult = new CustomerPersistence().search(clientGovernmentId, office.getOfficeId(), testUser.getPersonnelId(), testUser.getOffice().getOfficeId(), filters);
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(1, queryResult.getSize());
    Assert.assertEquals(1, queryResult.get(0, 10).size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Example 44 with GroupBuilder

use of org.mifos.domain.builders.GroupBuilder in project head by mifos.

the class SavingsAccountAdjustmentAndInterestCalculationServiceFacadeIntegrationTest method createCenterGroupClientHierarchy.

private void createCenterGroupClientHierarchy(MeetingBO aWeeklyMeeting) throws CustomerException {
    center = new CenterBuilder().withName("Savings Center").with(aWeeklyMeeting).with(sampleBranchOffice()).withLoanOfficer(testUser()).withActivationDate(mondayTwoWeeksAgo()).build();
    IntegrationTestObjectMother.createCenter(center, aWeeklyMeeting);
    group = new GroupBuilder().withName("Group").withMeeting(aWeeklyMeeting).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
    IntegrationTestObjectMother.createGroup(group, aWeeklyMeeting);
    client = new ClientBuilder().withName("Client 1").active().withMeeting(aWeeklyMeeting).withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, aWeeklyMeeting);
}
Also used : GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder)

Example 45 with GroupBuilder

use of org.mifos.domain.builders.GroupBuilder in project head by mifos.

the class GroupValidationTest method givenAnActiveSavingsAccountExistsOnClientOfGroupGroupTransferToCenterShouldFailValidation.

@Test
public void givenAnActiveSavingsAccountExistsOnClientOfGroupGroupTransferToCenterShouldFailValidation() {
    // setup
    CenterBO center = new CenterBuilder().build();
    GroupBO group = new GroupBuilder().withParentCustomer(center).build();
    ClientBO client = new ClientBuilder().withParentCustomer(group).active().buildForUnitTests();
    group.addChild(client);
    SavingsBO savings = new SavingsAccountBuilder().active().withCustomer(group).build();
    client.addAccount(savings);
    // exercise test
    try {
        group.validateNoActiveAccountsExist();
        fail("should fail validation");
    } catch (CustomerException e) {
        assertThat(e.getKey(), is(CustomerConstants.ERRORS_CHILDREN_HAS_ACTIVE_ACCOUNT));
    }
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) GroupBuilder(org.mifos.domain.builders.GroupBuilder) ClientBO(org.mifos.customers.client.business.ClientBO) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) GroupBO(org.mifos.customers.group.business.GroupBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Aggregations

GroupBuilder (org.mifos.domain.builders.GroupBuilder)67 CenterBuilder (org.mifos.domain.builders.CenterBuilder)53 Test (org.junit.Test)49 GroupBO (org.mifos.customers.group.business.GroupBO)42 CenterBO (org.mifos.customers.center.business.CenterBO)35 ClientBuilder (org.mifos.domain.builders.ClientBuilder)31 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)24 CustomerException (org.mifos.customers.exceptions.CustomerException)21 MeetingBO (org.mifos.application.meeting.business.MeetingBO)16 ClientBO (org.mifos.customers.client.business.ClientBO)14 OfficeBO (org.mifos.customers.office.business.OfficeBO)14 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)13 ArrayList (java.util.ArrayList)12 LocalDate (org.joda.time.LocalDate)11 DateTime (org.joda.time.DateTime)10 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)10 OfficeBuilder (org.mifos.domain.builders.OfficeBuilder)9 Before (org.junit.Before)8 CustomerNoteEntity (org.mifos.customers.business.CustomerNoteEntity)8 CustomerStatusFlag (org.mifos.customers.util.helpers.CustomerStatusFlag)8