Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EBCFA200B3C for ; Wed, 13 Jul 2016 19:22:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EA415160A6A; Wed, 13 Jul 2016 17:22:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1995F160A62 for ; Wed, 13 Jul 2016 19:22:43 +0200 (CEST) Received: (qmail 74327 invoked by uid 500); 13 Jul 2016 17:22:43 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 74317 invoked by uid 99); 13 Jul 2016 17:22:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2016 17:22:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C1ECE04BE; Wed, 13 Jul 2016 17:22:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergi@apache.org To: commits@ignite.apache.org Message-Id: <4f5f0d38f8d04325ac63337781e9b964@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: ignite-3254 - fixed Date: Wed, 13 Jul 2016 17:22:43 +0000 (UTC) archived-at: Wed, 13 Jul 2016 17:22:45 -0000 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 Authored: Wed Jul 13 20:19:25 2016 +0300 Committer: Sergi Vladykin 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 ccfg = new CacheConfiguration<>(); + + ccfg.setName("mytype"); + ccfg.setIndexedTypes(Integer.class, MyType.class); + + IgniteCache 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 { + /** + * @return ID. + */ + public T getId(); + } + + /** + * + */ + private static class MyType implements HasId { + /** */ + 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 extends MutableConfiguration { } for (Method mtd : c.getDeclaredMethods()) { + if (mtd.isBridge()) + continue; + QuerySqlField sqlAnn = mtd.getAnnotation(QuerySqlField.class); QueryTextField txtAnn = mtd.getAnnotation(QueryTextField.class);