ignite-sql-tests - api remove static
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/550e5d85 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/550e5d85 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/550e5d85 Branch: refs/heads/ignite-sql-tests Commit: 550e5d853d64924695948c2b76ff3cc090be5c90 Parents: 69c502a Author: S.Vladykin <[email protected]> Authored: Wed Feb 25 02:41:32 2015 +0300 Committer: S.Vladykin <[email protected]> Committed: Wed Feb 25 02:41:32 2015 +0300 ---------------------------------------------------------------------- .../datagrid/CacheContinuousQueryExample.java | 4 +- .../datagrid/CachePopularNumbersExample.java | 6 +- .../examples/datagrid/CacheQueryExample.java | 22 +++---- .../starschema/CacheStarSchemaExample.java | 6 +- .../org/apache/ignite/cache/query/Query.java | 67 -------------------- .../cache/IgniteCacheQueryIndexSelfTest.java | 2 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 29 ++++----- ...dCacheContinuousQueryReplicatedSelfTest.java | 6 +- .../GridContinuousOperationsLoadTest.java | 2 +- .../cache/GridCacheCrossCacheQuerySelfTest.java | 6 +- .../GridCacheCrossCacheQuerySelfTestNewApi.java | 10 +-- .../GridCacheQueryIndexDisabledSelfTest.java | 7 ++ .../IgniteCacheAbstractFieldsQuerySelfTest.java | 31 +++++---- .../cache/IgniteCacheAbstractQuerySelfTest.java | 59 +++++++++-------- ...hePartitionedQueryMultiThreadedSelfTest.java | 7 +- .../IgniteCacheAtomicFieldsQuerySelfTest.java | 6 +- .../IgniteCachePartitionedQuerySelfTest.java | 7 +- ...gniteCacheReplicatedFieldsQuerySelfTest.java | 2 +- .../commands/cache/VisorCacheCommandSpec.scala | 6 +- 19 files changed, 106 insertions(+), 179 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java index ec7a040..0455c61 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheContinuousQueryExample.java @@ -60,9 +60,9 @@ public class CacheContinuousQueryExample { cache.put(i, Integer.toString(i)); // Create new continuous query. - ContinuousQuery<Integer, String> qry = Query.continuous(); + ContinuousQuery<Integer, String> qry = new ContinuousQuery<>(); - qry.setInitialPredicate(Query.scan(new IgniteBiPredicate<Integer, String>() { + qry.setInitialPredicate(new ScanQuery<>(new IgniteBiPredicate<Integer, String>() { @Override public boolean apply(Integer key, String val) { return key > 10; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java index 0f71681..f1a16bb 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java @@ -18,13 +18,12 @@ package org.apache.ignite.examples.datagrid; import org.apache.ignite.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cluster.*; import javax.cache.processor.*; import java.util.*; -import static org.apache.ignite.cache.query.Query.*; - /** * Real time popular numbers counter. * <p> @@ -119,7 +118,8 @@ public class CachePopularNumbersExample { try { List<List<?>> results = new ArrayList<>(cache.queryFields( - sql("select _key, _val from Long order by _val desc limit ?").setArgs(cnt)).getAll()); + new SqlFieldsQuery("select _key, _val from Long order by _val desc limit ?").setArgs(cnt)) + .getAll()); for (List<?> res : results) System.out.println(res.get(0) + "=" + res.get(1)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java index 3f2ccef..f30c147 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java @@ -26,8 +26,6 @@ import javax.cache.*; import java.io.*; import java.util.*; -import static org.apache.ignite.cache.query.Query.*; - /** * Cache queries example. This example demonstrates SQL, TEXT, and FULL SCAN * queries over cache. @@ -123,13 +121,13 @@ public class CacheQueryExample { // Execute queries for salary ranges. print("People with salaries between 0 and 1000: ", - cache.query(sql(Person.class, sql).setArgs(0, 1000)).getAll()); + cache.query(new SqlQuery(Person.class, sql).setArgs(0, 1000)).getAll()); print("People with salaries between 1000 and 2000: ", - cache.query(sql(Person.class, sql).setArgs(1000, 2000)).getAll()); + cache.query(new SqlQuery(Person.class, sql).setArgs(1000, 2000)).getAll()); print("People with salaries greater than 2000: ", - cache.query(sql(Person.class, sql).setArgs(2000, Integer.MAX_VALUE)).getAll()); + cache.query(new SqlQuery(Person.class, sql).setArgs(2000, Integer.MAX_VALUE)).getAll()); } /** @@ -148,9 +146,9 @@ public class CacheQueryExample { // Execute queries for find employees for different organizations. print("Following people are 'GridGain' employees: ", - cache.query(sql(Person.class, joinSql).setArgs("GridGain")).getAll()); + cache.query(new SqlQuery(Person.class, joinSql).setArgs("GridGain")).getAll()); print("Following people are 'Other' employees: ", - cache.query(sql(Person.class, joinSql).setArgs("Other")).getAll()); + cache.query(new SqlQuery(Person.class, joinSql).setArgs("Other")).getAll()); } /** @@ -163,11 +161,11 @@ public class CacheQueryExample { // Query for all people with "Master Degree" in their resumes. QueryCursor<Cache.Entry<CacheAffinityKey<UUID>, Person>> masters = - cache.query(text(Person.class, "Master")); + cache.query(new TextQuery(Person.class, "Master")); // Query for all people with "Bachelor Degree" in their resumes. QueryCursor<Cache.Entry<CacheAffinityKey<UUID>, Person>> bachelors = - cache.query(text(Person.class, "Bachelor")); + cache.query(new TextQuery(Person.class, "Bachelor")); print("Following people have 'Master Degree' in their resumes: ", masters.getAll()); print("Following people have 'Bachelor Degree' in their resumes: ", bachelors.getAll()); @@ -182,7 +180,7 @@ public class CacheQueryExample { IgniteCache<CacheAffinityKey<UUID>, Person> cache = Ignition.ignite().jcache(CACHE_NAME); // Calculate average of salary of all persons in GridGain. - QueryCursor<List<?>> cursor = cache.queryFields(sql( + QueryCursor<List<?>> cursor = cache.queryFields(new SqlFieldsQuery( "select avg(salary) from Person, Organization where Person.orgId = Organization.id and " + "lower(Organization.name) = lower(?)").setArgs("GridGain")); @@ -201,7 +199,7 @@ public class CacheQueryExample { // Create query to get names of all employees. QueryCursor<List<?>> cursor = cache.queryFields( - sql("select concat(firstName, ' ', lastName) from Person")); + new SqlFieldsQuery("select concat(firstName, ' ', lastName) from Person")); // Execute query to get collection of rows. In this particular // case each row will have one element with full name of an employees. @@ -221,7 +219,7 @@ public class CacheQueryExample { IgniteCache<?, ?> cache = Ignition.ignite().jcache(CACHE_NAME); // Execute query to get names of all employees. - QueryCursor<List<?>> cursor = cache.queryFields(sql("select concat(firstName, ' ', lastName), " + QueryCursor<List<?>> cursor = cache.queryFields(new SqlFieldsQuery("select concat(firstName, ' ', lastName), " + "Organization.name from Person, Organization where " + "Person.orgId = Organization.id")); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java index 9cdb70f..07f7554 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/starschema/CacheStarSchemaExample.java @@ -26,8 +26,6 @@ import javax.cache.*; import java.util.*; import java.util.concurrent.*; -import static org.apache.ignite.cache.query.Query.*; - /** * <a href="http://en.wikipedia.org/wiki/Snowflake_schema">Snowflake Schema</a> is a logical * arrangement of data in which data is split into {@code dimensions} and {@code facts}. @@ -157,7 +155,7 @@ public class CacheStarSchemaExample { // ======================== // Create cross cache query to get all purchases made at store1. - QueryCursor<Cache.Entry<Integer, FactPurchase>> storePurchases = factCache.query(sql( + QueryCursor<Cache.Entry<Integer, FactPurchase>> storePurchases = factCache.query(new SqlQuery( FactPurchase.class, "from \"replicated\".DimStore, \"partitioned\".FactPurchase " + "where DimStore.id=FactPurchase.storeId and DimStore.name=?").setArgs("Store1")); @@ -187,7 +185,7 @@ public class CacheStarSchemaExample { // Create cross cache query to get all purchases made at store2 // for specified products. - QueryCursor<Cache.Entry<Integer, FactPurchase>> prodPurchases = factCache.query(sql( + QueryCursor<Cache.Entry<Integer, FactPurchase>> prodPurchases = factCache.query(new SqlQuery( FactPurchase.class, "from \"replicated\".DimStore, \"replicated\".DimProduct, \"partitioned\".FactPurchase " + "where DimStore.id=FactPurchase.storeId and DimProduct.id=FactPurchase.productId " http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java b/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java index 123b274..29c7bfb 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/query/Query.java @@ -19,8 +19,6 @@ package org.apache.ignite.cache.query; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.spi.indexing.*; import java.io.*; @@ -28,10 +26,6 @@ import java.io.*; * Base class for all Ignite cache queries. * Use {@link SqlQuery} and {@link TextQuery} for SQL and * text queries accordingly. - * <p> - * Also contains convenience shortcuts for query object construction: - * {@link #sql(Class, String)}, {@link #sql(String)}, {@link #text(Class, String)}, - * {@link #scan(IgniteBiPredicate)} and {@link #spi()}. * * @see IgniteCache#query(Query) * @see IgniteCache#localQuery(Query) @@ -53,67 +47,6 @@ public abstract class Query<T extends Query> implements Serializable { } /** - * Factory method for SQL fields queries. - * - * @param sql SQL Query string. - * @return SQL Fields query instance. - */ - public static SqlFieldsQuery sql(String sql) { - return new SqlFieldsQuery(sql); - } - - /** - * Factory method for SQL queries. - * - * @param type Type to be queried. - * @param sql SQL Query string. - * @return SQL Query instance. - */ - public static SqlQuery sql(Class<?> type, String sql) { - return new SqlQuery(type, sql); - } - - /** - * Factory method for Lucene fulltext queries. - * - * @param type Type to be queried. - * @param txt Search string. - * @return Fulltext query. - */ - public static TextQuery text(Class<?> type, String txt) { - return new TextQuery(txt).setType(type); - } - - /** - * Factory method for SPI queries. - * - * @param filter Filter. - * @return SPI Query. - */ - public static <K, V> ScanQuery<K, V> scan(final IgniteBiPredicate<K, V> filter) { - return new ScanQuery<>(filter); - } - - /** - * Factory method for SPI queries. - * - * @return SPI Query. - * @see IndexingSpi - */ - public static SpiQuery spi() { - return new SpiQuery(); - } - - /** - * Factory method for continuous queries. - * - * @return Continuous query. - */ - public static <K, V> ContinuousQuery<K, V> continuous() { - return new ContinuousQuery<>(); - } - - /** * Gets optional page size, if {@code 0}, then default is used. * * @return Optional page size. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java index b41424d..98dc5b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java @@ -96,7 +96,7 @@ public class IgniteCacheQueryIndexSelfTest extends GridCacheAbstractSelfTest { */ private void checkQuery(IgniteCache<Integer, CacheValue> cache) throws Exception { QueryCursor<Cache.Entry<Integer, CacheValue>> qry = - cache.query(Query.sql(CacheValue.class, "val >= 5")); + cache.query(new SqlQuery(CacheValue.class, "val >= 5")); Collection<Cache.Entry<Integer, CacheValue>> queried = qry.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 966d818..86e8a9f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -54,7 +54,6 @@ import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.internal.processors.cache.query.CacheQueryType.*; import static org.apache.ignite.events.EventType.*; import static org.apache.ignite.internal.processors.cache.query.CacheQueryType.*; @@ -203,7 +202,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo */ @SuppressWarnings("ThrowableResultOfMethodCallIgnored") public void testIllegalArguments() throws Exception { - final ContinuousQuery<Object, Object> q = Query.continuous(); + final ContinuousQuery<Object, Object> q = new ContinuousQuery<>(); GridTestUtils.assertThrows( log, @@ -247,7 +246,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testAllEntries() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, List<Integer>> map = new HashMap<>(); final CountDownLatch latch = new CountDownLatch(5); @@ -313,7 +312,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testEntriesByFilter() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, List<Integer>> map = new HashMap<>(); final CountDownLatch latch = new CountDownLatch(4); @@ -385,7 +384,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo if (((IgniteKernal)grid(0)).cache(null).configuration().getCacheMode() != PARTITIONED) return; - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, List<Integer>> map = new HashMap<>(); final CountDownLatch latch = new CountDownLatch(1); @@ -456,7 +455,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, List<Integer>> map = new HashMap<>(); final CountDownLatch latch = new CountDownLatch(5); @@ -541,7 +540,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED) return; - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, List<Integer>> map = new HashMap<>(); final CountDownLatch latch = new CountDownLatch(5); @@ -618,9 +617,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testInitialPredicate() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); - qry.setInitialPredicate(Query.scan(new P2<Integer, Integer>() { + qry.setInitialPredicate(new ScanQuery<>(new P2<Integer, Integer>() { @Override public boolean apply(Integer k, Integer v) { return k >= 5; } @@ -663,9 +662,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testInitialPredicateAndUpdates() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); - qry.setInitialPredicate(Query.scan(new P2<Integer, Integer>() { + qry.setInitialPredicate(new ScanQuery<>(new P2<Integer, Integer>() { @Override public boolean apply(Integer k, Integer v) { return k >= 5; } @@ -725,7 +724,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testLoadCache() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Map<Integer, Integer> map = new ConcurrentHashMap8<>(); final CountDownLatch latch = new CountDownLatch(10); @@ -761,7 +760,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo IgniteCache<Object, Object> cache = grid(0).jcache(null); - ContinuousQuery<Object, Object> qry = Query.continuous(); + ContinuousQuery<Object, Object> qry = new ContinuousQuery<>(); final Map<Object, Object> map = new ConcurrentHashMap8<>(); final CountDownLatch latch = new CountDownLatch(2); @@ -797,7 +796,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo public void testNodeJoin() throws Exception { IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final Collection<CacheEntryEvent<? extends Integer, ? extends Integer>> all = new ConcurrentLinkedDeque8<>(); final CountDownLatch latch = new CountDownLatch(2); @@ -897,7 +896,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo IgniteCache<Integer, Integer> cache = grid(0).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); qry.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() { @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer, ? extends Integer>> evts) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java index 5d0d84d..834a9b7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java @@ -51,7 +51,7 @@ public class GridCacheContinuousQueryReplicatedSelfTest extends GridCacheContinu IgniteCache<Integer, Integer> cache1 = grid(0).jcache(null); IgniteCache<Integer, Integer> cache2 = grid(1).jcache(null); - ContinuousQuery<Integer, Integer> qry = Query.continuous(); + ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); final AtomicReference<Integer> val = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); @@ -97,7 +97,7 @@ public class GridCacheContinuousQueryReplicatedSelfTest extends GridCacheContinu final CountDownLatch latch1 = new CountDownLatch(2); final CountDownLatch latch2 = new CountDownLatch(2); - ContinuousQuery<Integer, Integer> qry1 = Query.continuous(); + ContinuousQuery<Integer, Integer> qry1 = new ContinuousQuery<>(); qry1.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() { @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer, ? extends Integer>> evts) { @@ -109,7 +109,7 @@ public class GridCacheContinuousQueryReplicatedSelfTest extends GridCacheContinu } }); - ContinuousQuery<Integer, Integer> qry2 = Query.continuous(); + ContinuousQuery<Integer, Integer> qry2 = new ContinuousQuery<>(); qry2.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() { @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer, ? extends Integer>> evts) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java index 75ece98..fb0c2d8 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java @@ -95,7 +95,7 @@ public class GridContinuousOperationsLoadTest { for (int i = 0; i < parallelCnt; i++) { if (useQry) { - ContinuousQuery<Object, Object> qry = Query.continuous(); + ContinuousQuery<Object, Object> qry = new ContinuousQuery<>(); qry.setLocalListener(new CacheEntryUpdatedListener<Object,Object>() { @Override public void onUpdated(Iterable<CacheEntryEvent<?,?>> evts) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java index d0bf140..ffd8519 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -37,7 +38,6 @@ import java.util.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.cache.query.Query.*; /** * Tests cross cache queries. @@ -227,9 +227,9 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest { IgniteCache<Object,Object> c = ignite.jcache("partitioned"); - c.queryFields(sql("select cast(? as varchar) from FactPurchase").setArgs("aaa")).getAll(); + c.queryFields(new SqlFieldsQuery("select cast(? as varchar) from FactPurchase").setArgs("aaa")).getAll(); - List<List<?>> res = c.queryFields(sql("select cast(? as varchar), id " + + List<List<?>> res = c.queryFields(new SqlFieldsQuery("select cast(? as varchar), id " + "from FactPurchase order by id limit ? offset ?").setArgs("aaa", 1, 1)).getAll(); assertEquals(1, res.size()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTestNewApi.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTestNewApi.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTestNewApi.java index 1e07bde..e56fd04 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTestNewApi.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTestNewApi.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -38,7 +39,6 @@ import java.util.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.cache.query.Query.*; /** * Tests cross cache queries. @@ -107,7 +107,7 @@ public class GridCacheCrossCacheQuerySelfTestNewApi extends GridCommonAbstractTe IgniteCache<Object,Object> p = ignite.jcache("partitioned"); - List<Cache.Entry<Object,Object>> res = p.query(sql(FactPurchase.class, + List<Cache.Entry<Object,Object>> res = p.query(new SqlQuery(FactPurchase.class, "price = 5")).getAll(); assertEquals(1, res.size()); @@ -127,7 +127,7 @@ public class GridCacheCrossCacheQuerySelfTestNewApi extends GridCommonAbstractTe } }; - final long cnt = F.reduce(p.queryFields(sql("select count(*) from FactPurchase where price > 5")), rdc); + final long cnt = F.reduce(p.queryFields(new SqlFieldsQuery("select count(*) from FactPurchase where price > 5")), rdc); X.println("all facts: " + cnt); @@ -135,7 +135,7 @@ public class GridCacheCrossCacheQuerySelfTestNewApi extends GridCommonAbstractTe for (int i = 0; i < 3; i++) { List<List<?>> rows = grid(i).jcache("partitioned").localQueryFields( - sql("select count(*) from FactPurchase where price > 5")).getAll(); + new SqlFieldsQuery("select count(*) from FactPurchase where price > 5")).getAll(); assertEquals(1, rows.size()); @@ -150,7 +150,7 @@ public class GridCacheCrossCacheQuerySelfTestNewApi extends GridCommonAbstractTe for (int i = 0; i < 3; i++) { List<Cache.Entry<Object,Object>> rows = grid(i).jcache("partitioned").localQuery( - sql(FactPurchase.class, "price > 5")).getAll(); + new SqlQuery(FactPurchase.class, "price > 5")).getAll(); X.println("node facts: " + rows.size()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java index baffc0f..dd1c88d 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java @@ -25,6 +25,8 @@ import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; 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.*; import javax.cache.*; @@ -34,6 +36,9 @@ import javax.cache.*; */ public class GridCacheQueryIndexDisabledSelfTest extends GridCommonAbstractTest { /** */ + private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** */ public GridCacheQueryIndexDisabledSelfTest() { super(true); } @@ -53,6 +58,8 @@ public class GridCacheQueryIndexDisabledSelfTest extends GridCommonAbstractTest TcpDiscoverySpi disco = new TcpDiscoverySpi(); + disco.setIpFinder(ipFinder); + cfg.setDiscoverySpi(disco); return cfg; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java index d2cf52f..3ae942b 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java @@ -41,7 +41,6 @@ import java.util.concurrent.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.cache.query.Query.sql; /** * Tests for fields queries. @@ -174,7 +173,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testExecute() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select _KEY, name, age from Person")); + .queryFields(new SqlFieldsQuery("select _KEY, name, age from Person")); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -220,7 +219,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testExecuteWithArguments() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select _KEY, name, age from Person where age > ?").setArgs(30)); + .queryFields(new SqlFieldsQuery("select _KEY, name, age from Person where age > ?").setArgs(30)); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -261,7 +260,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testSelectAllJoined() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select * from Person p, Organization o where p.orgId = o.id")); + .queryFields(new SqlFieldsQuery("select * from Person p, Organization o where p.orgId = o.id")); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -323,7 +322,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testEmptyResult() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select name from Person where age = 0")); + .queryFields(new SqlFieldsQuery("select name from Person where age = 0")); Collection<List<?>> res = qry.getAll(); @@ -333,7 +332,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testQueryString() throws Exception { - QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(sql("select * from String")); + QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new SqlFieldsQuery("select * from String")); Collection<List<?>> res = qry.getAll(); @@ -350,7 +349,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testQueryIntegersWithJoin() throws Exception { - QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(sql( + QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new SqlFieldsQuery( "select i._KEY, i._VAL, j._KEY, j._VAL from Integer i join Integer j where i._VAL >= 100")); Collection<List<?>> res = qry.getAll(); @@ -374,7 +373,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA public void testPagination() throws Exception { // Query with page size 20. QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select * from Integer").setPageSize(20)); + .queryFields(new SqlFieldsQuery("select * from Integer").setPageSize(20)); List<List<?>> res = new ArrayList<>(qry.getAll()); @@ -399,7 +398,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA for (int i = 0; i < 200; i++) cache.put(i, i); - QueryCursor<List<?>> qry = cache.queryFields(sql("select * from Integer")); + QueryCursor<List<?>> qry = cache.queryFields(new SqlFieldsQuery("select * from Integer")); Collection<List<?>> res = qry.getAll(); @@ -415,7 +414,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { - return cache.queryFields(sql("select * from String")); + return cache.queryFields(new SqlFieldsQuery("select * from String")); } }, CacheException.class, null); } @@ -431,7 +430,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA cache.put(key, val); - Collection<List<?>> res = cache.queryFields(sql("select * from Person")).getAll(); + Collection<List<?>> res = cache.queryFields(new SqlFieldsQuery("select * from Person")).getAll(); assertEquals(1, res.size()); @@ -477,7 +476,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA */ private void testPaginationIterator(@Nullable String cacheName) throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(cacheName) - .queryFields(sql("select _key, _val from Integer").setPageSize(10)); + .queryFields(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10)); int cnt = 0; @@ -497,7 +496,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testPaginationIteratorKeepAll() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select _key, _val from Integer").setPageSize(10)); + .queryFields(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10)); int cnt = 0; @@ -513,7 +512,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA assertEquals(size, cnt); - qry = grid(0).jcache(null).queryFields(sql("select _key, _val from Integer").setPageSize(10)); + qry = grid(0).jcache(null).queryFields(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10)); List<List<?>> list = new ArrayList<>(qry.getAll()); @@ -549,7 +548,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA */ private void testPaginationGet(@Nullable String cacheName) throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select _key, _val from Integer").setPageSize(10)); + .queryFields(new SqlFieldsQuery("select _key, _val from Integer").setPageSize(10)); List<List<?>> list = new ArrayList<>(qry.getAll()); @@ -572,7 +571,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA /** @throws Exception If failed. */ public void testEmptyGrid() throws Exception { QueryCursor<List<?>> qry = grid(0).jcache(null) - .queryFields(sql("select name, age from Person where age = 25")); + .queryFields(new SqlFieldsQuery("select name, age from Person where age = 25")); List<?> res = F.first(qry.getAll()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java index a9a9883..64dce47 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java @@ -53,7 +53,6 @@ import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.cache.query.Query.*; import static org.apache.ignite.internal.processors.cache.query.CacheQueryType.*; import static org.apache.ignite.events.EventType.*; import static org.junit.Assert.*; @@ -198,7 +197,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put("tst", "test"); - QueryCursor<Cache.Entry<String, String>> qry = cache.query(sql(String.class, "_val='test'")); + QueryCursor<Cache.Entry<String, String>> qry = cache.query(new SqlQuery(String.class, "_val='test'")); Cache.Entry<String, String> entry = F.first(qry.getAll()); @@ -220,7 +219,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(key, val); QueryCursor<Cache.Entry<String, Integer>> qry = - cache.query(sql(Integer.class, "_key = 'k' and _val > 1")); + cache.query(new SqlQuery(Integer.class, "_key = 'k' and _val > 1")); Cache.Entry<String, Integer> entry = F.first(qry.getAll()); @@ -238,7 +237,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac // Without alias. final IgniteCache<Object, Object> cache = ignite.jcache(null); - QueryCursor<List<?>> qry = cache.queryFields(sql("select square(1), square(2)")); + QueryCursor<List<?>> qry = cache.queryFields(new SqlFieldsQuery("select square(1), square(2)")); Collection<List<?>> res = qry.getAll(); @@ -253,7 +252,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac assertEquals(4, row.get(1)); // With alias. - qry = cache.queryFields(sql("select _cube_(1), _cube_(2)")); + qry = cache.queryFields(new SqlFieldsQuery("select _cube_(1), _cube_(2)")); res = qry.getAll(); @@ -272,7 +271,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac log, new Callable<Object>() { @Override public Object call() throws Exception { - cache.queryFields(sql("select no()")); + cache.queryFields(new SqlFieldsQuery("select no()")); return null; } @@ -293,7 +292,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac IgniteCache<String, Integer> cache = ignite.jcache(null); - List<Cache.Entry<String, Integer>> qry = cache.query(sql(Integer.class, "1=1")).getAll(); + List<Cache.Entry<String, Integer>> qry = cache.query(new SqlQuery(Integer.class, "1=1")).getAll(); Cache.Entry<String, Integer> res = F.first(qry); @@ -301,7 +300,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac U.sleep(1020); - qry = cache.query(sql(Integer.class, "1=1")).getAll(); + qry = cache.query(new SqlQuery(Integer.class, "1=1")).getAll(); res = F.first(qry); @@ -317,7 +316,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, 1); cache.put(2, 2); - QueryCursor<Cache.Entry<Integer,Integer>> qry = cache.query(sql(Integer.class, "_key between 2 and 1")); + QueryCursor<Cache.Entry<Integer,Integer>> qry = cache.query(new SqlQuery(Integer.class, "_key between 2 and 1")); assertTrue(qry.getAll().isEmpty()); } @@ -347,7 +346,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(new Key(100501), val2); QueryCursor<Cache.Entry<Key, GridCacheQueryTestValue>> qry = cache - .query(sql(GridCacheQueryTestValue.class, + .query(new SqlQuery(GridCacheQueryTestValue.class, "fieldName='field1' and field2=1 and field3=1 and id=100500 and embeddedField2=11 and x=3")); Cache.Entry<Key, GridCacheQueryTestValue> entry = F.first(qry.getAll()); @@ -402,7 +401,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put("key", "value"); - QueryCursor<Cache.Entry<String, String>> qry = cache.query(sql(String.class, "true")); + QueryCursor<Cache.Entry<String, String>> qry = cache.query(new SqlQuery(String.class, "true")); Iterator<Cache.Entry<String, String>> iter = qry.iterator(); @@ -423,7 +422,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, val); QueryCursor<Cache.Entry<Integer, ObjectValue>> qry = - cache.query(sql(ObjectValue.class, "_val=?").setArgs(val)); + cache.query(new SqlQuery(ObjectValue.class, "_val=?").setArgs(val)); Iterator<Cache.Entry<Integer, ObjectValue>> iter = qry.iterator(); @@ -436,7 +435,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac assert !iter.hasNext(); - qry = cache.query(text(ObjectValue.class, "test")); + qry = cache.query(new TextQuery(ObjectValue.class, "test")); iter = qry.iterator(); @@ -483,7 +482,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac QueryCursor<Cache.Entry<Integer, ObjectValue>> qry = - cache.query(sql(ObjectValue.class, "intVal >= ? order by intVal").setArgs(0)); + cache.query(new SqlQuery(ObjectValue.class, "intVal >= ? order by intVal").setArgs(0)); Iterator<Cache.Entry<Integer, ObjectValue>> iter = qry.iterator(); @@ -510,7 +509,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < cnt; i++) assert set.contains(i); - qry = cache.query(sql(ObjectValue.class, "MOD(intVal, 2) = ? order by intVal").setArgs(0)); + qry = cache.query(new SqlQuery(ObjectValue.class, "MOD(intVal, 2) = ? order by intVal").setArgs(0)); iter = qry.iterator(); @@ -701,7 +700,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, 1); cache.put(2, 2); - QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(sql(Integer.class, "_val > 1")); + QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new SqlQuery(Integer.class, "_val > 1")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -737,7 +736,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < 50; i++) cache.put(i, i); - SqlQuery qry = sql(Integer.class, "_key >= 0"); + SqlQuery qry = new SqlQuery(Integer.class, "_key >= 0"); qry.setPageSize(10); @@ -780,7 +779,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(sql(Integer.class, "_key >= 0")); + cache.query(new SqlQuery(Integer.class, "_key >= 0")); List<Cache.Entry<Integer, Integer>> list = new ArrayList<>(q.getAll()); @@ -807,7 +806,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < 50; i++) cache.put(i, i); - QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(scan(new IgniteBiPredicate<Integer,Integer>() { + QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new ScanQuery(new IgniteBiPredicate<Integer,Integer>() { @Override public boolean apply(Integer k, Integer v) { assertNotNull(k); assertNotNull(v); @@ -846,7 +845,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(key, val); - QueryCursor<Cache.Entry<String, Integer>> qry = cache.query(sql(Integer.class, + QueryCursor<Cache.Entry<String, Integer>> qry = cache.query(new SqlQuery(Integer.class, "_key = 'k' and _val > 1")); Cache.Entry<String, Integer> entry = F.first(qry.getAll()); @@ -866,7 +865,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(new BadHashKeyObject("test_key0"), 1005001); cache.put(new BadHashKeyObject("test_key1"), 7); - assertEquals(1005001, cache.query(sql(Integer.class, "_key = ?").setArgs( + assertEquals(1005001, cache.query(new SqlQuery(Integer.class, "_key = ?").setArgs( new BadHashKeyObject("test_key0"))).iterator().next().getValue().intValue()); } @@ -904,13 +903,13 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, val); - QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(sql(val.getClass(), "_key >= 0")); + QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new SqlQuery(val.getClass(), "_key >= 0")); Collection<Cache.Entry<Integer, Object>> res = q.getAll(); assertEquals(1, res.size()); - List<List<?>> fieldsRes = cache.queryFields(sql( + List<List<?>> fieldsRes = cache.queryFields(new SqlFieldsQuery( "select field1 from IgniteCacheAbstractQuerySelfTest_5")).getAll(); assertEquals(1, fieldsRes.size()); @@ -942,7 +941,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(1, val1); cache.put(2, val2); - QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(sql(val1.getClass(), "_key >= 0")); + QueryCursor<Cache.Entry<Integer, Object>> q = cache.query(new SqlQuery(val1.getClass(), "_key >= 0")); Collection<Cache.Entry<Integer, Object>> res = q.getAll(); @@ -959,7 +958,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(sql(Integer.class, "_key >= 0")); + cache.query(new SqlQuery(Integer.class, "_key >= 0")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -989,7 +988,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(sql(Integer.class, "limit 5")); + cache.query(new SqlQuery(Integer.class, "limit 5")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); @@ -1017,7 +1016,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(2, new ArrayObject(new Long[] {4L, 5L, 6L})); QueryCursor<Cache.Entry<Integer, ArrayObject>> q = - cache.query(sql(ArrayObject.class, "array_contains(arr, cast(? as long))").setArgs(4)); + cache.query(new SqlQuery(ArrayObject.class, "array_contains(arr, cast(? as long))").setArgs(4)); Collection<Cache.Entry<Integer, ArrayObject>> res = q.getAll(); @@ -1068,7 +1067,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = - cache.query(sql(Integer.class, "_key >= ?").setArgs(10)); + cache.query(new SqlQuery(Integer.class, "_key >= ?").setArgs(10)); q.getAll(); @@ -1141,7 +1140,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac for (int i = 0; i < 20; i++) cache.put(i, i); - QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(scan(new IgniteBiPredicate<Integer,Integer>() { + QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new ScanQuery<>(new IgniteBiPredicate<Integer,Integer>() { @Override public boolean apply(Integer k, Integer v) { return k >= 10; } @@ -1278,7 +1277,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac cache.put(i, new Person("Person " + i, i)); QueryCursor<List<?>> q = cache - .queryFields(sql("select _key, name from Person where salary > ?").setArgs(10)); + .queryFields(new SqlFieldsQuery("select _key, name from Person where salary > ?").setArgs(10)); q.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java index e379536..dac9e81 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java @@ -21,10 +21,8 @@ import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; -import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -42,7 +40,6 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.query.Query.*; /** * Tests for partitioned cache queries. @@ -152,7 +149,7 @@ public class IgniteCachePartitionedQueryMultiThreadedSelfTest extends GridCommon @Override public void applyx() throws IgniteCheckedException { while (!done.get()) { QueryCursor<Cache.Entry<UUID, Person>> master = - cache0.query(text(Person.class, "Master")); + cache0.query(new TextQuery(Person.class, "Master")); Collection<Cache.Entry<UUID, Person>> entries = master.getAll(); @@ -173,7 +170,7 @@ public class IgniteCachePartitionedQueryMultiThreadedSelfTest extends GridCommon @Override public void applyx() throws IgniteCheckedException { while (!done.get()) { QueryCursor<Cache.Entry<UUID, Person>> bachelors = - cache0.query(sql(Person.class, "degree = 'Bachelor'")); + cache0.query(new SqlQuery(Person.class, "degree = 'Bachelor'")); Collection<Cache.Entry<UUID, Person>> entries = bachelors.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQuerySelfTest.java index 0d920f8..406814e 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheAtomicFieldsQuerySelfTest.java @@ -17,10 +17,8 @@ package org.apache.ignite.internal.processors.cache.distributed.near; -import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.query.*; -import org.apache.ignite.internal.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.internal.util.typedef.*; import java.util.*; @@ -47,7 +45,7 @@ public class IgniteCacheAtomicFieldsQuerySelfTest extends IgniteCachePartitioned */ public void testUnsupportedOperations() { try { - QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(Query.sql( + QueryCursor<List<?>> qry = grid(0).jcache(null).queryFields(new SqlFieldsQuery( "update Person set name = ?").setArgs("Mary Poppins")); qry.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java index fb9ad9a..f1c77b3 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java @@ -27,7 +27,6 @@ import javax.cache.Cache; import java.util.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.cache.query.Query.sql; /** * Tests for partitioned cache queries. @@ -65,14 +64,14 @@ public class IgniteCachePartitionedQuerySelfTest extends IgniteCacheAbstractQuer // Fields query QueryCursor<List<?>> qry = cache0 - .queryFields(sql("select name from Person where salary > ?").setArgs(1600)); + .queryFields(new SqlFieldsQuery("select name from Person where salary > ?").setArgs(1600)); Collection<List<?>> res = qry.getAll(); assertEquals(3, res.size()); // Fields query count(*) - qry = cache0.queryFields(sql("select count(*) from Person")); + qry = cache0.queryFields(new SqlFieldsQuery("select count(*) from Person")); res = qry.getAll(); @@ -105,7 +104,7 @@ public class IgniteCachePartitionedQuerySelfTest extends IgniteCacheAbstractQuer assert grid(0).cluster().nodes().size() == gridCount(); QueryCursor<Cache.Entry<UUID, Person>> qry = - cache0.query(sql(Person.class, "salary < 2000")); + cache0.query(new SqlQuery(Person.class, "salary < 2000")); // Execute on full projection, duplicates are expected. Collection<Cache.Entry<UUID, Person>> entries = qry.getAll(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQuerySelfTest.java index 8a200cf..b6987d0 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedFieldsQuerySelfTest.java @@ -56,7 +56,7 @@ public class IgniteCacheReplicatedFieldsQuerySelfTest extends IgniteCacheAbstrac for (int i = 0; i < maximumQueryIteratorCount + 1; i++) { QueryCursor<List<?>> q = cache - .queryFields(Query.sql("select _key from Integer where _key >= 0 order by _key")); + .queryFields(new SqlFieldsQuery("select _key from Integer where _key >= 0 order by _key")); assertEquals(0, q.iterator().next().get(0)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/550e5d85/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala index d32407a..fa1fa83 100644 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala +++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala @@ -20,7 +20,7 @@ package org.apache.ignite.visor.commands.cache import org.apache.ignite.Ignition import org.apache.ignite.cache.CacheAtomicityMode._ import org.apache.ignite.cache.CacheMode._ -import org.apache.ignite.cache.query.Query._ +import org.apache.ignite.cache.query.SqlQuery import org.apache.ignite.cache.query.annotations.QuerySqlField import org.apache.ignite.configuration._ import org.apache.ignite.spi.discovery.tcp._ @@ -102,12 +102,12 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) { c.put(3, Foo(150)) // Create and execute query that mast return 2 rows. - val q1 = c.query(sql(classOf[Foo], "_key > ?").setArgs(java.lang.Integer.valueOf(1))).getAll() + val q1 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(java.lang.Integer.valueOf(1))).getAll() assert(q1.size() == 2) // Create and execute query that mast return 0 rows. - val q2 = c.query(sql(classOf[Foo], "_key > ?").setArgs(java.lang.Integer.valueOf(100))).getAll() + val q2 = c.query(new SqlQuery(classOf[Foo], "_key > ?").setArgs(java.lang.Integer.valueOf(100))).getAll() assert(q2.size() == 0)
