ARTEMIS-1495 Test Improvements
Server.stop is currently waiting completions on Sessions just because of test cases. With the recent changes made into the Executors this is not needed any longer
This commit is contained in:
parent
ead60d54d0
commit
63b156e290
|
@ -67,6 +67,14 @@ public class Wait {
|
|||
assertTrue("Condition wasn't met", condition);
|
||||
}
|
||||
|
||||
public static void assertFalse(Condition condition) throws Exception {
|
||||
assertTrue(() -> !condition.isSatisfied());
|
||||
}
|
||||
|
||||
public static void assertFalse(String failureMessage, Condition condition) throws Exception {
|
||||
assertTrue(failureMessage, () -> !condition.isSatisfied());
|
||||
}
|
||||
|
||||
|
||||
public static void assertTrue(String failureMessage, Condition condition) throws Exception {
|
||||
boolean result = waitFor(condition);
|
||||
|
|
|
@ -845,11 +845,6 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
|||
@Message(id = 222104, value = "IO Error completing the transaction, code = {0}, message = {1}", format = Message.Format.MESSAGE_FORMAT)
|
||||
void ioErrorOnTX(Integer errorCode, String errorMessage);
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 222105, value = "Could not finish context execution in 10 seconds",
|
||||
format = Message.Format.MESSAGE_FORMAT)
|
||||
void errorCompletingContext(@Cause Exception e);
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 222106, value = "Replacing incomplete LargeMessage with ID={0}", format = Message.Format.MESSAGE_FORMAT)
|
||||
void replacingIncompleteLargeMessage(Long messageID);
|
||||
|
|
|
@ -203,8 +203,6 @@ public interface ServerSession extends SecurityAuth {
|
|||
|
||||
void close(boolean failed) throws Exception;
|
||||
|
||||
void waitContextCompletion() throws Exception;
|
||||
|
||||
void setTransferring(boolean transferring);
|
||||
|
||||
Set<ServerConsumer> getServerConsumers();
|
||||
|
|
|
@ -1245,16 +1245,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
|||
ActiveMQServerLogger.LOGGER.errorClosingSessionsWhileStoppingServer(e);
|
||||
}
|
||||
}
|
||||
if (!criticalIOError) {
|
||||
for (ServerSession session : sessions.values()) {
|
||||
try {
|
||||
session.waitContextCompletion();
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.errorClosingSessionsWhileStoppingServer(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void stopComponent(ActiveMQComponent component) {
|
||||
|
|
|
@ -1238,17 +1238,6 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
setStarted(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void waitContextCompletion() {
|
||||
try {
|
||||
if (!context.waitCompletion(10000)) {
|
||||
ActiveMQServerLogger.LOGGER.errorCompletingContext(new Exception("warning"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ActiveMQServerLogger.LOGGER.errorCompletingContext(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(final boolean failed) {
|
||||
if (closed)
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.paging.PagingStore;
|
|||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
|
||||
import org.apache.activemq.artemis.tests.util.JMSTestBase;
|
||||
import org.apache.activemq.artemis.tests.util.Wait;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -121,12 +122,8 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
|
|||
//subscriber1.close(); // << you can't call this on this test
|
||||
//session.close(); // << can't call this on this test
|
||||
|
||||
long timeout = System.currentTimeMillis() + 5000;
|
||||
while (timeout > System.currentTimeMillis() && pagingStore.isPaging()) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
Wait.assertFalse(pagingStore::isPaging);
|
||||
printPageStoreInfo(pagingStore);
|
||||
assertFalse(pagingStore.isPaging());
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue