ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject ignite git commit: ignite-3254 - fixed
Date Wed, 13 Jul 2016 17:22:43 GMT
Repository: ignite
Updated Branches:
  refs/heads/master d227995c5 -> 34a957cf6


ignite-3254 - fixed


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

Branch: refs/heads/master
Commit: 34a957cf6f64b9fbcb4d761cb2bb775c4f536b13
Parents: d227995
Author: Sergi Vladykin <sergi.vladykin@gmail.com>
Authored: Wed Jul 13 20:19:25 2016 +0300
Committer: Sergi Vladykin <sergi.vladykin@gmail.com>
Committed: Wed Jul 13 20:22:23 2016 +0300

----------------------------------------------------------------------
 .../examples/IndexingBridgeMethodTest.java      | 93 ++++++++++++++++++++
 .../IgniteExamplesJ8SelfTestSuite.java          |  2 +
 .../configuration/CacheConfiguration.java       |  3 +
 3 files changed, 98 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/34a957cf/examples/src/test/java8/org/apache/ignite/java8/examples/IndexingBridgeMethodTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/examples/IndexingBridgeMethodTest.java
b/examples/src/test/java8/org/apache/ignite/java8/examples/IndexingBridgeMethodTest.java
new file mode 100644
index 0000000..2837ed6
--- /dev/null
+++ b/examples/src/test/java8/org/apache/ignite/java8/examples/IndexingBridgeMethodTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.java8.examples;
+
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test covering bridge methods changes in Java 8.
+ */
+public class IndexingBridgeMethodTest extends GridCommonAbstractTest {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBridgeMethod() throws Exception {
+        Ignite ignite = startGrid();
+
+        CacheConfiguration<Integer, MyType> ccfg = new CacheConfiguration<>();
+
+        ccfg.setName("mytype");
+        ccfg.setIndexedTypes(Integer.class, MyType.class);
+
+        IgniteCache<Integer,MyType> c = ignite.getOrCreateCache(ccfg);
+
+        for (int i = 0; i < 100; i++)
+            c.put(i, new MyType(i));
+
+        assertEquals(100L, c.query(new SqlFieldsQuery(
+            "select count(*) from MyType")).getAll().get(0).get(0));
+        assertEquals(15, c.query(new SqlFieldsQuery(
+            "select id from MyType where _key = 15")).getAll().get(0).get(0));
+        assertEquals(25, c.query(new SqlFieldsQuery(
+            "select _key from MyType where id = 25")).getAll().get(0).get(0));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * Classes implementing this method, will have bridge method.
+     */
+    private static interface HasId<T extends Number> {
+        /**
+         * @return ID.
+         */
+        public T getId();
+    }
+
+    /**
+     *
+     */
+    private static class MyType implements HasId<Integer> {
+        /** */
+        private int id;
+
+        /**
+         * @param id Id.
+         */
+        private MyType(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return ID.
+         */
+        @QuerySqlField(index = true)
+        @Override public Integer getId() {
+            return id;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/34a957cf/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
b/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
index 57e48f9..949324c 100644
--- a/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
+++ b/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
@@ -24,6 +24,7 @@ import org.apache.ignite.java8.examples.CacheExamplesMultiNodeSelfTest;
 import org.apache.ignite.java8.examples.CacheExamplesSelfTest;
 import org.apache.ignite.java8.examples.EventsExamplesMultiNodeSelfTest;
 import org.apache.ignite.java8.examples.EventsExamplesSelfTest;
+import org.apache.ignite.java8.examples.IndexingBridgeMethodTest;
 import org.apache.ignite.java8.examples.MessagingExamplesSelfTest;
 import org.apache.ignite.testframework.GridTestUtils;
 
@@ -45,6 +46,7 @@ public class IgniteExamplesJ8SelfTestSuite extends TestSuite {
 
         TestSuite suite = new TestSuite("Ignite Examples Test Suite");
 
+        suite.addTest(new TestSuite(IndexingBridgeMethodTest.class));
         suite.addTest(new TestSuite(CacheExamplesSelfTest.class));
         suite.addTest(new TestSuite(BasicExamplesSelfTest.class));
 //        suite.addTest(new TestSuite(ContinuationExamplesSelfTest.class));

http://git-wip-us.apache.org/repos/asf/ignite/blob/34a957cf/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 3408834..64b7e1f 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
@@ -2299,6 +2299,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K,
V> {
             }
 
             for (Method mtd : c.getDeclaredMethods()) {
+                if (mtd.isBridge())
+                    continue;
+
                 QuerySqlField sqlAnn = mtd.getAnnotation(QuerySqlField.class);
                 QueryTextField txtAnn = mtd.getAnnotation(QueryTextField.class);
 


Mime
View raw message