Skip to content

Commit

Permalink
ignite-sql-tests - rename
Browse files Browse the repository at this point in the history
  • Loading branch information
S.Vladykin committed Feb 8, 2015
1 parent 9a694ab commit c9e2e5e
Show file tree
Hide file tree
Showing 22 changed files with 164 additions and 157 deletions.
32 changes: 20 additions & 12 deletions modules/core/src/main/java/org/apache/ignite/IgniteCache.java
Expand Up @@ -195,36 +195,44 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public boolean isLocalLocked(K key, boolean byCurrThread); public boolean isLocalLocked(K key, boolean byCurrThread);


/** /**
* Queries cache with given predicate. * Queries cache. Accepts any subclass of {@link Query}.
* *
* @param filter Filter. * @param qry Query.
* @return Cursor. * @return Cursor.
* @see QueryScan
* @see QuerySql
* @see QueryText
* @see QuerySpi
*/ */
public QueryCursor<Entry<K, V>> query(QueryPredicate filter); public QueryCursor<Entry<K, V>> query(Query qry);


/** /**
* Queries separate entry fields with given SQL predicate. * Queries separate entry fields.
* *
* @param filter SQL Filter. * @param qry SQL Query.
* @return Cursor. * @return Cursor.
*/ */
public QueryCursor<List<?>> queryFields(QuerySqlPredicate filter); public QueryCursor<List<?>> queryFields(QuerySql qry);


/** /**
* Queries cache with given predicate only locally. * Queries cache locally. Accepts any subclass of {@link Query}.
* *
* @param filter Filter. * @param qry Query.
* @return Cursor. * @return Cursor.
* @see QueryScan
* @see QuerySql
* @see QueryText
* @see QuerySpi
*/ */
public QueryCursor<Entry<K, V>> localQuery(QueryPredicate filter); public QueryCursor<Entry<K, V>> localQuery(Query qry);


/** /**
* Queries separate entry fields with given SQL predicate only locally. * Queries separate entry fields locally.
* *
* @param filter Filter. * @param qry SQL Query.
* @return Cursor. * @return Cursor.
*/ */
public QueryCursor<List<?>> localQueryFields(QuerySqlPredicate filter); public QueryCursor<List<?>> localQueryFields(QuerySql qry);


/** /**
* Allows for iteration over local cache entries. * Allows for iteration over local cache entries.
Expand Down
Expand Up @@ -26,17 +26,17 @@


/** /**
* Query to pass into any of {@code Cache.query(...)} methods. * Query to pass into any of {@code Cache.query(...)} methods.
* Use {@link QuerySqlPredicate} and {@link QueryTextPredicate} for SQL and * Use {@link QuerySql} and {@link QueryText} for SQL and
* text queries accordingly. * text queries accordingly.
*/ */
public abstract class QueryPredicate<T extends QueryPredicate> implements Serializable { public abstract class Query<T extends Query> implements Serializable {
/** Page size. */ /** Page size. */
private int pageSize; private int pageSize;


/** /**
* Empty constructor. * Empty constructor.
*/ */
protected QueryPredicate() { Query() {
// No-op. // No-op.
} }


Expand All @@ -46,8 +46,8 @@ protected QueryPredicate() {
* @param sql SQL Query string. * @param sql SQL Query string.
* @return SQL Query instance. * @return SQL Query instance.
*/ */
public static QuerySqlPredicate sql(String sql) { public static QuerySql sql(String sql) {
return new QuerySqlPredicate(sql); return new QuerySql(sql);
} }


/** /**
Expand All @@ -57,7 +57,7 @@ public static QuerySqlPredicate sql(String sql) {
* @param sql SQL Query string. * @param sql SQL Query string.
* @return SQL Query instance. * @return SQL Query instance.
*/ */
public static QuerySqlPredicate sql(Class<?> type, String sql) { public static QuerySql sql(Class<?> type, String sql) {
return sql(sql).setType(type); return sql(sql).setType(type);
} }


Expand All @@ -67,8 +67,8 @@ public static QuerySqlPredicate sql(Class<?> type, String sql) {
* @param txt Search string. * @param txt Search string.
* @return Fulltext query. * @return Fulltext query.
*/ */
public static QueryTextPredicate text(String txt) { public static QueryText text(String txt) {
return new QueryTextPredicate(txt); return new QueryText(txt);
} }


/** /**
Expand All @@ -78,7 +78,7 @@ public static QueryTextPredicate text(String txt) {
* @param txt Search string. * @param txt Search string.
* @return Fulltext query. * @return Fulltext query.
*/ */
public static QueryTextPredicate text(Class<?> type, String txt) { public static QueryText text(Class<?> type, String txt) {
return text(txt).setType(type); return text(txt).setType(type);
} }


Expand All @@ -88,17 +88,17 @@ public static QueryTextPredicate text(Class<?> type, String txt) {
* @param filter Filter. * @param filter Filter.
* @return SPI Query. * @return SPI Query.
*/ */
public static <K, V> QueryScanPredicate<K, V> scan(final IgniteBiPredicate<K, V> filter) { public static <K, V> QueryScan<K, V> scan(final IgniteBiPredicate<K, V> filter) {
return new QueryScanPredicate<>(filter); return new QueryScan<>(filter);
} }


/** /**
* Factory method for SPI queries returning all entries. * Factory method for SPI queries returning all entries.
* *
* @return SPI Query. * @return SPI Query.
*/ */
public static <K, V> QueryScanPredicate<K, V> scan() { public static <K, V> QueryScan<K, V> scan() {
return new QueryScanPredicate<>(); return new QueryScan<>();
} }


/** /**
Expand All @@ -107,8 +107,8 @@ public static <K, V> QueryScanPredicate<K, V> scan() {
* @return SPI Query. * @return SPI Query.
* @see IndexingSpi * @see IndexingSpi
*/ */
public static QuerySpiPredicate spi() { public static QuerySpi spi() {
return new QuerySpiPredicate(); return new QuerySpi();
} }


/** /**
Expand All @@ -135,6 +135,6 @@ public T setPageSize(int pageSize) {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public String toString() { @Override public String toString() {
return S.toString(QueryPredicate.class, this); return S.toString(Query.class, this);
} }
} }
Expand Up @@ -106,7 +106,7 @@
* If you need to repeat execution, use {@link org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create * If you need to repeat execution, use {@link org.apache.ignite.internal.processors.cache.query.CacheQueries#createContinuousQuery()} method to create
* new query. * new query.
*/ */
public final class QueryContinuousPredicate<K, V> extends QueryPredicate implements AutoCloseable { public final class QueryContinuous<K, V> extends Query implements AutoCloseable {
/** /**
* Default buffer size. Size of {@code 1} means that all entries * Default buffer size. Size of {@code 1} means that all entries
* will be sent to master node immediately (buffering is disabled). * will be sent to master node immediately (buffering is disabled).
Expand All @@ -122,7 +122,7 @@ public final class QueryContinuousPredicate<K, V> extends QueryPredicate impleme
*/ */
public static final boolean DFLT_AUTO_UNSUBSCRIBE = true; public static final boolean DFLT_AUTO_UNSUBSCRIBE = true;


public void setInitialPredicate(QueryPredicate filter) { public void setInitialPredicate(Query filter) {
// TODO: implement. // TODO: implement.
} }


Expand Down
Expand Up @@ -21,16 +21,16 @@
import org.apache.ignite.lang.*; import org.apache.ignite.lang.*;


/** /**
* Scan query over cache entries. By default will accept all the entries. * Scan query over cache entries. Will accept all the entries if no predicate was set.
*/ */
public class QueryScanPredicate<K, V> extends QueryPredicate<QueryScanPredicate<K, V>> { public class QueryScan<K, V> extends Query<QueryScan<K, V>> {
/** */ /** */
private IgniteBiPredicate<K,V> filter; private IgniteBiPredicate<K,V> filter;


/** /**
* Create scan query returning all entries. * Create scan query returning all entries.
*/ */
public QueryScanPredicate() { public QueryScan() {
this(new IgniteBiPredicate<K,V>() { this(new IgniteBiPredicate<K,V>() {
@Override public boolean apply(K k, V v) { @Override public boolean apply(K k, V v) {
return true; return true;
Expand All @@ -43,7 +43,7 @@ public QueryScanPredicate() {
* *
* @param filter Filter. * @param filter Filter.
*/ */
public QueryScanPredicate(IgniteBiPredicate<K,V> filter) { public QueryScan(IgniteBiPredicate<K,V> filter) {
setFilter(filter); setFilter(filter);
} }


Expand Down
Expand Up @@ -22,7 +22,7 @@
/** /**
* Query to be used by {@link IndexingSpi} implementations. * Query to be used by {@link IndexingSpi} implementations.
*/ */
public final class QuerySpiPredicate extends QueryPredicate<QuerySpiPredicate> { public final class QuerySpi extends Query<QuerySpi> {
/** Arguments. */ /** Arguments. */
private Object[] args; private Object[] args;


Expand All @@ -41,7 +41,7 @@ public Object[] getArgs() {
* @param args SQL arguments. * @param args SQL arguments.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QuerySpiPredicate setArgs(Object... args) { public QuerySpi setArgs(Object... args) {
this.args = args; this.args = args;


return this; return this;
Expand Down
Expand Up @@ -21,10 +21,10 @@
import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.typedef.internal.*;


/** /**
* Query SQL predicate to use with any of the {@code JCache.query(...)} and * SQL Query to use with any of the {@code JCache.query(...)} and
* {@code JCache.queryFields(...)} methods. * {@code JCache.queryFields(...)} methods.
*/ */
public final class QuerySqlPredicate extends QueryPredicate<QuerySqlPredicate> { public final class QuerySql extends Query<QuerySql> {
/** */ /** */
private String type; private String type;


Expand All @@ -40,7 +40,7 @@ public final class QuerySqlPredicate extends QueryPredicate<QuerySqlPredicate> {
* *
* @param sql SQL Query. * @param sql SQL Query.
*/ */
public QuerySqlPredicate(String sql) { public QuerySql(String sql) {
setSql(sql); setSql(sql);
} }


Expand All @@ -50,7 +50,7 @@ public QuerySqlPredicate(String sql) {
* @param type Type. * @param type Type.
* @param sql SQL Query. * @param sql SQL Query.
*/ */
public QuerySqlPredicate(Class<?> type, String sql) { public QuerySql(Class<?> type, String sql) {
this(sql); this(sql);


setType(type); setType(type);
Expand All @@ -71,7 +71,7 @@ public String getSql() {
* @param sql SQL clause. * @param sql SQL clause.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QuerySqlPredicate setSql(String sql) { public QuerySql setSql(String sql) {
A.notNull(sql, "sql"); A.notNull(sql, "sql");


this.sql = sql; this.sql = sql;
Expand All @@ -94,7 +94,7 @@ public Object[] getArgs() {
* @param args SQL arguments. * @param args SQL arguments.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QuerySqlPredicate setArgs(Object... args) { public QuerySql setArgs(Object... args) {
this.args = args; this.args = args;


return this; return this;
Expand All @@ -115,7 +115,7 @@ public String getType() {
* @param type Type. * @param type Type.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QuerySqlPredicate setType(String type) { public QuerySql setType(String type) {
this.type = type; this.type = type;


return this; return this;
Expand All @@ -124,7 +124,7 @@ public QuerySqlPredicate setType(String type) {
/** /**
* @param type Type. * @param type Type.
*/ */
public QuerySqlPredicate setType(Class<?> type) { public QuerySql setType(Class<?> type) {
return setType(name(type)); return setType(name(type));
} }


Expand All @@ -145,6 +145,6 @@ static String name(Class<?> type) {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public String toString() { @Override public String toString() {
return S.toString(QuerySqlPredicate.class, this); return S.toString(QuerySql.class, this);
} }
} }
Expand Up @@ -19,12 +19,12 @@


import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.typedef.internal.*;


import static org.apache.ignite.cache.query.QuerySqlPredicate.name; import static org.apache.ignite.cache.query.QuerySql.*;


/** /**
* Predicate for Lucene based fulltext search. * Query for Lucene based fulltext search.
*/ */
public final class QueryTextPredicate extends QueryPredicate<QueryTextPredicate> { public final class QueryText extends Query<QueryText> {
/** */ /** */
private String type; private String type;


Expand All @@ -36,7 +36,7 @@ public final class QueryTextPredicate extends QueryPredicate<QueryTextPredicate>
* *
* @param txt Search string. * @param txt Search string.
*/ */
public QueryTextPredicate(String txt) { public QueryText(String txt) {
setText(txt); setText(txt);
} }


Expand All @@ -46,7 +46,7 @@ public QueryTextPredicate(String txt) {
* @param type Type. * @param type Type.
* @param txt Search string. * @param txt Search string.
*/ */
public QueryTextPredicate(Class<?> type, String txt) { public QueryText(Class<?> type, String txt) {
this(txt); this(txt);


setType(type); setType(type);
Expand All @@ -67,7 +67,7 @@ public String getType() {
* @param type Type. * @param type Type.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QueryTextPredicate setType(Class<?> type) { public QueryText setType(Class<?> type) {
return setType(name(type)); return setType(name(type));
} }


Expand All @@ -77,7 +77,7 @@ public QueryTextPredicate setType(Class<?> type) {
* @param type Type. * @param type Type.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QueryTextPredicate setType(String type) { public QueryText setType(String type) {
this.type = type; this.type = type;


return this; return this;
Expand All @@ -98,7 +98,7 @@ public String getText() {
* @param txt Text search string. * @param txt Text search string.
* @return {@code this} For chaining. * @return {@code this} For chaining.
*/ */
public QueryTextPredicate setText(String txt) { public QueryText setText(String txt) {
A.notNull(txt, "txt"); A.notNull(txt, "txt");


this.txt = txt; this.txt = txt;
Expand All @@ -108,6 +108,6 @@ public QueryTextPredicate setText(String txt) {


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public String toString() { @Override public String toString() {
return S.toString(QueryTextPredicate.class, this); return S.toString(QueryText.class, this);
} }
} }

0 comments on commit c9e2e5e

Please sign in to comment.