Пример #1
0
  @Override
  @Secured
  public void removeTestExecution(TestExecution testExecution) throws ServiceException {
    TestExecution freshTestExecution = testExecutionDAO.get(testExecution.getId());
    if (freshTestExecution == null) {
      throw new ServiceException("serviceException.testExecutionNotFound", testExecution.getName());
    }
    for (TestExecutionParameter testExecutionParameter : freshTestExecution.getParameters()) {
      testExecutionParameterDAO.remove(testExecutionParameter);
    }
    for (Value value : freshTestExecution.getValues()) {
      for (ValueParameter valueParameter : value.getParameters()) {
        valueParameterDAO.remove(valueParameter);
      }
      valueDAO.remove(value);
    }

    Iterator<TestExecutionAttachment> allTestExecutionAttachments =
        freshTestExecution.getAttachments().iterator();
    while (allTestExecutionAttachments.hasNext()) {
      testExecutionAttachmentDAO.remove(allTestExecutionAttachments.next());
      allTestExecutionAttachments.remove();
    }
    testExecutionDAO.remove(freshTestExecution);
  }
Пример #2
0
 @Override
 @Secured
 public void removeAttachment(TestExecutionAttachment attachment) throws ServiceException {
   TestExecution exec = testExecutionDAO.get(attachment.getTestExecution().getId());
   if (exec == null) {
     throw new ServiceException(
         "serviceException.removeAttachment.testExecutionNotFound",
         attachment.getTestExecution().getName());
   }
   TestExecutionAttachment freshAttachment = testExecutionAttachmentDAO.get(attachment.getId());
   if (freshAttachment != null) {
     testExecutionAttachmentDAO.remove(freshAttachment);
   }
 }