Skip to content

Commit

Permalink
report timeout fix (fixes #59, via #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
baev authored Oct 26, 2018
1 parent ca49b46 commit d91367b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
16 changes: 8 additions & 8 deletions src/main/java/io/qameta/allure/maven/AllureCommandline.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ public class AllureCommandline {

public static final String ALLURE_DEFAULT_VERSION = "2.0.1";

private final String version;
private static final int DEFAULT_TIMEOUT = 3600;

private static final String SERVE_DEFAULT_TIMEOUT = "3600";
private final String version;

private final String serveTimeout;
private final int timeout;

private final Path installationDirectory;

public AllureCommandline(final Path installationDirectory, final String version) {
this(installationDirectory, version, SERVE_DEFAULT_TIMEOUT);
this(installationDirectory, version, DEFAULT_TIMEOUT);
}

public AllureCommandline(final Path installationDirectory, final String version, final String serveTimeout) {
public AllureCommandline(final Path installationDirectory, final String version, int timeout) {
this.installationDirectory = installationDirectory;
this.version = version;
this.serveTimeout = serveTimeout == null ? SERVE_DEFAULT_TIMEOUT : serveTimeout;
this.timeout = timeout;
}

public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOException {
Expand All @@ -56,7 +56,7 @@ public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOExc
commandLine.addArgument("-o");
commandLine.addArgument(reportPath.toAbsolutePath().toString(), true);

return execute(commandLine, 60);
return execute(commandLine, timeout);
}

public int serve(List<Path> resultsPaths, Path reportPath, String serveHost, Integer servePort) throws IOException {
Expand All @@ -78,7 +78,7 @@ public int serve(List<Path> resultsPaths, Path reportPath, String serveHost, Int
for (Path resultsPath : resultsPaths) {
commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true);
}
return execute(commandLine, Integer.valueOf(this.serveTimeout));
return execute(commandLine, timeout);
}

private void checkAllureExists() throws FileNotFoundException {
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/io/qameta/allure/maven/AllureGenerateMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,10 @@ public abstract class AllureGenerateMojo extends AllureBaseMojo {
private String reportDirectory;

/**
* Serve timeout parameter in seconds.
* Report timeout parameter in seconds.
*/
@Parameter(property = "allure.serve.timeout")
protected String serveTimeout;

/**
* Serve host parameter.
*/
@Parameter(property = "allure.serve.host")
protected String serveHost;

/**
* Serve port parameter.
*/
@Parameter(property = "allure.serve.port", defaultValue = "0")
protected Integer servePort;
@Parameter(property = "allure.report.timeout", defaultValue = "60")
protected int reportTimeout;

/**
* The path to the allure.properties file
Expand Down Expand Up @@ -219,7 +207,7 @@ protected void generateReport(List<Path> resultsPaths) throws MavenReportExcepti
Path reportPath = Paths.get(getReportDirectory());

AllureCommandline commandline
= new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion);
= new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion, reportTimeout);

getLog().info("Generate report to " + reportPath);
commandline.generateReport(resultsPaths, reportPath);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/qameta/allure/maven/AllureReportMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/io/qameta/allure/maven/AllureServeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@
@Mojo(name = "serve", defaultPhase = LifecyclePhase.SITE)
public class AllureServeMojo extends AllureGenerateMojo {

/**
* Serve timeout parameter in seconds.
*/
@Parameter(property = "allure.serve.timeout", defaultValue = "3600")
private int serveTimeout;

/**
* Serve host parameter.
*/
@Parameter(property = "allure.serve.host")
private String serveHost;

/**
* Serve port parameter.
*/
@Parameter(property = "allure.serve.port", defaultValue = "0")
private Integer servePort;

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit d91367b

Please sign in to comment.