Skip to content

Commit

Permalink
JBTM-3298 dump the test json array of LRAs on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusgrov committed Sep 27, 2024
1 parent b651d8f commit 121e26e
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,14 @@ private URI invokeInTransaction(String resourcePrefix, String resourcePath, int
*/
private boolean validateStateAndRemove(URI lra, LRAStatus state) {
JsonArray failedRecords = getFailedRecords(lra);

for (JsonValue failedLRA : failedRecords) {
String lraId = failedLRA.asJsonObject().getString("lraId");
lraId = lraId.replaceAll("\\\\", "");
String lraId = failedLRA.asJsonObject().getString("lraId")
.replaceAll("\\\\", "");

if (lraId.contains(lra.toASCIIString())) {
String status = failedLRA.asJsonObject().getString("status");

if (status.equals(state.name())) {
// remove the failed LRA
Assert.assertEquals("Could not remove log",
Expand All @@ -269,6 +272,9 @@ private boolean validateStateAndRemove(URI lra, LRAStatus state) {
}
}

System.out.printf("lra not in failed list:%n LRA=%s%n state=%s%n json=%s%n",
lra, state, failedRecords);

return false;
}

Expand Down

0 comments on commit 121e26e

Please sign in to comment.