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

arquillian/appclient wip progress logging changes #1647

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 @@ -61,15 +61,17 @@ public AppClientMethodExecutor(AppClientCmd appClient, AppClientProtocolConfigur
@Override
public TestResult invoke(TestMethodExecutor testMethodExecutor) {
TestResult result = TestResult.passed();
String appArchiveName = null;
String vehicleArchiveName = null;

// Run the appclient for the test if required
String testMethod = testMethodExecutor.getMethodName();
if (config.isRunClient()) {
log.info("Running appClient for: " + testMethod);
try {
Deployment deployment = deploymentInstance.get();
String appArchiveName = appClientArchiveName.get().name();
String vehicleArchiveName = TsTestPropsBuilder.vehicleArchiveName(deployment);
appArchiveName = appClientArchiveName.get().name();
vehicleArchiveName = TsTestPropsBuilder.vehicleArchiveName(deployment);
String[] additionalAgrs = TsTestPropsBuilder.runArgs(config, deployment, testMethodExecutor);
appClient.run(vehicleArchiveName, appArchiveName, additionalAgrs);
} catch (Exception ex) {
Expand All @@ -81,13 +83,13 @@ public TestResult invoke(TestMethodExecutor testMethodExecutor) {
}
String[] lines = appClient.readAll(config.getClientTimeout());

log.info(String.format("AppClient(%s) readAll returned %d lines\n", testMethod, lines.length));
log.fine(String.format("AppClient(%s) readAll returned %d lines\n", testMethod, lines.length));
boolean sawStatus = false;
MainStatus status = MainStatus.NOT_RUN;
String reason = "None";
String description = "None";
for (String line : lines) {
System.out.println(line);
log.finer(line);
Copy link
Contributor

Choose a reason for hiding this comment

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

This part could end up making it look a little odd if it's already a formatted log line. I also feel this should be at level fine not finer.

if (line.contains("STATUS:")) {
sawStatus = true;
description = line;
Expand Down Expand Up @@ -117,6 +119,7 @@ public TestResult invoke(TestMethodExecutor testMethodExecutor) {
break;
}
result.addDescription(description);
log.info(result.toString() + ": " + description + ": " + vehicleArchiveName + ": " + appArchiveName);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might look a little better with something like:

log.log(level, String.format("%s_%s [%s] %s : %s", vehicaleArchiveName, appArchiveName, result.getStatus(), description, result);

Note I'm not sure how the vehicaleArchiveName and appArchiveName should be formatted.

The level should be set in the in the switch statement right above this log line IMO. Then for ERROR and FAILED status we could set the level to Level.SEVERE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, switching over to this style. I don't think the appclient jar or vehicle names are what I really wanted to show here. Showing the EAR name would be nicer (based on how we current include more information in the ear name). Revising...

Copy link
Contributor Author

@scottmarlow scottmarlow Nov 15, 2024

Choose a reason for hiding this comment

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

Will update this to show the new output with:

result.addDescription(description);
log.log(Level.INFO, String.format("[%s] %s : %s", result.getStatus(), description, result));

}

return result;
Expand Down