diff --git a/integration/mediation-tests/tests-transport/src/test/java/org/wso2/carbon/esb/jms/transport/test/MSMPCronForwarderCase.java b/integration/mediation-tests/tests-transport/src/test/java/org/wso2/carbon/esb/jms/transport/test/MSMPCronForwarderCase.java index b6130a2c83..8c77e3f39e 100644 --- a/integration/mediation-tests/tests-transport/src/test/java/org/wso2/carbon/esb/jms/transport/test/MSMPCronForwarderCase.java +++ b/integration/mediation-tests/tests-transport/src/test/java/org/wso2/carbon/esb/jms/transport/test/MSMPCronForwarderCase.java @@ -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(); } @@ -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)); } @@ -101,4 +108,13 @@ private Callable isLogWritten() { } }; } + + private Callable isServerStarted() { + return new Callable() { + @Override public Boolean call() throws Exception { + log.info("isMQServerStarted: " + ActiveMQServerExtension.isMQServerStarted()); + return ActiveMQServerExtension.isMQServerStarted(); + } + }; + } }