Squashed commit of the following:
commit eb1633feb73f9e264bc94ef2ab9a3d25a7f3e2e9
Author: Igor Seliverstov <[email protected]>
Date: Fri May 5 16:21:57 2017 +0300
Ignite-5075
commit 18141c9e1fdfb79f1713a778bb40873186a959df
Author: Igor Seliverstov <[email protected]>
Date: Fri May 5 11:57:00 2017 +0300
Ignite-5075
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1b88c1bc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1b88c1bc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1b88c1bc
Branch: refs/heads/ignite-5075
Commit: 1b88c1bc23c40db071388d485e4d170da375997c
Parents: b904fd2
Author: sboikov <[email protected]>
Authored: Wed May 10 13:46:15 2017 +0300
Committer: sboikov <[email protected]>
Committed: Wed May 10 13:46:15 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheStartTest.java | 82 +++++++++++---------
.../jdbc/CacheJdbcPojoStoreFactorySelfTest.java | 2 +-
2 files changed, 46 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1b88c1bc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java
index 21b8d0f..eb8077f 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartTest.java
@@ -20,11 +20,14 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -35,6 +38,9 @@ public class IgniteCacheStartTest extends
GridCommonAbstractTest {
private static final TcpDiscoveryIpFinder IP_FINDER = new
TcpDiscoveryVmIpFinder(true);
/** */
+ private static final String CACHE_NAME = "c1";
+
+ /** */
private boolean client;
/** */
@@ -64,33 +70,34 @@ public class IgniteCacheStartTest extends
GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ @SuppressWarnings("unchecked")
public void testStartAndNodeJoin() throws Exception {
Ignite node0 = startGrid(0);
- checkCache(0, "c1", false);
+ checkCache(0, CACHE_NAME, false);
- node0.createCache(cacheConfiguration("c1"));
+ node0.createCache(cacheConfiguration(CACHE_NAME));
- checkCache(0, "c1", true);
+ checkCache(0, CACHE_NAME, true);
startGrid(1);
- checkCache(0, "c1", true);
- checkCache(1, "c1", true);
+ checkCache(0, CACHE_NAME, true);
+ checkCache(1, CACHE_NAME, true);
client = true;
startGrid(2);
- checkCache(0, "c1", true);
- checkCache(1, "c1", true);
- checkCache(2, "c1", false);
+ checkCache(0, CACHE_NAME, true);
+ checkCache(1, CACHE_NAME, true);
+ checkCache(2, CACHE_NAME, false);
- ignite(2).destroyCache("c1");
+ ignite(2).destroyCache(CACHE_NAME);
- checkCache(0, "c1", false);
- checkCache(1, "c1", false);
- checkCache(2, "c1", false);
+ checkCache(0, CACHE_NAME, false);
+ checkCache(1, CACHE_NAME, false);
+ checkCache(2, CACHE_NAME, false);
}
/**
@@ -119,42 +126,42 @@ public class IgniteCacheStartTest extends
GridCommonAbstractTest {
startGrid(2);
- ccfg = cacheConfiguration("c1");
+ ccfg = cacheConfiguration(CACHE_NAME);
client = joinClient;
startGrid(3);
- checkCache(0, "c1", true);
- checkCache(1, "c1", true);
- checkCache(2, "c1", false);
- checkCache(3, "c1", true);
+ checkCache(0, CACHE_NAME, true);
+ checkCache(1, CACHE_NAME, true);
+ checkCache(2, CACHE_NAME, false);
+ checkCache(3, CACHE_NAME, true);
client = false;
ccfg = null;
startGrid(4);
- checkCache(0, "c1", true);
- checkCache(1, "c1", true);
- checkCache(2, "c1", false);
- checkCache(3, "c1", true);
- checkCache(4, "c1", true);
+ checkCache(0, CACHE_NAME, true);
+ checkCache(1, CACHE_NAME, true);
+ checkCache(2, CACHE_NAME, false);
+ checkCache(3, CACHE_NAME, true);
+ checkCache(4, CACHE_NAME, true);
client = true;
startGrid(5);
- checkCache(0, "c1", true);
- checkCache(1, "c1", true);
- checkCache(2, "c1", false);
- checkCache(3, "c1", true);
- checkCache(4, "c1", true);
- checkCache(5, "c1", false);
+ checkCache(0, CACHE_NAME, true);
+ checkCache(1, CACHE_NAME, true);
+ checkCache(2, CACHE_NAME, false);
+ checkCache(3, CACHE_NAME, true);
+ checkCache(4, CACHE_NAME, true);
+ checkCache(5, CACHE_NAME, false);
- ignite(5).destroyCache("c1");
+ ignite(5).destroyCache(CACHE_NAME);
for (int i = 0; i < 5; i++)
- checkCache(i, "c1", false);
+ checkCache(i, CACHE_NAME, false);
}
/**
@@ -170,13 +177,14 @@ public class IgniteCacheStartTest extends
GridCommonAbstractTest {
* @param cacheName Cache name.
* @param expCache {@code True} if cache should be created.
*/
- private void checkCache(int idx, String cacheName, boolean expCache) {
- IgniteKernal node = (IgniteKernal)ignite(idx);
-
- if (expCache)
- assertNotNull(node.context().cache().cache(cacheName));
- else
- assertNull(node.context().cache().cache(cacheName));
+ private void checkCache(int idx, final String cacheName, final boolean
expCache) throws IgniteInterruptedCheckedException {
+ final IgniteKernal node = (IgniteKernal)ignite(idx);
+
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return expCache == (node.context().cache().cache(cacheName) !=
null);
+ }
+ }, 1000));
assertNotNull(node.context().cache().cache(CU.UTILITY_CACHE_NAME));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1b88c1bc/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
index 9389646..0fd16f0 100644
---
a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
+++
b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
@@ -77,7 +77,7 @@ public class CacheJdbcPojoStoreFactorySelfTest extends
GridCommonAbstractTest {
}
return null;
}
- }, IgniteException.class, "Failed to load bean in application
context");
+ }, IgniteException.class, "Spring bean with provided name doesn't
exist");
}
/**