oleg-vlsk commented on code in PR #11793: URL: https://github.com/apache/ignite/pull/11793#discussion_r1915947859
########## modules/core/src/test/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsThinClientTest.java: ########## @@ -171,6 +178,62 @@ public void testCacheOperation() throws Exception { checkCacheOperation(CACHE_GET_AND_REMOVE, cache -> cache.getAndRemove(5)); } + /** + * Cache {@link TcpClientCache#putAllConflict} and {@link TcpClientCache#removeAllConflict} operations performed. + * @throws Exception If failed. + */ + @Test + public void testCacheAllConflictOperations() throws Exception { + checkCacheAllConflictOperations(false); + } + + /** + * Cache {@link TcpClientCache#putAllConflictAsync} and {@link TcpClientCache#removeAllConflictAsync} operations performed. + * @throws Exception If failed. + */ + @Test + public void testCacheAllConflictOperationsAsync() throws Exception { + checkCacheAllConflictOperations(true); + } + + /** + * @param async boolean flag for asynchronous cache operation processing. + */ + private void checkCacheAllConflictOperations(boolean async) throws Exception { + int key = 6; + int val = 1; + + GridCacheVersion confl = new GridCacheVersion(1, 0, 1, (byte)2); + + Map<?, T3<?, GridCacheVersion, Long>> putMap = F.asMap(key, new T3<>(val, confl, CU.EXPIRE_TIME_ETERNAL)); + Map<?, GridCacheVersion> rmvMap = F.asMap(key, confl); + + if (async) { + checkCacheOperation(CACHE_PUT_ALL_CONFLICT, cache -> ((TcpClientCache<Object, Object>)cache).putAllConflict(putMap)); + + checkCacheOperation(CACHE_REMOVE_ALL_CONFLICT, cache -> ((TcpClientCache<Object, Object>)cache).removeAllConflict(rmvMap)); + } + else { + checkCacheOperation(CACHE_PUT_ALL_CONFLICT, cache -> { Review Comment: Maybe somethig like this to avoid `try-catch` code duplication? ``` checkCacheOperation(type, cache -> { try { if (type == CACHE_PUT_ALL_CONFLICT) ((TcpClientCache<Object, Object>)cache).putAllConflictAsync(putMap).get(); else if (type == CACHE_REMOVE_ALL_CONFLICT) ((TcpClientCache<Object, Object>)cache).removeAllConflictAsync(rmvMap).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } }); ``` -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org