Skip to content

Commit

Permalink
ignite-sql-tests - tests
Browse files Browse the repository at this point in the history
  • Loading branch information
S.Vladykin committed Feb 25, 2015
1 parent 9168bfa commit 29f294a
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 441 deletions.
Expand Up @@ -43,11 +43,13 @@ public final class SqlQuery extends Query<SqlQuery> {
private Object[] args;

/**
* Constructs query for the given SQL query.
* Constructs query for the given type name and SQL query.
*
* @param type Type.
* @param sql SQL Query.
*/
public SqlQuery(String sql) {
public SqlQuery(String type, String sql) {
setType(type);
setSql(sql);
}

Expand All @@ -58,9 +60,8 @@ public SqlQuery(String sql) {
* @param sql SQL Query.
*/
public SqlQuery(Class<?> type, String sql) {
this(sql);

setType(type);
setSql(sql);
}

/**
Expand Down
Expand Up @@ -252,13 +252,21 @@ protected CacheConfiguration cacheConfiguration(String gridName) throws Exceptio
cfg.setAtomicityMode(atomicityMode());
cfg.setWriteSynchronizationMode(writeSynchronization());
cfg.setDistributionMode(distributionMode());
cfg.setIndexedTypes(indexedTypes());

if (cacheMode() == PARTITIONED)
cfg.setBackups(1);

return cfg;
}

/**
* Indexed types.
*/
protected Class<?>[] indexedTypes() {
return null;
}

/**
* @return Default cache mode.
*/
Expand Down
Expand Up @@ -21,10 +21,9 @@
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cache.query.annotations.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.query.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.marshaller.optimized.*;
Expand Down Expand Up @@ -89,6 +88,8 @@ private CacheConfiguration cache(@Nullable String name) {
cache.setDistributionMode(distributionMode());
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setPreloadMode(SYNC);
cache.setQueryIndexEnabled(true);
cache.setIndexedTypes();

if (cacheMode() == PARTITIONED)
cache.setBackups(1);
Expand Down
Expand Up @@ -87,7 +87,7 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
* @return Cache configuration.
*/
private static CacheConfiguration createCache(String name, CacheMode mode) {
CacheConfiguration cc = defaultCacheConfiguration();
CacheConfiguration<?,?> cc = defaultCacheConfiguration();

cc.setName(name);
cc.setCacheMode(mode);
Expand All @@ -98,6 +98,18 @@ private static CacheConfiguration createCache(String name, CacheMode mode) {
cc.setAtomicityMode(TRANSACTIONAL);
cc.setDistributionMode(NEAR_PARTITIONED);

if (mode == CacheMode.PARTITIONED)
cc.setIndexedTypes(
Integer.class, FactPurchase.class
);
else if (mode == CacheMode.REPLICATED)
cc.setIndexedTypes(
Integer.class, DimProduct.class,
Integer.class, DimStore.class
);
else
throw new IllegalStateException("mode: " + mode);

return cc;
}

Expand Down

0 comments on commit 29f294a

Please sign in to comment.