use of org.apache.ignite.util.TestTcpCommunicationSpi in project ignite by apache.
the class IgniteCachePartitionLossPolicySelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
if (gridName.matches(".*\\d")) {
String idStr = UUID.randomUUID().toString();
char[] chars = idStr.toCharArray();
chars[chars.length - 3] = '0';
chars[chars.length - 2] = '0';
chars[chars.length - 1] = gridName.charAt(gridName.length() - 1);
cfg.setNodeId(UUID.fromString(new String(chars)));
}
cfg.setCommunicationSpi(new TestTcpCommunicationSpi());
cfg.setClientMode(client);
CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setBackups(0);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setPartitionLossPolicy(partLossPlc);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.util.TestTcpCommunicationSpi in project ignite by apache.
the class GridCachePartitionNotLoadedEventSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
if (igniteInstanceName.matches(".*\\d")) {
String idStr = UUID.randomUUID().toString();
char[] chars = idStr.toCharArray();
chars[chars.length - 3] = '0';
chars[chars.length - 2] = '0';
chars[chars.length - 1] = igniteInstanceName.charAt(igniteInstanceName.length() - 1);
cfg.setNodeId(UUID.fromString(new String(chars)));
}
cfg.setCommunicationSpi(new TestTcpCommunicationSpi());
CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setBackups(backupCnt);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
Aggregations