Skip to content

Commit

Permalink
Merge pull request #3089 from dulanjalidilmi/master-build-fix
Browse files Browse the repository at this point in the history
Troubleshoot Intermittent build failure in MSMPCronForwarderCase
  • Loading branch information
dulanjalidilmi authored Jan 31, 2024
2 parents f4eeb03 + c757754 commit 7fd05f7
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ protected void init() throws Exception {
// START THE ESB
super.init();
if (!ActiveMQServerExtension.isMQServerStarted()) {
log.info("ActiveMQ Server is not started. Hence starting the MQServer");
ActiveMQServerExtension.startMQServer();
Thread.sleep(60000);
Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(300,
TimeUnit.SECONDS).until(isServerStarted());
} else {
log.info("ActiveMQ Server has already started.");
}
carbonLogReader.start();
}
Expand Down Expand Up @@ -84,8 +90,9 @@ public void testMessageProcessorCronForwader() throws Exception {
assertEquals(response4.getResponseCode(), 202, "ESB failed to send 202 even after setting FORCE_SC_ACCEPTED");

// WAIT FOR THE MESSAGE PROCESSOR TO TRIGGER
Thread.sleep(60000);
Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(60, TimeUnit.SECONDS).until(isLogWritten());
// Thread.sleep(60000);
Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(300,
TimeUnit.SECONDS).until(isLogWritten());
assertTrue(carbonLogReader.checkForLog("Jack", 60, NUMBER_OF_MESSAGES));
}

Expand All @@ -101,4 +108,13 @@ private Callable<Boolean> isLogWritten() {
}
};
}

private Callable<Boolean> isServerStarted() {
return new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
log.info("isMQServerStarted: " + ActiveMQServerExtension.isMQServerStarted());
return ActiveMQServerExtension.isMQServerStarted();
}
};
}
}

0 comments on commit 7fd05f7

Please sign in to comment.