ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgovoruk...@apache.org
Subject ignite git commit: IGNITE-10107 Cache 7 tests optimization - Fixes #5234.
Date Tue, 06 Nov 2018 10:09:36 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 86b235104 -> 362d51525


IGNITE-10107 Cache 7 tests optimization - Fixes #5234.

Signed-off-by: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/362d5152
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/362d5152
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/362d5152

Branch: refs/heads/master
Commit: 362d51525b640ae25e5ec4eaa5949149c3e039fe
Parents: 86b2351
Author: ibessonov <bessonov.ip@gmail.com>
Authored: Tue Nov 6 13:09:22 2018 +0300
Committer: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>
Committed: Tue Nov 6 13:09:22 2018 +0300

----------------------------------------------------------------------
 .../processors/authentication/User.java         |  7 +-
 .../Authentication1kUsersNodeRestartTest.java   | 77 +++++++++++++++-----
 .../AuthenticationConfigurationClusterTest.java | 14 ++++
 .../AuthenticationOnNotActiveClusterTest.java   | 15 ++++
 .../AuthenticationProcessorNodeRestartTest.java | 14 ++++
 .../AuthenticationProcessorSelfTest.java        | 14 ++++
 .../cache/WalModeChangeAdvancedSelfTest.java    | 11 +--
 .../dht/IgniteCacheStartWithLoadTest.java       | 12 +--
 ...idCacheRebalancingWithAsyncClearingTest.java | 49 +++++++------
 .../cache/transactions/TxRollbackAsyncTest.java | 28 +++----
 10 files changed, 172 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/User.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/User.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/User.java
index c132e9e..5b92831 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/User.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/User.java
@@ -37,6 +37,11 @@ public class User implements Serializable {
     /** Default user password. */
     private static final String DFLT_USER_PASSWORD = "ignite";
 
+    /**
+     * @see BCrypt#GENSALT_DEFAULT_LOG2_ROUNDS
+     */
+    private static int bCryptGensaltLog2Rounds = 10;
+
     /** User name. */
     private String name;
 
@@ -107,7 +112,7 @@ public class User implements Serializable {
      * @return Hashed password.
      */
     @Nullable private static String password_bcrypt(String passwd) {
-        return BCrypt.hashpw(passwd, BCrypt.gensalt());
+        return BCrypt.hashpw(passwd, BCrypt.gensalt(bCryptGensaltLog2Rounds));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/Authentication1kUsersNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/Authentication1kUsersNodeRestartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/Authentication1kUsersNodeRestartTest.java
index 0ca621e..1f515d5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/Authentication1kUsersNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/Authentication1kUsersNodeRestartTest.java
@@ -17,7 +17,9 @@
 
 package org.apache.ignite.internal.processors.authentication;
 
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.IntStream;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.DataRegionConfiguration;
 import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -25,6 +27,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 /**
@@ -34,6 +37,8 @@ public class Authentication1kUsersNodeRestartTest extends GridCommonAbstractTest
     /** */
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
+    /** */
+    private static final int USERS_COUNT = 1000;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
@@ -56,6 +61,20 @@ public class Authentication1kUsersNodeRestartTest extends GridCommonAbstractTest
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 10);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 
@@ -64,45 +83,63 @@ public class Authentication1kUsersNodeRestartTest extends GridCommonAbstractTest
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
+        AuthorizationContext.clear();
+
         stopAllGrids();
 
         super.afterTest();
     }
+
     /**
      * @throws Exception If failed.
      */
     public void test1kUsersNodeRestartServer() throws Exception {
-        final int USERS_COUNT = 1000;
-
         startGrid(0);
 
         grid(0).cluster().active(true);
 
-        final AuthorizationContext actxDflt = grid(0).context().authentication().authenticate(User.DFAULT_USER_NAME,
"ignite");
+        IgniteAuthenticationProcessor authenticationProcessor = grid(0).context().authentication();
 
-        final AtomicInteger usrCnt = new AtomicInteger();
+        AuthorizationContext actxDflt = authenticationProcessor.authenticate(User.DFAULT_USER_NAME,
"ignite");
 
         AuthorizationContext.context(actxDflt);
 
-        for (int i = 0; i < USERS_COUNT; ++i)
-            grid(0).context().authentication().addUser("test" + i, "init");
-
-        usrCnt.set(0);
-
-        for (int i = 0; i < USERS_COUNT; ++i)
-            grid(0).context().authentication().updateUser("test"  + i, "passwd_" + i);
-
-        System.out.println("+++ STOP");
-
-        U.sleep(1000);
+        IntStream.range(0, USERS_COUNT).parallel().forEach(
+            i -> {
+                AuthorizationContext.context(actxDflt);
+
+                try {
+                    authenticationProcessor.addUser("test" + i, "init");
+                }
+                catch (IgniteCheckedException e) {
+                    throw new IgniteException(e);
+                }
+                finally {
+                    AuthorizationContext.clear();
+                }
+            }
+        );
+
+        IntStream.range(0, USERS_COUNT).parallel().forEach(
+            i -> {
+                AuthorizationContext.context(actxDflt);
+
+                try {
+                    authenticationProcessor.updateUser("test"  + i, "passwd_" + i);
+                }
+                catch (IgniteCheckedException e) {
+                    throw new IgniteException(e);
+                }
+                finally {
+                    AuthorizationContext.clear();
+                }
+            }
+        );
 
         stopGrid(0);
 
-        U.sleep(1000);
-
-        System.out.println("+++ START");
         startGrid(0);
 
-        AuthorizationContext actx = grid(0).context().authentication().authenticate("ignite",
"ignite");
+        authenticationProcessor.authenticate("ignite", "ignite");
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
index fb61d60..11aa754 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
@@ -66,6 +66,20 @@ public class AuthenticationConfigurationClusterTest extends GridCommonAbstractTe
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 10);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         stopAllGrids();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationOnNotActiveClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationOnNotActiveClusterTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationOnNotActiveClusterTest.java
index 638c378..18d2032 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationOnNotActiveClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationOnNotActiveClusterTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 /**
@@ -63,6 +64,20 @@ public class AuthenticationOnNotActiveClusterTest extends GridCommonAbstractTest
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 10);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
index 6f10aa7..248d685 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorNodeRestartTest.java
@@ -77,6 +77,20 @@ public class AuthenticationProcessorNodeRestartTest extends GridCommonAbstractTe
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 10);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationProcessorSelfTest.java
----------------------------------------------------------------------
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 6c79c7f..3d579ab 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
@@ -92,6 +92,20 @@ public class AuthenticationProcessorSelfTest extends GridCommonAbstractTest
{
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 4);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        GridTestUtils.setFieldValue(User.class, "bCryptGensaltLog2Rounds", 10);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
index be0f5df..d95b715 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -242,7 +243,7 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
 
         final AtomicInteger restartCnt = new AtomicInteger();
 
-        final int restarts = 10;
+        final int restarts = SF.applyLB(10, 3);
 
         Thread t = new Thread(new Runnable() {
             @Override public void run() {
@@ -289,7 +290,7 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
 
                 state = !state;
             }
-            catch (IgniteException e) {
+            catch (IgniteException ignore) {
                 // Possible disconnect, re-try.
             }
         }
@@ -431,7 +432,7 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
 
         final IgniteCache cache = cacheCli.getOrCreateCache(cacheConfig(PARTITIONED));
 
-        for (int i = 1; i <= 3; i++) {
+        for (int i = 1; i <= SF.applyLB(3, 2); i++) {
             // Start pushing requests.
             Collection<Ignite> walNodes = new ArrayList<>();
 
@@ -442,7 +443,7 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
 
             final AtomicBoolean done = new AtomicBoolean();
 
-            final CountDownLatch latch = new CountDownLatch(5);
+            final CountDownLatch latch = new CountDownLatch(walNodes.size() + 1);
 
             for (Ignite node : walNodes) {
                 final Ignite node0 = node;
@@ -476,7 +477,7 @@ public class WalModeChangeAdvancedSelfTest extends WalModeChangeCommonAbstractSe
 
             t.start();
 
-            Thread.sleep(20_000);
+            Thread.sleep(SF.applyLB(20_000, 2_000));
 
             done.set(true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheStartWithLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheStartWithLoadTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheStartWithLoadTest.java
index acccc5b..7d76c28 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheStartWithLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheStartWithLoadTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -46,8 +47,8 @@ public class IgniteCacheStartWithLoadTest extends GridCommonAbstractTest
{
     /** */
     static final String CACHE_NAME = "tx_repl";
 
-    @Override
-    protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception
{
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         cfg.setConsistentId(igniteInstanceName);
@@ -125,9 +126,8 @@ public class IgniteCacheStartWithLoadTest extends GridCommonAbstractTest
{
 
                     boolean hasMoving = false;
 
-                    for (int i = 0; i < 4; i++) {
+                    for (int i = 0; i < 4; i++)
                         hasMoving |= grid(i).cachex(CACHE_NAME).context().topology().hasMovingPartitions();
-                    }
 
                     if (hasMoving) {
                         log.error("Cache restarter has been stopped because rebalance is
triggered for stable caches.");
@@ -139,7 +139,7 @@ public class IgniteCacheStartWithLoadTest extends GridCommonAbstractTest
{
 
                     node.destroyCache(tmpCacheName);
 
-                    U.sleep(10_000);
+                    U.sleep(1_000);
                 }
                 catch (Throwable t) {
                     log.warning("Unexpected exception during caches restart.", t);
@@ -147,7 +147,7 @@ public class IgniteCacheStartWithLoadTest extends GridCommonAbstractTest
{
             }
         });
 
-        U.sleep(60_000);
+        U.sleep(SF.applyLB(60_000, 5_000));
 
         cacheRestartStop.set(true);
         txLoadStop.set(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
index 1b176ae..328653d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingTest.java
@@ -31,10 +31,11 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 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.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Assert;
 
@@ -63,7 +64,7 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
                                             .setMaxSize(100L * 1024 * 1024))
         );
 
-        cfg.setCacheConfiguration(new CacheConfiguration(CACHE_NAME)
+        cfg.setCacheConfiguration(new CacheConfiguration<>(CACHE_NAME)
                 .setBackups(2)
                 .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
                 .setIndexedTypes(Integer.class, Integer.class)
@@ -104,16 +105,17 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
         ig.cluster().active(true);
 
         // High number of keys triggers long partition eviction.
-        final int keysCount = 300_000;
+        final int keysCnt = SF.applyLB(300_000, 10_000);
 
-        try (IgniteDataStreamer ds = ig.dataStreamer(CACHE_NAME)) {
+        try (IgniteDataStreamer<Integer, Integer> ds = ig.dataStreamer(CACHE_NAME))
{
             log.info("Writing initial data...");
 
             ds.allowOverwrite(true);
-            for (int k = 1; k <= keysCount; k++) {
+
+            for (int k = 1; k <= keysCnt; k++) {
                 ds.addData(k, k);
 
-                if (k % 50_000 == 0)
+                if (k % 10_000 == 0)
                     log.info("Written " + k + " entities.");
             }
 
@@ -124,14 +126,15 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
 
         awaitPartitionMapExchange();
 
-        try (IgniteDataStreamer ds = ig.dataStreamer(CACHE_NAME)) {
+        try (IgniteDataStreamer<Integer, Integer> ds = ig.dataStreamer(CACHE_NAME))
{
             log.info("Writing external data...");
 
             ds.allowOverwrite(true);
-            for (int k = 1; k <= keysCount; k++) {
+
+            for (int k = 1; k <= keysCnt; k++) {
                 ds.addData(k, 2 * k);
 
-                if (k % 50_000 == 0)
+                if (k % 10_000 == 0)
                     log.info("Written " + k + " entities.");
             }
 
@@ -177,10 +180,12 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
             ignite.cache(CACHE_NAME).rebalance().get();
 
         // Check no data loss.
-        for (int k = 1; k <= keysCount; k++) {
-            Integer value = cache.get(k);
-            Assert.assertNotNull("Value for " + k + " is null", value);
-            Assert.assertEquals("Check failed for " + k + " " + value, 2 * k, (int) value);
+        for (int k = 1; k <= keysCnt; k++) {
+            Integer val = cache.get(k);
+
+            Assert.assertNotNull("Value for " + k + " is null", val);
+
+            Assert.assertEquals("Check failed for " + k + " " + val, 2 * k, (int)val);
         }
     }
 
@@ -194,16 +199,16 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
         ignite.cluster().active(true);
 
         // High number of keys triggers long partition eviction.
-        final int keysCount = 500_000;
+        final int keysCnt = SF.applyLB(300_000, 10_000);
 
-        try (IgniteDataStreamer ds = ignite.dataStreamer(CACHE_NAME)) {
+        try (IgniteDataStreamer<Integer, Integer> ds = ignite.dataStreamer(CACHE_NAME))
{
             log.info("Writing initial data...");
 
             ds.allowOverwrite(true);
-            for (int k = 1; k <= keysCount; k++) {
+            for (int k = 1; k <= keysCnt; k++) {
                 ds.addData(k, k);
 
-                if (k % 50_000 == 0)
+                if (k % 10_000 == 0)
                     log.info("Written " + k + " entities.");
             }
 
@@ -229,10 +234,12 @@ public class GridCacheRebalancingWithAsyncClearingTest extends GridCommonAbstrac
         awaitPartitionMapExchange();
 
         // Check no data loss.
-        for (int k = 1; k <= keysCount; k++) {
-            Integer value = (Integer) ignite.cache(CACHE_NAME).get(k);
-            Assert.assertNotNull("Value for " + k + " is null", value);
-            Assert.assertEquals("Check failed for " + k + " = " + value, k, (int) value);
+        for (int k = 1; k <= keysCnt; k++) {
+            Integer val = (Integer) ignite.cache(CACHE_NAME).get(k);
+
+            Assert.assertNotNull("Value for " + k + " is null", val);
+
+            Assert.assertEquals("Check failed for " + k + " = " + val, k, (int)val);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/362d5152/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
index 4ca8ba3..d08d4de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java
@@ -60,8 +60,8 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLock
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.CIX1;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.CIX1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.X;
@@ -75,12 +75,12 @@ import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
 import org.apache.ignite.internal.visor.tx.VisorTxTaskResult;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils.SF;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -106,7 +106,7 @@ import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK;
  */
 public class TxRollbackAsyncTest extends GridCommonAbstractTest {
     /** */
-    public static final int DURATION = 60_000;
+    public static final int DURATION = SF.applyLB(60_000, 5_000);
 
     /** */
     private static final String CACHE_NAME = "test";
@@ -356,7 +356,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
 
         U.awaitQuiet(keyLocked);
 
-        final int txCnt = 1000;
+        final int txCnt = SF.applyLB(250, 25);
 
         final IgniteKernal k = (IgniteKernal)tryLockNode;
 
@@ -639,7 +639,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
         final int txSize = 200;
 
         for (int k = 0; k < txSize; k++)
-            grid(0).cache(CACHE_NAME).put(k, (long)0);
+            grid(0).cache(CACHE_NAME).put(k, 0L);
 
         final long seed = System.currentTimeMillis();
 
@@ -711,13 +711,13 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
 
                     tx.commit();
 
-                    completed.add(1);
+                    completed.increment();
                 }
                 catch (Throwable e) {
-                    failed.add(1);
+                    failed.increment();
                 }
 
-                total.add(1);
+                total.increment();
             }
         }, threadCnt, "tx-thread");
 
@@ -728,11 +728,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
                 try {
                     IgniteFuture<Void> rollbackFut = tx.rollbackAsync();
 
-                    rollbackFut.listen(new IgniteInClosure<IgniteFuture<Void>>()
{
-                        @Override public void apply(IgniteFuture<Void> fut) {
-                            tx.close();
-                        }
-                    });
+                    rollbackFut.listen(fut -> tx.close());
                 }
                 catch (Throwable t) {
                     log.error("Exception on async rollback", t);
@@ -762,7 +758,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
 
                 // Rollback all transaction
                 while((tx = nodeQ.poll()) != null) {
-                    rolledBack.add(1);
+                    rolledBack.increment();
 
                     doSleep(r.nextInt(50)); // Add random sleep to increase completed txs
count.
 
@@ -787,7 +783,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
         try {
             rollbackFut.get();
         }
-        catch (IgniteFutureCancelledCheckedException e) {
+        catch (IgniteFutureCancelledCheckedException ignore) {
             // Expected.
         }
 
@@ -796,7 +792,7 @@ public class TxRollbackAsyncTest extends GridCommonAbstractTest {
             Transaction tx;
 
             while((tx = queue.poll()) != null) {
-                rolledBack.add(1);
+                rolledBack.increment();
 
                 rollbackClo.apply(tx);
             }


Mime
View raw message