/** @throws Exception If failed. */ public void testLocalIfNoMetadataCacheIsConfigured() throws Exception { GridCacheConfiguration cc = defaultCacheConfiguration(); cc.setQueryIndexEnabled(false); cc.setName(dataCache1Name); g1Cfg.setCacheConfiguration(cc); checkGridStartFails(g1Cfg, "Metadata cache is not configured locally for GGFS", true); }
/** * Gets cache configuration. * * @return Cache configuration. */ private GridCacheConfiguration[] cacheConfiguration() { GridCacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName("partitioned"); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY); cacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(GRP_SIZE)); cacheCfg.setBackups(0); cacheCfg.setQueryIndexEnabled(false); cacheCfg.setAtomicityMode(TRANSACTIONAL); GridCacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setName("replicated"); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setQueryIndexEnabled(false); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); return new GridCacheConfiguration[] {metaCacheCfg, cacheCfg}; }
/** * @param cacheNames 2 Optional caches names. * @return 2 preconfigured meta caches. */ private GridCacheConfiguration[] metaCaches(String... cacheNames) { assertTrue(ArrayUtils.isEmpty(cacheNames) || cacheNames.length == 2); if (ArrayUtils.isEmpty(cacheNames)) cacheNames = new String[] {metaCache1Name, metaCache2Name}; GridCacheConfiguration[] res = new GridCacheConfiguration[cacheNames.length]; for (int i = 0; i < cacheNames.length; i++) { GridCacheConfiguration metaCache = defaultCacheConfiguration(); metaCache.setName(cacheNames[i]); metaCache.setAtomicityMode(TRANSACTIONAL); metaCache.setQueryIndexEnabled(false); res[i] = metaCache; } return res; }
/** {@inheritDoc} */ protected GridCacheConfiguration cacheConfiguration(String cacheName) { GridCacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); if (META_CACHE_NAME.equals(cacheName)) cacheCfg.setCacheMode(REPLICATED); else { cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY); cacheCfg.setBackups(0); cacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(CFG_GRP_SIZE)); } cacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setQueryIndexEnabled(false); return cacheCfg; }
/** * @param grpSize Group size to use in {@link GridGgfsGroupDataBlocksKeyMapper}. * @param cacheNames 2 Optional caches names. * @return 2 preconfigured data caches. */ private GridCacheConfiguration[] dataCaches(int grpSize, String... cacheNames) { assertTrue(ArrayUtils.isEmpty(cacheNames) || cacheNames.length == 2); if (ArrayUtils.isEmpty(cacheNames)) cacheNames = new String[] {dataCache1Name, dataCache2Name}; GridCacheConfiguration[] res = new GridCacheConfiguration[cacheNames.length]; for (int i = 0; i < cacheNames.length; i++) { GridCacheConfiguration dataCache = defaultCacheConfiguration(); dataCache.setName(cacheNames[i]); dataCache.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(grpSize)); dataCache.setAtomicityMode(TRANSACTIONAL); dataCache.setQueryIndexEnabled(false); res[i] = dataCache; } return res; }