This is an automated email from the ASF dual-hosted git repository.
mattrpav pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/main by this push:
new cfbea60d6d [AMQ-9258] Update kahadb corruption test to account for new
fix from AMQ-9254 (#1007)
cfbea60d6d is described below
commit cfbea60d6d4f934e7fbe85915183a2f211414b82
Author: Matt Pavlovich <[email protected]>
AuthorDate: Thu May 18 11:29:01 2023 -0500
[AMQ-9258] Update kahadb corruption test to account for new fix from
AMQ-9254 (#1007)
---
.../store/kahadb/JournalCorruptionEofIndexRecoveryTest.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git
a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
index da89e5fd83..d12474523a 100644
---
a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
+++
b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -239,14 +240,20 @@ public class JournalCorruptionEofIndexRecoveryTest {
final var appender = new AbstractAppender("testAppender", new
AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
public void append(LogEvent event) {
+ /**
+ * NOTE: As of JDK v11.0.19 RandomAccessFile throws a
messageless EOFException when read fails
+ *
+ * throw new EOFException();
+ */
if (event != null
&& event.getLevel() == Level.WARN
&& event.getMessage() != null
&& event.getMessage().getFormattedMessage() != null
&&
event.getMessage().getFormattedMessage().contains("Cannot recover message
audit")
&& event.getThrown() != null
- && event.getThrown().getLocalizedMessage() != null
- &&
event.getThrown().getLocalizedMessage().contains("Invalid location size")) {
+ && event.getThrown() instanceof EOFException
+ && event.getThrown().getMessage() == null) {
+
trappedExpectedLogMessage.set(true);
}
}
@@ -263,6 +270,8 @@ public class JournalCorruptionEofIndexRecoveryTest {
}
assertEquals("no missing message", 50,
broker.getAdminView().getTotalMessageCount());
+ assertEquals("Drain", 50, drainQueue(50));
+ assertEquals("no problem draining messages", 0,
broker.getAdminView().getTotalMessageCount());
assertTrue("Did replay records on invalid location size",
trappedExpectedLogMessage.get());
}