add fully qualified class name

Add fully qualified class name because of multiple cache providers like iginte and hazelcast
This commit is contained in:
Rajat Garg 2018-05-13 21:38:16 +05:30 committed by GitHub
parent 2e119f774f
commit c319fbafca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,8 @@ public class CacheLoaderTest {
@Before @Before
public void setup() { public void setup() {
CachingProvider cachingProvider = Caching.getCachingProvider(); // Adding fully qualified class name because of multiple Cache Provider (Ignite and Hazelcast)
CachingProvider cachingProvider = Caching.getCachingProvider("com.hazelcast.cache.HazelcastCachingProvider");
CacheManager cacheManager = cachingProvider.getCacheManager(); CacheManager cacheManager = cachingProvider.getCacheManager();
MutableConfiguration<Integer, String> config = new MutableConfiguration<Integer, String>().setReadThrough(true).setCacheLoaderFactory(new FactoryBuilder.SingletonFactory<>(new SimpleCacheLoader())); MutableConfiguration<Integer, String> config = new MutableConfiguration<Integer, String>().setReadThrough(true).setCacheLoaderFactory(new FactoryBuilder.SingletonFactory<>(new SimpleCacheLoader()));
this.cache = cacheManager.createCache("SimpleCache", config); this.cache = cacheManager.createCache("SimpleCache", config);
@ -29,7 +30,7 @@ public class CacheLoaderTest {
@After @After
public void tearDown() { public void tearDown() {
Caching.getCachingProvider().getCacheManager().destroyCache(CACHE_NAME); Caching.getCachingProvider("com.hazelcast.cache.HazelcastCachingProvider").getCacheManager().destroyCache(CACHE_NAME);
} }
@Test @Test
@ -39,4 +40,4 @@ public class CacheLoaderTest {
assertEquals("fromCache" + i, value); assertEquals("fromCache" + i, value);
} }
} }
} }