From 71d95b1fe01ba10181aeb0bdad7524fb3804e868 Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Thu, 19 Dec 2024 17:43:22 +0300 Subject: [PATCH] IGNITE-23958 Fixed security context switch for internal future listeners. --- ...yContextInternalFuturePropagationTest.java | 57 ++++++++----------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/SecurityContextInternalFuturePropagationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/SecurityContextInternalFuturePropagationTest.java index 1ff14e0cfe213..2ab9eb496caec 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/SecurityContextInternalFuturePropagationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/SecurityContextInternalFuturePropagationTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.security; import java.security.Permissions; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -72,44 +71,36 @@ public class SecurityContextInternalFuturePropagationTest extends GridCommonAbst /** */ private static final AtomicInteger KEY_CNTR = new AtomicInteger(); - /** */ - private static final List, IgniteClientFuture>> CACHE_OPERATIONS = Arrays.asList( - cache -> cache.getAllAsync(ImmutableSet.of(nextKey(), nextKey())), // 0 - cache -> cache.getAndPutAsync(nextKey(), 0), // 1 - cache -> cache.getAndPutIfAbsentAsync(nextKey(), 0), // 2 - cache -> cache.getAndPutIfAbsentAsync(PRELOADED_KEY_CNT + nextKey(), 0), // 3 - cache -> cache.getAndRemoveAsync(nextKey()), // 4 - cache -> cache.getAndReplaceAsync(nextKey(), 0), // 5 - cache -> cache.getAsync(nextKey()), // 6 - cache -> cache.putAllAsync(new HashMap<>() {{ put(nextKey(), 0); put(nextKey(), 0); }}), // 7 - cache -> cache.putAsync(nextKey(), 0), // 8 - cache -> cache.putIfAbsentAsync(PRELOADED_KEY_CNT + nextKey(), 0), // 9 - cache -> cache.removeAsync(nextKey()), // 10 - cache -> { - int key = nextKey(); - return cache.removeAsync(key, key); - }, // 11 - cache -> cache.replaceAsync(nextKey(), 0), // 12 - cache -> { - int key = nextKey(); - - return cache.replaceAsync(key, key, 0); - } // 13 - ); - /** */ @Parameterized.Parameter() public Function, IgniteClientFuture> op; /** */ @Parameterized.Parameters() - public static Iterable data() { - List res = new ArrayList<>(); - - for (Function, IgniteClientFuture> op : CACHE_OPERATIONS) - res.add(new Object[] {op}); - - return res; + public static List, IgniteClientFuture>> data() { + return Arrays.asList( + cache -> cache.getAllAsync(ImmutableSet.of(nextKey(), nextKey())), // 0 + cache -> cache.getAndPutAsync(nextKey(), 0), // 1 + cache -> cache.getAndPutIfAbsentAsync(nextKey(), 0), // 2 + cache -> cache.getAndPutIfAbsentAsync(PRELOADED_KEY_CNT + nextKey(), 0), // 3 + cache -> cache.getAndRemoveAsync(nextKey()), // 4 + cache -> cache.getAndReplaceAsync(nextKey(), 0), // 5 + cache -> cache.getAsync(nextKey()), // 6 + cache -> cache.putAllAsync(new HashMap<>() {{ put(nextKey(), 0); put(nextKey(), 0); }}), // 7 + cache -> cache.putAsync(nextKey(), 0), // 8 + cache -> cache.putIfAbsentAsync(PRELOADED_KEY_CNT + nextKey(), 0), // 9 + cache -> cache.removeAsync(nextKey()), // 10 + cache -> { + int key = nextKey(); + return cache.removeAsync(key, key); + }, // 11 + cache -> cache.replaceAsync(nextKey(), 0), // 12 + cache -> { + int key = nextKey(); + + return cache.replaceAsync(key, key, 0); + } // 13 + ); } /** {@inheritDoc} */