Search in sources :

Example 16 with ClientPersonalDetailDto

use of org.mifos.dto.screen.ClientPersonalDetailDto in project head by mifos.

the class ClientIntegrationTest method testFailureCreateActiveClientWithoutMeeting.

@Test
public void testFailureCreateActiveClientWithoutMeeting() throws Exception {
    try {
        ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "", "last", "");
        clientNameDetailDto.setNames(ClientRules.getNameSequence());
        ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
        spouseNameDetailView.setNames(ClientRules.getNameSequence());
        ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
        client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("3")), null, null, null, null, null, null, personnel, officeBo, null, personnel, null, null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
        Assert.fail();
    } catch (CustomerException ce) {
        Assert.assertNull(client);
        Assert.assertEquals(CustomerConstants.INVALID_MEETING, ce.getKey());
    }
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) Test(org.junit.Test)

Example 17 with ClientPersonalDetailDto

use of org.mifos.dto.screen.ClientPersonalDetailDto in project head by mifos.

the class ClientIntegrationTest method testFailureCreatePendingClientWithParentGroupInLowerStatus.

@Test
public void testFailureCreatePendingClientWithParentGroupInLowerStatus() throws Exception {
    try {
        ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "Client", "", "1", "");
        clientNameDetailDto.setNames(ClientRules.getNameSequence());
        ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
        spouseNameDetailView.setNames(ClientRules.getNameSequence());
        ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
        createParentObjects(CustomerStatus.GROUP_PARTIAL);
        client = new ClientBO(TestUtils.makeUserWithLocales(), clientNameDetailDto.getDisplayName(), CustomerStatus.CLIENT_PENDING, null, null, null, null, null, null, personnel, group.getOffice(), group, null, null, null, null, YesNoFlag.YES.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto);
        Assert.fail();
    } catch (CustomerException e) {
        Assert.assertNull(client);
        Assert.assertEquals(ClientConstants.INVALID_CLIENT_STATUS_EXCEPTION, e.getKey());
    }
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) Test(org.junit.Test)

Example 18 with ClientPersonalDetailDto

use of org.mifos.dto.screen.ClientPersonalDetailDto in project head by mifos.

the class ClientIntegrationTest method testFailureCreateActiveClientWithoutLO.

@Test
public void testFailureCreateActiveClientWithoutLO() throws Exception {
    List<FeeDto> fees = getFees();
    try {
        meeting = getMeeting();
        ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "", "last", "");
        clientNameDetailDto.setNames(ClientRules.getNameSequence());
        ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
        spouseNameDetailView.setNames(ClientRules.getNameSequence());
        ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
        client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("3")), null, null, null, null, fees, null, personnel, officeBo, meeting, null, null, null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
        Assert.fail();
    } catch (CustomerException e) {
        Assert.assertNull(client);
        Assert.assertEquals(CustomerConstants.INVALID_LOAN_OFFICER, e.getKey());
    }
    removeFees(fees);
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) Test(org.junit.Test)

Example 19 with ClientPersonalDetailDto

use of org.mifos.dto.screen.ClientPersonalDetailDto in project head by mifos.

the class ClientIntegrationTest method testSuccessfulCreateWithParentGroup.

@Test
public void testSuccessfulCreateWithParentGroup() throws Exception {
    String name = "Client 1";
    ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "Client", "", "1", "");
    clientNameDetailDto.setNames(ClientRules.getNameSequence());
    ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), TestObjectFactory.SAMPLE_SALUTATION, "first", "middle", "last", "secondLast");
    spouseNameDetailView.setNames(ClientRules.getNameSequence());
    ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
    createParentObjects(CustomerStatus.GROUP_PARTIAL);
    client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, null, null, null, null, personnel, group.getOffice(), group, null, null, null, null, YesNoFlag.YES.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto);
    legacyClientDao.saveClient(client);
    StaticHibernateUtil.flushSession();
    client = TestObjectFactory.getClient(client.getCustomerId());
    Assert.assertEquals(name, client.getDisplayName());
    Assert.assertEquals(client.getOffice().getOfficeId(), group.getOffice().getOfficeId());
}
Also used : ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) Test(org.junit.Test)

Example 20 with ClientPersonalDetailDto

use of org.mifos.dto.screen.ClientPersonalDetailDto in project head by mifos.

the class ClientCustActionStrutsTest method createAndSetClientInSession.

private void createAndSetClientInSession() throws Exception {
    OfficeBO office = new OfficePersistence().getOffice(TestObjectFactory.HEAD_OFFICE);
    PersonnelBO personnel = legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER);
    meeting = getMeeting();
    ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), 1, "Client", "", "1", "");
    clientNameDetailDto.setNames(ClientRules.getNameSequence());
    ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), 1, "first", "middle", "last", "secondLast");
    spouseNameDetailView.setNames(ClientRules.getNameSequence());
    ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
    Calendar dob = new GregorianCalendar();
    dob.set(Calendar.YEAR, 1970);
    client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, new Address(), getCustomFields(), null, null, personnel, office, meeting, personnel, dob.getTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
    legacyClientDao.saveClient(client);
    StaticHibernateUtil.flushAndClearSession();
    client = TestObjectFactory.getClient(Integer.valueOf(client.getCustomerId()).intValue());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
Also used : Address(org.mifos.framework.business.util.Address) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) ClientBO(org.mifos.customers.client.business.ClientBO) GregorianCalendar(java.util.GregorianCalendar) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence)

Aggregations

ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)26 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)26 Test (org.junit.Test)13 CustomerException (org.mifos.customers.exceptions.CustomerException)12 ClientBO (org.mifos.customers.client.business.ClientBO)9 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)8 ArrayList (java.util.ArrayList)7 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)7 InputStream (java.io.InputStream)5 LocalDate (org.joda.time.LocalDate)5 OfficeBO (org.mifos.customers.office.business.OfficeBO)5 AddressDto (org.mifos.dto.domain.AddressDto)5 ClientFamilyDetailDto (org.mifos.dto.screen.ClientFamilyDetailDto)5 Date (java.sql.Date)4 Date (java.util.Date)4 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)4 ClientCreationDetail (org.mifos.dto.domain.ClientCreationDetail)4 MeetingDto (org.mifos.dto.domain.MeetingDto)4 Address (org.mifos.framework.business.util.Address)4 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3