rohfl opened a new pull request, #23928:
URL: https://github.com/apache/camel/pull/23928

   Title:
   CAMEL-19528: Replace Thread.sleep with Awaitility in camel-jpa tests
   
   # Body:
   
   ## Motivation
   The `camel-jpa` test suite relied on hard-coded `Thread.sleep()` calls to 
wait for asynchronous consumer activity (entity processing, deletion, file 
moves).
   These sleeps are flaky and slow: they either wait longer than necessary on 
fast machines or, on slow ones, race ahead before the work has actually 
completed.
   
   ## Changes
   Added the `org.awaitility:awaitility` test dependency to `camel-jpa`.
   
   Migrated the `Thread.sleep()`-based waits to Awaitility in:
   - `AbstractJpaMethodTest#consumeEntity` — wait until the consumer has 
deleted the entities (database is empty) before asserting, rather than sleeping 
and reading the entity while the consumer may still be mid-transaction.
   - `JpaWithNamedQueryTest` — poll the database (with `ignoreExceptions()`) 
until the consumer's transaction has committed, instead of sleeping before 
reading.
   - `FileConsumerJpaIdempotentTest` — wait until the consumed file has been 
moved to the `done` directory, and use `MockEndpoint.setAssertPeriod(...)` to 
assert the file is not re-consumed (replacing a trailing sleep).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to