Example usage for java.util Calendar getMaximum

List of usage examples for java.util Calendar getMaximum

Introduction

In this page you can find the example usage for java.util Calendar getMaximum.

Prototype

public abstract int getMaximum(int field);

Source Link

Document

Returns the maximum value for the given calendar field of this Calendar instance.

Usage

From source file:com.viettel.ttbankplus.servicegw.hibernate.dao.transaction.TransCPDAO.java

public List<Map<String, Object>> getReportTotal(Date fromDate, Date toDate, String by, String bankCode,
        ArrayList<Long> lstCpId) {
    List<Map<String, Object>> lst = new ArrayList();
    try {//from   w  w  w . j  a v  a  2s .  co  m
        //            String where = " where cp.trans_status = 2 and (cp.trans_type = 0 or cp.trans_type = 2) ";
        String where = " where (bp.error_code = '00' or bp.correct_code = '00') and (cp.trans_type = 0 or cp.trans_type = 2) ";
        where += " and cp.request_date >= to_date(:fromDate, 'dd/MM/yyyy hh24:mi:ss') and cp.request_date <= to_date(:toDate, 'dd/MM/yyyy hh24:mi:ss')";
        where += " and cp.content_provider_id in (:cpId) ";
        if (bankCode != null && !bankCode.equals("")) {
            where += " and upper(bp.bank_code) = :bankCode ";
        }
        String groupBy = "";
        String orderBy = "";
        String sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, ";
        if (by.equals("MON")) {
            //Chuyen ngay thang thanh thang
            Calendar cal = Calendar.getInstance();
            cal.setTime(fromDate);
            Calendar calFrom = Calendar.getInstance();
            calFrom.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMinimum(Calendar.DAY_OF_MONTH),
                    0, 0, 0);

            cal.setTime(toDate);
            Calendar calTo = Calendar.getInstance();
            calTo.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMaximum(Calendar.DAY_OF_MONTH),
                    23, 59, 59);

            fromDate = calFrom.getTime();
            toDate = calTo.getTime();

            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, ";
            groupBy = " group by  to_char(cp.request_date, 'MM/yyyy'), bp.bank_code, p.cp_code, p.cp_name ";
            orderBy = " order by to_date(monDay, 'MM/yyyy') desc";
        } else {
            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'dd/MM/yyyy') monDay, ";
            groupBy = " group by to_char(cp.request_date, 'dd/MM/yyyy'), bp.bank_code, p.cp_code, p.cp_name ";
            orderBy = " order by to_date(monDay, 'dd/MM/yyyy') desc";
        }
        sql += " SUM(CASE cp.trans_type WHEN 0 THEN 1 ELSE 0 END) totalPay,";
        sql += " SUM(CASE cp.trans_type WHEN 2 THEN 1 ELSE 0 END) totalRefund,";
        sql += " SUM(CASE cp.trans_type WHEN 0 THEN cp.AMOUNT ELSE 0 END) payAmount,";
        sql += " SUM(CASE cp.trans_type WHEN 2 THEN cp.AMOUNT ELSE 0 END) refundAmount,";
        sql += " SUM(nvl(bp.fee,0)) totalFee,";
        sql += " p.cp_code cpCode, p.cp_name cpName ";
        sql += " from trans_cp cp left join trans_bankplus bp on cp.trans_cp_id = bp.trans_cp_id";
        sql += " left join content_provider p on cp.content_provider_id = p.content_provider_id ";
        sql += where;
        sql += groupBy;
        sql += orderBy;
        log.debug(sql);
        SQLQuery query = getSession().createSQLQuery(sql);
        //        query.setResultTransformer(Transformers.aliasToBean(ReportTotal.class));
        query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);

        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

        query.setParameter("fromDate", sdf.format(fromDate));
        query.setParameter("toDate", sdf.format(toDate));

        //            query.setParameter("fromDate", fromDate);
        //            query.setParameter("toDate", toDate);
        query.setParameterList("cpId", lstCpId);
        if (bankCode != null && !bankCode.equals("")) {
            query.setParameter("bankCode", bankCode.toUpperCase());
        }
        lst = query.list();
    } catch (Exception ex) {
        log.error("getReportTotal: ", ex);
    } finally {
        DAOFactory.commitCurrentSessions();
    }
    return lst;
}

From source file:com.viettel.ttbankplus.servicegw.hibernate.dao.transaction.TransCPDAO.java

public List<Map<String, Object>> getReportRefund(Date fromDate, Date toDate, String by, String bankCode,
        ArrayList<Long> lstCpId) {
    List<Map<String, Object>> lst = new ArrayList();
    try {/*  w w w  .j  a v a 2s.  c  o  m*/
        String where = " where cp.trans_type = 2 ";
        where += " and cp.request_date >= to_date(:fromDate, 'dd/MM/yyyy hh24:mi:ss') and cp.request_date <= to_date(:toDate, 'dd/MM/yyyy hh24:mi:ss')";
        //            where += " and cp.request_date >= :fromDate and cp.request_date <= :toDate";
        where += " and cp.content_provider_id in (:cpId) ";
        if (bankCode != null && !bankCode.equals("")) {
            where += " and upper(bp.bank_code) = :bankCode ";
        }
        String groupBy = "";
        String orderBy = "";
        String sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, ";
        if (by.equals("MON")) {
            //Chuyen ngay thang thanh thang
            Calendar cal = Calendar.getInstance();
            cal.setTime(fromDate);
            Calendar calFrom = Calendar.getInstance();
            calFrom.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMinimum(Calendar.DAY_OF_MONTH),
                    0, 0, 0);

            cal.setTime(toDate);
            Calendar calTo = Calendar.getInstance();
            calTo.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMaximum(Calendar.DAY_OF_MONTH),
                    23, 59, 59);

            fromDate = calFrom.getTime();
            toDate = calTo.getTime();

            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, ";
            groupBy = " group by  to_char(cp.request_date, 'MM/yyyy'), bp.bank_code, p.cp_code, p.cp_name";
            orderBy = " order by to_date(monDay, 'MM/yyyy') desc";
        } else {
            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'dd/MM/yyyy') monDay, ";
            groupBy = " group by  to_char(cp.request_date, 'dd/MM/yyyy'), bp.bank_code, p.cp_code, p.cp_name";
            orderBy = " order by to_date(monDay, 'dd/MM/yyyy') desc";
        }
        sql += " SUM(CASE cp.trans_status WHEN '0' THEN 1 ELSE 0 END) totalpending,";
        sql += " SUM(CASE cp.trans_status WHEN '2' THEN 1 ELSE 0 END) totalsuccess,";
        sql += " SUM(CASE cp.trans_status WHEN '4' THEN 1 ELSE 0 END) totalfailure,";
        sql += " SUM(CASE cp.trans_status WHEN '0' THEN cp.amount ELSE 0 END) amountpending,";
        sql += " SUM(CASE cp.trans_status WHEN '2' THEN cp.amount ELSE 0 END) amountsuccess,";
        sql += " SUM(CASE cp.trans_status WHEN '4' THEN cp.amount ELSE 0 END) amountfailure,";
        sql += " p.cp_code cpCode, p.cp_name cpName ";
        //            sql += " from trans_cp cp left join trans_bankplus bp on cp.trans_cp_id = bp.trans_cp_id";
        sql += " from trans_cp cp";
        sql += " join trans_cp cp2 on cp.original_trans_id = cp2.trans_id ";
        sql += " left join trans_bankplus bp on cp2.trans_cp_id = bp.trans_cp_id ";
        sql += " left join content_provider p on cp.content_provider_id = p.content_provider_id ";
        sql += where;
        sql += groupBy;
        sql += orderBy;
        log.debug(sql);
        SQLQuery query = getSession().createSQLQuery(sql);
        //        query.setResultTransformer(Transformers.aliasToBean(ReportTotal.class));
        query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);

        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

        query.setParameter("fromDate", sdf.format(fromDate));
        query.setParameter("toDate", sdf.format(toDate));
        //            query.setParameter("fromDate", fromDate);
        //            query.setParameter("toDate", toDate);
        query.setParameterList("cpId", lstCpId);
        if (bankCode != null && !bankCode.equals("")) {
            query.setParameter("bankCode", bankCode.toUpperCase());
        }
        lst = query.list();
    } catch (Exception ex) {
        log.error("getReportRefund: ", ex);
    } finally {
        DAOFactory.commitCurrentSessions();
    }
    return lst;
}

From source file:com.viettel.ttbankplus.servicegw.hibernate.dao.transaction.TransCPDAO.java

public List<Map<String, Object>> getReportTotalEVN(Date fromDate, Date toDate, String by, String bankCode,
        Long cpId) {/*from  w w  w  . j a va 2  s .  c  o  m*/
    List<Map<String, Object>> lst = new ArrayList();
    try {

        String where = " where cp.trans_status = 2 and (cp.trans_type = 0 or cp.trans_type = 2) ";
        where += " and cp.request_date >= to_date(:fromDate, 'dd/MM/yyyy hh24:mi:ss') and cp.request_date <= to_date(:toDate, 'dd/MM/yyyy hh24:mi:ss')";
        //            where += " and cp.request_date >= :fromDate and cp.request_date <= :toDate";
        where += " and cp.content_provider_id = :cpId ";
        where += " and bp.process_code = '300001' ";
        where += " and bp.error_code = '00'  ";

        if (bankCode != null && !bankCode.equals("")) {
            where += " and upper(bp.bank_code) = :bankCode ";
        }
        String groupBy = " group by  to_char(cp.request_date, 'dd/MM/yyyy'), bp.bank_code";
        String orderBy = "";
        String sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, sum(bs.num_order) totalBill, ";
        if (by.equals("MON")) {
            //Chuyen ngay thang thanh thang
            Calendar cal = Calendar.getInstance();
            cal.setTime(fromDate);
            Calendar calFrom = Calendar.getInstance();
            calFrom.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMinimum(Calendar.DAY_OF_MONTH),
                    0, 0, 0);

            cal.setTime(toDate);
            Calendar calTo = Calendar.getInstance();
            calTo.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.getMaximum(Calendar.DAY_OF_MONTH),
                    23, 59, 59);

            fromDate = calFrom.getTime();
            toDate = calTo.getTime();

            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'MM/yyyy') monDay, sum(bs.num_order) totalBill, ";
            groupBy = " group by  to_char(cp.request_date, 'MM/yyyy'), bp.bank_code";
            orderBy = " order by to_date(monDay, 'MM/yyyy') desc";
        } else {
            sql = "select bp.bank_code bankCode, to_char(cp.request_date, 'dd/MM/yyyy') monDay, sum(bs.num_order) totalBill, ";
            groupBy = " group by  to_char(cp.request_date, 'dd/MM/yyyy'), bp.bank_code";
            orderBy = " order by to_date(monDay, 'dd/MM/yyyy') desc";
        }
        sql += " SUM(CASE cp.trans_type WHEN 0 THEN 1 ELSE 0 END) totalPay,";
        sql += " SUM(CASE cp.trans_type WHEN 2 THEN 1 ELSE 0 END) totalRefund,";
        sql += " SUM(CASE cp.trans_type WHEN 0 THEN bp.amount ELSE 0 END) payAmount,";
        sql += " SUM(CASE cp.trans_type WHEN 2 THEN bp.amount ELSE 0 END) refundAmount";

        sql += " from trans_cp cp left join trans_bankplus bp on cp.trans_cp_id = bp.trans_cp_id";
        sql += " left join (select aa.*, cc.num_order from trans_bankplus aa ";
        //sql += " inner join billing_service bb on aa.trans_bankplus_id = bb.trans_bankplus_id";
        sql += " inner join (select trans_bankplus_id, count(*) num_order from billing_service group by trans_bankplus_id) cc";
        sql += " on aa.trans_bankplus_id = cc.trans_bankplus_id where aa.error_code = '00') bs";
        sql += " on bp.original_request_id = bs.request_id ";

        sql += where;
        sql += groupBy;
        sql += orderBy;
        log.debug(sql);
        SQLQuery query = getSession().createSQLQuery(sql);
        query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);

        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

        query.setParameter("fromDate", sdf.format(fromDate));
        query.setParameter("toDate", sdf.format(toDate));
        //            query.setParameter("fromDate", fromDate);
        //            query.setParameter("toDate", toDate);
        query.setParameter("cpId", cpId);

        if (bankCode != null && !bankCode.equals("")) {
            query.setParameter("bankCode", bankCode.toUpperCase());
        }
        lst = query.list();
    } catch (Exception ex) {
        log.error("getReportTotal: ", ex);
    } finally {
        DAOFactory.commitCurrentSessions();
    }
    return lst;
}

From source file:org.sipfoundry.voicemail.Retrieve.java

/**
 * Play the "envelope information" about the message
 *
 * @param md/*from   w w w. j  a v  a  2s  .  c o m*/
 */
PromptList messageInfo(MessageDescriptor md) {
    DateFormat ttsDateFormat = TextToPrompts.ttsDateFormat();

    Calendar rxCal = Calendar.getInstance();
    rxCal.setTime(md.getTimeStampDate());
    Calendar nowCal = Calendar.getInstance();

    long daysInrxYear = rxCal.getMaximum(Calendar.DAY_OF_YEAR);
    long diffDays;
    long diffYears = nowCal.get(Calendar.YEAR) - rxCal.get(Calendar.YEAR);

    if (diffYears == 0) {
        // In the same year, so calculate
        // the difference in days between now and when the message was recorded
        diffDays = nowCal.get(Calendar.DAY_OF_YEAR) - rxCal.get(Calendar.DAY_OF_YEAR);
    } else {
        if (diffYears == 1) {
            // In different years, so offset by # days in the year
            diffDays = nowCal.get(Calendar.DAY_OF_YEAR) + daysInrxYear - rxCal.get(Calendar.DAY_OF_YEAR);
            // This is done so if playing a message recorded in the last week of December
            // while in the first week of January, we can still detect if the message is
            // less than a week old. Any older than that, and we'll add the year when speaking
            // the recording time.
        } else {
            diffDays = 42; // Long enough!
        }
    }

    // Build the appropriate date prompts based on how old the message is
    String rxCalString = ttsDateFormat.format(rxCal.getTime());
    String fragment = "msg_info_old";
    if (diffDays == 0) {
        // Same date
        fragment = "msg_info_today";
    } else if (diffDays == 1) {
        // Yesterday
        fragment = "msg_info_yesterday";
    } else if (diffDays < 7) {
        // within a week
        fragment = "msg_info_thisweek";
    } else if (diffYears == 0) {
        // In the same year
        fragment = "msg_info_thisyear";
    }
    LOG.debug(String.format("Retrieve::messageInfo (%s) (%s) (%s) %d %d days old", md.getTimestampString(),
            rxCalString, fragment, diffYears, diffDays));
    PromptList datePl = getPromptList(fragment, rxCalString);

    // Build the appropriate "from" based on what we know about the caller who left this
    // message
    String fromPrompts;
    String from = ValidUsers.getUserPart(md.getFromUri());
    User user = getValidUser(from);
    if (user != null) {
        // Well, looky here! A sipXecs user! Get his recorded name if we can
        File nameFile = m_mailboxManager.getRecordedName(user.getUserName());
        if (nameFile.exists()) {
            // "{name} at Extension {extension}"
            PromptList ext = getPromptList("atextension", nameFile.getPath(), user.getUserName());
            fromPrompts = ext.toString();
        } else {
            PromptList ext = getPromptList("extension", user.getUserName());
            // "Extension {extension}"
            fromPrompts = ext.toString();
        }
    } else {
        // Call from outside.

        if (from != null && from.matches("[0-9]{1,16}")) {
            // Up to 16 digits (no non-digits)
            PromptList digitsPl = getPromptList();
            digitsPl.addPrompts("{0, digits}", from);
            fromPrompts = digitsPl.toString();
        } else {
            // "An outside caller"
            PromptList outsidePl = getPromptList("msg_info_outsidecall");
            fromPrompts = outsidePl.toString();
        }
    }

    // "Message Received {date} {time} from {caller}"
    return getPromptList("msg_info", datePl.toString(), rxCalString, fromPrompts);

}

From source file:com.markuspage.android.atimetracker.Tasks.java

/**
 * Creates a progressDialog to change the dates for which task times are
 * shown. Offers a short selection of pre-defined defaults, and the option
 * to choose a range from a progressDialog.
 *
 * @see arrays.xml/* w ww .  j a  va 2s .co  m*/
 * @return the progressDialog to be displayed
 */
private Dialog openChangeViewDialog() {
    return new AlertDialog.Builder(Tasks.this).setItems(R.array.views, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            SharedPreferences.Editor ed = preferences.edit();
            ed.putInt(VIEW_MODE, which);
            ed.commit();
            if (which == 5) {
                Calendar calInstance = Calendar.getInstance();
                new DatePickerDialog(Tasks.this, new DatePickerDialog.OnDateSetListener() {
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                        Calendar start = Calendar.getInstance();
                        start.set(Calendar.YEAR, year);
                        start.set(Calendar.MONTH, monthOfYear);
                        start.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                        start.set(Calendar.HOUR, start.getMinimum(Calendar.HOUR));
                        start.set(Calendar.MINUTE, start.getMinimum(Calendar.MINUTE));
                        start.set(Calendar.SECOND, start.getMinimum(Calendar.SECOND));
                        start.set(Calendar.MILLISECOND, start.getMinimum(Calendar.MILLISECOND));
                        SharedPreferences.Editor ed = preferences.edit();
                        ed.putLong(START_DATE, start.getTime().getTime());
                        ed.commit();

                        new DatePickerDialog(Tasks.this, new DatePickerDialog.OnDateSetListener() {
                            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                                Calendar end = Calendar.getInstance();
                                end.set(Calendar.YEAR, year);
                                end.set(Calendar.MONTH, monthOfYear);
                                end.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                                end.set(Calendar.HOUR, end.getMaximum(Calendar.HOUR));
                                end.set(Calendar.MINUTE, end.getMaximum(Calendar.MINUTE));
                                end.set(Calendar.SECOND, end.getMaximum(Calendar.SECOND));
                                end.set(Calendar.MILLISECOND, end.getMaximum(Calendar.MILLISECOND));
                                SharedPreferences.Editor ed = preferences.edit();
                                ed.putLong(END_DATE, end.getTime().getTime());
                                ed.commit();
                                Tasks.this.switchView(5); // Update the list view
                            }
                        }, year, monthOfYear, dayOfMonth).show();
                    }
                }, calInstance.get(Calendar.YEAR), calInstance.get(Calendar.MONTH),
                        calInstance.get(Calendar.DAY_OF_MONTH)).show();
            } else {
                switchView(which);
            }
        }
    }).create();
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * Gets the accumulated params./*from  w  w w.  j  a va 2 s  . c o  m*/
 * @param month the month
 * @return the accumulated params
 */
private HashMap<String, String> getAccumulatedParams(int month) {

    HashMap<String, String> params = new HashMap<String, String>();
    Calendar start = DateUtil.getUTCCalendar();
    start.set(Calendar.MONTH, month - 1);
    start.set(Calendar.DATE, 1);
    Calendar end = DateUtil.getUTCCalendar();
    end.set(Calendar.MONTH, month - 1);
    end.set(Calendar.DATE, end.getMaximum(Calendar.DATE));
    params.put(ReportsAPIConfig.START_DATE, DateUtil.format(start, DateUtil.DATE_FMT));
    params.put(ReportsAPIConfig.END_DATE, DateUtil.format(end, DateUtil.DATE_FMT));
    params.put(ReportsAPIConfig.ACCUMULATED, "true");
    return params;
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * Gets the not accumulated params./*from   w  w  w  .java  2 s .c o m*/
 * @param month the month
 * @return the not accumulated params
 */
private HashMap<String, String> getNotAccumulatedParams(int month) {

    HashMap<String, String> params = new HashMap<String, String>();
    Calendar start = DateUtil.getUTCCalendar();
    start.set(Calendar.MONTH, month - 1);
    start.set(Calendar.DATE, 1);
    Calendar end = DateUtil.getUTCCalendar();
    end.set(Calendar.MONTH, month - 1);
    end.set(Calendar.DATE, end.getMaximum(Calendar.DATE));
    params.put(ReportsAPIConfig.START_DATE, DateUtil.format(start, DateUtil.DATE_FMT));
    params.put(ReportsAPIConfig.END_DATE, DateUtil.format(end, DateUtil.DATE_FMT));
    params.put(ReportsAPIConfig.ACCUMULATED, "false");
    return params;
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * Location savings.//from w ww .  j  ava2 s .c o m
 */
@Test(groups = { "sanity1" })
public void locationSavings() {

    String id = reportsAPIConfig.get(ReportsAPIConfig.LOCATION_ID);
    String content = HttpUtil.get(getLocationSavingsURL(id), getNotAccumulatedParams(5), 200);
    JSONObject object = JsonUtil.parseObject(content);

    Calendar start = DateUtil.getUTCCalendar();
    start.set(Calendar.MONTH, 5 - 1);
    start.set(Calendar.DATE, 1);
    start.set(Calendar.HOUR, 0);
    start.set(Calendar.MINUTE, 0);
    start.set(Calendar.SECOND, 0);
    Calendar end = DateUtil.getUTCCalendar();
    end.set(Calendar.MONTH, 5 - 1);
    end.set(Calendar.DATE, end.getMaximum(Calendar.DATE));
    end.set(Calendar.HOUR, 23);
    end.set(Calendar.MINUTE, 59);
    end.set(Calendar.SECOND, 0);
    assertLocationSavingsData(object, start, end);
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * User savings./*from   www.  ja v a2s  . co m*/
 */
@Test(groups = { "sanity1" })
public void userSavings() {

    String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID);
    String content = HttpUtil.get(getUserSavingsURL(id), getNotAccumulatedParams(5), 200);
    JSONObject object = JsonUtil.parseObject(content);

    Calendar start = DateUtil.getUTCCalendar();
    start.set(Calendar.MONTH, 5 - 1);
    start.set(Calendar.DATE, 1);
    start.set(Calendar.HOUR, 0);
    start.set(Calendar.MINUTE, 0);
    start.set(Calendar.SECOND, 0);
    Calendar end = DateUtil.getUTCCalendar();
    end.set(Calendar.MONTH, 5 - 1);
    end.set(Calendar.DATE, end.getMaximum(Calendar.DATE));
    end.set(Calendar.HOUR, 23);
    end.set(Calendar.MINUTE, 59);
    end.set(Calendar.SECOND, 0);
    assertUserSavingsData(object, start, end);
}

From source file:com.ecofactor.qa.automation.api.ReportsAPITest.java

/**
 * User savings accumulated.//ww  w  . j a v a  2 s.  co  m
 */
@Test(groups = { "sanity1" })
public void userSavingsAccumulated() {

    String id = reportsAPIConfig.get(ReportsAPIConfig.USER_ID);
    String content = HttpUtil.get(getUserSavingsURL(id), getAccumulatedParams(5), 200);
    JSONObject object = JsonUtil.parseObject(content);

    Calendar start = DateUtil.getUTCCalendar();
    start.set(Calendar.MONTH, 5 - 1);
    start.set(Calendar.DATE, 1);
    start.set(Calendar.HOUR, 0);
    start.set(Calendar.MINUTE, 0);
    start.set(Calendar.SECOND, 0);
    Calendar end = DateUtil.getUTCCalendar();
    end.set(Calendar.MONTH, 5 - 1);
    end.set(Calendar.DATE, end.getMaximum(Calendar.DATE));
    end.set(Calendar.HOUR, 23);
    end.set(Calendar.MINUTE, 59);
    end.set(Calendar.SECOND, 0);

    assertAccumulatedUserSavingsData(object, start, end);
}