Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-10692: Fix GridCommonAbstractTest.dht() method. #5671

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
Expand Down Expand Up @@ -389,7 +390,10 @@ public void testPreloadManyNodes() throws Exception {
* @return Topology.
*/
private GridDhtPartitionTopology topology(Ignite g) {
return ((GridNearCacheAdapter<Integer, String>)((IgniteKernal)g).<Integer, String>internalCache(DEFAULT_CACHE_NAME)).dht().topology();
GridCacheAdapter<Integer, String> internalCache = ((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME);

return internalCache.isNear() ? ((GridNearCacheAdapter<Integer, String>)internalCache).dht().topology() :
internalCache.context().dht().topology();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.testframework.MvccFeatureChecker;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -75,6 +76,9 @@ private CacheConfiguration cacheConfiguration() {

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
if (MvccFeatureChecker.forcedMvcc())
fail("https://issues.apache.org/jira/browse/IGNITE-8582");

startGridsMultiThreaded(GRID_CNT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,19 @@ protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K, V> cache) {
* @return DHT cache.
*/
protected <K, V> GridDhtCacheAdapter<K, V> dht() {
return this.<K, V>near().dht();
GridCacheAdapter<K, V> internalCache = ((IgniteKernal)grid()).internalCache(DEFAULT_CACHE_NAME);

return internalCache.isNear() ? internalCache.context().near().dht() : internalCache.context().dht();
}

/**
* @param idx Grid index.
* @return DHT cache.
*/
protected <K, V> GridDhtCacheAdapter<K, V> dht(int idx) {
return this.<K, V>near(idx).dht();
GridCacheAdapter<K, V> internalCache = ((IgniteKernal)grid(idx)).internalCache(DEFAULT_CACHE_NAME);

return internalCache.isNear() ? internalCache.context().near().dht() : internalCache.context().dht();
}

/**
Expand All @@ -334,7 +338,9 @@ protected <K, V> GridDhtCacheAdapter<K, V> dht(int idx) {
* @return DHT cache.
*/
protected <K, V> GridDhtCacheAdapter<K, V> dht(int idx, String cache) {
return this.<K, V>near(idx, cache).dht();
GridCacheAdapter<K, V> internalCache = ((IgniteKernal)grid(idx)).internalCache(cache);

return internalCache.isNear() ? internalCache.context().near().dht() : internalCache.context().dht();
}

/**
Expand Down