Search in sources :

Example 1 with TestTcpCommunicationSpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestTcpCommunicationSpi(org.apache.ignite.util.TestTcpCommunicationSpi) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 2 with TestTcpCommunicationSpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestTcpCommunicationSpi(org.apache.ignite.util.TestTcpCommunicationSpi) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)2 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)2 TestTcpCommunicationSpi (org.apache.ignite.util.TestTcpCommunicationSpi)2