Exemplo n.º 1
0
  @Test
  public void find() {
    Report report = reportDAO.find(1L);
    assertNotNull(report);

    assertNotNull(report.getExecs());
    assertFalse(report.getExecs().isEmpty());
    assertEquals(1, report.getExecs().size());
  }
Exemplo n.º 2
0
  @Override
  public void registerJob(final Report report, final Date startAt)
      throws SchedulerException, ParseException {
    ReportJob job = createSpringBean(ReportJob.class);
    job.setReportKey(report.getKey());

    Map<String, Object> jobMap = new HashMap<>();
    jobMap.put(JobInstanceLoader.DOMAIN, AuthContextUtils.getDomain());

    registerJob(JobNamer.getJobName(report), job, report.getCronExpression(), startAt, jobMap);
  }
Exemplo n.º 3
0
  @Test(expected = EntityExistsException.class)
  public void saveWithExistingName() {
    Report report = reportDAO.find(1L);
    assertNotNull(report);

    String name = report.getName();

    report = entityFactory.newEntity(Report.class);
    report.setName(name);

    reportDAO.save(report);
    reportDAO.flush();
  }
Exemplo n.º 4
0
  @Test
  public void deleteReportExecution() {
    ReportExec execution = reportExecDAO.find(1L);
    int executionNumber = execution.getReport().getExecs().size();

    reportExecDAO.delete(1L);

    reportExecDAO.flush();

    assertNull(reportExecDAO.find(1L));

    Report report = reportDAO.find(1L);
    assertEquals(report.getExecs().size(), executionNumber - 1);
  }
Exemplo n.º 5
0
  @Test
  public void save() {
    Report report = reportDAO.find(1L);
    assertNotNull(report);
    assertEquals(1, report.getExecs().size());

    ReportExec reportExec = entityFactory.newEntity(ReportExec.class);
    reportExec.setReport(report);
    reportExec.setStartDate(new Date());
    reportExec.setEndDate(new Date());
    reportExec.setStatus(ReportExecStatus.SUCCESS);

    report.add(reportExec);

    reportExec = reportExecDAO.save(reportExec);
    assertNotNull(reportExec);
    assertNotNull(reportExec.getKey());

    reportExecDAO.flush();

    report = reportDAO.find(1L);
    assertNotNull(report);
    assertEquals(2, report.getExecs().size());
  }