use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class GridPartitionedCacheJtaLookupClassNameSelfTest method testUncompatibleTmLookup.
/**
*
*/
@IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-1094", forceFailure = true)
public void testUncompatibleTmLookup() {
final IgniteEx ignite = grid(0);
final CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setName("Foo");
cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cacheCfg.setTransactionManagerLookupClassName(TestTmLookup2.class.getName());
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws IgniteException {
ignite.createCache(cacheCfg);
return null;
}
}, IgniteException.class, null);
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class LocalAffinityFunctionTest method getConfiguration.
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setBackups(1);
ccfg.setName(CACHE1);
ccfg.setCacheMode(CacheMode.LOCAL);
ccfg.setAffinity(new RendezvousAffinityFunction());
cfg.setCacheConfiguration(ccfg);
return cfg;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class LocalAffinityFunctionTest method testWronglySetAffinityFunctionForLocalCache.
public void testWronglySetAffinityFunctionForLocalCache() {
Ignite node = ignite(NODE_CNT - 1);
CacheConfiguration ccf = node.cache(CACHE1).getConfiguration(CacheConfiguration.class);
assertEquals("org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction", ccf.getAffinity().getClass().getName());
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class DataStructuresProcessor method compatibleConfiguration.
/**
* @param cfg Collection configuration.
* @return Cache name.
* @throws IgniteCheckedException If failed.
*/
private String compatibleConfiguration(CollectionConfiguration cfg) throws IgniteCheckedException {
List<CacheCollectionInfo> caches = utilityDataCache.context().affinityNode() ? utilityDataCache.localPeek(DATA_STRUCTURES_CACHE_KEY, null, null) : utilityDataCache.get(DATA_STRUCTURES_CACHE_KEY);
String cacheName = findCompatibleConfiguration(cfg, caches);
if (cacheName == null)
cacheName = utilityDataCache.invoke(DATA_STRUCTURES_CACHE_KEY, new AddDataCacheProcessor(cfg)).get();
assert cacheName != null;
CacheConfiguration newCfg = cacheConfiguration(cfg, cacheName);
if (ctx.cache().cache(cacheName) == null) {
ctx.cache().dynamicStartCache(newCfg, cacheName, null, CacheType.INTERNAL, false, false, true, true).get();
}
assert ctx.cache().cache(cacheName) != null : cacheName;
return cacheName;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class PlatformProcessorImpl method getOrCreateCacheFromConfig.
/** {@inheritDoc} */
@Override
public PlatformTargetProxy getOrCreateCacheFromConfig(long memPtr) throws IgniteCheckedException {
BinaryRawReaderEx reader = platformCtx.reader(platformCtx.memory().get(memPtr));
CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
IgniteCacheProxy cache = reader.readBoolean() ? (IgniteCacheProxy) ctx.grid().getOrCreateCache(cfg, PlatformConfigurationUtils.readNearConfiguration(reader)) : (IgniteCacheProxy) ctx.grid().getOrCreateCache(cfg);
return createPlatformCache(cache);
}
Aggregations