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 3a77f5cb01d40..c5682fc7c6e43 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.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 static T externalize(Externalizable obj, Marshaller marshaller) throw 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 d403a5b6e06be..21dc082ad46d4 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 @@ 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.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 @@ private void doRebalanceAfterPartitionsWereLost(boolean reactivateGridBeforeRese assertEquals(CACHE_NAMES.length * CACHE_SIZE, averageSizeAroundAllNodes()); } - /** - * @param gridNumber Grid number. - * @param cacheName Cache name. - * @return Partitions states for given cache name. - */ - private List 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 2f0230c1f371d..2f281a8162a75 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 @@ private TxThread( 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 a6e7a05d449f8..878bb7c465fc5 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 @@ private List dataToTest() { ); } - /** */ - private void putRegularGetInBinary(IgniteCache 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 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 3e52bbc0e35e5..cb53073815f3f 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 @@ private > Integer[] binaryOrdinals(Object fld) { 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 015e6e29d446f..e6cbf52b6c883 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 void testOverrideIdMapperFullNameMapper() throws Exception { 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 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 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 8b0b580536b28..8d3c9f7804bc0 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 @@ private static Collection createObjectsOfAllTypes(BinaryContext ctx) thr 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 8d1ff662782f2..6ff2aeeb32357 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.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 static class TestObjectAllTypes implements Serializable { /** */ 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 efaace9dee8d1..2644741eb9d46 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 @@ private static class MockLogger extends GridTestLog4jLogger { public List 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 06fa3cc2e7da6..51bc2cb90f024 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 void testRemoteNodeSecurityContext() throws Exception { } } - /** - * @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 0cd45d982a5a5..1c3b141250697 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 @@ private void createCaches(boolean statisticsEnabled) { 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 11ad252160c16..570fd96882c3b 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 void testPutxIfAbsentAsyncNoTx() throws Exception { checkPutxIfAbsentAsync(false); } - /** - * @param inTx In tx flag. - * @throws Exception If failed. - */ - private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception { - IgniteCache cache = jcache(); - - IgniteCache cacheAsync = cache.withAsync(); - - cacheAsync.putIfAbsent("key", 1); - - IgniteFuture fut1 = cacheAsync.future(); - - assert fut1.get(); - assert cache.get("key") != null && cache.get("key") == 1; - - cacheAsync.putIfAbsent("key", 2); - - IgniteFuture 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.future().get()); - - // Check db. - if (!isMultiJvm()) { - storeStgy.putToStore("key3", 3); - - cacheAsync.putIfAbsent("key3", 4); - - assertFalse(cacheAsync.future().get()); - } - - cache.localEvict(Collections.singletonList("key2")); - - // Same checks inside tx. - Transaction tx = inTx ? transactions().txStart() : null; - - try { - cacheAsync.putIfAbsent("key2", 3); - - assertFalse(cacheAsync.future().get()); - - if (!isMultiJvm()) { - cacheAsync.putIfAbsent("key3", 4); - - assertFalse(cacheAsync.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 void testGlobalRemoveAllAsync() throws Exception { globalRemoveAll(true); } - /** - * @param async If {@code true} uses asynchronous operation. - * @throws Exception In case of error. - */ - private void globalRemoveAllOld(boolean async) throws Exception { - IgniteCache cache = jcache(); - - cache.put("key1", 1); - cache.put("key2", 2); - cache.put("key3", 3); - - checkSize(F.asSet("key1", "key2", "key3")); - - IgniteCache 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 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 @@ private static class TestValue implements Serializable { 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 d50cb3311f1e3..116e132c6af4f 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 @@ private void checkLocalStore(Ignite ignite, CacheStore> store, String name, - Set 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 d823a490dafbb..1557a3021352a 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 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 void testCancelUpdate() throws Exception { } } - /** - * @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 b5f73f900b3e6..639722a81dbab 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 @@ private void startServerNodes() throws Exception { 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 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 d4971a8b26ece..0000000000000 --- 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 null 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 committedVers, Collection rolledbackVers) { - mvcc.orderCompleted(baseVer, committedVers, rolledbackVers); - } - - /** - * @param ver Version. - */ - void doneRemote(GridCacheVersion ver) { - mvcc.doneRemote(ver, Collections.emptyList(), - Collections.emptyList(), Collections.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 committedVers, Collection rolledbackVers, - Collection 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 localCandidates(GridCacheVersion... exclude) { - return mvcc.localCandidates(exclude); - } - - /** @inheritDoc */ - Collection localCandidates(boolean reentries, GridCacheVersion... exclude) { - return mvcc.localCandidates(reentries, exclude); - } - - /** @inheritDoc */ - @Override public Collection 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 f528d534e2505..87695faab4dc3 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 void testLocalEvict() throws Exception { } } - /** - * @param cache Cache. - * @param k Key. - */ - private void checkKeyAfterLocalEvict(IgniteCache 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 19171ac170457..534c252d5f276 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 @@ private void checkStorage(int nodeIdx) throws Exception { cache0.removeAll(new HashSet<>(keys)); } } - - /** - * @param nodeIdx Node index. - * @throws Exception If failed. - */ - private void checkSizeAffinityFilter(int nodeIdx) throws Exception { - IgniteCache cache0 = jcache(nodeIdx); - - final int PUT_KEYS = 10; - - List 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 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 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 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 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 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 cache0 = jcache(nodeIdx); - - final int PUT_KEYS = 10; - - int part = nodeIdx; - - List 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 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 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 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 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 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 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> swapKeys(int nodeIdx) { -// TODO: GG-11148. -// SwapSpaceSpi swap = ignite(nodeIdx).configuration().getSwapSpaceSpi(); -// -// IgniteSpiCloseableIterator it = swap.keyIterator(SPACE_NAME, null); - IgniteSpiCloseableIterator it = new GridEmptyCloseableIterator<>(); - - assertNotNull(it); - - Affinity aff = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME); - - ClusterNode node = ignite(nodeIdx).cluster().localNode(); - - List primary = new ArrayList<>(); - List 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 swapKeysCount(int nodeIdx) { - T2, List> 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> offheapKeys(int nodeIdx) { - GridCacheAdapter internalCache = - ((IgniteKernal)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME); - -// TODO GG-11148. - Iterator> 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 primary = new ArrayList<>(); - List backups = new ArrayList<>(); - - while (offheapIt.hasNext()) { - Map.Entry 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 offheapKeysCount(int nodeIdx) { - T2, List> 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 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 cache0 = jcache(nodeIdx); - - List primaryKeys = primaryKeys(cache0, 100, 10_000); - List 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 swapKeys = swapKeysCount(nodeIdx); - - assertTrue(swapKeys.get1() > 0); - assertTrue(swapKeys.get2() > 0); - - T2 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 swap = swapKeysCount(i); - - globalSwapPrimary += swap.get1(); - globalSwapBackup += swap.get2(); - - T2 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 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 cache0 = jcache(nodeIdx); - - int part = nodeIdx; - - List primaryKeys = primaryKeys(cache0, 100, 10_000); - List 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 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 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 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 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 cache0 = jcache(nodeIdx); - - List primaryKeys = primaryKeys(cache0, 100, 10_000); - List 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> swapKeys = swapKeys(nodeIdx); - - assertTrue(!swapKeys.get1().isEmpty()); - assertTrue(!swapKeys.get2().isEmpty()); - - T2, List> offheapKeys = offheapKeys(nodeIdx); - - assertTrue(!offheapKeys.get1().isEmpty()); - assertTrue(!offheapKeys.get2().isEmpty()); - - List swap = new ArrayList<>(); - - swap.addAll(swapKeys.get1()); - swap.addAll(swapKeys.get2()); - - assertFalse(swap.isEmpty()); - - List offheap = new ArrayList<>(); - - offheap.addAll(offheapKeys.get1()); - offheap.addAll(offheapKeys.get2()); - - assertFalse(offheap.isEmpty()); - - List 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 cache0 = jcache(nodeIdx); - - final int PUT_KEYS = 10; - - List primaryKeys = null; - List backupKeys = null; - List 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.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> entries, Collection... exp) { - checkLocalEntries(entries, "", exp); - } - - /** - * @param entries Entries. - * @param expVal Expected value. - * @param exp Expected keys. - */ - private void checkLocalEntries(Iterable> entries, - String expVal, - Collection... exp) { - Set allExp = new HashSet<>(); - - for (Collection col : exp) - assertTrue(allExp.addAll(col)); - - for (Cache.Entry 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 9a88f28b973ba..4d941cc180347 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.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 @@ private void startAdditionalNodes(int cnt, String queueName) throws Exception { 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 nodes(AffinityFunction aff, int part, Collection nodes) { - List> 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 72aa8a4a59e5e..49f5f83899fc5 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 @@ protected Params currentTestParams() { 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 e99f819d6845c..e0b82a5b25d06 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 @@ private void checkPrimaryNodeCrash(final boolean commmit) throws Exception { } } - /** - * @return All node IDs. - */ - private Collection allNodeIds() { - Collection 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 42060fab26162..9c38fed0f2a00 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 @@ private void startGrids(int cnt, int startIdx, Collection list) throws E } } - /** @param grids Grids to stop. */ - private void stopGrids(Iterable 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 649dbd24a9979..5eeaafa632497 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 @@ private void startGrids(int cnt, int startIdx, Collection list) throws E } } - /** - * @param grids Grids to stop. - */ - private void stopGrids(Iterable 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 47362d65149ed..f157b7d1770c0 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 @@ 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 GridCacheDhtPreloadStartStopSelfTest() { 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 void testDeadlock() throws Exception { 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 c1 = g1.cache(DEFAULT_CACHE_NAME); - - putKeys(c1, keyCnt); - checkKeys(c1, keyCnt); - - Collection ignites = new LinkedList<>(); - - startGrids(nodeCnt, 1, ignites); - - // Check all nodes. - for (Ignite g : ignites) { - IgniteCache c = g.cache(DEFAULT_CACHE_NAME); - - checkKeys(c, keyCnt); - } - - info(">>> Finished checking nodes [keyCnt=" + keyCnt + ", nodeCnt=" + nodeCnt + ']'); - - stopGrids(ignites); - - GridDhtCacheAdapter dht = dht(c1); - - info(">>> Waiting for preload futures..."); - - GridCachePartitionExchangeManager exchMgr - = ((IgniteKernal)g1).context().cache().context().exchange(); - - // Wait for exchanges to complete. - for (IgniteInternalFuture fut : exchMgr.exchangeFutures()) - fut.get(); - - Affinity 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 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 c, int cnt) { - Affinity 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 d400a271cb221..ff02a7d585a4a 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 @@ 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.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 void testActivationHashIsNotUpdatedOnMultipleActivationRequests() throws verifyBaselineTopologyOnNodes(verifier, new Ignite[] {nodeA, nodeB}); } - /** - * Creates BaselineNode with specific attribute indicating that this node is not client. - */ - private BaselineNode createBaselineNodeWithConsId(String consId) { - Map 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 34d9efacd1cce..1be7ff806b174 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 d0b2313227546..2474cc5ce8c45 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.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 @@ private void awaitExchange(IgniteEx ig) throws IgniteCheckedException { 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 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 479381e197d97..dd1ab1e13520b 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.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.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 @@ private void runVerification(int threads, final int recsPerThread) throws Except 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 restartedCache) { - int verifyChunk = 100; - - int totalRecsToVerify = recsPerThread * threads; - int chunks = totalRecsToVerify / verifyChunk; - - for (int c = 0; c < chunks; c++) { - Set keys = new TreeSet<>(); - - for (int i = 0; i < verifyChunk; i++) - keys.add(i + c * verifyChunk); - - Map values = restartedCache.getAll(keys); - - for (Map.Entry 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 340b84d5c0c80..399c85cda7a4b 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 @@ private CacheConfiguration cacheConfiguration() { */ 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 353ba0bb5f743..b99083fef66a8 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.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.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.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 @@ private IgniteEx startGridWithExtraStorage() throws Exception { 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 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 d99b6f7b26fb9..70fa1391be72d 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 void testMultiThreaded() throws Exception { 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>> expEvts, - CacheEventListener2 lsnr) { - assertTrue(!expEvts.isEmpty()); - - boolean pass = true; - - for (Map.Entry>> e : expEvts.entrySet()) { - Integer key = e.getKey(); - List> exp = e.getValue(); - - List> 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 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 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 e7c21a3ed30c1..d447fd14aab54 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 @@ private static class TestCacheStore extends CacheStoreAdapter impl /** */ 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 c16bf2577751d..42306ea398dde 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 localRoutines(GridContinuousProcessor proc) { - return F.view(U.>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 a617a4f361a74..426ee2e3d9a1c 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 void testEmptyCursors() throws IgniteCheckedException { 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 be549b01534ef..fae844a99efb3 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 void testLoaderApi() throws Exception { } } - /** - * Wraps integer to closure returning it. - * - * @param i Value to wrap. - * @return Callable. - */ - private static Callable callable(@Nullable final Integer i) { - return new Callable() { - @Override public Integer call() throws Exception { - return i; - } - }; - } - - /** - * Wraps integer to closure returning it. - * - * @param i Value to wrap. - * @return Closure. - */ - private static IgniteClosure closure(@Nullable final Integer i) { - return new IgniteClosure() { - @Override public Integer apply(Integer e) { - return e == null ? i : e + i; - } - }; - } - /** * Wraps object to closure returning it. * @@ -734,23 +706,6 @@ private static IgniteClosure fixedClosure(@Nullable final T obj) { }; } - /** - * Wraps integer to closure expecting it and returning {@code null}. - * - * @param exp Expected closure value. - * @return Remove expected cache value closure. - */ - private static IgniteClosure removeClosure(@Nullable final T exp) { - return new IgniteClosure() { - @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 bc9a5db21f124..0187bc066118d 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 void testCoordinatorChangeReassignedServiceRedeployment() throws Exceptio 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 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 19f6ad17c38d8..bbab9f7b75b9f 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.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 void testDetectPeerDeployAwareInfiniteRecursion() throws Exception { } } - /** - * @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 dbc383834040f..fb615f2bb6243 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.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 @@ private GridConsistentHash initialize(GridConsistentHash hash, int r return hash; } - /** - * @param hash Hash to clean. - */ - private void clean(GridConsistentHash 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 void testHistory() { } } - /** - * @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 @@ private UUID[] nodes(int nodes) { return ids; } - - /** - * @param hash Hash. - * @param replicas Replicas. - * @param nodes Nodes. - * @return Runnable. - */ - private Runnable initializer(final GridConsistentHash 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 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 hash, Map cnts, Map 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 m1, Map 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 84f1de2445a61..e0b25f97ca393 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 static IgnitePredicate clientNode() { 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 b0390cee3bdac..2b3e006547a46 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 void testRedeploySharedMode() throws Exception { 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 5000fe323a056..296d2e273cef6 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 void testContinuousMode() throws Exception { 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 02e9a4d21d250..21b2765fe8b4a 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 @@ 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 static String getIgniteHome() throws Exception { 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 getFiles(String path, @Nullable final String startFilter, - @Nullable final String endFilter) throws IOException { - Collection 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 f6e1f1eb6777f..b829e050f8986 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 @@ protected Ignite startGrid(String igniteInstanceName, GridSpringResourceContext 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 boolean isDebug() { 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 55e53c7d44cb1..3b2a188e8b14a 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 @@ protected GridDhtColocatedCache colocated(int idx, String cache) { return (GridDhtColocatedCache)((IgniteKernal)grid(idx)).internalCache(cache); } - /** - * @param cache Cache. - * @return {@code True} if near cache is enabled. - */ - private static boolean nearEnabled(GridCacheAdapter cache) { - return isNearEnabled(cache.configuration()); - } - /** * @param cache Cache. * @return {@code True} if near cache is enabled. @@ -424,14 +416,6 @@ protected static boolean nearEnabled(final IgniteCache cache) { return isNearEnabled(cfg); } - /** - * @param cache Cache. - * @return Near cache. - */ - private static GridNearCacheAdapter near(GridCacheAdapter cache) { - return cache.context().near(); - } - /** * @param cache Cache. * @return Near cache.