Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3901D17AD0 for ; Fri, 5 Jun 2015 02:34:58 +0000 (UTC) Received: (qmail 45893 invoked by uid 500); 5 Jun 2015 02:34:58 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 45861 invoked by uid 500); 5 Jun 2015 02:34:58 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 45852 invoked by uid 99); 5 Jun 2015 02:34:58 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2015 02:34:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id A852BC1241 for ; Fri, 5 Jun 2015 02:34:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id gZs65T7fJEF2 for ; Fri, 5 Jun 2015 02:34:56 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 8796B27622 for ; Fri, 5 Jun 2015 02:34:41 +0000 (UTC) Received: (qmail 44970 invoked by uid 99); 5 Jun 2015 02:34:41 -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; Fri, 05 Jun 2015 02:34:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 442D9E10F6; Fri, 5 Jun 2015 02:34:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.incubator.apache.org Date: Fri, 05 Jun 2015 02:35:02 -0000 Message-Id: <5845c4bd6be74e6fb0ef5b7a36a2cf7f@git.apache.org> In-Reply-To: <71b010951115479d95ec5232c9ebdce6@git.apache.org> References: <71b010951115479d95ec5232c9ebdce6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [23/50] incubator-ignite git commit: IGNITE-983: Added tests. 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-389 Commit: bafad99677ff63431adfc9ca9c3e3a3897447c25 Parents: 11c0b90 Author: AKuznetsov Authored: Wed Jun 3 15:25:49 2015 +0700 Committer: AKuznetsov 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 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 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; } }