Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Modified FileSystemResultsWriter.java #16

Merged
merged 2 commits into from
Jul 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import static io.qameta.allure.AllureUtils.generateTestResultContainerName;
import static io.qameta.allure.AllureUtils.generateTestResultName;
import static java.nio.file.StandardOpenOption.CREATE_NEW;

/**
* @author charlie (Dmitry Baev).
Expand All @@ -37,7 +36,7 @@ public void write(TestResult testResult) {
: generateTestResultName(testResult.getUuid());
createDirectories(outputDirectory);
Path file = outputDirectory.resolve(testResultName);
try (OutputStream os = Files.newOutputStream(file, CREATE_NEW)) {
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file.toString()))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using new BufferedOutputStream(Files.newOutputStream(file, CREATE_NEW)) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debugged both operations, the former causes the allure results exeception. It's reproduced here: https://github.com/AutomatedOwl/allure-testng-result-write-bug

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, let me check it

PS you need to add aspectjweaver dependency to maven surefire plugin in order to run it (I got no aspectjweaver:1.9.1 in my local maven repo, so build fails)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess we need to use blocking io, so your solution is fine. Please replace file.toString() with file.toFile() and update other methods write as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baev changes done

mapper.writeValue(os, testResult);
} catch (IOException e) {
throw new AllureResultsWriteException("Could not write Allure test result", e);
Expand Down