You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2019/03/18 09:51:20 UTC
[ignite] branch master updated: IGNITE-11398 Cleanup leftover
@RunWith(JUnit4.class) - Fixes #6175.
This is an automated email from the ASF dual-hosted git repository.
ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 113f034 IGNITE-11398 Cleanup leftover @RunWith(JUnit4.class) - Fixes #6175.
113f034 is described below
commit 113f034dabe186e5e387649601da8bbe1164782a
Author: ipavlukhin <vo...@gmail.com>
AuthorDate: Mon Mar 18 12:50:43 2019 +0300
IGNITE-11398 Cleanup leftover @RunWith(JUnit4.class) - Fixes #6175.
Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
.../ignite/cache/NodeWithFilterRestartTest.java | 6 +-
.../GridHistoryAffinityAssignmentTest.java | 6 -
...istoryAffinityAssignmentTestNoOptimization.java | 3 -
.../IgnitePdsSporadicDataRecordsOnBackupTest.java | 491 ++++++++++-----------
.../db/checkpoint/CheckpointFreeListTest.java | 3 -
.../cluster/ChangeTopologyWatcherTest.java | 5 +-
.../spi/ExponentialBackoffTimeoutStrategyTest.java | 3 -
.../TcpCommunicationSpiFaultyClientSslTest.java | 3 -
.../tcp/TcpCommunicationSpiFreezingClientTest.java | 3 -
.../tcp/TcpDiscoveryCoordinatorFailureTest.java | 3 -
.../mvcc/MvccDeadlockDetectionConfigTest.java | 3 -
.../twostep/AbstractPartitionPruningBaseTest.java | 3 -
.../twostep/DmlSelectPartitionPruningSelfTest.java | 6 +-
.../twostep/MvccDmlPartitionPruningSelfTest.java | 3 -
.../processors/query/oom/AbstractQueryOOMTest.java | 3 -
.../oom/QueryOOMWithQueryParallelismTest.java | 4 -
.../oom/QueryOOMWithoutQueryParallelismTest.java | 4 -
17 files changed, 247 insertions(+), 305 deletions(-)
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/NodeWithFilterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/cache/NodeWithFilterRestartTest.java
index 6c59b1e..d701a5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/NodeWithFilterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/NodeWithFilterRestartTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.cache;
+import java.util.Arrays;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -36,15 +37,10 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.Arrays;
/**
*
*/
-@RunWith(JUnit4.class)
public class NodeWithFilterRestartTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTest.java
index c282932..9fa209a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTest.java
@@ -21,9 +21,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -35,13 +32,10 @@ import org.apache.ignite.testframework.GridTestNode;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Tests affinity history assignment diff calculation for history assignment.
*/
-@RunWith(JUnit4.class)
public class GridHistoryAffinityAssignmentTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTestNoOptimization.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTestNoOptimization.java
index d1822c4..2fe2f9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTestNoOptimization.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridHistoryAffinityAssignmentTestNoOptimization.java
@@ -20,13 +20,10 @@ package org.apache.ignite.internal.processors.affinity;
import org.apache.ignite.IgniteSystemProperties;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Tests affinity history assignment diff calculation for history assignment without optimization.
*/
-@RunWith(JUnit4.class)
public class GridHistoryAffinityAssignmentTestNoOptimization extends GridHistoryAffinityAssignmentTest {
/** */
@BeforeClass
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSporadicDataRecordsOnBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSporadicDataRecordsOnBackupTest.java
index 29b49d5..6622b41 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSporadicDataRecordsOnBackupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsSporadicDataRecordsOnBackupTest.java
@@ -1,247 +1,244 @@
-/*
- * 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.internal.processors.cache.persistence;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DataRegionConfiguration;
-import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.WALMode;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.pagemem.wal.WALIterator;
-import org.apache.ignite.internal.pagemem.wal.WALPointer;
-import org.apache.ignite.internal.pagemem.wal.record.DataRecord;
-import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory;
-import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
-
-/**
- *
- */
-@RunWith(JUnit4.class)
-public class IgnitePdsSporadicDataRecordsOnBackupTest extends GridCommonAbstractTest {
- /** */
- private static final int GRID_CNT = 2;
-
- /** Transactional cache name. */
- protected static final String TX_CACHE_NAME = "txCache";
-
- /** Keys count. */
- protected static final int KEYS_CNT = 100;
-
- /** Stop tx load flag. */
- protected static final AtomicBoolean txStop = new AtomicBoolean();
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- DataStorageConfiguration memCfg = new DataStorageConfiguration()
- .setDefaultDataRegionConfiguration(
- new DataRegionConfiguration().setMaxSize(10L * 1024 * 1024).setPersistenceEnabled(true))
- .setWalMode(WALMode.LOG_ONLY);
-
- cfg.setDataStorageConfiguration(memCfg);
-
- CacheConfiguration<Integer, Long> txCacheCfg = new CacheConfiguration<Integer, Long>(TX_CACHE_NAME)
- .setBackups(1)
- .setAtomicityMode(TRANSACTIONAL)
- .setAffinity(new RendezvousAffinityFunction(false, 32))
- .setWriteSynchronizationMode(FULL_SYNC)
- .setQueryEntities(Collections.singletonList(new QueryEntity(Integer.class, Long.class)));
-
- cfg.setCacheConfiguration(txCacheCfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- cleanPersistenceDir();
-
- super.beforeTest();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- cleanPersistenceDir();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSporadicDataRecordsOnBackup() throws Exception {
- IgniteEx ig0 = startGrid(0);
- IgniteEx ig1 = startGrid(1);
-
- grid(0).cluster().active(true);
-
- String nodeFolderName0 = ig0.context().pdsFolderResolver().resolveFolders().folderName();
- String nodeFolderName1 = ig1.context().pdsFolderResolver().resolveFolders().folderName();
-
- IgniteCache<Integer, Long> cache = grid(0).cache(TX_CACHE_NAME);
-
- for (int i = 0; i < KEYS_CNT; ++i)
- cache.put(i, (long)i);
-
- IgniteInternalFuture txLoadFut = startTxLoad(5, null);
-
- doSleep(10_000);
-
- txStop.set(true);
-
- txLoadFut.get();
-
- grid(0).cluster().active(false);
-
- stopAllGrids();
-
- assertEquals(0,findSporadicDataRecords(nodeFolderName0) + findSporadicDataRecords(nodeFolderName1));
- }
-
- /**
- * Returns a number of {@link DataRecord} that do not have a xid version,
- * in other words, number of records that were created by GridCacheUtils#createBackupPostProcessingClosure().
- *
- * @throws IgniteCheckedException If failed.
- */
- private long findSporadicDataRecords(String nodeFolderName) throws IgniteCheckedException {
- File dbDir = new File(U.defaultWorkDirectory(), "db");
- File commonWalDir = new File(dbDir, "wal");
- File walDir = new File(commonWalDir, nodeFolderName);
- File walArchiveDir = new File(new File(commonWalDir, "archive"), nodeFolderName);
-
- assertTrue(walDir.exists());
- assertTrue(walArchiveDir.exists());
-
- IteratorParametersBuilder params = new IteratorParametersBuilder();
-
- params.bufferSize(1024 * 1024);
- params.filesOrDirs(walDir, walArchiveDir);
- params.filter((type, pointer) -> type == WALRecord.RecordType.DATA_RECORD);
-
- int cacheId = CU.cacheId(TX_CACHE_NAME);
-
- long createOpCnt = 0;
-
- try (WALIterator itr = new IgniteWalIteratorFactory().iterator(params)) {
- while (itr.hasNext()) {
- IgniteBiTuple<WALPointer, WALRecord> walEntry = itr.next();
-
- assertTrue(walEntry.get2() instanceof DataRecord);
-
- DataRecord rec = (DataRecord)walEntry.get2();
-
- createOpCnt += rec.writeEntries()
- .stream()
- .filter(e ->
- e.cacheId() == cacheId && GridCacheOperation.CREATE == e.op() && e.nearXidVersion() == null)
- .count();
- }
- }
-
- return createOpCnt;
- }
-
- /**
- * @param threads Threads.
- * @param ignite Load source instance.
- */
- @SuppressWarnings({"SameParameterValue"})
- protected IgniteInternalFuture startTxLoad(int threads, Ignite ignite) {
- txStop.set(false);
-
- return GridTestUtils.runMultiThreadedAsync(() -> {
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- while (!txStop.get()) {
- Ignite ig = ignite == null ? grid(rnd.nextInt(GRID_CNT)) : ignite;
-
- if (ig == null)
- continue;
-
- IgniteCache<Integer, Long> cache = ig.cache(TX_CACHE_NAME);
-
- try (Transaction tx = ig.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
- int acc0 = rnd.nextInt(KEYS_CNT);
-
- int acc1 = rnd.nextInt(KEYS_CNT);
-
- while (acc1 == acc0)
- acc1 = rnd.nextInt(KEYS_CNT);
-
- // Avoid deadlocks.
- if (acc0 > acc1) {
- int tmp = acc0;
- acc0 = acc1;
- acc1 = tmp;
- }
-
- long val0 = cache.get(acc0);
- long val1 = cache.get(acc1);
-
- long delta = rnd.nextLong(Math.max(val0, val1));
-
- if (val0 < val1) {
- cache.put(acc0, val0 + delta);
- cache.put(acc1, val1 - delta);
- }
- else {
- cache.put(acc0, val0 - delta);
- cache.put(acc1, val1 + delta);
- }
-
- tx.commit();
- }
- catch (Throwable e) {
- assertFalse(e instanceof NullPointerException);
- }
- }
- },
- threads, "tx-load-thread"
- );
- }
-}
+/*
+ * 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.internal.processors.cache.persistence;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.pagemem.wal.WALIterator;
+import org.apache.ignite.internal.pagemem.wal.WALPointer;
+import org.apache.ignite.internal.pagemem.wal.record.DataRecord;
+import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory;
+import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.junit.Test;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
+
+/**
+ *
+ */
+public class IgnitePdsSporadicDataRecordsOnBackupTest extends GridCommonAbstractTest {
+ /** */
+ private static final int GRID_CNT = 2;
+
+ /** Transactional cache name. */
+ protected static final String TX_CACHE_NAME = "txCache";
+
+ /** Keys count. */
+ protected static final int KEYS_CNT = 100;
+
+ /** Stop tx load flag. */
+ protected static final AtomicBoolean txStop = new AtomicBoolean();
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(10L * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ CacheConfiguration<Integer, Long> txCacheCfg = new CacheConfiguration<Integer, Long>(TX_CACHE_NAME)
+ .setBackups(1)
+ .setAtomicityMode(TRANSACTIONAL)
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setWriteSynchronizationMode(FULL_SYNC)
+ .setQueryEntities(Collections.singletonList(new QueryEntity(Integer.class, Long.class)));
+
+ cfg.setCacheConfiguration(txCacheCfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ cleanPersistenceDir();
+
+ super.beforeTest();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ cleanPersistenceDir();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testSporadicDataRecordsOnBackup() throws Exception {
+ IgniteEx ig0 = startGrid(0);
+ IgniteEx ig1 = startGrid(1);
+
+ grid(0).cluster().active(true);
+
+ String nodeFolderName0 = ig0.context().pdsFolderResolver().resolveFolders().folderName();
+ String nodeFolderName1 = ig1.context().pdsFolderResolver().resolveFolders().folderName();
+
+ IgniteCache<Integer, Long> cache = grid(0).cache(TX_CACHE_NAME);
+
+ for (int i = 0; i < KEYS_CNT; ++i)
+ cache.put(i, (long)i);
+
+ IgniteInternalFuture txLoadFut = startTxLoad(5, null);
+
+ doSleep(10_000);
+
+ txStop.set(true);
+
+ txLoadFut.get();
+
+ grid(0).cluster().active(false);
+
+ stopAllGrids();
+
+ assertEquals(0,findSporadicDataRecords(nodeFolderName0) + findSporadicDataRecords(nodeFolderName1));
+ }
+
+ /**
+ * Returns a number of {@link DataRecord} that do not have a xid version,
+ * in other words, number of records that were created by GridCacheUtils#createBackupPostProcessingClosure().
+ *
+ * @throws IgniteCheckedException If failed.
+ */
+ private long findSporadicDataRecords(String nodeFolderName) throws IgniteCheckedException {
+ File dbDir = new File(U.defaultWorkDirectory(), "db");
+ File commonWalDir = new File(dbDir, "wal");
+ File walDir = new File(commonWalDir, nodeFolderName);
+ File walArchiveDir = new File(new File(commonWalDir, "archive"), nodeFolderName);
+
+ assertTrue(walDir.exists());
+ assertTrue(walArchiveDir.exists());
+
+ IteratorParametersBuilder params = new IteratorParametersBuilder();
+
+ params.bufferSize(1024 * 1024);
+ params.filesOrDirs(walDir, walArchiveDir);
+ params.filter((type, pointer) -> type == WALRecord.RecordType.DATA_RECORD);
+
+ int cacheId = CU.cacheId(TX_CACHE_NAME);
+
+ long createOpCnt = 0;
+
+ try (WALIterator itr = new IgniteWalIteratorFactory().iterator(params)) {
+ while (itr.hasNext()) {
+ IgniteBiTuple<WALPointer, WALRecord> walEntry = itr.next();
+
+ assertTrue(walEntry.get2() instanceof DataRecord);
+
+ DataRecord rec = (DataRecord)walEntry.get2();
+
+ createOpCnt += rec.writeEntries()
+ .stream()
+ .filter(e ->
+ e.cacheId() == cacheId && GridCacheOperation.CREATE == e.op() && e.nearXidVersion() == null)
+ .count();
+ }
+ }
+
+ return createOpCnt;
+ }
+
+ /**
+ * @param threads Threads.
+ * @param ignite Load source instance.
+ */
+ @SuppressWarnings({"SameParameterValue"})
+ protected IgniteInternalFuture startTxLoad(int threads, Ignite ignite) {
+ txStop.set(false);
+
+ return GridTestUtils.runMultiThreadedAsync(() -> {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ while (!txStop.get()) {
+ Ignite ig = ignite == null ? grid(rnd.nextInt(GRID_CNT)) : ignite;
+
+ if (ig == null)
+ continue;
+
+ IgniteCache<Integer, Long> cache = ig.cache(TX_CACHE_NAME);
+
+ try (Transaction tx = ig.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
+ int acc0 = rnd.nextInt(KEYS_CNT);
+
+ int acc1 = rnd.nextInt(KEYS_CNT);
+
+ while (acc1 == acc0)
+ acc1 = rnd.nextInt(KEYS_CNT);
+
+ // Avoid deadlocks.
+ if (acc0 > acc1) {
+ int tmp = acc0;
+ acc0 = acc1;
+ acc1 = tmp;
+ }
+
+ long val0 = cache.get(acc0);
+ long val1 = cache.get(acc1);
+
+ long delta = rnd.nextLong(Math.max(val0, val1));
+
+ if (val0 < val1) {
+ cache.put(acc0, val0 + delta);
+ cache.put(acc1, val1 - delta);
+ }
+ else {
+ cache.put(acc0, val0 - delta);
+ cache.put(acc1, val1 + delta);
+ }
+
+ tx.commit();
+ }
+ catch (Throwable e) {
+ assertFalse(e instanceof NullPointerException);
+ }
+ }
+ },
+ threads, "tx-load-thread"
+ );
+ }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/CheckpointFreeListTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/CheckpointFreeListTest.java
index 655a687..26441e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/CheckpointFreeListTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/CheckpointFreeListTest.java
@@ -59,8 +59,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import static java.util.Objects.requireNonNull;
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.CACHE_DIR_PREFIX;
@@ -71,7 +69,6 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
/**
*
*/
-@RunWith(JUnit4.class)
public class CheckpointFreeListTest extends GridCommonAbstractTest {
/** Ip finder. */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cluster/ChangeTopologyWatcherTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cluster/ChangeTopologyWatcherTest.java
index 89fe806..c454ceb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cluster/ChangeTopologyWatcherTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cluster/ChangeTopologyWatcherTest.java
@@ -34,8 +34,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
@@ -43,7 +41,6 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
*
*/
@GridCommonTest(group = "Kernal Self")
-@RunWith(JUnit4.class)
public class ChangeTopologyWatcherTest extends GridCommonAbstractTest {
/** */
private static final String TEST_NAME = "TEST_NAME";
@@ -347,4 +344,4 @@ public class ChangeTopologyWatcherTest extends GridCommonAbstractTest {
assertTrue(isCurrentBaselineFromOneNode(ignite0));
}
-}
\ No newline at end of file
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/ExponentialBackoffTimeoutStrategyTest.java b/modules/core/src/test/java/org/apache/ignite/spi/ExponentialBackoffTimeoutStrategyTest.java
index e535541..1e5f52c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/ExponentialBackoffTimeoutStrategyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/ExponentialBackoffTimeoutStrategyTest.java
@@ -19,13 +19,10 @@ package org.apache.ignite.spi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Test for {@link ExponentialBackoffTimeoutStrategyTest}.
*/
-@RunWith(JUnit4.class)
public class ExponentialBackoffTimeoutStrategyTest extends GridCommonAbstractTest {
/** */
@Test
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientSslTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientSslTest.java
index 6510475..5038b25 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientSslTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientSslTest.java
@@ -19,13 +19,10 @@ package org.apache.ignite.spi.communication.tcp;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Tests that faulty client will be failed if connection can't be established.
*/
-@RunWith(JUnit4.class)
public class TcpCommunicationSpiFaultyClientSslTest extends TcpCommunicationSpiFaultyClientTest {
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFreezingClientTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFreezingClientTest.java
index 2a6cb00..926a056 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFreezingClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFreezingClientTest.java
@@ -37,8 +37,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -47,7 +45,6 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Tests that freezing due to JVM STW client will be failed if connection can't be established.
*/
-@RunWith(JUnit4.class)
public class TcpCommunicationSpiFreezingClientTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryCoordinatorFailureTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryCoordinatorFailureTest.java
index 2dbf6ad..fc3adcc 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryCoordinatorFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryCoordinatorFailureTest.java
@@ -41,14 +41,11 @@ import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.After;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
*
*/
@SuppressWarnings("deprecation")
-@RunWith(JUnit4.class)
public class TcpDiscoveryCoordinatorFailureTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(false)
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java
index 50157da..bc62b14 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java
@@ -33,15 +33,12 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.junit.After;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
/** */
-@RunWith(JUnit4.class)
public class MvccDeadlockDetectionConfigTest extends GridCommonAbstractTest {
/** */
private boolean deadlockDetectionEnabled;
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
index 493b264..8b6c421 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
@@ -45,14 +45,11 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Base class for partition pruning tests.
*/
@SuppressWarnings("deprecation")
-@RunWith(JUnit4.class)
public abstract class AbstractPartitionPruningBaseTest extends GridCommonAbstractTest {
/** Number of intercepted requests. */
private static final AtomicInteger INTERCEPTED_REQS = new AtomicInteger();
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/DmlSelectPartitionPruningSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/DmlSelectPartitionPruningSelfTest.java
index 927cc3d..ce7fec6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/DmlSelectPartitionPruningSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/DmlSelectPartitionPruningSelfTest.java
@@ -17,19 +17,15 @@
package org.apache.ignite.internal.processors.query.h2.twostep;
+import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.binary.BinaryObject;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.List;
/**
* Tests for use partition pruning at the SELECT step of the UPDATE/DELETE statements execution.
*/
@SuppressWarnings("deprecation")
-@RunWith(JUnit4.class)
public class DmlSelectPartitionPruningSelfTest extends AbstractPartitionPruningBaseTest {
/** Rows count for test tables. */
private static final int ROWS = 10;
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java
index c63e31b..0deac66 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java
@@ -21,14 +21,11 @@ import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.binary.BinaryObject;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Tests for use partition pruning at the SELECT step of the UPDATE/DELETE statements execution.
*/
@SuppressWarnings("deprecation")
-@RunWith(JUnit4.class)
public class MvccDmlPartitionPruningSelfTest extends AbstractPartitionPruningBaseTest {
/** Rows count for test tables. */
private static final int ROWS = 10;
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
index cfe2d3e..d29aaaa 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
@@ -47,13 +47,10 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
import org.junit.Ignore;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Tests for OOME on query.
*/
-@RunWith(JUnit4.class)
public abstract class AbstractQueryOOMTest extends GridCommonAbstractTest {
/** */
private static final long KEY_CNT = 1_000_000L;
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithQueryParallelismTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithQueryParallelismTest.java
index 4a0404c..98772ed 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithQueryParallelismTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithQueryParallelismTest.java
@@ -17,13 +17,9 @@
package org.apache.ignite.internal.processors.query.oom;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
/**
* Tests for OOME on query.
*/
-@RunWith(JUnit4.class)
public class QueryOOMWithQueryParallelismTest extends AbstractQueryOOMTest {
/** {@inheritDoc} */
@Override protected int queryParallelism() {
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithoutQueryParallelismTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithoutQueryParallelismTest.java
index 2db821a..b1c53a6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithoutQueryParallelismTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/QueryOOMWithoutQueryParallelismTest.java
@@ -17,13 +17,9 @@
package org.apache.ignite.internal.processors.query.oom;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
/**
* Tests for OOME on query.
*/
-@RunWith(JUnit4.class)
public class QueryOOMWithoutQueryParallelismTest extends AbstractQueryOOMTest {
/** {@inheritDoc} */
@Override protected int queryParallelism() {