Repository: incubator-ignite Updated Branches: refs/heads/sprint-2 c72a45875 -> 188554bc8
# sprint-2 added test Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/188554bc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/188554bc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/188554bc Branch: refs/heads/sprint-2 Commit: 188554bc8f7bc1e15d4f95583470c9ee3451f433 Parents: c72a458 Author: sboikov <sboi...@gridgain.com> Authored: Mon Mar 16 17:58:50 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Mar 16 17:58:50 2015 +0300 ---------------------------------------------------------------------- ...ridCacheContinuousQueryAbstractSelfTest.java | 75 ++++++++++++++++---- 1 file changed, 61 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/188554bc/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 3c264c0..e0ef254 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 @@ -67,6 +67,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo /** Latch timeout. */ protected static final long LATCH_TIMEOUT = 5000; + /** */ + private static final String NO_CACHE_GRID_NAME = "noCacheGrid"; + /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { @@ -74,20 +77,22 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo cfg.setPeerClassLoadingEnabled(peerClassLoadingEnabled()); - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(cacheMode()); - cacheCfg.setAtomicityMode(atomicityMode()); - cacheCfg.setDistributionMode(distributionMode()); - cacheCfg.setRebalanceMode(ASYNC); - cacheCfg.setWriteSynchronizationMode(FULL_SYNC); - cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore())); - cacheCfg.setReadThrough(true); - cacheCfg.setWriteThrough(true); - cacheCfg.setLoadPreviousValue(true); - cacheCfg.setQueryIndexEnabled(false); - - cfg.setCacheConfiguration(cacheCfg); + if (!gridName.equals(NO_CACHE_GRID_NAME)) { + CacheConfiguration cacheCfg = defaultCacheConfiguration(); + + cacheCfg.setCacheMode(cacheMode()); + cacheCfg.setAtomicityMode(atomicityMode()); + cacheCfg.setDistributionMode(distributionMode()); + cacheCfg.setRebalanceMode(ASYNC); + cacheCfg.setWriteSynchronizationMode(FULL_SYNC); + cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestStore())); + cacheCfg.setReadThrough(true); + cacheCfg.setWriteThrough(true); + cacheCfg.setLoadPreviousValue(true); + cacheCfg.setQueryIndexEnabled(false); + + cfg.setCacheConfiguration(cacheCfg); + } TcpDiscoverySpi disco = new TcpDiscoverySpi(); @@ -838,6 +843,48 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo /** * @throws Exception If failed. */ + @SuppressWarnings("TryFinallyCanBeTryWithResources") + public void testNodeJoinWithoutCache() throws Exception { + IgniteCache<Integer, Integer> cache = grid(0).jcache(null); + + ContinuousQuery<Integer, Integer> qry = Query.continuous(); + + final CountDownLatch latch = new CountDownLatch(1); + + qry.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() { + @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer, ? extends Integer>> evts) { + latch.countDown(); + } + }); + + QueryCursor<Cache.Entry<Integer, Integer>> cur = cache.query(qry); + + try { + try (Ignite ignite = startGrid(NO_CACHE_GRID_NAME)) { + log.info("Started node without cache: " + ignite); + + try { + ignite.jcache(null); + + fail(); + } + catch (IllegalArgumentException ignore) { + // Expected exception. + } + } + + cache.put(1, 1); + + assertTrue(latch.await(5000, MILLISECONDS)); + } + finally { + cur.close(); + } + } + + /** + * @throws Exception If failed. + */ public void testEvents() throws Exception { final AtomicInteger cnt = new AtomicInteger(); final CountDownLatch latch = new CountDownLatch(50);