private void checkHistory(Ignite ignite, List<AffinityTopologyVersion> expHist, int expSize) throws Exception {
awaitPartitionMapExchange();
GridCacheProcessor proc = ((IgniteKernal)ignite).context().cache();
int cnt = 0;
for (GridCacheContext cctx : proc.context().cacheContexts()) {
GridAffinityAssignmentCache aff = GridTestUtils.getFieldValue(cctx.affinity(), "aff");
AtomicInteger fullHistSize = GridTestUtils.getFieldValue(aff, "fullHistSize");
assertEquals(expSize, fullHistSize.get());
Map<AffinityTopologyVersion, Object> cache = GridTestUtils.getFieldValue(aff, "affCache");
assertEquals("Unexpected history: " + cache.keySet(), expHist.size(), cache.size());
for (AffinityTopologyVersion topVer : expHist)
assertTrue("No history [ver=" + topVer + ", hist=" + cache.keySet() + ']', cache.containsKey(topVer));
cnt++;
}
assert cnt > 4;
}