Examples of ReportDAO


Examples of co.nubetech.crux.dao.ReportDAO

  @Test
  public void testGetDashboardWhenNoReportsAreOnDashboard(){
   
    ArrayList<Report> reportList = new ArrayList<Report>();
   
    ReportDAO reportDAO = mock(ReportDAO.class);
    when(reportDAO.findDashboardReports()).thenReturn(reportList);
   
    DashBoardAction dashboardAction = new DashBoardAction();
    dashboardAction.setReportDAO(reportDAO);
    String result = dashboardAction.getDashBoard();
    ArrayList<Report> fetchedReportList = dashboardAction.getReportListForDashBoard();
View Full Code Here

Examples of co.nubetech.crux.dao.ReportDAO

  }
 
  @Test
  public void testGetDashboardWhenNoReports(){
       
    ReportDAO reportDAO = mock(ReportDAO.class);
    when(reportDAO.findAll()).thenReturn(new ArrayList<Report>());
   
    DashBoardAction dashboardAction = new DashBoardAction();
    dashboardAction.setReportDAO(reportDAO);
    String result = dashboardAction.getDashBoard();
    ArrayList<Report> fetchedReportList = dashboardAction.getReportListForDashBoard();
View Full Code Here

Examples of co.nubetech.crux.dao.ReportDAO

    List<Report> reportList = new ArrayList<Report>();
    reportList.add(report1);
    reportList.add(report2);
    reportList.add(report3);
   
    ReportDAO mockedReportDAO = mock(ReportDAO.class);
    ViewReportListAction viewReportListAction = new ViewReportListAction();
    viewReportListAction.setReportDAO(mockedReportDAO);
    when(mockedReportDAO.findAll()).thenReturn(reportList);
   
    String successString = viewReportListAction.displayReportList();
   
    assertEquals(successString, "success");
       
View Full Code Here

Examples of co.nubetech.crux.dao.ReportDAO

    report.setReportType(reportType);
   
    List<Report> reportList = new ArrayList<Report>();
    reportList.add(report);
   
    ReportDAO mockedReportDAO = mock(ReportDAO.class);
    ViewReportListAction viewReportListAction = new ViewReportListAction();
    viewReportListAction.setReportDAO(mockedReportDAO);
    when(mockedReportDAO.findAll()).thenReturn(reportList);
   
    String successString = viewReportListAction.displayReportList();
   
    assertEquals(successString, "success");
   
View Full Code Here

Examples of co.nubetech.crux.dao.ReportDAO

   
   
    List<Report> reportList = new ArrayList<Report>();
    reportList.add(report);
   
    ReportDAO mockedReportDAO = mock(ReportDAO.class);
    ViewReportListAction viewReportListAction = new ViewReportListAction();
    viewReportListAction.setReportDAO(mockedReportDAO);
    when(mockedReportDAO.findAll()).thenReturn(reportList);
   
    // with this, report.getReportType().getType() is called in ReportView(index, report)
    // which NullPointerException as there is no ReportType for report object.
    String successString = viewReportListAction.displayReportList();
   
View Full Code Here

Examples of co.nubetech.crux.dao.ReportDAO

    mappingList.add(mapping3);
   
    // Nothing in the report list in this test.
    List<Report> reportList = new ArrayList<Report>();
   
    ReportDAO mockedReportDAO = mock(ReportDAO.class);
    ViewReportListAction viewReportListAction = new ViewReportListAction();
    viewReportListAction.setReportDAO(mockedReportDAO);
   
    when(mockedReportDAO.findAll()).thenReturn(reportList);
   
   
    MappingDAO mockedMappingDAO = mock(MappingDAO.class);
    viewReportListAction.setMappingDAO(mockedMappingDAO);
   
View Full Code Here

Examples of com.serotonin.m2m2.reports.ReportDao

*/
public class ReportsDwr extends ModuleDwr {
    @DwrPermission(user = true)
    public ProcessResult init() {
        ProcessResult response = new ProcessResult();
        ReportDao reportDao = new ReportDao();
        User user = Common.getUser();

        response.addData("points", getReadablePoints());
        response.addData("mailingLists", new MailingListDao().getMailingLists());
        response.addData("users", new UserDao().getUsers());
        if(user.isAdmin()) {
          response.addData("reports", reportDao.getReports());
          response.addData("instances", getReportInstances(user));
      }
        else {
          response.addData("reports", reportDao.getReports(user.getId()));
          response.addData("instances", getReportInstances(user));
      }
        response.addData("templates", getTemplateList());

        return response;
View Full Code Here

Examples of com.serotonin.m2m2.reports.ReportDao

    @DwrPermission(user = true)
    public ReportVO getReport(int id, boolean copy) {
        ReportVO report;
        if (id == Common.NEW_ID) {
            report = new ReportVO();
            report.setXid(new ReportDao().generateUniqueXid());
            report.setName(translate("common.newName"));
        }
        else {
            report = new ReportDao().getReport(id);

            if (copy) {
                report.setId(Common.NEW_ID);
                report.setName(TranslatableMessage.translate(getTranslations(), "common.copyPrefix", report.getName()));
            }
View Full Code Here

Examples of com.serotonin.m2m2.reports.ReportDao

        if (response.getHasMessages())
            return response;

        User user = Common.getUser();
        ReportDao reportDao = new ReportDao();
        ReportVO report;
        if (id == Common.NEW_ID) {
            report = new ReportVO();
            report.setUserId(user.getId());
        }
        else
            report = reportDao.getReport(id);
       
        ReportCommon.ensureReportPermission(user, report);

        // Update the new values.
        report.setXid(xid);
        report.setName(name);
        report.setPoints(points);
        report.setTemplate(template);
        report.setIncludeEvents(includeEvents);
        report.setIncludeUserComments(includeUserComments);
        report.setDateRangeType(dateRangeType);
        report.setRelativeDateType(relativeDateType);
        report.setPreviousPeriodCount(previousPeriodCount);
        report.setPreviousPeriodType(previousPeriodType);
        report.setPastPeriodCount(pastPeriodCount);
        report.setPastPeriodType(pastPeriodType);
        report.setFromNone(fromNone);
        report.setFromYear(fromYear);
        report.setFromMonth(fromMonth);
        report.setFromDay(fromDay);
        report.setFromHour(fromHour);
        report.setFromMinute(fromMinute);
        report.setToNone(toNone);
        report.setToYear(toYear);
        report.setToMonth(toMonth);
        report.setToDay(toDay);
        report.setToHour(toHour);
        report.setToMinute(toMinute);
        report.setSchedule(schedule);
        report.setSchedulePeriod(schedulePeriod);
        report.setRunDelayMinutes(runDelayMinutes);
        report.setScheduleCron(scheduleCron);
        report.setEmail(email);
        report.setIncludeData(includeData);
        report.setZipData(zipData);
        report.setRecipients(recipients);

        // Save the report
        reportDao.saveReport(report);

        // Conditionally schedule the report.
        ReportJob.scheduleReportJob(report);

        // Send back the report id in case this was new.
View Full Code Here

Examples of com.serotonin.m2m2.reports.ReportDao

        return response;
    }

    @DwrPermission(user = true)
    public void deleteReport(int id) {
        ReportDao reportDao = new ReportDao();

        ReportVO report = reportDao.getReport(id);
        if (report != null) {
            ReportCommon.ensureReportPermission(Common.getUser(), report);
            ReportJob.unscheduleReportJob(report);
            reportDao.deleteReport(id);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.