private Attachment convert(final Path source, final ResultsVisitor visitor, final ru.yandex.qatools.allure.model.Attachment attachment) { final Path attachmentFile = source.resolve(attachment.getSource()); if (Files.isRegularFile(attachmentFile)) { final Attachment found = visitor.visitAttachmentFile(attachmentFile); if (Objects.nonNull(attachment.getType())) { found.setType(attachment.getType()); } if (Objects.nonNull(attachment.getTitle())) { found.setName(attachment.getTitle()); } return found; } else { visitor.error("Could not find attachment " + attachment.getSource() + " in directory " + source); return new Attachment() .setType(attachment.getType()) .setName(attachment.getTitle()) .setSize(0L); } }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { String theTitle; theTitle = this.getTitle(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "title", theTitle), currentHashCode, theTitle); } { String theSource; theSource = this.getSource(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "source", theSource), currentHashCode, theSource); } { String theType; theType = this.getType(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "type", theType), currentHashCode, theType); } { Integer theSize; theSize = this.getSize(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "size", theSize), currentHashCode, theSize); } return currentHashCode; }
/** * Remove attachment form {@link #resultsDirectory} * * @param attachment to remove * @return true, if attachment removed successfully, false otherwise */ public static boolean deleteAttachment(Attachment attachment) { File attachmentFile = new File(getResultsDirectory(), attachment.getSource()); return attachmentFile.exists() && attachmentFile.canWrite() && attachmentFile.delete(); }
public static boolean deleteAttachment(Attachment attachment) { File attachmentFile = new File(getResultsDirectory(), attachment.getSource()); return attachmentFile.exists() && attachmentFile.canWrite() && attachmentFile.delete(); }
@Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } }
/** * Remove attachments matches pattern from step and all step substeps * * @param context from which attachments will be removed */ @Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } }
private Attachment convert(final Path source, final ResultsVisitor visitor, final ru.yandex.qatools.allure.model.Attachment attachment) { final Path attachmentFile = source.resolve(attachment.getSource()); if (Files.isRegularFile(attachmentFile)) { final Attachment found = visitor.visitAttachmentFile(attachmentFile); if (Objects.nonNull(attachment.getType())) { found.setType(attachment.getType()); } if (Objects.nonNull(attachment.getTitle())) { found.setName(attachment.getTitle()); } return found; } else { visitor.error("Could not find attachment " + attachment.getSource() + " in directory " + source); return new Attachment() .setType(attachment.getType()) .setName(attachment.getTitle()) .setSize(0L); } }