Search in sources :

Example 1 with CenterPersistence

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

the class CenterBOIntegrationTest method testSuccessfulCreateWithoutFee.

@Test
public void testSuccessfulCreateWithoutFee() throws Exception {
    String name = "Center";
    meeting = getMeeting();
    center = new CenterBO(TestUtils.makeUser(), name, null, getCustomFields(), null, null, null, officeBo, meeting, personnelBo, new CustomerPersistence());
    new CenterPersistence().saveCenter(center);
    StaticHibernateUtil.flushSession();
    center = TestObjectFactory.getCenter(center.getCustomerId());
    Assert.assertEquals(name, center.getDisplayName());
    Assert.assertEquals(officeId, center.getOffice().getOfficeId());
    Assert.assertEquals(2, center.getCustomFields().size());
}
Also used : CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence) Test(org.junit.Test)

Example 2 with CenterPersistence

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

the class TestObjectFactory method createCenter.

public static CenterBO createCenter(final String customerName, final MeetingBO meeting, final Short officeId, final Short personnelId, final List<FeeDto> fees) {
    CenterBO center;
    try {
        center = new CenterBO(TestUtils.makeUserWithLocales(), customerName, null, null, fees, null, null, new OfficePersistence().getOffice(officeId), meeting, ApplicationContextProvider.getBean(LegacyPersonnelDao.class).getPersonnel(personnelId), new CustomerPersistence());
        new CenterPersistence().saveCenter(center);
        StaticHibernateUtil.flushSession();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return center;
}
Also used : MifosRuntimeException(org.mifos.core.MifosRuntimeException) CenterBO(org.mifos.customers.center.business.CenterBO) LegacyPersonnelDao(org.mifos.customers.personnel.persistence.LegacyPersonnelDao) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) SystemException(org.mifos.framework.exceptions.SystemException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) CustomerException(org.mifos.customers.exceptions.CustomerException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) OfficeException(org.mifos.customers.office.exceptions.OfficeException) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence)

Example 3 with CenterPersistence

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

the class GroupPersistenceIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    this.officePersistence = new OfficePersistence();
    this.centerPersistence = new CenterPersistence();
    this.groupPersistence = new GroupPersistence();
    initializeStatisticsService();
}
Also used : OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence) Before(org.junit.Before)

Example 4 with CenterPersistence

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

the class GroupActionStrutsTest method createCenterWithoutFee.

private void createCenterWithoutFee() throws Exception {
    meeting = new MeetingBO(WeekDay.MONDAY, EVERY_WEEK, new Date(), MeetingType.CUSTOMER_MEETING, "Delhi");
    center = new CenterBO(userContext, "MyCenter", null, null, null, "1234", null, TestObjectFactory.getBranchOffice(), meeting, TestObjectFactory.getTestUser(), new CustomerPersistence());
    new CenterPersistence().saveCenter(center);
    StaticHibernateUtil.flushAndClearSession();
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBO(org.mifos.customers.center.business.CenterBO) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) Date(java.util.Date) CenterPersistence(org.mifos.customers.center.persistence.CenterPersistence)

Example 5 with CenterPersistence

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

the class CenterBOIntegrationTest method testSuccessfulCreateWithoutFeeAndCustomField.

@Test
public void testSuccessfulCreateWithoutFeeAndCustomField() throws Exception {
    String name = "Center";
    meeting = getMeeting();
    center = new CenterBO(TestUtils.makeUser(), name, null, null, null, null, null, officeBo, meeting, personnelBo, new CustomerPersistence());
    new CenterPersistence().saveCenter(center);
    StaticHibernateUtil.flushSession();
    center = TestObjectFactory.getCenter(center.getCustomerId());
    Assert.assertEquals(name, center.getDisplayName());
    Assert.assertEquals(officeId, center.getOffice().getOfficeId());
}
Also used : CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) 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