Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh fork #1

Merged
merged 15 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 14 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[//]: # (
. Thank you so much for sending us a pull request!
.
. Make sure you have a clear name for your pull request.
. The name should start with a capital letter and no dot is required in the end of the sentence.
. To link the request with isses use the following notation: (fixes #123, fixes #321\)
.
. An example of good pull request names:
. - Add Russian translation (fixes #123\)
. - Add an ability to disable default plugins
. - Support emoji in test descriptions
)
<!---
Thank you so much for sending us a pull request!

Make sure you have a clear name for your pull request.
The name should start with a capital letter and no dot is required in the end of the sentence.
To link the request with isses use the following notation: (fixes #123, fixes #321\)

An example of good pull request names:
* Add Cucumber integration (fixes #123\)
* Add an ability to disable default plugins
* Support emoji in test descriptions
-->

### Context
[//]: # (
<!---
Describe the problem or feature in addition to a link to the issues
)
-->

#### Checklist
- [ ] [Sign Allure CLA][cla]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,6 @@ public MainCommand getMainCommand() {
}

private void printUsage(final JCommander commander) {
final String parsedCommand = commander.getParsedCommand();
if (Objects.isNull(parsedCommand)) {
commander.usage();
} else {
commander.usage(parsedCommand);
}
commander.usage();
}
}
27 changes: 10 additions & 17 deletions allure-commandline/src/main/java/io/qameta/allure/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.qameta.allure;

import com.beust.jcommander.JCommander;
import io.qameta.allure.config.ConfigLoader;
import io.qameta.allure.core.Configuration;
import io.qameta.allure.core.Plugin;
Expand Down Expand Up @@ -52,7 +51,7 @@
public class Commands {

private static final Logger LOGGER = LoggerFactory.getLogger(Commands.class);
private static final String DIRECTORY_EXISTS_MESSAGE = "Allure: Target directory %s for the report is already"
private static final String DIRECTORY_EXISTS_MESSAGE = "Allure: Target directory {} for the report is already"
+ " in use, add a '--clean' option to overwrite";

private final Path allureHome;
Expand All @@ -61,7 +60,7 @@ public Commands(final Path allureHome) {
this.allureHome = allureHome;
}

public CommandlineConfig getConfig(final ConfigOptions configOptions) throws IOException {
public CommandlineConfig getConfig(final ConfigOptions configOptions) {
return getConfigFile(configOptions)
.map(ConfigLoader::new)
.map(ConfigLoader::load)
Expand Down Expand Up @@ -97,14 +96,14 @@ public ExitCode generate(final Path reportDirectory,
if (clean && directoryExists) {
FileUtils.deleteQuietly(reportDirectory.toFile());
} else if (directoryExists && isDirectoryNotEmpty(reportDirectory)) {
JCommander.getConsole().println(format(DIRECTORY_EXISTS_MESSAGE, reportDirectory.toAbsolutePath()));
LOGGER.error(DIRECTORY_EXISTS_MESSAGE, reportDirectory.toAbsolutePath());
return ExitCode.GENERIC_ERROR;
}
try {
final ReportGenerator generator = new ReportGenerator(createReportConfiguration(profile));
generator.generate(reportDirectory, resultsDirectories);
} catch (IOException e) {
LOGGER.error("Could not generate report: {}", e);
LOGGER.error("Could not generate report", e);
return ExitCode.GENERIC_ERROR;
}
LOGGER.info("Report successfully generated to {}", reportDirectory);
Expand All @@ -123,7 +122,7 @@ public ExitCode serve(final List<Path> resultsDirectories,
reportDirectory = tmp.resolve("allure-report");
tmp.toFile().deleteOnExit();
} catch (IOException e) {
LOGGER.error("Could not create temp directory: {}", e);
LOGGER.error("Could not create temp directory", e);
return ExitCode.GENERIC_ERROR;
}

Expand All @@ -145,7 +144,7 @@ public ExitCode open(final Path reportDirectory, final String host, final int po
try {
server.start();
} catch (Exception e) {
LOGGER.error("Could not serve the report: {}", e);
LOGGER.error("Could not serve the report", e);
return ExitCode.GENERIC_ERROR;
}

Expand All @@ -162,20 +161,15 @@ public ExitCode open(final Path reportDirectory, final String host, final int po
try {
server.join();
} catch (InterruptedException e) {
LOGGER.error("Report serve interrupted {}", e);
LOGGER.error("Report serve interrupted", e);
return ExitCode.GENERIC_ERROR;
}
return ExitCode.NO_ERROR;
}

public ExitCode listPlugins(final ConfigOptions configOptions) {
try {
final CommandlineConfig config = getConfig(configOptions);
config.getPlugins().forEach(LOGGER::info);
} catch (IOException e) {
LOGGER.error("Can't read config: {}", e);
return ExitCode.GENERIC_ERROR;
}
final CommandlineConfig config = getConfig(configOptions);
config.getPlugins().forEach(LOGGER::info);
return ExitCode.NO_ERROR;
}

Expand All @@ -184,9 +178,8 @@ public ExitCode listPlugins(final ConfigOptions configOptions) {
*
* @param profile selected profile.
* @return created report configuration.
* @throws IOException if any occurs.
*/
protected Configuration createReportConfiguration(final ConfigOptions profile) throws IOException {
protected Configuration createReportConfiguration(final ConfigOptions profile) {
final DefaultPluginLoader loader = new DefaultPluginLoader();
final CommandlineConfig commandlineConfig = getConfig(profile);
final ClassLoader classLoader = getClass().getClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PortValidator implements IParameterValidator {
private static final String MESSAGE = "invalid port value. Should be an integer between 0 and 65535";

@Override
public void validate(final String name, final String value) throws ParameterException {
public void validate(final String name, final String value) {
try {
final int port = Integer.parseInt(value);
if (port < 0 || port > MAX_PORT_VALUE) {
Expand Down
1 change: 1 addition & 0 deletions allure-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ dependencies {
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("commons-io:commons-io")
implementation("io.qameta.allure:allure-model")
implementation("javax.xml.bind:jaxb-api")
implementation("org.allurefw:allure1-model")
implementation("org.apache.httpcomponents:httpclient")
implementation("org.apache.tika:tika-core")
Expand Down
59 changes: 30 additions & 29 deletions allure-generator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion allure-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"d3-shape": "^1.2.0",
"filesize": "^3.5.10",
"font-awesome": "^4.7.0",
"handlebars": "^4.0.10",
"handlebars": "^4.1.2",
"highlight.js": "^9.12.0",
"i18next": "^8.4.3",
"jquery": "^3.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void updateHistory(final Map<String, HistoryData> history,
}

final List<HistoryItem> newItems = Stream.concat(Stream.of(newItem), data.getItems().stream())
.limit(5)
.limit(20)
.collect(Collectors.toList());
result.setNewFailed(isNewFailed(newItems));
result.setFlaky(isFlaky(newItems));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

/**
* Default call adapter factory.
*
* @param <T> return type.
*/
public final class DefaultCallAdapterFactory<T> extends CallAdapter.Factory {
Expand All @@ -45,14 +46,11 @@ public final class DefaultCallAdapterFactory<T> extends CallAdapter.Factory {
}

private static String getErrorMessage(final retrofit2.Response<?> response) {
final ResponseBody errorBody = response.errorBody();
final String errorMessage;
try {
errorMessage = Objects.isNull(errorBody) ? response.message() : errorBody.string();
try (ResponseBody errorBody = response.errorBody()) {
return Objects.isNull(errorBody) ? response.message() : errorBody.string();
} catch (IOException e) {
throw new ServiceException("could not read error body", e);
}
return errorMessage;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.stream.Stream;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.params.provider.Arguments.arguments;

/**
* @author charlie (Dmitry Baev).
Expand All @@ -32,9 +33,10 @@ class ZonedDateTimeParserTest {

static Stream<Arguments> data() {
return Stream.of(
Arguments.of("2018-05-31T14:05:25.155Z", 1527775525155L),
Arguments.of("2018-05-06T07:41:51Z", 1525592511000L),
Arguments.of("2018-05-31T14:05:25.155Z[America/Los_Angeles]", 1527775525155L + TimeUnit.HOURS.toMillis(7))
arguments("2018-05-31T14:05:25.155Z", 1527775525155L),
arguments("2018-05-06T07:41:51Z", 1525592511000L),
arguments("2018-05-31T14:05:25.155+03:00", 1527775525155L - TimeUnit.HOURS.toMillis(3)),
arguments("2018-05-31T14:05:25.155-07:00", 1527775525155L + TimeUnit.HOURS.toMillis(7))
);
}

Expand Down
Loading