ARTEMIS-3697 Adding test assertion on invalid IO on Paging

This commit is part of a bigger task where I am improving paging.
This test is needed to validate some of the changes I am making on further commits.
This commit is contained in:
Clebert Suconic 2022-02-25 11:01:55 -05:00 committed by clebertsuconic
parent b0f131f080
commit 293b96aa45
3 changed files with 49 additions and 35 deletions

View File

@ -184,10 +184,9 @@ public abstract class AbstractSequentialFileFactory implements SequentialFileFac
@Override
public void onIOError(Exception exception, String message, SequentialFile file) {
ActiveMQJournalLogger.LOGGER.criticalIO(message, exception);
if (critialErrorListener != null) {
critialErrorListener.onIOException(exception, message, file);
} else {
logger.warn("Critical IO Error Called. No Critical IO Error Handler Registered::" + message + " at file " + file, exception);
}
}

View File

@ -288,4 +288,10 @@ public interface ActiveMQJournalLogger extends BasicLogger {
@LogMessage(level = Logger.Level.WARN)
@Message(id = 144009, value = "Could not get a file in {0} seconds, System will retry the open but you may see increased latency in your system", format = Message.Format.MESSAGE_FORMAT)
void cantOpenFileTimeout(long timeout);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 144010, value = "Critical IO Exception happened: {0}", format = Message.Format.MESSAGE_FORMAT)
void criticalIO(String message, @Cause Exception error);
}

View File

@ -2041,6 +2041,11 @@ public class PagingTest extends ActiveMQTestBase {
@Test
public void testInabilityToCreateDirectoryDuringPaging() throws Exception {
AssertionLoggerHandler.startCapture();
try {
// this test only applies to file-based stores
Assume.assumeTrue(storeType == StoreConfiguration.StoreType.FILE);
@ -2093,6 +2098,10 @@ public class PagingTest extends ActiveMQTestBase {
session.close();
sf.close();
locator.close();
} finally {
Assert.assertTrue(AssertionLoggerHandler.findText("AMQ144010"));
AssertionLoggerHandler.stopCapture();
}
}
/**