use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteCacheFullTextQueryNodeJoiningSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
cache.setCacheMode(PARTITIONED);
cache.setAtomicityMode(atomicityMode());
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setBackups(1);
QueryEntity qryEntity = new QueryEntity();
qryEntity.setKeyType(AffinityKey.class.getName());
qryEntity.setValueType(IndexedEntity.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("val", String.class.getName());
qryEntity.setFields(fields);
qryEntity.setIndexes(Arrays.asList(new QueryIndex("val", QueryIndexType.FULLTEXT)));
cache.setQueryEntities(Arrays.asList(qryEntity));
cfg.setCacheConfiguration(cache);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
commSpi.setSharedMemoryPort(-1);
cfg.setCommunicationSpi(commSpi);
cfg.setDiscoverySpi(disco);
return cfg;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteCacheDistributedJoinTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = ((TcpDiscoverySpi) cfg.getDiscoverySpi());
spi.setIpFinder(IP_FINDER);
CacheConfiguration<Integer, A> ccfga = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfga.setName("a");
ccfga.setSqlSchema("A");
ccfga.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfga.setBackups(1);
ccfga.setCacheMode(CacheMode.PARTITIONED);
ccfga.setIndexedTypes(Integer.class, A.class);
CacheConfiguration<Integer, B> ccfgb = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfgb.setName("b");
ccfgb.setSqlSchema("B");
ccfgb.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfgb.setBackups(1);
ccfgb.setCacheMode(CacheMode.PARTITIONED);
ccfgb.setIndexedTypes(Integer.class, B.class);
CacheConfiguration<Integer, C> ccfgc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfgc.setName("c");
ccfgc.setSqlSchema("C");
ccfgc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ccfgc.setBackups(1);
ccfgc.setCacheMode(CacheMode.PARTITIONED);
ccfgc.setIndexedTypes(Integer.class, C.class);
cfg.setCacheConfiguration(ccfga, ccfgb, ccfgc);
return cfg;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteCacheLockPartitionOnAffinityRunAbstractTest method createCacheWithAffinity.
/**
* @param cacheName Cache name.
* @throws Exception If failed.
*/
private void createCacheWithAffinity(String cacheName) throws Exception {
CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
ccfg.setName(cacheName);
ccfg.setAffinity(new DummyAffinity());
grid(0).createCache(ccfg);
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest method createCache.
/**
* @param cacheName Cache name.
* @param mode Atomicity mode.
* @throws Exception If failed.
*/
private void createCache(String cacheName, CacheAtomicityMode mode) throws Exception {
CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
ccfg.setName(cacheName);
ccfg.setAtomicityMode(mode);
ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT));
grid(0).createCache(ccfg);
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest method cacheConfiguration.
/** {@inheritDoc} */
@Override
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
ccfg.setBackups(0);
return ccfg;
}
Aggregations