-
Notifications
You must be signed in to change notification settings - Fork 12
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
Server log report extension #230
Server log report extension #230
Conversation
If anyone want to start review feel free :) Except serverLogXmlRep.xslt, I will work on it a little more. |
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshHandler.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshHandler.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshReportType.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshSteps.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshTemplate.java
Show resolved
Hide resolved
ec859b5
to
288c735
Compare
288c735
to
ce10c1f
Compare
…/SshReportType.java Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
@AfterScenario | ||
public void after() { | ||
scenarioEnd = ZonedDateTime.now(); | ||
if (serverLogXmlReporterExtension != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sanity check occurs quite often, consider implementing Null Object Design Pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it occurs only once and throws assertion error.
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshReportType.java
Show resolved
Hide resolved
public void afterFailedScenario() { | ||
if (serverLogXmlReporterExtension != null) { | ||
if (serverLogXmlReporterExtension.getSshReportType() != SshReportType.TEMPLATE && | ||
serverLogXmlReporterExtension.isLoggingOnFailure()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From javadoc of this class:
This class implements steps for testing ssh
All these methods @AfterScenario
has nothing to do with testing ssh, rather reporting content of what ssh handler delivers. Therefore this place for such behavior looks inappropriate to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved a lot of stuff elsewhere :)
} | ||
printEnd(writer, SYSTEM); | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you insist on lambdas: logContents.forEach((MultiKey k, String v) -> {
Otherwise plain old java would still love you: for (Map.Entry<MultiKey<? extends MultiKey>, String> multiKeyStringEntry : logContents.entrySet()) {
++multiple occurrence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using forEach on entrySet now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed - even on your sshTemplates merger ultra code 😛
sshTemplatesArray.entrySet() | ||
.stream() | ||
.forEach(entry -> { | ||
List<SshTemplate> flattenedSshTemplatesArray = entry.getValue() | ||
.stream() | ||
.flatMap(Arrays::stream) | ||
.collect(Collectors.toList()); | ||
if (sshTemplates.get(entry.getKey()) != null) { | ||
sshTemplates.get(entry.getKey()).addAll(flattenedSshTemplatesArray); | ||
} else { | ||
sshTemplates.put(entry.getKey(), flattenedSshTemplatesArray); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sshTemplatesArray.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().stream().flatMap(Arrays::stream).collect(Collectors.toList())))
.forEach((k, v) -> sshTemplates.merge(k, v, (v1, v2) -> {
v2.addAll(v1);
return v2;
}));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1, v2 >> list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables renamed + changed to use biconsumer foreach.
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshHandler.java
Outdated
Show resolved
Hide resolved
cf005e2
to
7e9a17e
Compare
7e9a17e
to
2cdc417
Compare
…/SshSteps.java Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
2cdc417
to
b9b262b
Compare
jbehave-support-core/src/main/java/org/jbehavesupport/core/report/ReportSteps.java
Outdated
Show resolved
Hide resolved
|
jbehave-support-core/src/main/java/org/jbehavesupport/core/report/ReportSteps.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/org/jbehavesupport/core/report/extension/ServerLogXmlReporterExtension.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshHandler.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshHandler.java
Outdated
Show resolved
Hide resolved
jbehave-support-core/src/main/java/org/jbehavesupport/core/ssh/SshTemplate.java
Outdated
Show resolved
Hide resolved
Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
b6c5ca6
to
7590a2d
Compare
…/SshReportType.java Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
…/SshSteps.java Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
Co-Authored-By: Pavel Jandejsek <43804753+paveljandejsek@users.noreply.github.com>
Ssh report extension rewriten
Server log report extension updated