ignite-sql - 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/f1cba0b0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f1cba0b0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f1cba0b0 Branch: refs/heads/sprint-1 Commit: f1cba0b02e5cecb72d08e5464eeed7fdea2858d3 Parents: d07fb87 Author: S.Vladykin <svlady...@gridgain.com> Authored: Tue Jan 27 15:22:47 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Tue Jan 27 15:22:47 2015 +0300 ---------------------------------------------------------------------- .../processors/query/h2/IgniteH2Indexing.java | 5 +- .../query/h2/sql/GridQueryParsingTest.java | 69 ++++++++++++++++---- 2 files changed, 62 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f1cba0b0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index a1efcdd..2d105d2 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -31,6 +31,7 @@ import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.future.GridFinishedFutureEx; import org.apache.ignite.lang.*; import org.apache.ignite.marshaller.*; +import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.indexing.*; @@ -1110,7 +1111,9 @@ public class IgniteH2Indexing implements GridQueryIndexing { if (log.isDebugEnabled()) log.debug("Starting cache query index..."); - if (ctx != null) { // This is allowed in some tests. + if (ctx == null) // This is allowed in some tests. + marshaller = new IgniteOptimizedMarshaller(); + else { this.ctx = ctx; nodeId = ctx.localNodeId(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f1cba0b0/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java index accb965..96d46cb 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java @@ -9,13 +9,19 @@ package org.apache.ignite.internal.processors.query.h2.sql; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.query.*; +import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.processors.query.h2.*; import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.marshaller.optimized.*; +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 org.h2.command.*; import org.h2.command.dml.*; import org.h2.engine.*; @@ -24,23 +30,64 @@ import org.h2.jdbc.*; import java.io.*; import java.util.*; +import static org.apache.ignite.cache.CacheDistributionMode.*; +import static org.apache.ignite.cache.CachePreloadMode.SYNC; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; + /** * */ -public class GridQueryParsingTest extends GridCacheAbstractQuerySelfTest { - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 1; - } +public class GridQueryParsingTest extends GridCommonAbstractTest { + /** */ + private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** */ + private static Ignite ignite; /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; + @SuppressWarnings("unchecked") + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration c = super.getConfiguration(gridName); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(ipFinder); + + c.setDiscoverySpi(disco); + + GridQueryConfiguration idxCfg = new GridQueryConfiguration(); + + c.setQueryConfiguration(idxCfg); + + c.setMarshaller(new IgniteOptimizedMarshaller(true)); + + // Cache. + CacheConfiguration cc = defaultCacheConfiguration(); + + cc.setCacheMode(CacheMode.PARTITIONED); + cc.setAtomicityMode(CacheAtomicityMode.ATOMIC); + cc.setDistributionMode(PARTITIONED_ONLY); + cc.setWriteSynchronizationMode(FULL_SYNC); + cc.setPreloadMode(SYNC); + cc.setSwapEnabled(false); + + CacheQueryConfiguration qcfg = new CacheQueryConfiguration(); + + qcfg.setIndexPrimitiveKey(true); + qcfg.setIndexFixedTyping(true); + + cc.setQueryConfiguration(qcfg); + + c.setCacheConfiguration(cc); + + return c; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); + /** */ + @Override protected void beforeTestsStarted() throws Exception { + super.beforeTestsStarted(); + + ignite = startGrid(); GridCache cache = ignite.cache(null);