oleg-vlsk commented on code in PR #11793:
URL: https://github.com/apache/ignite/pull/11793#discussion_r1926028218


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsThinClientTest.java:
##########
@@ -171,6 +178,87 @@ public void testCacheOperation() throws Exception {
         checkCacheOperation(CACHE_GET_AND_REMOVE, cache -> 
cache.getAndRemove(5));
     }
 
+    /**
+     * Cache {@link TcpClientCache#putAllConflict} operation performed.
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCachePutAllConflict() throws Exception {
+        checkCacheAllConflictOperations(CACHE_PUT_ALL_CONFLICT, false);
+    }
+
+    /**
+     * Cache {@link TcpClientCache#removeAllConflict} operation performed.
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCacheRemoveAllConflict() throws Exception {
+        checkCacheAllConflictOperations(CACHE_REMOVE_ALL_CONFLICT, false);
+    }
+
+    /**
+     * Cache {@link TcpClientCache#putAllConflictAsync} operation performed.
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCachePutAllConflictAsync() throws Exception {
+        checkCacheAllConflictOperations(CACHE_PUT_ALL_CONFLICT, true);
+    }
+
+    /**
+     * Cache {@link TcpClientCache#removeAllConflictAsync} operation performed.
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCacheRemoveAllConflictAsync() throws Exception {
+        checkCacheAllConflictOperations(CACHE_REMOVE_ALL_CONFLICT, true);
+    }
+
+    /**
+     * @param opType {@link OperationType} cache operation type.
+     * @param isAsync boolean flag for asynchronous cache operation processing.
+     */
+    private void checkCacheAllConflictOperations(OperationType opType, boolean 
isAsync) throws Exception {
+        checkCacheOperation(opType, cache -> {
+            try {
+                if (opType == CACHE_PUT_ALL_CONFLICT && !isAsync)
+                    ((TcpClientCache<Object, 
Object>)cache).putAllConflict(getPutAllConflictMap(6, 1));
+                else if (opType == CACHE_REMOVE_ALL_CONFLICT && !isAsync)
+                    ((TcpClientCache<Object, 
Object>)cache).removeAllConflict(getRemoveAllConflictMap(6));
+                else if (opType == CACHE_PUT_ALL_CONFLICT)
+                    ((TcpClientCache<Object, 
Object>)cache).putAllConflictAsync(getPutAllConflictMap(7, 2)).get();
+                else if (opType == CACHE_REMOVE_ALL_CONFLICT)
+                    ((TcpClientCache<Object, 
Object>)cache).removeAllConflictAsync(getRemoveAllConflictMap(7)).get();
+            }
+            catch (InterruptedException | ExecutionException e) {
+                throw new RuntimeException(e);
+            }
+        });
+    }
+
+    /**
+     * @param key Key
+     * @param val Value
+     * @return {@link Map} with data to send with {@link 
TcpClientCache#putAllConflict(Map)} or
+     * {@link TcpClientCache#putAllConflictAsync(Map)} cache operations.
+     */
+    private Map<?, T3<?, GridCacheVersion, Long>> getPutAllConflictMap(int 
key, int val) {
+        GridCacheVersion confl = new GridCacheVersion(1, 0, 1, (byte)2);

Review Comment:
   Code duplication here and in `getRemoveAllConflictMap`. As an option, 
`GridCacheVersion confl` could be decalred as a class variable and then 
initialized in `checkCacheAllConflictOperations`.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java:
##########
@@ -2838,9 +2846,10 @@ protected IgniteInternalFuture<Boolean> 
removeAsync0(final K key, @Nullable fina
         if (F.isEmpty(drMap))
             return;
 
-        boolean statsEnabled = ctx.statisticsEnabled();
+        final boolean statsEnabled = ctx.statisticsEnabled();
+        final boolean performanceStatsEnabled = 
ctx.kernalContext().performanceStatistics().enabled();

Review Comment:
   Not shortened like other occurences of this variable.



##########
modules/core/src/test/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsThinClientTest.java:
##########
@@ -171,6 +178,87 @@ public void testCacheOperation() throws Exception {
         checkCacheOperation(CACHE_GET_AND_REMOVE, cache -> 
cache.getAndRemove(5));
     }
 
+    /**
+     * Cache {@link TcpClientCache#putAllConflict} operation performed.
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCachePutAllConflict() throws Exception {

Review Comment:
   I would consider removing the "Cache" substring from the names of the test 
methods and `checkCacheAllConflictOperations`, as it doesn't really provide any 
additional useful information. This will result in less code and improved 
readability.



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

Reply via email to