Beispiel #1
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);
   }
 }
Beispiel #2
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);
  }
Beispiel #3
0
 @Override
 @Secured
 public Long addAttachment(TestExecutionAttachment attachment) throws ServiceException {
   TestExecution exec = testExecutionDAO.get(attachment.getTestExecution().getId());
   if (exec == null) {
     throw new ServiceException(
         "serviceException.addAttachment.testExecutionNotFound",
         attachment.getTestExecution().getName());
   }
   attachment.setTestExecution(exec);
   TestExecutionAttachment newAttachment = testExecutionAttachmentDAO.create(attachment);
   return newAttachment.getId();
 }
Beispiel #4
0
 @Override
 public TestExecutionAttachment getAttachment(Long id) {
   return testExecutionAttachmentDAO.get(id);
 }