You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/06/04 10:51:20 UTC

[1/5] incubator-ignite git commit: IGNITE-983: Added support for primitive types.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sprint-5 922c1c445 -> bf3203a42


IGNITE-983: Added support for primitive types.


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

Branch: refs/heads/ignite-sprint-5
Commit: 11c0b904a934c31ac936a8793cd11bf34af7634b
Parents: 97d0bc1
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Jun 3 14:26:49 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Jun 3 14:26:49 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/configuration/CacheConfiguration.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/11c0b904/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 2c7d8c1..8b1e1a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -1664,7 +1664,14 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         A.ensure(indexedTypes == null || (indexedTypes.length & 1) == 0,
             "Number of indexed types is expected to be even. Refer to method javadoc for details.");
 
-        this.indexedTypes = indexedTypes;
+        int len = indexedTypes.length;
+
+        Class<?>[] newIndexedTypes = new Class<?>[len];
+
+        for (int i = 0; i < len; i++)
+            newIndexedTypes[i] = U.box(indexedTypes[i]);
+
+        this.indexedTypes = newIndexedTypes;
 
         return this;
     }


[2/5] incubator-ignite git commit: IGNITE-983: Added tests.

Posted by ak...@apache.org.
IGNITE-983: Added tests.


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

Branch: refs/heads/ignite-sprint-5
Commit: bafad99677ff63431adfc9ca9c3e3a3897447c25
Parents: 11c0b90
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Jun 3 15:25:49 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Jun 3 15:25:49 2015 +0700

----------------------------------------------------------------------
 ...acheConfigurationPrimitiveTypesSelfTest.java | 104 +++++++++++++++++++
 .../IgniteCacheWithIndexingTestSuite.java       |   2 +
 2 files changed, 106 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bafad996/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
new file mode 100644
index 0000000..967a466
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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 org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+/**
+ *
+ */
+@SuppressWarnings("unchecked")
+public class IgniteCacheConfigurationPrimitiveTypesSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimitiveTypes() throws Exception {
+        Ignite ignite = startGrid(1);
+
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>("c1");
+
+        ccfg.setIndexedTypes(
+            byte.class, byte.class,
+            short.class, short.class,
+            int.class, int.class,
+            long.class, long.class,
+            float.class, float.class,
+            double.class, double.class,
+            boolean.class, boolean.class);
+
+        IgniteCache<Object, Object> cache = ignite.getOrCreateCache(ccfg);
+
+        byte b = 1;
+        cache.put(b, b);
+
+        short s = 2;
+        cache.put(s, s);
+
+        int i = 3;
+        cache.put(i, i);
+
+        long l = 4;
+        cache.put(l, l);
+
+        float f = 5;
+        cache.put(f, f);
+
+        double d = 6;
+        cache.put(d, d);
+
+        boolean bool = true;
+        cache.put(bool, bool);
+
+        assert cache.query(new ScanQuery<>()).getAll().size() == 7;
+
+        assert cache.query(new SqlQuery<>(Byte.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Short.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Integer.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Long.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Float.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Double.class, "1 = 1")).getAll().size() == 1;
+        assert cache.query(new SqlQuery<>(Boolean.class, "1 = 1")).getAll().size() == 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bafad996/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index 240caff..67ebda9 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -51,6 +51,8 @@ public class IgniteCacheWithIndexingTestSuite extends TestSuite {
 
         suite.addTestSuite(CacheConfigurationP2PTest.class);
 
+        suite.addTestSuite(IgniteCacheConfigurationPrimitiveTypesSelfTest.class);
+
         return suite;
     }
 }


[4/5] incubator-ignite git commit: Merge branches 'ignite-983' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-983

Posted by ak...@apache.org.
Merge branches 'ignite-983' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-983


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

Branch: refs/heads/ignite-sprint-5
Commit: 46b244723a0c39c7bb5bb92157d71032d655923a
Parents: 51d4737 922c1c4
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 4 15:29:43 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 4 15:29:43 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |   3 +
 .../processors/cache/GridCacheContext.java      |   3 -
 .../dht/GridDhtPartitionTopologyImpl.java       |   8 +-
 .../GridDhtPartitionsExchangeFuture.java        |  10 +-
 .../internal/visor/query/VisorQueryJob.java     |   2 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   3 +
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  31 -----
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  56 +++++++-
 .../tcp/ipfinder/TcpDiscoveryIpFinder.java      |  10 +-
 .../TcpDiscoveryMulticastIpFinder.java          |  47 +++++--
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  62 +++++++++
 .../tcp/TcpClientDiscoverySpiMulticastTest.java | 129 +++++++++++++++++++
 .../IgniteSpiDiscoverySelfTestSuite.java        |   1 +
 .../gce/TcpDiscoveryGoogleStorageIpFinder.java  |  43 ++++---
 .../commands/cache/VisorCacheScanCommand.scala  |   2 +-
 15 files changed, 326 insertions(+), 84 deletions(-)
----------------------------------------------------------------------



[5/5] incubator-ignite git commit: # IGNITE-983. Minor fix after review.

Posted by ak...@apache.org.
# IGNITE-983. Minor fix after review.


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

Branch: refs/heads/ignite-sprint-5
Commit: bf3203a42fbd92e5960c29f672351d20cd756897
Parents: 46b2447
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 4 15:50:16 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 4 15:50:16 2015 +0700

----------------------------------------------------------------------
 ...gniteCacheConfigurationPrimitiveTypesSelfTest.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf3203a4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
index 967a466..e90f10c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
@@ -93,12 +93,12 @@ public class IgniteCacheConfigurationPrimitiveTypesSelfTest extends GridCommonAb
 
         assert cache.query(new ScanQuery<>()).getAll().size() == 7;
 
-        assert cache.query(new SqlQuery<>(Byte.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Short.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Integer.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Long.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Float.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Double.class, "1 = 1")).getAll().size() == 1;
-        assert cache.query(new SqlQuery<>(Boolean.class, "1 = 1")).getAll().size() == 1;
+        assertEquals(cache.query(new SqlQuery<>(Byte.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Short.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Integer.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Long.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Float.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Double.class, "1 = 1")).getAll().size(), 1);
+        assertEquals(cache.query(new SqlQuery<>(Boolean.class, "1 = 1")).getAll().size(), 1);
     }
 }


[3/5] incubator-ignite git commit: # IGNITE-983 Fixed logic to support null value.

Posted by ak...@apache.org.
# IGNITE-983 Fixed logic to support null value.


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

Branch: refs/heads/ignite-sprint-5
Commit: 51d4737ab70a2962ec8ef3f300317e1223d52ab3
Parents: bafad99
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 4 00:17:27 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 4 00:17:27 2015 +0700

----------------------------------------------------------------------
 .../ignite/configuration/CacheConfiguration.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/51d4737a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 8b1e1a5..1aa4fd6 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -1664,14 +1664,18 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         A.ensure(indexedTypes == null || (indexedTypes.length & 1) == 0,
             "Number of indexed types is expected to be even. Refer to method javadoc for details.");
 
-        int len = indexedTypes.length;
+        if (indexedTypes != null) {
+            int len = indexedTypes.length;
 
-        Class<?>[] newIndexedTypes = new Class<?>[len];
+            Class<?>[] newIndexedTypes = new Class<?>[len];
 
-        for (int i = 0; i < len; i++)
-            newIndexedTypes[i] = U.box(indexedTypes[i]);
+            for (int i = 0; i < len; i++)
+                newIndexedTypes[i] = U.box(indexedTypes[i]);
 
-        this.indexedTypes = newIndexedTypes;
+            this.indexedTypes = newIndexedTypes;
+        }
+        else
+            this.indexedTypes = null;
 
         return this;
     }