use of org.apache.ignite.IgniteIllegalStateException in project ignite by apache.
the class IgniteCachePrimaryNodeFailureRecoveryAbstractTest method checkKey.
/**
* @param key Key.
* @param keyNodes Key nodes.
*/
private void checkKey(Integer key, Collection<ClusterNode> keyNodes) {
if (keyNodes == null) {
for (Ignite ignite : G.allGrids()) {
IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
assertNull("Unexpected value for: " + ignite.name(), cache.localPeek(key));
}
for (Ignite ignite : G.allGrids()) {
IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
assertNull("Unexpected value for: " + ignite.name(), cache.get(key));
}
} else {
boolean found = false;
for (ClusterNode node : keyNodes) {
try {
Ignite ignite = grid(node);
found = true;
ignite.cache(DEFAULT_CACHE_NAME);
assertEquals("Unexpected value for: " + ignite.name(), key, key);
} catch (IgniteIllegalStateException ignore) {
// No-op.
}
}
assertTrue("Failed to find key node.", found);
for (Ignite ignite : G.allGrids()) {
IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
assertEquals("Unexpected value for: " + ignite.name(), key, cache.get(key));
}
}
}
Aggregations