Search in sources :

Example 71 with DateTimeService

use of org.mifos.framework.util.DateTimeService in project head by mifos.

the class SavingsTestHelper method createSavingsOffering.

public SavingsOfferingBO createSavingsOffering(String offeringName, String shortName, Short depGLCode, Short intGLCode) {
    MeetingBO meetingIntCalc = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    MeetingBO meetingIntPost = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
    return TestObjectFactory.createSavingsProduct(offeringName, shortName, ApplicableTo.GROUPS, new DateTimeService().getCurrentJavaDateTime(), PrdStatus.SAVINGS_ACTIVE, 300.0, RecommendedAmountUnit.PER_INDIVIDUAL, 24.0, 200.0, 200.0, SavingsType.VOLUNTARY, InterestCalcType.MINIMUM_BALANCE, meetingIntCalc, meetingIntPost, depGLCode, intGLCode);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) DateTimeService(org.mifos.framework.util.DateTimeService)

Example 72 with DateTimeService

use of org.mifos.framework.util.DateTimeService in project head by mifos.

the class CollectionSheetServiceImplIntegrationTest method tearDown.

@After
public void tearDown() throws Exception {
    try {
        saveCollectionSheetUtils.clearObjects();
    } catch (Exception e) {
    // TODO Whoops, cleanup didnt work, reset db
    }
    new DateTimeService().resetToCurrentSystemDateTime();
    StaticHibernateUtil.flushSession();
}
Also used : DateTimeService(org.mifos.framework.util.DateTimeService) MifosRuntimeException(org.mifos.core.MifosRuntimeException) After(org.junit.After)

Example 73 with DateTimeService

use of org.mifos.framework.util.DateTimeService in project head by mifos.

the class SystemInfoTest method testGetDateTime.

@Test
public void testGetDateTime() {
    DateTime referenceDateTime = new DateTime(2008, 12, 5, 1, 10, 0, 0);
    DateTimeService dateTimeService = new DateTimeService();
    try {
        // set a fixed datetime which is what SystemInfo should get back
        dateTimeService.setCurrentDateTimeFixed(referenceDateTime);
        Assert.assertEquals("System info date time should be from the DateTimeService", referenceDateTime, info.getDateTime());
    } finally {
        dateTimeService.resetToCurrentSystemDateTime();
    }
}
Also used : DateTimeService(org.mifos.framework.util.DateTimeService) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 74 with DateTimeService

use of org.mifos.framework.util.DateTimeService in project head by mifos.

the class ActivityMapperTest method testAdjustmentPermittedForSameDayPayments.

@Test
public void testAdjustmentPermittedForSameDayPayments() {
    new DateTimeService().setCurrentDateTime(TestUtils.getDateTime(10, 10, 2010));
    Assert.assertTrue(activityMapper.isAdjustmentPermittedForBackDatedPayments(TestUtils.getDate(10, 10, 2010), userContext, new Short("1"), new Short("1")));
    verify(legacyRolesPermissionsDao, never()).isActivityAllowed(Matchers.<UserContext>anyObject(), Matchers.<ActivityContext>anyObject());
}
Also used : DateTimeService(org.mifos.framework.util.DateTimeService) Test(org.junit.Test)

Example 75 with DateTimeService

use of org.mifos.framework.util.DateTimeService in project head by mifos.

the class ActivityMapperTest method testAdjustmentPermittedForBackDatedPayments.

@Test
public void testAdjustmentPermittedForBackDatedPayments() {
    new DateTimeService().setCurrentDateTime(TestUtils.getDateTime(11, 10, 2010));
    when(legacyRolesPermissionsDao.isActivityAllowed(eq(userContext), Matchers.argThat(new ActivityContextTypeSafeMatcher()))).thenReturn(true);
    Assert.assertTrue(activityMapper.isAdjustmentPermittedForBackDatedPayments(TestUtils.getDate(10, 10, 2010), userContext, new Short("1"), new Short("1")));
    verify(legacyRolesPermissionsDao).isActivityAllowed(eq(userContext), Matchers.argThat(new ActivityContextTypeSafeMatcher()));
}
Also used : DateTimeService(org.mifos.framework.util.DateTimeService) Test(org.junit.Test)

Aggregations

DateTimeService (org.mifos.framework.util.DateTimeService)99 Test (org.junit.Test)24 Date (java.util.Date)21 Money (org.mifos.framework.util.helpers.Money)20 DateTime (org.joda.time.DateTime)19 PersistenceException (org.mifos.framework.exceptions.PersistenceException)19 MeetingBO (org.mifos.application.meeting.business.MeetingBO)16 MifosRuntimeException (org.mifos.core.MifosRuntimeException)16 LocalDate (org.joda.time.LocalDate)15 AccountException (org.mifos.accounts.exceptions.AccountException)14 LoanBO (org.mifos.accounts.loan.business.LoanBO)14 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)14 ArrayList (java.util.ArrayList)13 CustomerBO (org.mifos.customers.business.CustomerBO)10 CustomerException (org.mifos.customers.exceptions.CustomerException)10 UserContext (org.mifos.security.util.UserContext)10 BusinessRuleException (org.mifos.service.BusinessRuleException)9 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)8 MeetingException (org.mifos.application.meeting.exceptions.MeetingException)8 ApplicationException (org.mifos.framework.exceptions.ApplicationException)8