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

   ## Changes
   
   This PR addresses several improvements identified during a comprehensive 
review of the KeyValueRepository infrastructure:
   
   ### Test Coverage
   - **Add `KeyValueRepositoryHelperTest`** — 22 new tests covering 
serialize/deserialize roundtrips (String, Integer, complex objects), ByteBuffer 
variant, offset/length variant, error cases (non-Serializable objects), and 
null handling edge cases. This helper had zero test coverage despite being 
shared across all persistent backends.
   - **Add `cacheNull=true` test in `CacheProcessorTest`** — Tests the code 
path where null bodies ARE cached (`contains()` + `get()` instead of just 
`get()`). This was the trickier code path and previously untested.
   
   ### Atomicity Fix
   - **Fix `RedisKeyValueRepository.put()`** — Replace the non-atomic `get()` + 
`set()` with Redisson's atomic `getAndSet()` (with TTL variant). The previous 
implementation could return stale previous values if another client wrote 
between the two calls.
   
   ### Code Deduplication
   - **Extract shared `KeyValueTtlValue`** — The identical `TtlValue` inner 
class was duplicated in both `EhcacheKeyValueRepository` and 
`JCacheKeyValueRepository`. Extracted to a shared `KeyValueTtlValue` class in 
`camel-support`, which both backends now reference.
   
   ### Build Verification
   - All existing tests pass (MemoryKeyValueRepositoryTest, 
KeyValueIdempotentRepositoryTest, KeyValueAggregationRepositoryTest, 
CacheProcessorTest)
   - All affected component modules compile cleanly (camel-ehcache, 
camel-jcache, camel-redis)
   


-- 
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