示例#1
0
  @Override
  public void addTagsToTestExecutions(
      Collection<String> tags, Collection<TestExecution> testExecutions) {
    for (TestExecution testExecutionItem : testExecutions) {
      TestExecution testExecution = testExecutionDAO.get(testExecutionItem.getId());
      if (testExecution == null) {
        continue;
      }

      for (String tagName : tags) {
        if (!testExecution.getTags().contains(tagName)) {
          Tag tag = tagDAO.findByName(tagName);
          if (tag == null) {
            Tag newTag = new Tag();
            newTag.setName(tagName);
            tag = tagDAO.create(newTag);
          }

          Collection<TestExecution> tagTestExecutions = tag.getTestExecutions();
          if (tagTestExecutions == null) {
            tag.setTestExecutions(new ArrayList<>());
          }

          tag.getTestExecutions().add(testExecution);
          testExecution.getTags().add(tag);
        }
      }

      testExecutionDAO.update(testExecution);
    }
  }
示例#2
0
  @Override
  @Secured
  public TestExecution updateTestExecution(TestExecution testExecution) throws ServiceException {
    TestExecution execEntity = testExecutionDAO.get(testExecution.getId());
    if (execEntity == null) {
      throw new ServiceException("serviceException.testExecutionNotFound", testExecution.getName());
    }
    // this is what can be updated here
    execEntity.setName(testExecution.getName());
    execEntity.setStarted(testExecution.getStarted());
    execEntity.setComment(testExecution.getComment());
    execEntity.setTags(new ArrayList<>());

    for (Tag tag : testExecution.getTags()) {
      Tag tagEntity = tagDAO.findByName(tag.getName());
      if (tagEntity == null) {
        Tag newTag = new Tag();
        newTag.setName(tag.getName());
        tagEntity = tagDAO.create(newTag);
      }

      Collection<TestExecution> tagTestExecutions = tagEntity.getTestExecutions();
      if (tagTestExecutions == null) {
        tagEntity.setTestExecutions(new ArrayList<>());
      }

      tagEntity.getTestExecutions().add(execEntity);
      execEntity.getTags().add(tagEntity);
    }
    TestExecution execClone = cloneAndFetch(execEntity, true, true, true, true, true);
    return execClone;
  }
示例#3
0
 public void setTag(String name, Tag value) {
   value.setName(name);
   valueMap.put(name, value);
 }
 public void put(String name, Tag tag) {
   tags.put(name, tag.setName(name));
 }
 public void startElement(String name, AttributeList attributes) {
   currentTag.clear();
   currentTag.setName(name);
 }
 private Tag createTag(Group group) {
   Tag tag = new Tag();
   tag.setName("Test Tag " + RandomStringUtils.randomAlphanumeric(9));
   tag.setGroup(group);
   return tag;
 }