File tree Expand file tree Collapse file tree
activemq-unit-tests/src/test/java/org/apache/activemq/bugs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545import org .apache .activemq .broker .region .policy .PolicyMap ;
4646import org .apache .activemq .store .kahadb .KahaDBPersistenceAdapter ;
4747import org .apache .activemq .store .kahadb .MessageDatabase ;
48+ import org .apache .activemq .util .Wait ;
4849import org .apache .commons .io .FileUtils ;
4950import org .apache .commons .io .filefilter .TrueFileFilter ;
5051import org .apache .commons .io .filefilter .WildcardFileFilter ;
@@ -89,11 +90,23 @@ public void testPersistJMSRedeliveredMessageLossOnIndexRebuild() throws Exceptio
8990
9091 restart ();
9192
92- assertEquals (msgCount , getProxyToQueue (QUEUE_NAME ).getQueueSize ());
93+ assertTrue ("Queue size should match expected count: " + msgCount , Wait .waitFor (() -> {
94+ try {
95+ return getProxyToQueue (QUEUE_NAME ).getQueueSize () == msgCount ;
96+ } catch (Exception e ) {
97+ return false ;
98+ }
99+ }));
93100
94101 restartWithRecovery (getPersistentDir ());
95102
96- assertEquals (msgCount , getProxyToQueue (QUEUE_NAME ).getQueueSize ());
103+ assertTrue ("Queue size should match expected count: " + msgCount , Wait .waitFor (() -> {
104+ try {
105+ return getProxyToQueue (QUEUE_NAME ).getQueueSize () == msgCount ;
106+ } catch (Exception e ) {
107+ return false ;
108+ }
109+ }));
97110 }
98111
99112 @ Before
You can’t perform that action at this time.
0 commit comments