use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class IgniteVariousConnectionNumberTest method testVariousConnectionNumber.
/**
* @throws Exception If failed.
*/
public void testVariousConnectionNumber() throws Exception {
startGridsMultiThreaded(3);
client = true;
startGridsMultiThreaded(3, 3);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(REPLICATED);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ignite(0).createCache(ccfg);
for (int i = 0; i < 10; i++) {
log.info("Iteration: " + i);
runOperations(5000);
awaitPartitionMapExchange();
int idx = ThreadLocalRandom.current().nextInt(NODES);
Ignite node = ignite(idx);
client = node.configuration().isClientMode();
stopGrid(idx);
startGrid(idx);
}
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class GridDiscoveryManagerAliveCacheSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cCfg = defaultCacheConfiguration();
cCfg.setCacheMode(PARTITIONED);
cCfg.setBackups(1);
cCfg.setNearConfiguration(new NearCacheConfiguration());
cCfg.setRebalanceMode(SYNC);
cCfg.setWriteSynchronizationMode(FULL_SYNC);
TcpDiscoverySpi disc = new TcpDiscoverySpi();
if (clientMode && ((igniteInstanceName.charAt(igniteInstanceName.length() - 1) - '0') & 1) != 0)
cfg.setClientMode(true);
else
cfg.setClientFailureDetectionTimeout(50000);
disc.setIpFinder(IP_FINDER);
disc.setAckTimeout(1000);
disc.setSocketTimeout(1000);
cfg.setCacheConfiguration(cCfg);
cfg.setDiscoverySpi(disc);
cfg.setMetricsUpdateFrequency(500);
return cfg;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class GridCacheConcurrentTxMultiNodeTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
c.getTransactionConfiguration().setDefaultTxConcurrency(PESSIMISTIC);
c.getTransactionConfiguration().setDefaultTxIsolation(REPEATABLE_READ);
AtomicConfiguration atomicCfg = new AtomicConfiguration();
atomicCfg.setAtomicSequenceReserveSize(100000);
atomicCfg.setCacheMode(mode);
c.setAtomicConfiguration(atomicCfg);
if (cacheOn) {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(mode);
LruEvictionPolicy plc = new LruEvictionPolicy();
plc.setMaxSize(1000);
cc.setEvictionPolicy(plc);
cc.setOnheapCacheEnabled(true);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setRebalanceMode(NONE);
c.setCacheConfiguration(cc);
} else
c.setCacheConfiguration();
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
c.setPeerClassLoadingEnabled(false);
return c;
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class GridCacheConfigurationConsistencySelfTest method testPartitionedOnlyAttributesIgnoredForReplicated.
/**
* @throws Exception If failed.
*/
public void testPartitionedOnlyAttributesIgnoredForReplicated() throws Exception {
cacheEnabled = true;
cacheMode = REPLICATED;
initCache = new C1<CacheConfiguration, Void>() {
@Override
public Void apply(CacheConfiguration cfg) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
nearCfg.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
nearCfg.setNearEvictionPolicy(new LruEvictionPolicy());
cfg.setNearConfiguration(nearCfg);
return null;
}
};
startGrid(1);
initCache = new C1<CacheConfiguration, Void>() {
@Override
public Void apply(CacheConfiguration cfg) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
nearCfg.setNearEvictionPolicyFactory(new FifoEvictionPolicyFactory<>());
nearCfg.setNearEvictionPolicy(new FifoEvictionPolicy());
cfg.setNearConfiguration(nearCfg);
return null;
}
};
startGrid(2);
}
use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.
the class GridCacheConfigurationValidationSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
// Default cache config.
CacheConfiguration dfltCacheCfg = defaultCacheConfiguration();
dfltCacheCfg.setCacheMode(PARTITIONED);
dfltCacheCfg.setRebalanceMode(ASYNC);
dfltCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dfltCacheCfg.setAffinity(new RendezvousAffinityFunction());
dfltCacheCfg.setIndexedTypes(Integer.class, String.class);
// Non-default cache configuration.
CacheConfiguration namedCacheCfg = defaultCacheConfiguration();
namedCacheCfg.setCacheMode(PARTITIONED);
namedCacheCfg.setRebalanceMode(ASYNC);
namedCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
namedCacheCfg.setAffinity(new RendezvousAffinityFunction());
// Modify cache config according to test parameters.
if (igniteInstanceName.contains(WRONG_PRELOAD_MODE_IGNITE_INSTANCE_NAME))
dfltCacheCfg.setRebalanceMode(SYNC);
else if (igniteInstanceName.contains(WRONG_CACHE_MODE_IGNITE_INSTANCE_NAME))
dfltCacheCfg.setCacheMode(REPLICATED);
else if (igniteInstanceName.contains(WRONG_AFFINITY_IGNITE_INSTANCE_NAME))
dfltCacheCfg.setAffinity(new TestRendezvousAffinityFunction());
else if (igniteInstanceName.contains(WRONG_AFFINITY_MAPPER_IGNITE_INSTANCE_NAME))
dfltCacheCfg.setAffinityMapper(new TestCacheDefaultAffinityKeyMapper());
if (igniteInstanceName.contains(DUP_CACHES_IGNITE_INSTANCE_NAME))
cfg.setCacheConfiguration(namedCacheCfg, namedCacheCfg);
else if (igniteInstanceName.contains(DUP_DFLT_CACHES_IGNITE_INSTANCE_NAME))
cfg.setCacheConfiguration(dfltCacheCfg, dfltCacheCfg);
else
// Normal configuration.
cfg.setCacheConfiguration(dfltCacheCfg, namedCacheCfg);
if (igniteInstanceName.contains(RESERVED_FOR_DATASTRUCTURES_CACHE_NAME_IGNITE_INSTANCE_NAME))
namedCacheCfg.setName(DataStructuresProcessor.ATOMICS_CACHE_NAME + "@abc");
else
namedCacheCfg.setName(NON_DFLT_CACHE_NAME);
if (igniteInstanceName.contains(RESERVED_FOR_DATASTRUCTURES_CACHE_GROUP_NAME_IGNITE_INSTANCE_NAME))
namedCacheCfg.setGroupName("default-ds-group");
return cfg;
}
Aggregations