Search in sources :

Example 6 with CenterPersistence

use of org.mifos.customers.center.persistence.CenterPersistence in project head by mifos.

the class CenterBOIntegrationTest method testSuccessfulCreate.

@Test
public void testSuccessfulCreate() throws Exception {
    String name = "Center";
    String externalId = "12345";
    Date mfiJoiningDate = getDate("11/12/2005");
    meeting = getMeeting();
    List<FeeDto> fees = getFees();
    center = new CenterBO(TestUtils.makeUser(), name, null, getCustomFields(), fees, externalId, mfiJoiningDate, new OfficePersistence().getOffice(officeId), meeting, legacyPersonnelDao.getPersonnel(personnelId), new CustomerPersistence());
    new CenterPersistence().saveCenter(center);
    StaticHibernateUtil.flushSession();
    center = TestObjectFactory.getCenter(center.getCustomerId());
    Assert.assertEquals(name, center.getDisplayName());
    Assert.assertEquals(externalId, center.getExternalId());
    Assert.assertEquals(mfiJoiningDate, DateUtils.getDateWithoutTimeStamp(center.getMfiJoiningDate().getTime()));
    Assert.assertEquals(officeId, center.getOffice().getOfficeId());
    Assert.assertEquals(2, center.getCustomFields().size());
    Assert.assertEquals(AccountState.CUSTOMER_ACCOUNT_ACTIVE.getValue(), center.getCustomerAccount().getAccountState().getId());
    // check if values in account fees are entered.
    Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(0).getFeeIdValue()));
    Assert.assertNotNull(center.getCustomerAccount().getAccountFees(fees.get(1).getFeeIdValue()));
}
Also used : FeeDto(org.mifos.accounts.fees.business.FeeDto) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Date(java.util.Date) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence) Test(org.junit.Test)

Aggregations

CenterPersistence (org.mifos.customers.center.persistence.CenterPersistence)6 CustomerPersistence (org.mifos.customers.persistence.CustomerPersistence)5 Test (org.junit.Test)3 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)3 Date (java.util.Date)2 CenterBO (org.mifos.customers.center.business.CenterBO)2 Before (org.junit.Before)1 FeeDto (org.mifos.accounts.fees.business.FeeDto)1 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)1 MeetingBO (org.mifos.application.meeting.business.MeetingBO)1 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 CustomerException (org.mifos.customers.exceptions.CustomerException)1 OfficeException (org.mifos.customers.office.exceptions.OfficeException)1 LegacyPersonnelDao (org.mifos.customers.personnel.persistence.LegacyPersonnelDao)1 ApplicationException (org.mifos.framework.exceptions.ApplicationException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 SystemException (org.mifos.framework.exceptions.SystemException)1