Skip to content

Commit

Permalink
fix parallel run and rft lifecycle (via allure-framework#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
baev authored Oct 30, 2018
1 parent b84d3da commit 190e675
Show file tree
Hide file tree
Showing 17 changed files with 1,067 additions and 382 deletions.
3 changes: 2 additions & 1 deletion allure-java-commons-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 10,8 @@ configurations {
}

dependencies {
compile project(':allure-java-commons')
compile('commons-io:commons-io')
compile(project(':allure-java-commons'))
}

jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 3,24 @@
import io.qameta.allure.AllureResultsWriter;
import io.qameta.allure.model.TestResult;
import io.qameta.allure.model.TestResultContainer;
import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
* @author Egor Borisov [email protected]
*/
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
public class AllureResultsWriterStub implements AllureResultsWriter {

private final List<TestResult> testResults = new CopyOnWriteArrayList<>();
private final List<TestResultContainer> testContainers = new CopyOnWriteArrayList<>();
private final Map<String, byte[]> attachments = new ConcurrentHashMap<>();

public void write(final TestResult testResult) {
testResults.add(testResult);
Expand All @@ -25,7 31,12 @@ public void write(final TestResultContainer testResultContainer) {
}

public void write(final String source, final InputStream attachment) {
//not implemented
try {
final byte[] bytes = IOUtils.toByteArray(attachment);
attachments.put(source, bytes);
} catch (IOException e) {
throw new RuntimeException("Could not read attachment content " source, e);
}
}

public List<TestResult> getTestResults() {
Expand All @@ -35,4 46,8 @@ public List<TestResult> getTestResults() {
public List<TestResultContainer> getTestContainers() {
return testContainers;
}

public Map<String, byte[]> getAttachments() {
return attachments;
}
}
Loading

0 comments on commit 190e675

Please sign in to comment.