You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2019/03/19 06:57:33 UTC

[ignite] branch master updated: IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This closes #6270.

This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e95bb4  IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This closes #6270.
4e95bb4 is described below

commit 4e95bb400198b6d7c51be353e323c37e36578db4
Author: AMRepo <an...@gmail.com>
AuthorDate: Tue Mar 19 09:57:23 2019 +0300

    IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This closes #6270.
---
 .../IgnitePdsBinarySortObjectFieldsTest.java       | 123 ++++++++++-----------
 1 file changed, 59 insertions(+), 64 deletions(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
index a14ed8c..bccad9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
@@ -19,11 +19,15 @@ package org.apache.ignite.internal.processors.cache.persistence;
 
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
@@ -34,6 +38,60 @@ public class IgnitePdsBinarySortObjectFieldsTest extends GridCommonAbstractTest
     /** */
     private static final String CACHE_NAME = "ignitePdsBinarySortObjectFieldsTestCache";
 
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        cleanPersistenceDir();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setConsistentId(gridName);
+
+        cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+            .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)
+                .setPersistenceEnabled(true)));
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    @Test
+    @WithSystemProperty(key = IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS, value = "true")
+    public void testGivenCacheWithPojoValueAndPds_WhenPut_ThenNoHangup() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        ignite.cluster().active(true);
+
+        final IgniteCache<Long, Value> cache = ignite.getOrCreateCache(
+            new CacheConfiguration<Long, Value>(CACHE_NAME)
+                .setAffinity(new RendezvousAffinityFunction().setPartitions(32)));
+
+        GridTestUtils.assertTimeout(5, TimeUnit.SECONDS, () -> cache.put(1L, new Value(1L)));
+
+        assertEquals(1, cache.size());
+    }
+
     /**
      * Value.
      */
@@ -78,67 +136,4 @@ public class IgnitePdsBinarySortObjectFieldsTest extends GridCommonAbstractTest
             return "Value [val=" + val + ']';
         }
     }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        cleanPersistenceDir();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        cleanPersistenceDir();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setConsistentId(gridName);
-
-        cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-
-        cleanPersistenceDir();
-
-        super.afterTest();
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    @Test
-    public void testGivenCacheWithPojoValueAndPds_WhenPut_ThenNoHangup() throws Exception {
-        System.setProperty("IGNITE_BINARY_SORT_OBJECT_FIELDS", "true");
-
-        GridTestUtils.assertTimeout(5, TimeUnit.SECONDS, new Runnable() {
-            @Override public void run() {
-                IgniteEx ignite;
-
-                try {
-                    ignite = startGrid(0);
-                }
-                catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-
-                ignite.active(true);
-
-                IgniteCache<Long, Value> cache = ignite.getOrCreateCache(
-                    new CacheConfiguration<Long, Value>(CACHE_NAME)
-                );
-
-                cache.put(1L, new Value(1L));
-
-                assertEquals(1, cache.size());
-            }
-        });
-    }
 }