This is an automated email from the ASF dual-hosted git repository.
wernerdv 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 7d36a423293 IGNITE-29063 Remove unused methods from core tests (#13601)
7d36a423293 is described below
commit 7d36a423293535681f7792a98c5304dfcef76172
Author: Dmitry Werner <[email protected]>
AuthorDate: Tue Sep 22 18:38:56 2026 +0500
IGNITE-29063 Remove unused methods from core tests (#13601)
---
.../java/org/apache/ignite/GridTestIoUtils.java | 50 --
.../ignite/cache/ResetLostPartitionTest.java | 21 -
.../ignite/internal/TransactionMetricsTest.java | 14 -
.../internal/binary/BinaryArraySelfTest.java | 18 -
.../internal/binary/BinaryMarshallerSelfTest.java | 11 -
.../binary/GridBinaryWildcardsSelfTest.java | 39 -
.../binary/RawBinaryObjectExtractorTest.java | 9 -
.../binary/mutabletest/GridBinaryTestClasses.java | 25 -
.../IgniteTopologyPrintFormatSelfTest.java | 5 -
.../AuthenticationProcessorSelfTest.java | 7 -
.../cache/CacheMetricsForClusterGroupSelfTest.java | 8 -
.../cache/GridCacheAbstractFullApiSelfTest.java | 143 ----
.../cache/GridCacheAbstractLocalStoreSelfTest.java | 12 -
.../GridCacheInterceptorAbstractSelfTest.java | 30 -
...idCacheTcpClientDiscoveryMultiThreadedTest.java | 21 -
.../processors/cache/GridCacheTestEntryEx.java | 878 ---------------------
.../IgniteCacheConfigVariationsFullApiTest.java | 9 -
.../cache/IgniteCachePeekModesAbstractTest.java | 851 +-------------------
...GridCachePartitionedQueueEntryMoveSelfTest.java | 19 -
.../distributed/CacheBlockOnReadAbstractTest.java | 7 -
...sticOriginatingNodeFailureAbstractSelfTest.java | 12 -
.../dht/GridCacheDhtPreloadDisabledSelfTest.java | 6 -
.../dht/GridCacheDhtPreloadSelfTest.java | 8 -
.../dht/GridCacheDhtPreloadStartStopSelfTest.java | 104 ---
...niteBaselineAffinityTopologyActivationTest.java | 14 -
.../persistence/IgnitePdsCorruptedStoreTest.java | 8 -
...ocalWalModeChangeDuringRebalancingSelfTest.java | 24 -
.../db/checkpoint/IgniteMassLoadSandboxTest.java | 37 -
.../db/wal/WalDeletionArchiveAbstractTest.java | 7 -
.../snapshot/IgniteSnapshotManagerSelfTest.java | 11 -
...cheContinuousQueryFailoverAbstractSelfTest.java | 78 --
.../IgniteCacheWriteBehindNoUpdateSelfTest.java | 7 -
.../continuous/GridEventConsumeSelfTest.java | 13 -
.../processors/database/BPlusTreeSelfTest.java | 8 -
.../datastreamer/DataStreamProcessorSelfTest.java | 45 --
.../service/ServiceRedeploymentOnNodeLeftTest.java | 9 -
.../ignite/internal/util/IgniteUtilsSelfTest.java | 26 -
.../lang/utils/GridConsistentHashSelfTest.java | 124 ---
.../apache/ignite/loadtests/dsi/GridDsiClient.java | 33 -
.../p2p/GridP2PDifferentClassLoaderSelfTest.java | 14 -
.../ignite/p2p/GridP2PSameClassLoaderSelfTest.java | 14 -
.../apache/ignite/testframework/GridTestUtils.java | 49 --
.../testframework/junits/GridAbstractTest.java | 32 -
.../junits/common/GridCommonAbstractTest.java | 16 -
44 files changed, 1 insertion(+), 2875 deletions(-)
diff --git a/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
b/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
index 3a77f5cb01d..c5682fc7c6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
@@ -28,14 +28,7 @@ import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import org.apache.commons.io.IOUtils;
import org.apache.ignite.marshaller.Marshaller;
-import org.jetbrains.annotations.Nullable;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
/**
* IO test utilities.
@@ -141,49 +134,6 @@ public final class GridTestIoUtils {
return (T)marshaller.unmarshal(buf, obj.getClass().getClassLoader());
}
- /**
- * Validate streams generate the same output.
- *
- * @param expIn Expected input stream.
- * @param actIn Actual input stream.
- * @param expSize Expected size of the streams.
- * @throws IOException In case of any IO exception.
- */
- public static void assertEqualStreams(InputStream expIn, InputStream actIn,
- @Nullable Long expSize) throws IOException {
- int bufSize = 2345;
- byte buf1[] = new byte[bufSize];
- byte buf2[] = new byte[bufSize];
- long pos = 0;
-
- while (true) {
- int i1 = actIn.read(buf1, 0, bufSize);
-
- int i2;
-
- if (i1 == -1) // Expects EOF?
- i2 = expIn.read(buf2, 0, 1); // Try to read at least 1 byte
guaranted by stream's API.
- else
- IOUtils.readFully(expIn, buf2, 0, i2 = i1); // Read the same
bytes count as from actual stream.
-
- if (i1 != i2)
- fail("Expects the same data [pos=" + pos + ", i1=" + i1 + ",
i2=" + i2 + ']');
-
- if (i1 == -1)
- break; // EOF
-
- // i1 == bufSize => compare buffers.
- // i1 < bufSize => Compare part of buffers, rest of buffers are
equal from previous iteration.
- assertTrue("Expects the same data [pos=" + pos + ", i1=" + i1 + ",
i2=" + i2 + ']',
- Arrays.equals(buf1, buf2));
-
- pos += i1;
- }
-
- if (expSize != null)
- assertEquals(expSize.longValue(), pos);
- }
-
/**
* Gets short value from byte array assuming that value stored in
little-endian byte order.
*
diff --git
a/modules/core/src/test/java/org/apache/ignite/cache/ResetLostPartitionTest.java
b/modules/core/src/test/java/org/apache/ignite/cache/ResetLostPartitionTest.java
index d403a5b6e06..21dc082ad46 100644
---
a/modules/core/src/test/java/org/apache/ignite/cache/ResetLostPartitionTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/cache/ResetLostPartitionTest.java
@@ -19,9 +19,7 @@ package org.apache.ignite.cache;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
import java.util.concurrent.Callable;
-import java.util.stream.Collectors;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
@@ -33,11 +31,7 @@ import
org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
-import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopologyImpl;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.lang.IgniteBiPredicate;
@@ -241,21 +235,6 @@ public class ResetLostPartitionTest extends
GridCommonAbstractTest {
assertEquals(CACHE_NAMES.length * CACHE_SIZE,
averageSizeAroundAllNodes());
}
- /**
- * @param gridNumber Grid number.
- * @param cacheName Cache name.
- * @return Partitions states for given cache name.
- */
- private List<GridDhtPartitionState> getPartitionsStates(int gridNumber,
String cacheName) {
- CacheGroupContext cgCtx =
grid(gridNumber).context().cache().cacheGroup(CU.cacheId(cacheName));
-
- GridDhtPartitionTopologyImpl top =
(GridDhtPartitionTopologyImpl)cgCtx.topology();
-
- return top.localPartitions().stream()
- .map(GridDhtLocalPartition::state)
- .collect(Collectors.toList());
- }
-
/**
* Checks that all nodes see the correct size.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java
index 2f0230c1f37..2f281a8162a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java
@@ -254,20 +254,6 @@ public class TransactionMetricsTest extends
GridCommonAbstractTest {
this.key2 = key2;
}
- /**
- * @param ignite Ignite.
- * @param key1 key 1.
- * @param key2 key 2.
- */
- private TxThread(final Ignite ignite, final int key1, final int key2) {
- commitAllowLatch = new CountDownLatch(0);
- transactionStartLatch = new CountDownLatch(1);
-
- this.ignite = ignite;
- this.key1 = key1;
- this.key2 = key2;
- }
-
/** {@inheritDoc} */
@Override public void run() {
try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC,
REPEATABLE_READ)) {
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArraySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArraySelfTest.java
index a6e7a05d449..878bb7c465f 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArraySelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryArraySelfTest.java
@@ -370,24 +370,6 @@ public class BinaryArraySelfTest extends
AbstractBinaryArraysTest {
);
}
- /** */
- private void putRegularGetInBinary(IgniteCache<Object, Object> c) {
- List<?> vals = dataToTest();
-
- for (Object val : vals) {
- c.put(1, val);
-
- Object obj = c.withKeepBinary().get(1);
-
- assertEquals(useBinaryArrays ? BinaryArray.class : Object[].class,
obj.getClass());
-
- if (useBinaryArrays)
- assertEquals(val.getClass(),
((BinaryObject)obj).deserialize().getClass());
-
- assertTrue(c.remove(1));
- }
- }
-
/** */
private void putInBinaryGetRegular(CacheAdapter<Object, Object> c) {
Runnable checker = () -> {
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index 3e52bbc0e35..cb53073815f 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -4081,17 +4081,6 @@ public class BinaryMarshallerSelfTest extends
AbstractBinaryArraysTest {
return ords;
}
- /**
- * @param po Binary object.
- * @param off Offset.
- * @return Value.
- */
- private int intFromBinary(BinaryObject po, int off) {
- byte[] arr = U.field(po, "arr");
-
- return Integer.reverseBytes(U.bytesToInt(arr, off));
- }
-
/**
* @param obj Original object.
* @return Result object.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryWildcardsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryWildcardsSelfTest.java
index 015e6e29d44..e6cbf52b6c8 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryWildcardsSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryWildcardsSelfTest.java
@@ -274,45 +274,6 @@ public class GridBinaryWildcardsSelfTest extends
GridCommonAbstractTest {
checkOverrideNameMapper(new BinaryBasicNameMapper(false), new
BinaryBasicIdMapper(false));
}
- /**
- *
- * @param nameMapper Name mapper.
- * @param mapper Mapper.
- * @throws IgniteCheckedException If failed.
- */
- private void checkOverrideIdMapper(BinaryNameMapper nameMapper,
BinaryIdMapper mapper) throws IgniteCheckedException {
- BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
-
- typeCfg.setTypeName(CLASS2_FULL_NAME);
- typeCfg.setIdMapper(new BinaryIdMapper() {
- @Override public int typeId(String clsName) {
- return 100;
- }
-
- @Override public int fieldId(int typeId, String fieldName) {
- return 0;
- }
- });
-
- BinaryMarshaller marsh = binaryMarshaller(nameMapper, mapper,
Arrays.asList(
- new
BinaryTypeConfiguration("org.apache.ignite.internal.binary.test.*"),
- typeCfg));
-
- BinaryContext ctx = binaryContext(marsh);
-
- Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
- assertEquals(3, typeIds.size());
-
- assertTrue(typeIds.containsKey(typeId(CLASS1_FULL_NAME, nameMapper,
mapper)));
- assertTrue(typeIds.containsKey(typeId(INNER_CLASS_FULL_NAME,
nameMapper, mapper)));
- assertTrue(typeIds.containsKey(100));
-
- Map<String, org.apache.ignite.internal.binary.BinaryInternalMapper>
typeMappers = U.field(ctx, "cls2Mappers");
-
- assertEquals(100,
typeMappers.get(CLASS2_FULL_NAME).idMapper().typeId(CLASS2_FULL_NAME));
- }
-
/**
* @throws Exception If failed.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/RawBinaryObjectExtractorTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/RawBinaryObjectExtractorTest.java
index 8b0b580536b..8d3c9f7804b 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/RawBinaryObjectExtractorTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/RawBinaryObjectExtractorTest.java
@@ -99,15 +99,6 @@ public class RawBinaryObjectExtractorTest extends
GridCommonAbstractTest {
return res;
}
- /** */
- private Object createTestObject() {
- TestObjectAllTypes res = new TestObjectAllTypes();
-
- res.setDefaultData();
-
- return res;
- }
-
/** */
private interface RegisteredClass { }
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/binary/mutabletest/GridBinaryTestClasses.java
b/modules/core/src/test/java/org/apache/ignite/internal/binary/mutabletest/GridBinaryTestClasses.java
index 8d1ff662782..6ff2aeeb323 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/binary/mutabletest/GridBinaryTestClasses.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/binary/mutabletest/GridBinaryTestClasses.java
@@ -17,10 +17,6 @@
package org.apache.ignite.internal.binary.mutabletest;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -33,7 +29,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.UUID;
-import com.google.common.base.Throwables;
import org.apache.ignite.binary.BinaryMapFactory;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectException;
@@ -249,26 +244,6 @@ public class GridBinaryTestClasses {
/** */
public Map.Entry entry;
- /**
- * @return Array.
- */
- private byte[] serialize() {
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-
- try {
- ObjectOutput out = new ObjectOutputStream(byteOut);
-
- out.writeObject(this);
-
- out.close();
- }
- catch (IOException e) {
- Throwables.propagate(e);
- }
-
- return byteOut.toByteArray();
- }
-
/**
*
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
index efaace9dee8..2644741eb9d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
@@ -359,10 +359,5 @@ public class IgniteTopologyPrintFormatSelfTest extends
GridCommonAbstractTest {
public List<String> logs() {
return logs;
}
-
- /** */
- public void clear() {
- logs.clear();
- }
}
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorSelfTest.java
index 06fa3cc2e7d..51bc2cb90f0 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorSelfTest.java
@@ -472,13 +472,6 @@ public class AuthenticationProcessorSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * @param passwd User's password to check.
- */
- private void checkInvalidPassword(final String passwd) {
- assertThrows(() -> asRoot(grid(CLI_NODE), s -> s.createUser("test",
passwd.toCharArray())), "Invalid user name");
- }
-
/**
* @param createNode Node to execute create operation.
* @param authNode Node to execute authentication.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
index 0cd45d982a5..1c3b1412506 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java
@@ -178,14 +178,6 @@ public class CacheMetricsForClusterGroupSelfTest extends
GridCommonAbstractTest
cache2 = grid(0).getOrCreateCache(ccfg2);
}
- /**
- * Closes caches.
- */
- private void destroyCaches() {
- cache1.destroy();
- cache2.destroy();
- }
-
/**
* @param cache Cache.
* @param cnt Count.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 11ad252160c..570fd96882c 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -2587,77 +2587,6 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
checkPutxIfAbsentAsync(false);
}
- /**
- * @param inTx In tx flag.
- * @throws Exception If failed.
- */
- private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception {
- IgniteCache<String, Integer> cache = jcache();
-
- IgniteCache<String, Integer> cacheAsync = cache.withAsync();
-
- cacheAsync.putIfAbsent("key", 1);
-
- IgniteFuture<Boolean> fut1 = cacheAsync.future();
-
- assert fut1.get();
- assert cache.get("key") != null && cache.get("key") == 1;
-
- cacheAsync.putIfAbsent("key", 2);
-
- IgniteFuture<Boolean> fut2 = cacheAsync.future();
-
- assert !fut2.get();
- assert cache.get("key") != null && cache.get("key") == 1;
-
- // Check swap.
- cache.put("key2", 1);
-
- cache.localEvict(Collections.singleton("key2"));
-
- cacheAsync.putIfAbsent("key2", 3);
-
- assertFalse(cacheAsync.<Boolean>future().get());
-
- // Check db.
- if (!isMultiJvm()) {
- storeStgy.putToStore("key3", 3);
-
- cacheAsync.putIfAbsent("key3", 4);
-
- assertFalse(cacheAsync.<Boolean>future().get());
- }
-
- cache.localEvict(Collections.singletonList("key2"));
-
- // Same checks inside tx.
- Transaction tx = inTx ? transactions().txStart() : null;
-
- try {
- cacheAsync.putIfAbsent("key2", 3);
-
- assertFalse(cacheAsync.<Boolean>future().get());
-
- if (!isMultiJvm()) {
- cacheAsync.putIfAbsent("key3", 4);
-
- assertFalse(cacheAsync.<Boolean>future().get());
- }
-
- if (tx != null)
- tx.commit();
- }
- finally {
- if (tx != null)
- tx.close();
- }
-
- assertEquals((Integer)1, cache.get("key2"));
-
- if (!isMultiJvm())
- assertEquals((Integer)3, cache.get("key3"));
- }
-
/**
* @param inTx In tx flag.
* @throws Exception If failed.
@@ -3434,71 +3363,6 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
globalRemoveAll(true);
}
- /**
- * @param async If {@code true} uses asynchronous operation.
- * @throws Exception In case of error.
- */
- private void globalRemoveAllOld(boolean async) throws Exception {
- IgniteCache<String, Integer> cache = jcache();
-
- cache.put("key1", 1);
- cache.put("key2", 2);
- cache.put("key3", 3);
-
- checkSize(F.asSet("key1", "key2", "key3"));
-
- IgniteCache<String, Integer> asyncCache = cache.withAsync();
-
- if (async) {
- asyncCache.removeAll(F.asSet("key1", "key2"));
-
- asyncCache.future().get();
- }
- else
- cache.removeAll(F.asSet("key1", "key2"));
-
- checkSize(F.asSet("key3"));
-
- checkContainsKey(false, "key1");
- checkContainsKey(false, "key2");
- checkContainsKey(true, "key3");
-
- // Put values again.
- cache.put("key1", 1);
- cache.put("key2", 2);
- cache.put("key3", 3);
-
- if (async) {
- IgniteCache<String, Integer> asyncCache0 = jcache(gridCount() > 1
? 1 : 0).withAsync();
-
- asyncCache0.removeAll();
-
- asyncCache0.future().get();
- }
- else
- jcache(gridCount() > 1 ? 1 : 0).removeAll();
-
- assertEquals(0, cache.localSize());
- long entryCnt = hugeRemoveAllEntryCount();
-
- for (int i = 0; i < entryCnt; i++)
- cache.put(String.valueOf(i), i);
-
- for (int i = 0; i < entryCnt; i++)
- assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
-
- if (async) {
- asyncCache.removeAll();
-
- asyncCache.future().get();
- }
- else
- cache.removeAll();
-
- for (int i = 0; i < entryCnt; i++)
- assertNull(cache.get(String.valueOf(i)));
- }
-
/**
* @param async If {@code true} uses asynchronous operation.
* @throws Exception In case of error.
@@ -6788,13 +6652,6 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
this.val = val;
}
- /**
- * @return Value.
- */
- public int value() {
- return val;
- }
-
/** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o)
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
index d50cb3311f1..116e132c6af 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
@@ -753,18 +753,6 @@ public abstract class GridCacheAbstractLocalStoreSelfTest
extends GridCommonAbst
}
}
- /**
- * Checks that local stores contains primary and backup entries.
- * @param ignite Ignite.
- * @param store Store.
- * @param name Cache name.
- * @param keys keys.
- */
- private void checkLocalStore(Ignite ignite, CacheStore<Integer,
IgniteBiTuple<Integer, ?>> store, String name,
- Set<Integer> keys) {
- checkLocalStore(ignite, store, name, keys, true);
- }
-
/**
* Checks that local stores contains primary and backup or only primary
entries.
*
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
index d823a490daf..1557a302135 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
@@ -48,7 +48,6 @@ import org.junit.Test;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
/**
* Tests {@link CacheInterceptor}.
@@ -418,35 +417,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest
extends GridCacheAbst
}
}
- /**
- * @param op Operation type.
- * @return {@code True} if this is atomic cache and update is first run on
primary node.
- */
- private int expectedIgnoreInvokeCount(Operation op) {
- int dataNodes = cacheMode() == REPLICATED ? gridCount() : 2;
-
- if (atomicityMode() == TRANSACTIONAL)
- return dataNodes + (storeEnabled() ? 1 : 0); // One call before
store is updated.
- else {
- // If update goes through primary node and it is cancelled then
backups aren't updated.
- return op == Operation.TRANSFORM ? 1 : dataNodes;
- }
- }
-
- /**
- * @param op Operation type.
- * @return {@code True} if this is atomic cache and update is first run on
primary node.
- */
- private int expectedInvokeCount(Operation op) {
- int dataNodes = cacheMode() == REPLICATED ? gridCount() : 2;
-
- if (atomicityMode() == TRANSACTIONAL)
- // Update + after update + one call before store is updated.
- return dataNodes * 2 + (storeEnabled() ? 1 : 0);
- else
- return op == Operation.TRANSFORM ? 2 : dataNodes * 2;
- }
-
/**
* @param key Key.
* @param op Operation type.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
index b5f73f900b3..639722a81db 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
@@ -169,25 +169,4 @@ public class GridCacheTcpClientDiscoveryMultiThreadedTest
extends GridCacheAbstr
for (int i = 0; i < srvNodesCnt; i++)
startGrid(i);
}
-
- /**
- * @throws Exception If failed.
- */
- private void stopServerNodes() throws Exception {
- for (int i = 0; i < srvNodesCnt; i++)
- stopGrid(i);
- }
-
- /**
- * Executes simple operation on the cache.
- *
- * @param cache Cache instance to use.
- */
- private void performSimpleOperationsOnCache(IgniteCache<Integer, Integer>
cache) {
- for (int i = 100; i < 200; i++)
- cache.put(i, i);
-
- for (int i = 100; i < 200; i++)
- assertEquals(i, (int)cache.get(i));
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
deleted file mode 100644
index d4971a8b26e..00000000000
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * 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;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.UUID;
-import javax.cache.Cache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.eviction.EvictableEntry;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
-import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
-import
org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import
org.apache.ignite.internal.processors.cache.version.GridCacheVersionedEntryEx;
-import org.apache.ignite.internal.processors.dr.GridDrType;
-import
org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
-import org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Test entry.
- */
-@SuppressWarnings("unchecked")
-public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements
GridCacheEntryEx {
- /** Key. */
- private KeyCacheObject key;
-
- /** Val. */
- private CacheObject val;
-
- /** TTL. */
- private long ttl;
-
- /** Version. */
- private GridCacheVersion ver = new GridCacheVersion(0, 0, 1, 0);
-
- /** Obsolete version. */
- private GridCacheVersion obsoleteVer = ver;
-
- /** MVCC. */
- private GridCacheMvcc mvcc;
-
- /**
- * @param ctx Context.
- * @param key Key.
- */
- GridCacheTestEntryEx(GridCacheContext ctx, Object key) {
- mvcc = new GridCacheMvcc(ctx);
-
- this.key = ctx.toCacheKeyObject(key);
- }
-
- /** {@inheritDoc} */
- @Override public int memorySize() throws IgniteCheckedException {
- return 1024;
- }
-
- /** {@inheritDoc} */
- @Override public boolean initialValue(CacheObject val, GridCacheVersion
ver, long ttl, long expireTime,
- boolean preload, AffinityTopologyVersion topVer, GridDrType drType,
boolean fromStore, boolean primary) {
- assert false;
-
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isInternal() {
- return key instanceof GridCacheInternal;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isDht() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isNear() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isReplicated() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isLocal() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean detached() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public GridCacheContext context() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public EvictableEntry wrapEviction() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public int partition() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public boolean partitionValid() {
- return true;
- }
-
- /**
- * @param threadId Thread ID.
- * @param ver Lock version.
- * @param timeout Lock acquisition timeout.
- * @param reenter Reentry flag ({@code true} if reentry is allowed).
- * @param tx Transaction flag.
- * @return New lock candidate if lock was added, or current owner if lock
was reentered,
- * or <tt>null</tt> if lock was owned by another thread and timeout
is negative.
- */
- @Nullable GridCacheMvccCandidate addLocal(
- long threadId,
- GridCacheVersion ver,
- long timeout,
- boolean reenter,
- boolean tx) {
- return mvcc.addLocal(
- this,
- threadId,
- ver,
- timeout,
- reenter,
- tx,
- false,
- false
- );
- }
-
- /**
- * Adds new lock candidate.
- *
- * @param nodeId Node ID.
- * @param threadId Thread ID.
- * @param ver Lock version.
- * @param tx Transaction flag.
- * @return Remote candidate.
- */
- GridCacheMvccCandidate addRemote(UUID nodeId, long threadId,
GridCacheVersion ver,
- boolean tx) {
- return mvcc.addRemote(this, nodeId, null, threadId, ver, tx, true,
false);
- }
-
- /**
- * Adds new lock candidate.
- *
- * @param nodeId Node ID.
- * @param threadId Thread ID.
- * @param ver Lock version.
- * @param tx Transaction flag.
- * @return Remote candidate.
- */
- GridCacheMvccCandidate addNearLocal(UUID nodeId, long threadId,
GridCacheVersion ver,
- boolean tx) {
- return mvcc.addNearLocal(this, nodeId, null, threadId, ver, tx, true,
false);
- }
-
- /**
- *
- * @param baseVer Base version.
- */
- void salvageRemote(GridCacheVersion baseVer) {
- mvcc.salvageRemote(baseVer, false);
- }
-
- /**
- * Moves completed candidates right before the base one. Note that
- * if base is not found, then nothing happens and {@code false} is
- * returned.
- *
- * @param baseVer Base version.
- * @param committedVers Committed versions relative to base.
- * @param rolledbackVers Rolled back versions relative to base.
- */
- void orderCompleted(GridCacheVersion baseVer,
- Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledbackVers) {
- mvcc.orderCompleted(baseVer, committedVers, rolledbackVers);
- }
-
- /**
- * @param ver Version.
- */
- void doneRemote(GridCacheVersion ver) {
- mvcc.doneRemote(ver, Collections.<GridCacheVersion>emptyList(),
- Collections.<GridCacheVersion>emptyList(),
Collections.<GridCacheVersion>emptyList());
- }
-
- /**
- * @param baseVer Base version.
- * @param owned Owned.
- */
- void orderOwned(GridCacheVersion baseVer, GridCacheVersion owned) {
- mvcc.markOwned(baseVer, owned);
- }
-
- /**
- * @param ver Lock version to acquire or set to ready.
- */
- void readyLocal(GridCacheVersion ver) {
- mvcc.readyLocal(ver);
- }
-
- /**
- * @param ver Ready near lock version.
- * @param mapped Mapped version.
- * @param committedVers Committed versions.
- * @param rolledbackVers Rolled back versions.
- * @param pending Pending versions.
- */
- void readyNearLocal(GridCacheVersion ver, GridCacheVersion mapped,
- Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledbackVers,
- Collection<GridCacheVersion> pending) {
- mvcc.readyNearLocal(ver, mapped, committedVers, rolledbackVers,
pending);
- }
-
- /**
- * @param cand Candidate to set to ready.
- */
- void readyLocal(GridCacheMvccCandidate cand) {
- mvcc.readyLocal(cand);
- }
-
- /**
- * Local release.
- *
- * @param threadId ID of the thread.
- */
- void releaseLocal(long threadId) {
- mvcc.releaseLocal(threadId);
- }
-
- /**
- *
- */
- void recheckLock() {
- mvcc.recheck();
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheEntryInfo info() {
- return new GridCacheEntryInfo(0, key(), val, version(),
U.currentTimeMillis(), expireTime(), ttl());
- }
-
- /** {@inheritDoc} */
- @Override public boolean valid(AffinityTopologyVersion topVer) {
- return true;
- }
-
- /** @inheritDoc */
- @Override public KeyCacheObject key() {
- return key;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteTxKey txKey() {
- return new IgniteTxKey(key, 0);
- }
-
- /** @inheritDoc */
- @Override public CacheObject rawGet() {
- return val;
- }
-
- /** {@inheritDoc} */
- @Override public boolean hasValue() {
- return val != null;
- }
-
- /** @inheritDoc */
- @Override public CacheObject rawPut(CacheObject val, long ttl) {
- CacheObject old = this.val;
-
- this.ttl = ttl;
- this.val = val;
-
- return old;
- }
-
- /** @inheritDoc */
- @Override public Cache.Entry wrap() {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public Cache.Entry wrapLazyValue(boolean keepBinary) {
- assert false;
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public CacheEntryImplEx wrapVersioned() {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Nullable @Override public CacheObject peekVisibleValue() {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public GridCacheVersion obsoleteVersion() {
- return obsoleteVer;
- }
-
- /** @inheritDoc */
- @Override public boolean obsolete() {
- return obsoleteVer != null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean obsolete(GridCacheVersion exclude) {
- return obsoleteVer != null && !obsoleteVer.equals(exclude);
- }
-
- /** @inheritDoc */
- @Override public boolean invalidate(GridCacheVersion newVer)
- throws IgniteCheckedException {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public boolean evictInternal(GridCacheVersion obsoleteVer,
- @Nullable CacheEntryPredicate[] filter, boolean evictOffheap) {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public boolean isNew() {
- assert false; return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isNewLocked() throws
GridCacheEntryRemovedException {
- assert false; return false;
- }
-
- /** @inheritDoc */
- @Override public CacheObject innerGet(
- @Nullable GridCacheVersion ver,
- @Nullable IgniteInternalTx tx,
- boolean readThrough,
- boolean updateMetrics,
- boolean evt,
- Object transformClo,
- String taskName,
- @Nullable IgniteCacheExpiryPolicy expiryPlc,
- boolean keepBinary) {
- return val;
- }
-
- /** @inheritDoc */
- @Override public void clearReserveForLoad(GridCacheVersion ver) {
- assert false;
- }
-
- /** @inheritDoc */
- @Override public EntryGetResult innerGetAndReserveForLoad(
- boolean updateMetrics,
- boolean evt,
- String taskName,
- @Nullable IgniteCacheExpiryPolicy expiryPlc,
- boolean keepBinary,
- @Nullable ReaderArguments args) throws IgniteCheckedException,
GridCacheEntryRemovedException {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Nullable @Override public EntryGetResult innerGetVersioned(
- @Nullable GridCacheVersion ver,
- IgniteInternalTx tx,
- boolean updateMetrics,
- boolean evt,
- Object transformClo,
- String taskName,
- @Nullable IgniteCacheExpiryPolicy expiryPlc,
- boolean keepBinary,
- @Nullable ReaderArguments readerArgs) {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public CacheObject innerReload() {
- return val;
- }
-
- /** @inheritDoc */
- @Override public GridCacheUpdateTxResult innerSet(@Nullable
IgniteInternalTx tx,
- UUID evtNodeId,
- UUID affNodeId,
- @Nullable CacheObject val,
- boolean writeThrough,
- boolean retval,
- long ttl,
- boolean evt,
- boolean metrics,
- boolean keepBinary,
- boolean keepBinaryInInterceptor,
- boolean hasOldVal,
- @Nullable CacheObject oldVal,
- AffinityTopologyVersion topVer,
- GridDrType drType,
- long drExpireTime,
- @Nullable GridCacheVersion drVer,
- String taskName,
- @Nullable GridCacheVersion dhtVer,
- @Nullable Long updateCntr
- ) {
- rawPut(val, ttl);
-
- return new GridCacheUpdateTxResult(true);
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheUpdateAtomicResult innerUpdate(
- GridCacheVersion ver,
- UUID evtNodeId,
- UUID affNodeId,
- GridCacheOperation op,
- @Nullable Object val,
- @Nullable Object[] invokeArgs,
- boolean writeThrough,
- boolean readThrough,
- boolean retval,
- boolean keepBinary,
- boolean keepBinaryInInterceptor,
- @Nullable IgniteCacheExpiryPolicy expiryPlc,
- boolean evt,
- boolean metrics,
- boolean primary,
- boolean checkVer,
- boolean readRepairRecovery,
- AffinityTopologyVersion topVer,
- @Nullable CacheEntryPredicate[] filter,
- GridDrType drType,
- long conflictTtl,
- long conflictExpireTime,
- @Nullable GridCacheVersion conflictVer,
- boolean conflictResolve,
- boolean intercept,
- String taskName,
- @Nullable CacheObject prevVal,
- @Nullable Long updateCntr,
- @Nullable GridDhtAtomicAbstractUpdateFuture fut,
- boolean transformOp
- ) {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public GridCacheUpdateTxResult innerRemove(
- @Nullable IgniteInternalTx tx,
- UUID evtNodeId,
- UUID affNodeId,
- boolean retval,
- boolean evt,
- boolean metrics,
- boolean keepBinary,
- boolean keepBinaryInInterceptor,
- boolean oldValPresent,
- @Nullable CacheObject oldVal,
- AffinityTopologyVersion topVer,
- GridDrType drType,
- @Nullable GridCacheVersion drVer,
- String taskName,
- @Nullable GridCacheVersion dhtVer,
- @Nullable Long updateCntr
- ) {
- obsoleteVer = ver;
-
- val = null;
-
- return new GridCacheUpdateTxResult(true);
- }
-
- /** @inheritDoc */
- @Override public boolean clear(GridCacheVersion ver, boolean readers)
throws IgniteCheckedException {
- if (ver == null || ver.equals(this.ver)) {
- val = null;
-
- return true;
- }
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public boolean tmLock(IgniteInternalTx tx,
- long timeout,
- @Nullable GridCacheVersion serOrder,
- GridCacheVersion serReadVer,
- boolean read) {
- assert false;
- return false;
- }
-
- /** @inheritDoc */
- @Override public void txUnlock(IgniteInternalTx tx) {
- assert false;
- }
-
- /** @inheritDoc */
- @Override public boolean removeLock(GridCacheVersion ver) {
- GridCacheMvccCandidate doomed = mvcc.candidate(ver);
-
- mvcc.remove(ver);
-
- return doomed != null;
- }
-
- /** @inheritDoc */
- @Override public boolean markObsolete(GridCacheVersion ver) {
- if (ver == null || ver.equals(obsoleteVer)) {
- obsoleteVer = ver;
-
- val = null;
-
- return true;
- }
-
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public void onMarkedObsolete() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public boolean markObsoleteIfEmpty(GridCacheVersion ver) {
- if (val == null)
- obsoleteVer = ver;
-
- return obsoleteVer != null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean markObsoleteVersion(GridCacheVersion ver) {
- if (this.ver.equals(ver)) {
- obsoleteVer = ver;
-
- return true;
- }
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public GridCacheVersion version() {
- return ver;
- }
-
- /** @inheritDoc */
- @Override public boolean checkSerializableReadVersion(GridCacheVersion
ver) {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public boolean initialValue(
- CacheObject val,
- GridCacheVersion ver,
- long ttl,
- long expireTime,
- boolean preload,
- AffinityTopologyVersion topVer,
- GridDrType drType,
- boolean fromStore,
- boolean primary,
- CacheDataRow row
- ) throws IgniteCheckedException, GridCacheEntryRemovedException {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
- @Override public GridCacheVersionedEntryEx versionedEntry(final boolean
keepBinary) throws IgniteCheckedException {
- return null;
- }
-
- /** @inheritDoc */
- @Override public EntryGetResult versionedValue(CacheObject val,
- GridCacheVersion curVer,
- GridCacheVersion newVer,
- @Nullable IgniteCacheExpiryPolicy loadExpiryPlc,
- @Nullable ReaderArguments readerArgs) {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public boolean hasLockCandidate(GridCacheVersion ver) {
- return mvcc.hasCandidate(ver);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByAny(GridCacheVersion... exclude) {
- return !mvcc.isEmpty(exclude);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByThread() {
- return lockedByThread(Thread.currentThread().getId());
- }
-
- /** @inheritDoc */
- @Override public boolean lockedLocally(GridCacheVersion lockVer) {
- return mvcc.isLocallyOwned(lockVer);
- }
-
- /** {@inheritDoc} */
- @Override public boolean lockedLocallyByIdOrThread(GridCacheVersion
lockVer, long threadId)
- throws GridCacheEntryRemovedException {
- return lockedLocally(lockVer) || lockedByThread(threadId);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByThread(long threadId, GridCacheVersion
exclude) {
- return mvcc.isLocallyOwnedByThread(threadId, false, exclude);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByThread(long threadId) {
- return mvcc.isLocallyOwnedByThread(threadId, true);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedBy(GridCacheVersion ver) {
- return mvcc.isOwnedBy(ver);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByThreadUnsafe(long threadId) {
- return mvcc.isLocallyOwnedByThread(threadId, true);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedByUnsafe(GridCacheVersion ver) {
- return mvcc.isOwnedBy(ver);
- }
-
- /** @inheritDoc */
- @Override public boolean lockedLocallyUnsafe(GridCacheVersion lockVer) {
- return mvcc.isLocallyOwned(lockVer);
- }
-
- /** @inheritDoc */
- @Override public boolean hasLockCandidateUnsafe(GridCacheVersion ver) {
- return mvcc.hasCandidate(ver);
- }
-
- /** @inheritDoc */
- @Override public Collection<GridCacheMvccCandidate>
localCandidates(GridCacheVersion... exclude) {
- return mvcc.localCandidates(exclude);
- }
-
- /** @inheritDoc */
- Collection<GridCacheMvccCandidate> localCandidates(boolean reentries,
GridCacheVersion... exclude) {
- return mvcc.localCandidates(reentries, exclude);
- }
-
- /** @inheritDoc */
- @Override public Collection<GridCacheMvccCandidate>
remoteMvccSnapshot(GridCacheVersion... exclude) {
- return mvcc.remoteCandidates(exclude);
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheMvccCandidate localCandidate(long threadId)
throws GridCacheEntryRemovedException {
- return mvcc.localCandidate(threadId);
- }
-
- /** @inheritDoc */
- @Override public GridCacheMvccCandidate candidate(GridCacheVersion ver) {
- return mvcc.candidate(ver);
- }
-
- /** {@inheritDoc} */
- @Override public GridCacheMvccCandidate candidate(UUID nodeId, long
threadId)
- throws GridCacheEntryRemovedException {
- return mvcc.remoteCandidate(nodeId, threadId);
- }
-
- /**
- * @return Any MVCC owner.
- */
- GridCacheMvccCandidate anyOwner() {
- return mvcc.anyOwner();
- }
-
- /** @inheritDoc */
- @Override public GridCacheMvccCandidate localOwner() {
- return mvcc.localOwner();
- }
-
- /** @inheritDoc */
- @Override public CacheObject valueBytes() {
- assert false;
-
- return null;
- }
-
- /** @inheritDoc */
- @Override public CacheObject valueBytes(GridCacheVersion ver) {
- assert false;
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public long rawExpireTime() {
- return 0;
- }
-
- /** @inheritDoc */
- @Override public long expireTime() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public long expireTimeUnlocked() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public boolean onTtlExpired(GridCacheVersion obsoleteVer) {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public long rawTtl() {
- return ttl;
- }
-
- /** @inheritDoc */
- @Override public long ttl() {
- return ttl;
- }
-
- /** @inheritDoc */
- @Override public void updateTtl(GridCacheVersion ver,
IgniteCacheExpiryPolicy expiryPlc) {
- throw new UnsupportedOperationException();
- }
-
- /** @inheritDoc */
- @Override public void updateTtl(GridCacheVersion ver, long ttl) {
- throw new UnsupportedOperationException();
- }
-
- /** {@inheritDoc} */
- @Override public CacheObject unswap() throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public CacheObject unswap(boolean needVal) throws
IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public CacheObject unswap(CacheDataRow row) throws
IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean hasLockCandidate(long threadId) throws
GridCacheEntryRemovedException {
- return localCandidate(threadId) != null;
- }
-
- /** {@inheritDoc} */
- @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public boolean deleted() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean obsoleteOrDeleted() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public CacheObject peek(boolean heap,
- boolean offheap,
- AffinityTopologyVersion topVer,
- @Nullable IgniteCacheExpiryPolicy plc) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public CacheObject peek()
- throws GridCacheEntryRemovedException, IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void onUnlock() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void lockEntry() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void unlockEntry() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public boolean tryLockEntry(long timeout) {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean lockedByCurrentThread() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public void touch() {
- context().evicts().touch(this);
- }
-}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
index f528d534e25..87695faab4d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java
@@ -4626,15 +4626,6 @@ public class IgniteCacheConfigVariationsFullApiTest
extends IgniteCacheConfigVar
}
}
- /**
- * @param cache Cache.
- * @param k Key.
- */
- private void checkKeyAfterLocalEvict(IgniteCache<String, Integer> cache,
String k) {
- assertNull(cache.localPeek(k, ONHEAP));
- assertNotNull(cache.localPeek(k, OFFHEAP));
- }
-
/**
* JUnit.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
index 19171ac1704..534c252d5f2 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
@@ -17,33 +17,25 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.spi.IgniteSpiCloseableIterator;
import org.junit.Test;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CachePeekMode.ALL;
import static org.apache.ignite.cache.CachePeekMode.BACKUP;
@@ -316,845 +308,4 @@ public abstract class IgniteCachePeekModesAbstractTest
extends IgniteCacheAbstra
cache0.removeAll(new HashSet<>(keys));
}
}
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkSizeAffinityFilter(int nodeIdx) throws Exception {
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- final int PUT_KEYS = 10;
-
- List<Integer> keys = null;
-
- try {
- if (cacheMode() == REPLICATED) {
- keys = backupKeys(cache0, 10, 0);
-
- for (Integer key : keys)
- cache0.put(key, String.valueOf(key));
-
- assertEquals(PUT_KEYS, cache0.localSize(BACKUP));
- assertEquals(PUT_KEYS, cache0.localSize(ALL));
- assertEquals(0, cache0.localSize());
- assertEquals(0, cache0.localSize(PRIMARY));
- assertEquals(0, cache0.localSize(NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(0, cache.size(NEAR));
- assertEquals(PUT_KEYS, cache.size(PRIMARY));
- assertEquals(PUT_KEYS * (gridCount() - 1),
cache.size(BACKUP));
- assertEquals(PUT_KEYS * gridCount(), cache.size(PRIMARY,
BACKUP));
- assertEquals(PUT_KEYS * gridCount(), cache.size(ALL)); //
Primary + backups.
- }
- }
- else {
- keys = nearKeys(cache0, PUT_KEYS, 0);
-
- for (Integer key : keys)
- cache0.put(key, String.valueOf(key));
-
- if (hasNearCache()) {
- assertEquals(0, cache0.localSize());
- assertEquals(PUT_KEYS, cache0.localSize(ALL));
- assertEquals(PUT_KEYS, cache0.localSize(NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(PUT_KEYS, cache.size(NEAR));
- assertEquals(PUT_KEYS, cache.size(BACKUP));
- assertEquals(PUT_KEYS * 2, cache.size(PRIMARY,
BACKUP));
- assertEquals(PUT_KEYS * 2 + PUT_KEYS,
cache.size(ALL)); // Primary + backups + near.
- }
- }
- else {
- assertEquals(0, cache0.localSize());
- assertEquals(0, cache0.localSize(ALL));
- assertEquals(0, cache0.localSize(NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(0, cache.size(NEAR));
- assertEquals(PUT_KEYS, cache.size(BACKUP));
- assertEquals(PUT_KEYS * 2, cache.size(PRIMARY,
BACKUP));
- assertEquals(PUT_KEYS * 2, cache.size(ALL)); //
Primary + backups.
- }
- }
-
- assertEquals(0, cache0.localSize(BACKUP));
- assertEquals(0, cache0.localSize(PRIMARY));
- }
-
- checkPrimarySize(PUT_KEYS);
-
- Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
-
- for (int i = 0; i < gridCount(); i++) {
- if (i == nodeIdx)
- continue;
-
- ClusterNode node = ignite(i).cluster().localNode();
-
- int primary = 0;
- int backups = 0;
-
- for (Integer key : keys) {
- if (aff.isPrimary(node, key))
- primary++;
- else if (aff.isBackup(node, key))
- backups++;
- }
-
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(primary, cache.localSize(PRIMARY));
- assertEquals(backups, cache.localSize(BACKUP));
- assertEquals(primary + backups, cache.localSize(PRIMARY,
BACKUP));
- assertEquals(primary + backups, cache.localSize(BACKUP,
PRIMARY));
- assertEquals(primary + backups, cache.localSize(ALL));
- }
-
- cache0.remove(keys.get(0));
-
- checkPrimarySize(PUT_KEYS - 1);
-
- if (cacheMode() == REPLICATED) {
- assertEquals(PUT_KEYS - 1, cache0.localSize(ALL));
- assertEquals(0, cache0.localSize(PRIMARY));
- assertEquals(PUT_KEYS - 1, cache0.localSize(BACKUP));
- }
- else {
- if (hasNearCache())
- assertEquals(PUT_KEYS - 1, cache0.localSize(ALL));
- else
- assertEquals(0, cache0.localSize(ALL));
- }
- }
- finally {
- if (keys != null)
- cache0.removeAll(new HashSet<>(keys));
- }
-
- checkEmpty();
- }
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkPartitionSizeAffinityFilter(int nodeIdx) throws
Exception {
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- final int PUT_KEYS = 10;
-
- int part = nodeIdx;
-
- List<Integer> keys = null;
-
- try {
- if (cacheMode() == REPLICATED) {
- keys = backupKeys(cache0, 10, 0);
-
- for (Integer key : keys)
- cache0.put(key, String.valueOf(key));
-
- int partSize = 0;
-
- for (Integer key : keys) {
- int keyPart =
ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME).partition(key);
- if (keyPart == part)
- partSize++;
- }
-
- assertEquals(PUT_KEYS, cache0.localSize(BACKUP));
- assertEquals(PUT_KEYS, cache0.localSize(ALL));
- assertEquals(partSize, cache0.localSizeLong(part, BACKUP));
- assertEquals(partSize, cache0.localSizeLong(part, ALL));
- assertEquals(0, cache0.localSizeLong(part, PRIMARY));
- assertEquals(0, cache0.localSizeLong(part, NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
- assertEquals(0, cache.size(NEAR));
- assertEquals(partSize, cache.sizeLong(part, PRIMARY));
- assertEquals(partSize * (gridCount() - 1),
cache.sizeLong(part, BACKUP));
- assertEquals(partSize * gridCount(), cache.sizeLong(part,
PRIMARY, BACKUP));
- assertEquals(partSize * gridCount(), cache.sizeLong(part,
ALL)); // Primary + backups.
- }
- }
- else {
- keys = nearKeys(cache0, PUT_KEYS, 0);
-
- for (Integer key : keys)
- cache0.put(key, String.valueOf(key));
-
- int partSize = 0;
-
- for (Integer key :keys) {
- int keyPart =
ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME).partition(key);
- if (keyPart == part)
- partSize++;
- }
-
- if (hasNearCache()) {
- assertEquals(0, cache0.localSize());
- assertEquals(0, cache0.localSizeLong(part, ALL));
- assertEquals(0, cache0.localSizeLong(part, NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(0, cache.sizeLong(part, NEAR));
- assertEquals(partSize, cache.sizeLong(part, BACKUP));
- assertEquals(partSize * 2, cache.sizeLong(part,
PRIMARY, BACKUP));
- assertEquals(partSize * 2, cache.sizeLong(part, ALL));
// Primary + backups + near.
- }
- }
- else {
- assertEquals(0, cache0.localSize());
- //assertEquals(partitionSize,
cache0.localSizeLong(partition, ALL));
- assertEquals(0, cache0.localSizeLong(part, NEAR));
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(0, cache.size(NEAR));
- assertEquals(partSize, cache.sizeLong(part, BACKUP));
- assertEquals(partSize * 2, cache.sizeLong(part,
PRIMARY, BACKUP));
- assertEquals(partSize * 2, cache.sizeLong(part, ALL));
// Primary + backups.
- }
- }
-
- assertEquals(0, cache0.localSize(BACKUP));
- assertEquals(0, cache0.localSize(PRIMARY));
- }
-
- checkPrimarySize(PUT_KEYS);
-
- Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
-
- for (int i = 0; i < gridCount(); i++) {
- if (i == nodeIdx)
- continue;
-
- ClusterNode node = ignite(i).cluster().localNode();
-
- int primary = 0;
- int backups = 0;
-
- for (Integer key : keys) {
- if (aff.isPrimary(node, key) && aff.partition(key) == part)
- primary++;
- else if (aff.isBackup(node, key) && aff.partition(key) ==
part)
- backups++;
- }
-
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(primary, cache.localSizeLong(part, PRIMARY));
- assertEquals(backups, cache.localSizeLong(part, BACKUP));
- assertEquals(primary + backups, cache.localSizeLong(part,
PRIMARY, BACKUP));
- assertEquals(primary + backups, cache.localSizeLong(part,
BACKUP, PRIMARY));
- assertEquals(primary + backups, cache.localSizeLong(part,
ALL));
- }
-
- cache0.remove(keys.get(0));
-
- keys.remove(0);
-
- checkPrimarySize(PUT_KEYS - 1);
-
- int primary = 0;
- int backups = 0;
-
- ClusterNode node = ignite(nodeIdx).cluster().localNode();
-
- for (Integer key : keys) {
- if (aff.isPrimary(node, key) && aff.partition(key) == part)
- primary++;
- else if (aff.isBackup(node, key) && aff.partition(key) == part)
- backups++;
- }
-
- if (cacheMode() == REPLICATED) {
- assertEquals(primary + backups, cache0.localSizeLong(part,
ALL));
- assertEquals(primary, cache0.localSizeLong(part, PRIMARY));
- assertEquals(backups, cache0.localSizeLong(part, BACKUP));
- }
- else {
- if (hasNearCache())
- assertEquals(0, cache0.localSizeLong(part, ALL));
- else
- assertEquals(0, cache0.localSizeLong(part, ALL));
- }
- }
- finally {
- if (keys != null)
- cache0.removeAll(new HashSet<>(keys));
- }
-
- checkEmpty();
- }
-
- /**
- * Checks size is zero.
- */
- private void checkEmpty() {
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(0, cache.localSize());
-
- assertEquals(0, cache.size());
-
- for (CachePeekMode peekMode : CachePeekMode.values()) {
- assertEquals(0, cache.localSize(peekMode));
-
- assertEquals(0, cache.size(peekMode));
- }
- }
-
- checkPrimarySize(0);
- }
-
- /**
- * @param nodeIdx Node index.
- * @return Tuple with primary and backup keys.
- */
- private T2<List<Integer>, List<Integer>> swapKeys(int nodeIdx) {
-// TODO: GG-11148.
-// SwapSpaceSpi swap =
ignite(nodeIdx).configuration().getSwapSpaceSpi();
-//
-// IgniteSpiCloseableIterator<KeyCacheObject> it =
swap.keyIterator(SPACE_NAME, null);
- IgniteSpiCloseableIterator<KeyCacheObject> it = new
GridEmptyCloseableIterator<>();
-
- assertNotNull(it);
-
- Affinity aff = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME);
-
- ClusterNode node = ignite(nodeIdx).cluster().localNode();
-
- List<Integer> primary = new ArrayList<>();
- List<Integer> backups = new ArrayList<>();
-
- CacheObjectContext coctx =
((IgniteEx)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME)
- .context().cacheObjectContext();
-
- while (it.hasNext()) {
- Integer key = it.next().value(coctx, false);
-
- if (aff.isPrimary(node, key))
- primary.add(key);
- else {
- assertTrue(aff.isBackup(node, key));
-
- backups.add(key);
- }
- }
-
- return new T2<>(primary, backups);
- }
-
- /**
- * @param nodeIdx Node index.
- * @return Tuple with number of primary and backup keys.
- */
- private T2<Integer, Integer> swapKeysCount(int nodeIdx) {
- T2<List<Integer>, List<Integer>> keys = swapKeys(nodeIdx);
-
- return new T2<>(keys.get1().size(), keys.get2().size());
- }
-
- /**
- * @param nodeIdx Node index.
- * @return Tuple with primary and backup keys.
- */
- private T2<List<Integer>, List<Integer>> offheapKeys(int nodeIdx) {
- GridCacheAdapter<Integer, String> internalCache =
-
((IgniteKernal)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME);
-
-// TODO GG-11148.
- Iterator<Map.Entry<Integer, String>> offheapIt =
Collections.EMPTY_MAP.entrySet().iterator();
-// if (internalCache.context().isNear())
-// offheapIt =
internalCache.context().near().dht().context().swap().lazyOffHeapIterator(false);
-// else
-// offheapIt =
internalCache.context().swap().lazyOffHeapIterator(false);
-
- Affinity aff = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME);
-
- ClusterNode node = ignite(nodeIdx).cluster().localNode();
-
- List<Integer> primary = new ArrayList<>();
- List<Integer> backups = new ArrayList<>();
-
- while (offheapIt.hasNext()) {
- Map.Entry<Integer, String> e = offheapIt.next();
-
- if (aff.isPrimary(node, e.getKey()))
- primary.add(e.getKey());
- else {
- assertTrue(aff.isBackup(node, e.getKey()));
-
- backups.add(e.getKey());
- }
- }
-
- return new T2<>(primary, backups);
- }
-
- /**
- * @param nodeIdx Node index.
- * @return Tuple with number of primary and backup keys.
- */
- private T2<Integer, Integer> offheapKeysCount(int nodeIdx) {
- T2<List<Integer>, List<Integer>> keys = offheapKeys(nodeIdx);
-
- return new T2<>(keys.get1().size(), keys.get2().size());
- }
-
- /**
- * @param nodeIdx Node index.
- * @param part Cache partition.
- * @return Tuple with number of primary and backup keys (one or both will
be zero).
- */
- private T2<Integer, Integer> offheapKeysCount(int nodeIdx, int part)
throws IgniteCheckedException {
- GridCacheContext ctx =
((IgniteEx)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME).context();
- // Swap and offheap are disabled for near cache.
- IgniteCacheOffheapManager offheapMgr = ctx.isNear() ?
ctx.near().dht().context().offheap() : ctx.offheap();
- //First count entries...
- int cnt = (int)offheapMgr.cacheEntriesCount(ctx.cacheId(), part);
-
- GridCacheAffinityManager aff = ctx.affinity();
- AffinityTopologyVersion topVer = aff.affinityTopologyVersion();
-
- //And then find out whether they are primary or backup ones.
- int primaryCnt = 0;
- int backupCnt = 0;
- if (aff.primaryByPartition(ctx.localNode(), part, topVer))
- primaryCnt = cnt;
- else if (aff.backupByPartition(ctx.localNode(), part, topVer))
- backupCnt = cnt;
- return new T2<>(primaryCnt, backupCnt);
- }
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkSizeStorageFilter(int nodeIdx) throws Exception {
- if (true) // TODO GG-11148.
- return;
-
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- List<Integer> primaryKeys = primaryKeys(cache0, 100, 10_000);
- List<Integer> backupKeys = backupKeys(cache0, 100, 10_000);
-
- try {
- final String val = "test_value";
-
- for (int i = 0; i < 100; i++) {
- cache0.put(primaryKeys.get(i), val);
- cache0.put(backupKeys.get(i), val);
- }
-
- int totalKeys = 200;
-
- T2<Integer, Integer> swapKeys = swapKeysCount(nodeIdx);
-
- assertTrue(swapKeys.get1() > 0);
- assertTrue(swapKeys.get2() > 0);
-
- T2<Integer, Integer> offheapKeys = offheapKeysCount(nodeIdx);
-
- assertTrue(offheapKeys.get1() > 0);
- assertTrue(offheapKeys.get2() > 0);
-
- int totalSwap = swapKeys.get1() + swapKeys.get2();
- int totalOffheap = offheapKeys.get1() + offheapKeys.get2();
-
- log.info("Local keys [total=" + totalKeys + ", offheap=" +
offheapKeys + ", swap=" + swapKeys + ']');
-
- assertTrue(totalSwap + totalOffheap < totalKeys);
-
- assertEquals(primaryKeys.size(), cache0.localSize());
- assertEquals(totalKeys, cache0.localSize(ALL));
- assertEquals(totalOffheap, cache0.localSize(PRIMARY, BACKUP, NEAR,
OFFHEAP));
- assertEquals(totalSwap, cache0.localSize(PRIMARY, BACKUP, NEAR));
- assertEquals(totalKeys - (totalOffheap + totalSwap),
cache0.localSize(PRIMARY, BACKUP, NEAR, ONHEAP));
- assertEquals(totalKeys, cache0.localSize(PRIMARY, BACKUP, NEAR,
OFFHEAP, ONHEAP));
-
- assertEquals(swapKeys.get1(), (Integer)cache0.localSize(PRIMARY));
- assertEquals(swapKeys.get2(), (Integer)cache0.localSize(BACKUP));
-
- assertEquals(offheapKeys.get1(),
(Integer)cache0.localSize(OFFHEAP, PRIMARY));
- assertEquals(offheapKeys.get2(),
(Integer)cache0.localSize(OFFHEAP, BACKUP));
-
- assertEquals(swapKeys.get1() + offheapKeys.get1(),
cache0.localSize(OFFHEAP, PRIMARY));
- assertEquals(swapKeys.get2() + offheapKeys.get2(),
cache0.localSize(OFFHEAP, BACKUP));
-
- assertEquals(totalSwap + totalOffheap, cache0.localSize(PRIMARY,
BACKUP, NEAR, OFFHEAP));
-
- int globalSwapPrimary = 0;
- int globalSwapBackup = 0;
-
- int globalOffheapPrimary = 0;
- int globalOffheapBackup = 0;
-
- for (int i = 0; i < gridCount(); i++) {
- T2<Integer, Integer> swap = swapKeysCount(i);
-
- globalSwapPrimary += swap.get1();
- globalSwapBackup += swap.get2();
-
- T2<Integer, Integer> offheap = offheapKeysCount(i);
-
- globalOffheapPrimary += offheap.get1();
- globalOffheapBackup += offheap.get2();
- }
-
- int backups;
-
- if (cacheMode() == PARTITIONED)
- backups = 1;
- else // REPLICATED.
- backups = gridCount() - 1;
-
- int globalTotal = totalKeys + totalKeys * backups;
- int globalTotalSwap = globalSwapPrimary + globalSwapBackup;
- int globalTotalOffheap = globalOffheapPrimary +
globalOffheapBackup;
-
- log.info("Global keys [total=" + globalTotal +
- ", offheap=" + globalTotalOffheap +
- ", swap=" + globalTotalSwap + ']');
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(totalKeys, cache.size(PRIMARY));
- assertEquals(globalTotal, cache.size(ALL));
- assertEquals(globalTotal, cache.size(PRIMARY, BACKUP, NEAR,
ONHEAP, OFFHEAP));
- assertEquals(globalTotal, cache.size(ONHEAP, OFFHEAP, PRIMARY,
BACKUP));
-
- assertEquals(globalTotalSwap, cache.size(PRIMARY, BACKUP,
NEAR));
- assertEquals(globalSwapPrimary, cache.size(PRIMARY));
- assertEquals(globalSwapBackup, cache.size(BACKUP));
-
- assertEquals(globalTotalOffheap, cache.size(PRIMARY, BACKUP,
NEAR, OFFHEAP));
- assertEquals(globalOffheapPrimary, cache.size(OFFHEAP,
PRIMARY));
- assertEquals(globalOffheapBackup, cache.size(OFFHEAP, BACKUP));
-
- assertEquals(globalTotalSwap + globalTotalOffheap,
cache.size(PRIMARY, BACKUP, NEAR, OFFHEAP));
- assertEquals(globalSwapPrimary + globalOffheapPrimary,
cache.size(OFFHEAP, PRIMARY));
- assertEquals(globalSwapBackup + globalOffheapBackup,
cache.size(OFFHEAP, BACKUP));
-
- assertEquals(globalTotal - (globalTotalOffheap +
globalTotalSwap), cache.size(PRIMARY, BACKUP, NEAR, ONHEAP));
- }
- }
- finally {
- cache0.removeAll(new HashSet<>(primaryKeys));
- cache0.removeAll(new HashSet<>(backupKeys));
- }
-
- checkEmpty();
- }
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkPartitionSizeStorageFilter(int nodeIdx) throws Exception
{
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- int part = nodeIdx;
-
- List<Integer> primaryKeys = primaryKeys(cache0, 100, 10_000);
- List<Integer> backupKeys = backupKeys(cache0, 100, 10_000);
-
- try {
- final String val = "test_value";
-
- for (int i = 0; i < 100; i++) {
- cache0.put(primaryKeys.get(i), val);
- cache0.put(backupKeys.get(i), val);
- }
-
- int totalKeys = 200;
-
- T2<Integer, Integer> offheapKeys = offheapKeysCount(nodeIdx, part);
-
- int totalOffheap = offheapKeys.get1() + offheapKeys.get2();
-
- log.info("Local keys [total=" + totalKeys + ", offheap=" +
offheapKeys + ']');
-
- assertTrue(totalOffheap < totalKeys);
-
- assertEquals(primaryKeys.size(), cache0.localSize());
- assertEquals(totalKeys, cache0.localSize(ALL));
- assertEquals(totalOffheap, cache0.localSizeLong(part, PRIMARY,
BACKUP, NEAR, OFFHEAP));
-
- assertEquals((long)offheapKeys.get1(), cache0.localSizeLong(part,
OFFHEAP, PRIMARY));
- assertEquals((long)offheapKeys.get2(), cache0.localSizeLong(part,
OFFHEAP, BACKUP));
-
- int globalParitionSwapPrimary = 0;
- int globalPartSwapBackup = 0;
-
- int globalPartOffheapPrimary = 0;
- int globalPartOffheapBackup = 0;
-
- for (int i = 0; i < gridCount(); i++) {
- T2<Integer, Integer> offheap = offheapKeysCount(i, part);
-
- globalPartOffheapPrimary += offheap.get1();
- globalPartOffheapBackup += offheap.get2();
- }
-
- int backups;
-
- if (cacheMode() == PARTITIONED)
- backups = 1;
- else // REPLICATED.
- backups = gridCount() - 1;
-
- int globalTotal = totalKeys + totalKeys * backups;
- int globalPartTotalSwap = globalParitionSwapPrimary +
globalPartSwapBackup;
- int globalPartTotalOffheap = globalPartOffheapPrimary +
globalPartOffheapBackup;
-
- log.info("Global keys [total=" + globalTotal +
- ", offheap=" + globalPartTotalOffheap +
- ", swap=" + globalPartTotalSwap + ']');
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(totalKeys, cache.size(PRIMARY));
- assertEquals(globalTotal, cache.size(ALL));
- assertEquals(globalTotal, cache.size(PRIMARY, BACKUP, NEAR,
ONHEAP, OFFHEAP));
- assertEquals(globalTotal, cache.size(ONHEAP, OFFHEAP, PRIMARY,
BACKUP));
-
- assertEquals(globalPartTotalSwap, cache.sizeLong(part,
PRIMARY, BACKUP, NEAR));
- assertEquals(globalParitionSwapPrimary, cache.sizeLong(part,
PRIMARY));
- assertEquals(globalPartSwapBackup, cache.sizeLong(part,
BACKUP));
-
- assertEquals(globalPartTotalOffheap, cache.sizeLong(part,
PRIMARY, BACKUP, NEAR, OFFHEAP));
- assertEquals(globalPartOffheapPrimary, cache.sizeLong(part,
OFFHEAP, PRIMARY));
- assertEquals(globalPartOffheapBackup, cache.sizeLong(part,
OFFHEAP, BACKUP));
-
- assertEquals(globalPartTotalSwap + globalPartTotalOffheap,
cache.sizeLong(part, PRIMARY, BACKUP, NEAR, OFFHEAP));
- assertEquals(globalParitionSwapPrimary +
globalPartOffheapPrimary, cache.sizeLong(part, OFFHEAP, PRIMARY));
- assertEquals(globalPartSwapBackup + globalPartOffheapBackup,
cache.sizeLong(part, OFFHEAP, BACKUP));
- }
- }
- finally {
- cache0.removeAll(new HashSet<>(primaryKeys));
- cache0.removeAll(new HashSet<>(backupKeys));
- }
-
- checkEmpty();
- }
-
- /**
- * @param exp Expected size.
- */
- private void checkPrimarySize(int exp) {
- int size = 0;
-
- for (int i = 0; i < gridCount(); i++) {
- IgniteCache<Integer, String> cache = jcache(i);
-
- assertEquals(exp, cache.size(PRIMARY));
-
- size += cache.localSize(PRIMARY);
-
- assertEquals(exp, (int)cache.sizeAsync(PRIMARY).get());
- }
-
- assertEquals(exp, size);
- }
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkLocalEntriesStorageFilter(int nodeIdx) throws Exception {
- if (true) // TODO GG-11148.
- return;
-
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- List<Integer> primaryKeys = primaryKeys(cache0, 100, 10_000);
- List<Integer> backupKeys = backupKeys(cache0, 100, 10_000);
-
- try {
- final String val = "test_value-";
-
- for (int i = 0; i < 100; i++) {
- cache0.put(primaryKeys.get(i), val + primaryKeys.get(i));
- cache0.put(backupKeys.get(i), val + backupKeys.get(i));
- }
-
- int totalKeys = 200;
-
- T2<List<Integer>, List<Integer>> swapKeys = swapKeys(nodeIdx);
-
- assertTrue(!swapKeys.get1().isEmpty());
- assertTrue(!swapKeys.get2().isEmpty());
-
- T2<List<Integer>, List<Integer>> offheapKeys =
offheapKeys(nodeIdx);
-
- assertTrue(!offheapKeys.get1().isEmpty());
- assertTrue(!offheapKeys.get2().isEmpty());
-
- List<Integer> swap = new ArrayList<>();
-
- swap.addAll(swapKeys.get1());
- swap.addAll(swapKeys.get2());
-
- assertFalse(swap.isEmpty());
-
- List<Integer> offheap = new ArrayList<>();
-
- offheap.addAll(offheapKeys.get1());
- offheap.addAll(offheapKeys.get2());
-
- assertFalse(offheap.isEmpty());
-
- List<Integer> heap = new ArrayList<>();
-
- heap.addAll(primaryKeys);
- heap.addAll(backupKeys);
-
- heap.removeAll(swap);
- heap.removeAll(offheap);
-
- log.info("Keys [total=" + totalKeys +
- ", offheap=" + offheap.size() +
- ", swap=" + swap.size() + ']');
-
- assertFalse(heap.isEmpty());
-
- checkLocalEntries(cache0.localEntries(), val, primaryKeys,
backupKeys);
- checkLocalEntries(cache0.localEntries(ALL), val, primaryKeys,
backupKeys);
- checkLocalEntries(cache0.localEntries(ONHEAP, OFFHEAP), val,
primaryKeys, backupKeys);
-
- checkLocalEntries(cache0.localEntries(), val, swap);
- checkLocalEntries(cache0.localEntries(OFFHEAP), val, offheap);
- checkLocalEntries(cache0.localEntries(ONHEAP), val, heap);
-
- checkLocalEntries(cache0.localEntries(OFFHEAP), val, swap,
offheap);
- checkLocalEntries(cache0.localEntries(ONHEAP), val, swap, heap);
-
- checkLocalEntries(cache0.localEntries(PRIMARY), val,
swapKeys.get1());
- checkLocalEntries(cache0.localEntries(BACKUP), val,
swapKeys.get2());
- checkLocalEntries(cache0.localEntries(OFFHEAP, PRIMARY), val,
offheapKeys.get1());
- checkLocalEntries(cache0.localEntries(OFFHEAP, BACKUP), val,
offheapKeys.get2());
-
- checkLocalEntries(cache0.localEntries(OFFHEAP, PRIMARY), val,
swapKeys.get1(), offheapKeys.get1());
- checkLocalEntries(cache0.localEntries(OFFHEAP, BACKUP), val,
swapKeys.get2(), offheapKeys.get2());
- checkLocalEntries(cache0.localEntries(OFFHEAP, PRIMARY, BACKUP),
val, swap, offheap);
- }
- finally {
- cache0.removeAll(new HashSet<>(primaryKeys));
- cache0.removeAll(new HashSet<>(backupKeys));
- }
- }
-
- /**
- * @param nodeIdx Node index.
- * @throws Exception If failed.
- */
- private void checkLocalEntriesAffinityFilter(int nodeIdx) throws Exception
{
- IgniteCache<Integer, String> cache0 = jcache(nodeIdx);
-
- final int PUT_KEYS = 10;
-
- List<Integer> primaryKeys = null;
- List<Integer> backupKeys = null;
- List<Integer> nearKeys = null;
-
- try {
- primaryKeys = primaryKeys(cache0, PUT_KEYS, 0);
- backupKeys = backupKeys(cache0, PUT_KEYS, 0);
-
- for (Integer key : primaryKeys)
- cache0.put(key, String.valueOf(key));
- for (Integer key : backupKeys)
- cache0.put(key, String.valueOf(key));
-
- nearKeys = cacheMode() == PARTITIONED ? nearKeys(cache0, PUT_KEYS,
0) : Collections.<Integer>emptyList();
-
- for (Integer key : nearKeys)
- cache0.put(key, String.valueOf(key));
-
- log.info("Keys [near=" + nearKeys + ", primary=" + primaryKeys +
", backup=" + backupKeys + ']');
-
- if (hasNearCache()) {
- checkLocalEntries(cache0.localEntries(), nearKeys,
primaryKeys, backupKeys);
- checkLocalEntries(cache0.localEntries(ALL), nearKeys,
primaryKeys, backupKeys);
- checkLocalEntries(cache0.localEntries(NEAR), nearKeys);
- checkLocalEntries(cache0.localEntries(PRIMARY, BACKUP, NEAR),
nearKeys, primaryKeys, backupKeys);
- checkLocalEntries(cache0.localEntries(NEAR, PRIMARY),
nearKeys, primaryKeys);
- checkLocalEntries(cache0.localEntries(NEAR, BACKUP), nearKeys,
backupKeys);
- }
- else {
- checkLocalEntries(cache0.localEntries(), primaryKeys,
backupKeys);
- checkLocalEntries(cache0.localEntries(ALL), primaryKeys,
backupKeys);
- checkLocalEntries(cache0.localEntries(NEAR));
- checkLocalEntries(cache0.localEntries(NEAR, PRIMARY),
primaryKeys);
- checkLocalEntries(cache0.localEntries(NEAR, BACKUP),
backupKeys);
- checkLocalEntries(cache0.localEntries(PRIMARY, BACKUP, NEAR),
primaryKeys, backupKeys);
- }
-
- checkLocalEntries(cache0.localEntries(PRIMARY), primaryKeys);
- checkLocalEntries(cache0.localEntries(BACKUP), backupKeys);
- checkLocalEntries(cache0.localEntries(PRIMARY, BACKUP),
primaryKeys, backupKeys);
- }
- finally {
- if (primaryKeys != null)
- cache0.removeAll(new HashSet<>(primaryKeys));
-
- if (backupKeys != null)
- cache0.removeAll(new HashSet<>(backupKeys));
-
- if (nearKeys != null)
- cache0.removeAll(new HashSet<>(nearKeys));
- }
- }
-
- /**
- * @param entries Entries.
- * @param exp Expected entries.
- */
- private void checkLocalEntries(Iterable<Cache.Entry<Integer, String>>
entries, Collection<Integer>... exp) {
- checkLocalEntries(entries, "", exp);
- }
-
- /**
- * @param entries Entries.
- * @param expVal Expected value.
- * @param exp Expected keys.
- */
- private void checkLocalEntries(Iterable<Cache.Entry<Integer, String>>
entries,
- String expVal,
- Collection<Integer>... exp) {
- Set<Integer> allExp = new HashSet<>();
-
- for (Collection<Integer> col : exp)
- assertTrue(allExp.addAll(col));
-
- for (Cache.Entry<Integer, String> e : entries) {
- assertNotNull(e.getKey());
- assertNotNull(e.getValue());
- assertEquals(expVal + e.getKey(), e.getValue());
-
- assertTrue("Unexpected entry: " + e, allExp.remove(e.getKey()));
- }
-
- assertTrue("Expected entries not found: " + allExp, allExp.isEmpty());
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
index 9a88f28b973..4d941cc1803 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueEntryMoveSelfTest.java
@@ -17,9 +17,7 @@
package org.apache.ignite.internal.processors.cache.datastructures.partitioned;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import org.apache.ignite.Ignite;
@@ -27,14 +25,11 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import
org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl;
import
org.apache.ignite.internal.processors.cache.datastructures.IgniteCollectionAbstractTest;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
@@ -200,18 +195,4 @@ public class GridCachePartitionedQueueEntryMoveSelfTest
extends IgniteCollection
throw new IgniteCheckedException("Unable to move the queue to a new
primary node");
}
-
- /**
- * @param aff Affinity function.
- * @param part Partition.
- * @param nodes Topology nodes.
- * @return Affinity nodes for partition.
- */
- private Collection<ClusterNode> nodes(AffinityFunction aff, int part,
Collection<ClusterNode> nodes) {
- List<List<ClusterNode>> assignment = aff.assignPartitions(
- new GridAffinityFunctionContextImpl(new ArrayList<>(nodes), null,
null, new AffinityTopologyVersion(1),
- BACKUP_CNT));
-
- return assignment.get(part);
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
index 72aa8a4a59e..49f5f83899f 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBlockOnReadAbstractTest.java
@@ -1438,13 +1438,6 @@ public abstract class CacheBlockOnReadAbstractTest
extends GridCommonAbstractTes
return params;
}
- /**
- * Assert that two numbers are close to each other.
- */
- private static void assertAlmostEqual(long exp, long actual) {
- assertTrue(String.format("Numbers differ too much [exp=%d,
actual=%d]", exp, actual), almostEqual(exp, actual));
- }
-
/**
* Assert that two numbers are not close to each other.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
index e99f819d684..e0b82a5b25d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
@@ -471,18 +471,6 @@ public abstract class
IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
}
}
- /**
- * @return All node IDs.
- */
- private Collection<UUID> allNodeIds() {
- Collection<UUID> nodeIds = new ArrayList<>(gridCount());
-
- for (int i = 0; i < gridCount(); i++)
- nodeIds.add(grid(i).localNode().id());
-
- return nodeIds;
- }
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
index 42060fab261..9c38fed0f2a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
@@ -259,12 +259,6 @@ public class GridCacheDhtPreloadDisabledSelfTest extends
GridCommonAbstractTest
}
}
- /** @param grids Grids to stop. */
- private void stopGrids(Iterable<Ignite> grids) {
- for (Ignite g : grids)
- stopGrid(g.name());
- }
-
/**
* @param c Cache.
* @param cnt Key count.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
index 649dbd24a99..5eeaafa6324 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
@@ -443,14 +443,6 @@ public class GridCacheDhtPreloadSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * @param grids Grids to stop.
- */
- private void stopGrids(Iterable<Ignite> grids) {
- for (Ignite g : grids)
- stopGrid(g.name());
- }
-
/**
* @param keyCnt Key count.
* @param nodeCnt Node count.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
index 47362d65149..f157b7d1770 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
@@ -20,30 +20,20 @@ package
org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.Collection;
import java.util.LinkedList;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteKernal;
-import
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
-import
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheRebalanceMode.ASYNC;
-import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
import static org.apache.ignite.configuration.DeploymentMode.CONTINUOUS;
import static
org.apache.ignite.configuration.IgniteConfiguration.DFLT_REBALANCE_BATCH_SIZE;
-import static
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING;
/**
* Test cases for partitioned cache {@link GridDhtPreloader preloader}.
@@ -128,14 +118,6 @@ public class GridCacheDhtPreloadStartStopSelfTest extends
GridCommonAbstractTest
return TEST_TIMEOUT;
}
- /**
- * @param c Cache.
- * @return {@code True} if synchronoous preloading.
- */
- private boolean isSync(IgniteCache<?, ?> c) {
- return c.getConfiguration(CacheConfiguration.class).getRebalanceMode()
== SYNC;
- }
-
/**
* @param cnt Number of grids.
* @param startIdx Start node index.
@@ -168,90 +150,4 @@ public class GridCacheDhtPreloadStartStopSelfTest extends
GridCommonAbstractTest
stopGrids(ignites);
}
-
- /**
- * @param keyCnt Key count.
- * @param nodeCnt Node count.
- * @throws Exception If failed.
- */
- private void checkNodes(int keyCnt, int nodeCnt) throws Exception {
- try {
- Ignite g1 = startGrid(0);
-
- IgniteCache<Integer, String> c1 = g1.cache(DEFAULT_CACHE_NAME);
-
- putKeys(c1, keyCnt);
- checkKeys(c1, keyCnt);
-
- Collection<Ignite> ignites = new LinkedList<>();
-
- startGrids(nodeCnt, 1, ignites);
-
- // Check all nodes.
- for (Ignite g : ignites) {
- IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
-
- checkKeys(c, keyCnt);
- }
-
- info(">>> Finished checking nodes [keyCnt=" + keyCnt + ",
nodeCnt=" + nodeCnt + ']');
-
- stopGrids(ignites);
-
- GridDhtCacheAdapter<Integer, String> dht = dht(c1);
-
- info(">>> Waiting for preload futures...");
-
- GridCachePartitionExchangeManager<Object, Object> exchMgr
- = ((IgniteKernal)g1).context().cache().context().exchange();
-
- // Wait for exchanges to complete.
- for (IgniteInternalFuture<?> fut : exchMgr.exchangeFutures())
- fut.get();
-
- Affinity<Integer> aff = affinity(c1);
-
- for (int i = 0; i < keyCnt; i++) {
- if
(aff.mapPartitionToPrimaryAndBackups(aff.partition(i)).contains(g1.cluster().localNode()))
{
- GridDhtPartitionTopology top = dht.topology();
-
- for (GridDhtLocalPartition p : top.localPartitions())
- assertEquals("Invalid partition state for partition: "
+ p, OWNING, p.state());
- }
- }
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
- * @param c Cache.
- * @param cnt Key count.
- */
- private void putKeys(IgniteCache<Integer, String> c, int cnt) {
- for (int i = 0; i < cnt; i++)
- c.put(i, Integer.toString(i));
- }
-
- /**
- * @param c Cache.
- * @param cnt Key count.
- */
- private void checkKeys(IgniteCache<Integer, String> c, int cnt) {
- Affinity<Integer> aff = affinity(c);
-
- boolean sync = isSync(c);
-
- Ignite ignite = c.unwrap(Ignite.class);
-
- for (int i = 0; i < cnt; i++) {
- if
(aff.mapPartitionToPrimaryAndBackups(aff.partition(i)).contains(ignite.cluster().localNode()))
{
- String val = sync ? c.localPeek(i, CachePeekMode.ONHEAP) :
c.get(i);
-
- assertEquals("Key check failed [igniteInstanceName=" +
ignite.name() + ", cache=" + c.getName() +
- ", key=" + i + ']', Integer.toString(i), val);
- }
- }
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
index d400a271cb2..ff02a7d585a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteBaselineAffinityTopologyActivationTest.java
@@ -19,8 +19,6 @@ package
org.apache.ignite.internal.processors.cache.persistence;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -39,7 +37,6 @@ 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.cluster.DetachedClusterNode;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
import org.apache.ignite.internal.processors.cluster.BaselineTopology;
@@ -752,17 +749,6 @@ public class IgniteBaselineAffinityTopologyActivationTest
extends GridCommonAbst
verifyBaselineTopologyOnNodes(verifier, new Ignite[] {nodeA, nodeB});
}
- /**
- * Creates BaselineNode with specific attribute indicating that this node
is not client.
- */
- private BaselineNode createBaselineNodeWithConsId(String consId) {
- Map<String, Object> attrs = new HashMap<>();
-
- attrs.put("org.apache.ignite.cache.client", false);
-
- return new DetachedClusterNode(consId, attrs);
- }
-
/** */
@Test
public void testAutoActivationSimple() throws Exception {
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
index 34d9efacd1c..1be7ff806b1 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
@@ -128,14 +128,6 @@ public class IgnitePdsCorruptedStoreTest extends
GridCommonAbstractTest {
return cfg;
}
- /**
- * @return File or folder in work directory.
- * @throws IgniteCheckedException If failed to resolve file name.
- */
- private File file(String file) throws IgniteCheckedException {
- return U.resolveWorkDirectory(U.defaultWorkDirectory(), file, false);
- }
-
/**
* Create cache configuration.
*
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
index d0b23132275..2474cc5ce8c 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
@@ -829,29 +828,6 @@ public class LocalWalModeChangeDuringRebalancingSelfTest
extends GridCommonAbstr
ig.context().cache().context().exchange().lastTopologyFuture().get();
}
- /**
- * Put random values to cache in multiple threads until time interval
given expires.
- *
- * @param cache Cache to modify.
- * @param threadCnt Number ot threads to be used.
- * @param duration Time interval in milliseconds.
- * @throws Exception When something goes wrong.
- */
- private void doLoad(IgniteCache<Integer, Integer> cache, int threadCnt,
long duration) throws Exception {
- GridTestUtils.runMultiThreaded(() -> {
- long stopTs = U.currentTimeMillis() + duration;
-
- int keysCnt = getKeysCount();
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- do {
- cache.put(rnd.nextInt(keysCnt), rnd.nextInt());
- }
- while (U.currentTimeMillis() < stopTs);
- }, threadCnt, "load-cache");
- }
-
/**
*
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java
index 479381e197d..dd1ab1e1352 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java
@@ -21,10 +21,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Map;
import java.util.Random;
-import java.util.Set;
-import java.util.TreeSet;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -32,7 +29,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
@@ -441,39 +437,6 @@ public class IgniteMassLoadSandboxTest extends
GridCommonAbstractTest {
watchdog2.stop();
}
- /**
- * @param threads Threads count.
- * @param recsPerThread initial records per thread.
- * @param restartedCache cache to obtain data from.
- */
- private void verifyByChunk(int threads, int recsPerThread, Cache<Integer,
HugeIndexedObject> restartedCache) {
- int verifyChunk = 100;
-
- int totalRecsToVerify = recsPerThread * threads;
- int chunks = totalRecsToVerify / verifyChunk;
-
- for (int c = 0; c < chunks; c++) {
- Set<Integer> keys = new TreeSet<>();
-
- for (int i = 0; i < verifyChunk; i++)
- keys.add(i + c * verifyChunk);
-
- Map<Integer, HugeIndexedObject> values =
restartedCache.getAll(keys);
-
- for (Map.Entry<Integer, HugeIndexedObject> next :
values.entrySet()) {
- Integer key = next.getKey();
-
- int actVal = values.get(next.getKey()).iVal;
- int i = key;
- Assert.assertEquals(i, actVal);
-
- if (i % 1000 == 0)
- X.println(" >> Verified: " + i);
- }
-
- }
- }
-
/**
* @param id entry id.
* @return {@code True} if need to keep entry in DB and checkpoint it.
Most of entries not required.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
index 340b84d5c0c..399c85cda7a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalDeletionArchiveAbstractTest.java
@@ -114,13 +114,6 @@ public abstract class WalDeletionArchiveAbstractTest
extends GridCommonAbstractT
*/
protected abstract WALMode walMode();
- /**
- * find first cause's message
- */
- private String findSourceMessage(Throwable ex) {
- return ex.getCause() == null ? ex.getMessage() :
findSourceMessage(ex.getCause());
- }
-
/**
* Correct delete archived wal files.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
index 353ba0bb5f7..b99083fef66 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
@@ -33,7 +33,6 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.BiFunction;
import java.util.stream.LongStream;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
@@ -58,7 +57,6 @@ import
org.apache.ignite.internal.processors.cache.persistence.file.FileIODecora
import
org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore;
import
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
-import
org.apache.ignite.internal.processors.cache.persistence.file.FileVersionCheckingFactory;
import
org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
import
org.apache.ignite.internal.processors.cache.persistence.filename.FileTreeUtils;
import
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
@@ -81,7 +79,6 @@ import static
org.apache.ignite.internal.processors.cache.persistence.partstate.
import static
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.CP_SNAPSHOT_REASON;
import static
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_RUNNER_THREAD_PREFIX;
import static
org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
-import static org.apache.ignite.testframework.GridTestUtils.setFieldValue;
import static org.junit.Assume.assumeFalse;
/**
@@ -781,14 +778,6 @@ public class IgniteSnapshotManagerSelfTest extends
AbstractSnapshotSelfTest {
return startGridWithCache(ccfg, CACHE_KEYS_RANGE);
}
- /**
- * @param ignite Ignite instance to set factory.
- * @param factory New factory to use.
- */
- private static void snapshotStoreFactory(IgniteEx ignite,
BiFunction<Integer, Boolean, FileVersionCheckingFactory> factory) {
- setFieldValue(snp(ignite), "storeFactory", factory);
- }
-
/**
* @param mgr Snapshot manager.
* @param snpName Snapshot name.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index d99b6f7b26f..70fa1391be7 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -2166,84 +2166,6 @@ public abstract class
CacheContinuousQueryFailoverAbstractSelfTest extends GridC
cur.close();
}
- /**
- * @param logAll If {@code true} logs all unexpected values.
- * @param expEvts Expected values.
- * @param lsnr Listener.
- * @return Check status.
- */
- @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
- private boolean checkEvents(boolean logAll,
- Map<Integer, List<T2<Integer, Integer>>> expEvts,
- CacheEventListener2 lsnr) {
- assertTrue(!expEvts.isEmpty());
-
- boolean pass = true;
-
- for (Map.Entry<Integer, List<T2<Integer, Integer>>> e :
expEvts.entrySet()) {
- Integer key = e.getKey();
- List<T2<Integer, Integer>> exp = e.getValue();
-
- List<CacheEntryEvent<?, ?>> rcvdEvts = lsnr.evts.get(key);
-
- if (rcvdEvts == null) {
- pass = false;
-
- log.info("No events for key [key=" + key + ", exp=" +
e.getValue() + ']');
-
- if (!logAll)
- return false;
- }
- else {
- synchronized (rcvdEvts) {
- if (rcvdEvts.size() != exp.size()) {
- pass = false;
-
- log.info("Missed or extra events for key [key=" + key +
- ", exp=" + e.getValue() +
- ", rcvd=" + rcvdEvts + ']');
-
- if (!logAll)
- return false;
- }
-
- int cnt = Math.min(rcvdEvts.size(), exp.size());
-
- for (int i = 0; i < cnt; i++) {
- T2<Integer, Integer> expEvt = exp.get(i);
- CacheEntryEvent<?, ?> rcvdEvt = rcvdEvts.get(i);
-
- if (pass) {
- assertEquals(key, rcvdEvt.getKey());
- assertEquals(expEvt.get1(), rcvdEvt.getValue());
- }
- else {
- if (!key.equals(rcvdEvt.getKey()) ||
!expEvt.get1().equals(rcvdEvt.getValue()))
- log.warning("Missed events. [key=" + key + ",
actKey=" + rcvdEvt.getKey()
- + ", expVal=" + expEvt.get1() + ",
actVal=" + rcvdEvt.getValue() + "]");
- }
- }
-
- if (!pass) {
- for (int i = cnt; i < exp.size(); i++) {
- T2<Integer, Integer> val = exp.get(i);
-
- log.warning("Missed events. [key=" + key + ",
expVal=" + val.get1()
- + ", prevVal=" + val.get2() + "]");
- }
- }
- }
- }
- }
-
- if (pass) {
- expEvts.clear();
- lsnr.evts.clear();
- }
-
- return pass;
- }
-
/**
* This is failover test detecting CQ event loss while topology changing.
*
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
index e7c21a3ed30..d447fd14aab 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
@@ -121,13 +121,6 @@ public class IgniteCacheWriteBehindNoUpdateSelfTest
extends GridCommonAbstractTe
/** */
private AtomicInteger writeCnt = new AtomicInteger();
- /**
- *
- */
- public void resetWrites() {
- writeCnt.set(0);
- }
-
/** {@inheritDoc} */
@Override public Long load(String key) throws CacheLoaderException {
return null;
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index c16bf257775..42306ea398d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -152,19 +152,6 @@ public class GridEventConsumeSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * @param proc Continuous processor.
- * @return Local event routines.
- */
- private Collection<ContinousRoutineLocalInfo>
localRoutines(GridContinuousProcessor proc) {
- return F.view(U.<Map<UUID, ContinousRoutineLocalInfo>>field(proc,
"locInfos").values(),
- new IgnitePredicate<>() {
- @Override public boolean apply(ContinousRoutineLocalInfo info)
{
- return info.handler().isEvents();
- }
- });
- }
-
/**
* @throws Exception If failed.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
index a617a4f361a..426ee2e3d9a 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java
@@ -1518,14 +1518,6 @@ public class BPlusTreeSelfTest extends
GridCommonAbstractTest {
assertNoLocks();
}
- /** */
- private void doTestCursor(boolean canGetRow) throws IgniteCheckedException
{
- TestTree tree = createTestTree(canGetRow);
-
- for (long i = 15; i >= 0; i--)
- tree.put(i);
- }
-
/**
* @throws IgniteCheckedException If failed.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index be549b01534..fae844a99ef 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -689,34 +689,6 @@ public class DataStreamProcessorSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * Wraps integer to closure returning it.
- *
- * @param i Value to wrap.
- * @return Callable.
- */
- private static Callable<Integer> callable(@Nullable final Integer i) {
- return new Callable<Integer>() {
- @Override public Integer call() throws Exception {
- return i;
- }
- };
- }
-
- /**
- * Wraps integer to closure returning it.
- *
- * @param i Value to wrap.
- * @return Closure.
- */
- private static IgniteClosure<Integer, Integer> closure(@Nullable final
Integer i) {
- return new IgniteClosure<Integer, Integer>() {
- @Override public Integer apply(Integer e) {
- return e == null ? i : e + i;
- }
- };
- }
-
/**
* Wraps object to closure returning it.
*
@@ -734,23 +706,6 @@ public class DataStreamProcessorSelfTest extends
GridCommonAbstractTest {
};
}
- /**
- * Wraps integer to closure expecting it and returning {@code null}.
- *
- * @param exp Expected closure value.
- * @return Remove expected cache value closure.
- */
- private static <T> IgniteClosure<T, T> removeClosure(@Nullable final T
exp) {
- return new IgniteClosure<T, T>() {
- @Override public T apply(T act) {
- if (exp == null ? act == null : exp.equals(act))
- return null;
-
- throw new AssertionError("Unexpected value [exp=" + exp + ",
act=" + act + ']');
- }
- };
- }
-
/**
* @throws Exception If failed.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServiceRedeploymentOnNodeLeftTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServiceRedeploymentOnNodeLeftTest.java
index bc9a5db21f1..0187bc06611 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServiceRedeploymentOnNodeLeftTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServiceRedeploymentOnNodeLeftTest.java
@@ -134,15 +134,6 @@ public class ServiceRedeploymentOnNodeLeftTest extends
GridCommonAbstractTest {
assertEquals("test", grid(3).services().serviceProxy("service",
Supplier.class, false, 5_000).get());
}
- /** */
- private void invokeOnDiscoveryMessage(int nodeIdx, Class<?> msgCls,
Runnable action) {
- interceptDiscoveryMessage(nodeIdx, msgCls, () -> {
- action.run();
-
- return true;
- });
- }
-
/** */
private void interceptDiscoveryMessage(int nodeIdx, Class<?> msgCls,
Supplier<Boolean> interceptor) {
TestTcpDiscoverySpi discoSpi =
(TestTcpDiscoverySpi)grid(nodeIdx).configuration().getDiscoverySpi();
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 19f6ad17c38..bbab9f7b75b 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -65,7 +65,6 @@ import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.thread.IgniteThreadFactory;
@@ -117,17 +116,6 @@ public class IgniteUtilsSelfTest extends
GridCommonAbstractTest {
/** Maximum string length to be written at once. */
private static final int MAX_STR_LEN = 0xFFFF / 4;
- /**
- * @return 120 character length string.
- */
- private String text120() {
- char[] chs = new char[120];
-
- Arrays.fill(chs, 'x');
-
- return new String(chs);
- }
-
/**
*
*/
@@ -360,20 +348,6 @@ public class IgniteUtilsSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * @param r Runnable.
- * @return Job created for given runnable.
- */
- private static ComputeJob job(final Runnable r) {
- return new ComputeJobAdapter() {
- @Nullable @Override public Object execute() {
- r.run();
-
- return null;
- }
- };
- }
-
/**
* @throws Exception If test failed.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/lang/utils/GridConsistentHashSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridConsistentHashSelfTest.java
index dbc38383404..fb615f2bb62 100644
---
a/modules/core/src/test/java/org/apache/ignite/lang/utils/GridConsistentHashSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridConsistentHashSelfTest.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.internal.util.GridConsistentHash;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -74,30 +73,6 @@ public class GridConsistentHashSelfTest extends
GridCommonAbstractTest {
return hash;
}
- /**
- * @param hash Hash to clean.
- */
- private void clean(GridConsistentHash<UUID> hash) {
- if (hash != null) {
- int cnt = hash.count();
-
- assert hash.removeNode(hash.random());
-
- assertEquals(cnt - 1, hash.count());
-
-// info("Cleaning nodes", hash.nodes());
-
- hash.removeNodes(hash.nodes());
-
- hash.clear();
-
- assertEquals(0, hash.size());
- assertEquals("Invalid hash: " + hash.nodes(), 0, hash.count());
-
- assert hash.isEmpty();
- }
- }
-
/**
* Test hash codes collisions.
*
@@ -247,14 +222,6 @@ public class GridConsistentHashSelfTest extends
GridCommonAbstractTest {
}
}
- /**
- * @param msg Message.
- * @param c Collection.
- */
- private void info(String msg, Collection c) {
- info(msg + " [size=" + c.size() + ", col=" + c + ']');
- }
-
/**
* @param nodes Nodes.
* @return Nodes.
@@ -267,95 +234,4 @@ public class GridConsistentHashSelfTest extends
GridCommonAbstractTest {
return ids;
}
-
- /**
- * @param hash Hash.
- * @param replicas Replicas.
- * @param nodes Nodes.
- * @return Runnable.
- */
- private Runnable initializer(final GridConsistentHash<UUID> hash, final
int replicas, final UUID[] nodes) {
- return new Runnable() {
- @Override public void run() {
- initialize(hash, replicas, nodes);
- }
- };
- }
-
- /**
- * @param hash Hash.
- * @param keys Keys.
- * @return Runnable.
- */
- private Runnable hasher(final GridConsistentHash<UUID> hash, final
String[] keys) {
- return new Runnable() {
- @Override public void run() {
- for (String k : keys) {
- assert hash.node(k) != null;
- }
- }
- };
- }
-
- /**
- * @param hash Hash.
- * @param cnts Counts.
- * @param mappings Mappings.
- * @param keys Keys.
- */
- private void hash(GridConsistentHash<UUID> hash, Map<UUID, AtomicInteger>
cnts, Map<String, UUID> mappings,
- String[] keys) {
- for (String k : keys) {
- UUID id = hash.node(k);
-
- assert id != null;
-
- AtomicInteger i = cnts.get(id);
-
- if (i == null)
- cnts.put(id, i = new AtomicInteger());
-
- i.incrementAndGet();
-
- mappings.put(k, id);
- }
- }
-
- /**
- *
- * @param m1 Map 1.
- * @param m2 Map 2.
- * @param keys Keys.
- * @return Reassignment count.
- */
- private int compare(Map<String, UUID> m1, Map<String, UUID> m2, String[]
keys) {
- int cnt = 0;
-
- // Check reassignment percentages.
- for (String key : keys) {
- UUID id1 = m1.get(key);
- UUID id2 = m2.get(key);
-
- assert id1 != null;
- assert id2 != null;
-
- if (!id1.equals(id2))
- cnt++;
- }
-
- return cnt;
- }
-
- /**
- * @param cnt Number of keys to create.
- * @return Array of keys.
- */
- private String[] keys(int cnt) {
- String[] keys = new String[cnt];
-
- for (int i = 0; i < cnt; i++)
- keys[i] = UUID.randomUUID().toString();
-
- return keys;
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
index 84f1de2445a..e0b25f97ca3 100644
---
a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
+++
b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiClient.java
@@ -158,39 +158,6 @@ public class GridDsiClient implements Callable {
return null;
}
- /**
- * Method to print request statistics.
- */
- private static void displayReqCount() {
- new Thread(new Runnable() {
- @SuppressWarnings({"BusyWait"})
- @Override public void run() {
- int interval = 30;
-
- while (true) {
- long cnt0 = txCnt.get();
- long lt0 = latency.get();
-
- try {
- Thread.sleep(interval * 1000);
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- long cnt1 = txCnt.get();
- long lt1 = latency.get();
-
- X.println(">>>");
- X.println(">>> Transaction/s: " + (cnt1 - cnt0) /
interval);
- X.println(
- ">>> Avg Latency: " + ((cnt1 - cnt0) > 0 ? (lt1 - lt0)
/ (cnt1 - cnt0) + "ms" : "invalid"));
- X.println(">>> Max Submit Time: " +
submitTime.getAndSet(0));
- }
- }
- }).start();
- }
-
/**
* Execute DSI load client.
*
diff --git
a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PDifferentClassLoaderSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PDifferentClassLoaderSelfTest.java
index b0390cee3bd..2b3e006547a 100644
---
a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PDifferentClassLoaderSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PDifferentClassLoaderSelfTest.java
@@ -216,18 +216,4 @@ public class GridP2PDifferentClassLoaderSelfTest extends
GridCommonAbstractTest
processTest(true, false);
}
-
- /**
- * Return true if and only if all elements of array are different.
- *
- * @param m1 array 1.
- * @param m2 array 2.
- * @return true if all elements of array are different.
- */
- private boolean isNotSame(int[] m1, int[] m2) {
- assert m1.length == m2.length;
- assert m1.length == 2;
-
- return m1[0] != m2[0] && m1[1] != m2[1];
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
index 5000fe323a0..296d2e273ce 100644
---
a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
@@ -149,18 +149,4 @@ public class GridP2PSameClassLoaderSelfTest extends
GridCommonAbstractTest {
processTest();
}
-
- /**
- * Return true if and only if all elements of array are different.
- *
- * @param m1 array 1.
- * @param m2 array 2.
- * @return true if all elements of array are different.
- */
- private boolean isNotSame(int[] m1, int[] m2) {
- assert m1.length == m2.length;
- assert m1.length == 2;
-
- return m1[0] != m2[0] && m1[1] != m2[1];
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 02e9a4d21d2..21b2765fe8b 100644
---
a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -20,7 +20,6 @@ package org.apache.ignite.testframework;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
@@ -1459,54 +1458,6 @@ public final class GridTestUtils {
addr = new int[] {229, 1, 1, 1};
}
- /**
- * @param path Path.
- * @param startFilter Start filter.
- * @param endFilter End filter.
- * @return List of JARs that corresponds to the filters.
- * @throws IOException If failed.
- */
- private static Collection<String> getFiles(String path, @Nullable final
String startFilter,
- @Nullable final String endFilter) throws IOException {
- Collection<String> res = new ArrayList<>();
-
- File file = new File(path);
-
- assert file.isDirectory();
-
- File[] jars = file.listFiles(new FilenameFilter() {
- /**
- * @see FilenameFilter#accept(File, String)
- */
- @SuppressWarnings({"UnnecessaryJavaDocLink"})
- @Override public boolean accept(File dir, String name) {
- // Exclude spring.jar because it tries to load
META-INF/spring-handlers.xml from
- // all available JARs and create instances of classes from
there for example.
- // Exclude logging as it is used by spring and casted to Log
interface.
- // Exclude log4j because of the design - 1 per VM.
- if (name.startsWith("spring") || name.startsWith("log4j") ||
- name.startsWith("commons-logging") ||
name.startsWith("junit") ||
- name.startsWith("ignite-tests"))
- return false;
-
- boolean ret = true;
-
- if (startFilter != null)
- ret = name.startsWith(startFilter);
-
- if (ret && endFilter != null)
- ret = name.endsWith(endFilter);
-
- return ret;
- }
- });
-
- for (File jar : jars)
- res.add(jar.getCanonicalPath());
-
- return res;
- }
-
/**
* Silent stop grid.
* Method doesn't throw any exception.
diff --git
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index f6e1f1eb677..b829e050f89 100755
---
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -195,8 +195,6 @@ public abstract class GridAbstractTest extends
JUnitAssertAware {
* DO NOT REMOVE TRANSIENT - THIS OBJECT MIGHT BE TRANSFERRED *
* TO ANOTHER NODE. *
**************************************************************/
- /** Null name for execution map. */
- private static final String NULL_NAME = UUID.randomUUID().toString();
/** Ip finder for TCP discovery. */
public static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new
TcpDiscoveryVmIpFinder(false).
@@ -1243,28 +1241,6 @@ public abstract class GridAbstractTest extends
JUnitAssertAware {
return startGrid(igniteInstanceName,
optimize(getConfiguration(igniteInstanceName)), ctx);
}
- /**
- * @param regionCfg Region config.
- */
- private void validateDataRegion(DataRegionConfiguration regionCfg) {
- if (regionCfg.isPersistenceEnabled() && regionCfg.getMaxSize() ==
DataStorageConfiguration.DFLT_DATA_REGION_MAX_SIZE)
- throw new AssertionError("Max size of data region should be set
explicitly to avoid memory over usage");
- }
-
- /**
- * @param cfg Config.
- */
- private void validateConfiguration(IgniteConfiguration cfg) {
- if (cfg.getDataStorageConfiguration() != null) {
-
validateDataRegion(cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration());
-
- if
(cfg.getDataStorageConfiguration().getDataRegionConfigurations() != null) {
- for (DataRegionConfiguration reg :
cfg.getDataStorageConfiguration().getDataRegionConfigurations())
- validateDataRegion(reg);
- }
- }
- }
-
/**
* Starts new grid with given name.
*
@@ -2075,14 +2051,6 @@ public abstract class GridAbstractTest extends
JUnitAssertAware {
return System.getProperty("DEBUG") != null;
}
- /**
- * @param name Name to mask.
- * @return Masked name.
- */
- private String maskNull(String name) {
- return name == null ? NULL_NAME : name;
- }
-
/**
* @return Ignite home.
*/
diff --git
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 55e53c7d44c..3b2a188e8b1 100755
---
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -399,14 +399,6 @@ public abstract class GridCommonAbstractTest extends
GridAbstractTest {
return (GridDhtColocatedCache<K,
V>)((IgniteKernal)grid(idx)).internalCache(cache);
}
- /**
- * @param cache Cache.
- * @return {@code True} if near cache is enabled.
- */
- private static <K, V> boolean nearEnabled(GridCacheAdapter<K, V> cache) {
- return isNearEnabled(cache.configuration());
- }
-
/**
* @param cache Cache.
* @return {@code True} if near cache is enabled.
@@ -424,14 +416,6 @@ public abstract class GridCommonAbstractTest extends
GridAbstractTest {
return isNearEnabled(cfg);
}
- /**
- * @param cache Cache.
- * @return Near cache.
- */
- private static <K, V> GridNearCacheAdapter<K, V> near(GridCacheAdapter<K,
V> cache) {
- return cache.context().near();
- }
-
/**
* @param cache Cache.
* @return Near cache.