Exemplo n.º 1
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.º 2
0
  @Test
  public void deleteReport() {
    reportDAO.delete(1L);

    reportDAO.flush();

    assertNull(reportDAO.find(1L));
    assertNull(reportExecDAO.find(1L));
  }
Exemplo n.º 3
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());
  }