You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2019/03/06 12:14:27 UTC

[GitHub] [ignite] zstan commented on a change in pull request #6111: IGNITE-11282 fix primitive arrays usage as cache index

zstan commented on a change in pull request #6111: IGNITE-11282 fix primitive arrays usage as cache index
URL: https://github.com/apache/ignite/pull/6111#discussion_r262914962
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
 ##########
 @@ -1200,6 +1201,70 @@ public void testTransform() throws Exception {
         }
     }
 
+    /**
+     * IGNITE-11282
+     * There is test for cases when Array used as cache key
+     * The issue with primitive arrys as key has been fixed whenever multidementional arrays will couse exception
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testPrimitiveArrayAsCacheKey() throws Exception {
+        IgniteKernal ignite = (IgniteKernal) grid(0);
+
+        Object[] testIdx = new Object[]{
+            new byte[]{1,0,1},
+            new int[]{1,2,3},
+            new boolean[]{true,true,false},
+            new float[]{1,2,3},
+            new double[]{1,2,3},
+            new long[]{1,2,3},
+            new char[]{'a','b','c'},
+        };
+
+        assert new KeyCacheObjectImpl(testIdx[0],null,1).
+            equals(new KeyCacheObjectImpl(new byte[]{1,0,1},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[1],null,1).
+                equals(new KeyCacheObjectImpl(new int[]{1,2,3},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[2],null,1).
+                equals(new KeyCacheObjectImpl(new boolean[]{true,true,false},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[3],null,1).
+                equals(new KeyCacheObjectImpl(new float[]{1,2,3},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[4],null,1).
+                equals(new KeyCacheObjectImpl(new double[]{1,2,3},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[5],null,1).
+                equals(new KeyCacheObjectImpl(new long[]{1,2,3},null,1)) : "Not equals";
+
+        assert new KeyCacheObjectImpl(testIdx[6],null,1).
+                equals(new KeyCacheObjectImpl(new char[]{'a','b','c'},null,1)) : "Not equals";
 
 Review comment:
   4 spaces left here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services