예제 #1
0
  @Test
  public void deleteReport() {
    reportDAO.delete(1L);

    reportDAO.flush();

    assertNull(reportDAO.find(1L));
    assertNull(reportExecDAO.find(1L));
  }
예제 #2
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();
  }
예제 #3
0
  @Test
  public void find() {
    Report report = reportDAO.find(1L);
    assertNotNull(report);

    assertNotNull(report.getExecs());
    assertFalse(report.getExecs().isEmpty());
    assertEquals(1, report.getExecs().size());
  }
예제 #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);
  }
예제 #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());
  }