Search in sources :

Example 56 with Calendar

use of java.util.Calendar in project head by mifos.

the class AccountBOIntegrationTest method offSetCurrentDate.

private java.sql.Date offSetCurrentDate(final int noOfDays) {
    Calendar currentDateCalendar = new GregorianCalendar();
    int year = currentDateCalendar.get(Calendar.YEAR);
    int month = currentDateCalendar.get(Calendar.MONTH);
    int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
    currentDateCalendar = new GregorianCalendar(year, month, day - noOfDays);
    return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.sql.Date)

Example 57 with Calendar

use of java.util.Calendar in project head by mifos.

the class AccountBOIntegrationTest method testIsTrxnDateValid.

@Test
public void testIsTrxnDateValid() throws Exception {
    Calendar calendar = new GregorianCalendar();
    // Added by rajender on 24th July as test case was not passing
    calendar.add(Calendar.DAY_OF_MONTH, 10);
    java.util.Date trxnDate = new Date(calendar.getTimeInMillis());
    Date meetingDate = new CustomerPersistence().getLastMeetingDateForCustomer(groupLoan.getCustomer().getCustomerId());
    if (AccountingRules.isBackDatedTxnAllowed()) {
        Assert.assertTrue(groupLoan.isTrxnDateValid(trxnDate, meetingDate, false));
    } else {
        Assert.assertFalse(groupLoan.isTrxnDateValid(trxnDate, meetingDate, false));
    }
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) Date(java.sql.Date) Test(org.junit.Test)

Example 58 with Calendar

use of java.util.Calendar in project head by mifos.

the class CalendarTest method createPreviousDate.

private Date createPreviousDate(int numberOfDays) {
    Calendar calendar = new GregorianCalendar();
    calendar.setTime(new Date());
    calendar.add(Calendar.DATE, -numberOfDays);
    Date pastDate = DateUtils.getDateWithoutTimeStamp(calendar.getTime());
    return pastDate;
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date)

Example 59 with Calendar

use of java.util.Calendar in project head by mifos.

the class SavingsOfferingBOIntegrationTest method reduceCurrentDate.

private java.sql.Date reduceCurrentDate(final int noOfDays) {
    Calendar currentDateCalendar = new GregorianCalendar();
    int year = currentDateCalendar.get(Calendar.YEAR);
    int month = currentDateCalendar.get(Calendar.MONTH);
    int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
    currentDateCalendar = new GregorianCalendar(year, month, day - noOfDays);
    return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.sql.Date)

Example 60 with Calendar

use of java.util.Calendar in project head by mifos.

the class SavingsOfferingBOIntegrationTest method offSetCurrentDate.

private java.sql.Date offSetCurrentDate(final int noOfDays) {
    Calendar currentDateCalendar = new GregorianCalendar();
    int year = currentDateCalendar.get(Calendar.YEAR);
    int month = currentDateCalendar.get(Calendar.MONTH);
    int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
    currentDateCalendar = new GregorianCalendar(year, month, day + noOfDays);
    return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
Also used : Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) Date(java.sql.Date)

Aggregations

Calendar (java.util.Calendar)9446 Date (java.util.Date)2436 GregorianCalendar (java.util.GregorianCalendar)2130 Test (org.junit.Test)1735 SimpleDateFormat (java.text.SimpleDateFormat)889 ArrayList (java.util.ArrayList)476 ParseException (java.text.ParseException)353 HashMap (java.util.HashMap)270 TimeZone (java.util.TimeZone)270 IOException (java.io.IOException)235 DateFormat (java.text.DateFormat)224 Timestamp (java.sql.Timestamp)194 List (java.util.List)187 File (java.io.File)167 Map (java.util.Map)149 BigDecimal (java.math.BigDecimal)134 Locale (java.util.Locale)134 Test (org.testng.annotations.Test)118 Identity (org.olat.core.id.Identity)112 Date (java.sql.Date)110