This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b0501342dcdf CAMEL-26394: Fix flakiness in 
SpringQuartzPersistentStoreRestartAppChangeOptionsTest
b0501342dcdf is described below

commit b0501342dcdf0f748ba71354212651732ba96e7e
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Mon Nov 2 12:14:44 2026 +0100

    CAMEL-26394: Fix flakiness in 
SpringQuartzPersistentStoreRestartAppChangeOptionsTest
    
    - Increase repeatCount to repeat indefinitely (-1) in test XMLs so triggers
      do not complete and get deleted from the persistent store during tests
    - Fix app2 variable shadowing in testRestartAppChangeTriggerType so 
@AfterEach
      can reliably close the application context
    - Use assertInstanceOf to provide detailed failure messages with actual type
      instead of boolean assertions
    
    Co-authored-by: IBM Bob 2.2.1
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 ...artzPersistentStoreRestartAppChangeOptionsTest.java | 18 ++++--------------
 ...artzPersistentStoreRestartAppChangeOptionsTest1.xml |  2 +-
 ...artzPersistentStoreRestartAppChangeOptionsTest2.xml |  2 +-
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git 
a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java
 
b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java
index f934bc765497..9b3a95cf5ef0 100644
--- 
a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java
+++ 
b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest.java
@@ -33,9 +33,9 @@ import org.slf4j.LoggerFactory;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class SpringQuartzPersistentStoreRestartAppChangeOptionsTest {
 
@@ -136,11 +136,6 @@ public class 
SpringQuartzPersistentStoreRestartAppChangeOptionsTest {
         long repeatInterval2 = trigger2.getRepeatInterval();
         app2.stop();
 
-        // we're done so let's properly close the application contexts, but 
close
-        // the second app before the first one so that the quartz scheduler 
running
-        // inside it can be properly shutdown
-        IOHelper.close(app2, app);
-
         assertNotEquals(repeatInterval, repeatInterval2);
     }
 
@@ -156,7 +151,7 @@ public class 
SpringQuartzPersistentStoreRestartAppChangeOptionsTest {
         app.start();
         CamelContext camel = app.getBean("camelContext-" + 
getClass().getSimpleName(), CamelContext.class);
         assertNotNull(camel);
-        assertTrue(getTrigger(camel, "quartzRoute") instanceof CronTrigger);
+        assertInstanceOf(CronTrigger.class, getTrigger(camel, "quartzRoute"));
         app.stop();
 
         log.info("Restarting ...");
@@ -164,17 +159,12 @@ public class 
SpringQuartzPersistentStoreRestartAppChangeOptionsTest {
         log.info("Restarting ...");
 
         // load spring app
-        AbstractXmlApplicationContext app2 = 
newAppContext("SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml");
+        app2 = 
newAppContext("SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml");
         app2.start();
         CamelContext camel2 = app2.getBean("camelContext-" + 
getClass().getSimpleName(), CamelContext.class);
         assertNotNull(camel2);
-        assertTrue(getTrigger(camel2, "quartzRoute") instanceof SimpleTrigger);
+        assertInstanceOf(SimpleTrigger.class, getTrigger(camel2, 
"quartzRoute"));
         app2.stop();
-
-        // we're done so let's properly close the application contexts, but 
close
-        // the second app before the first one so that the quartz scheduler 
running
-        // inside it can be properly shutdown
-        IOHelper.close(app2, app);
     }
 
     private Trigger getTrigger(CamelContext camel, String routeId) throws 
SchedulerException {
diff --git 
a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest1.xml
 
b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest1.xml
index 22386dfcb6b7..7ba5f5c92223 100644
--- 
a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest1.xml
+++ 
b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest1.xml
@@ -63,7 +63,7 @@
 
   <camelContext id="camelContext-{{testClassSimpleName}}" 
managementNamePattern="#name#-opts1" 
xmlns="http://camel.apache.org/schema/spring";>
     <route id="quartzRoute">
-      <from 
uri="quartzBean://app/test?trigger.repeatInterval=10&amp;trigger.repeatCount=1"/>
+      <from 
uri="quartzBean://app/test?trigger.repeatInterval=1000&amp;trigger.repeatCount=-1"/>
       <to uri="log:trigger"/>
       <to uri="mock:result"/>
     </route>
diff --git 
a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml
 
b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml
index a1354398d46d..58576f172283 100644
--- 
a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml
+++ 
b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppChangeOptionsTest2.xml
@@ -63,7 +63,7 @@
 
   <camelContext id="camelContext-{{testClassSimpleName}}" 
managementNamePattern="#name#-opts2" 
xmlns="http://camel.apache.org/schema/spring";>
     <route id="quartzRoute">
-      <from 
uri="quartzBean://app/test?trigger.repeatInterval=20&amp;trigger.repeatCount=2"/>
+      <from 
uri="quartzBean://app/test?trigger.repeatInterval=2000&amp;trigger.repeatCount=-1"/>
       <to uri="log:trigger"/>
       <to uri="mock:result"/>
     </route>

Reply via email to