nizhikov commented on code in PR #11726:
URL: https://github.com/apache/ignite/pull/11726#discussion_r1880796291


##########
modules/core/src/test/java/org/apache/ignite/session/SessionContextCacheInterceptorTest.java:
##########
@@ -0,0 +1,442 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.session;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntry;
+import org.apache.ignite.cache.CacheInterceptor;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.resources.SessionContextProviderResource;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+/** */
+@RunWith(Parameterized.class)
+public class SessionContextCacheInterceptorTest extends GridCommonAbstractTest 
{
+    /** */
+    private static final int KEYS = 10;
+
+    /** */
+    @Parameterized.Parameter
+    public CacheAtomicityMode mode;
+
+    /** */
+    @Parameterized.Parameter(1)
+    public CacheWriteSynchronizationMode syncMode;
+
+    /** */
+    @Parameterized.Parameter(2)
+    public boolean clnNode;
+
+    /** */
+    @Parameterized.Parameter(3)
+    public boolean dynamicCache;
+
+    /** */
+    @Parameterized.Parameter(4)
+    public int backups;
+
+    /** */
+    private Ignite ign;
+
+    /** */
+    private IgniteCache<Integer, String> cache;
+
+    /** */
+    @Parameterized.Parameters(name = "mode={0}, syncMode={1}, clnNode={2}, 
dynamicCache={3}, backups={4}")
+    public static Collection<Object[]> params() {
+        List<Object[]> params = new ArrayList<>();
+
+        for (CacheAtomicityMode m: CacheAtomicityMode.values()) {
+            for (CacheWriteSynchronizationMode syncMode : 
CacheWriteSynchronizationMode.values()) {
+                for (boolean cln : new boolean[] {true, false}) {
+                    for (boolean dynCache : new boolean[] {true, false}) {
+                        if (m == CacheAtomicityMode.TRANSACTIONAL) {
+                            for (int backupCnt = 0; backupCnt <= 2; 
backupCnt++)
+                                params.add(new Object[] {m, syncMode, cln, 
dynCache, backupCnt});
+                        }
+                        else
+                            params.add(new Object[] {m, syncMode, cln, 
dynCache, 1});
+                    }
+                }
+            }
+        }
+
+        return params;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        if (!dynamicCache)
+            cfg.setCacheConfiguration(cacheConfig());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        ign = startGrids(3);
+
+        if (clnNode)
+            ign = startClientGrid(3);
+
+        cache = ign.getOrCreateCache(cacheConfig());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();

Review Comment:
   Looks like we can create separate cache for each test mode.
   This will allow to start grids only once - on test start, which make test 
significantly faster.
   Currently, you perform like 24 grid restarts for test run.
   
   You have to make test cache name constists of all params like 
   
   `DEFAULT_CACHE_NAME + "_" + m + "_" + syncMode ...`



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