/** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(IP_FINDER);

    cfg.getTransactionConfiguration().setTxSerializableEnabled(true);

    cfg.setDiscoverySpi(disco);

    BasicWarmupClosure warmupClosure = new BasicWarmupClosure();

    warmupClosure.setGridCount(2);
    warmupClosure.setIterationCount(10);
    warmupClosure.setKeyRange(10);

    cfg.setWarmupClosure(warmupClosure);

    CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();

    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    cacheCfg.setBackups(1);
    cacheCfg.setName("test");

    cfg.setCacheConfiguration(cacheCfg);

    return cfg;
  }
  /**
   * @return Configuration.
   * @throws Exception If failed.
   */
  @Override
  protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();

    cfg.setCollisionSpi(new GridTestCollision());

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    if (gridName.equals(getTestGridName(GRID_CNT - 1))) cfg.setClientMode(true);

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();

    cfg.setPeerClassLoadingEnabled(false);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    cfg.setCacheConfiguration();
    cfg.setMetricsUpdateFrequency(0);

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setDeploymentMode(CONTINUOUS);

    if (GRID_NAME.equals(gridName)) cfg.setCacheConfiguration();
    else cfg.setCacheConfiguration(cacheConfiguration());

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(disco);

    return cfg;
  }
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TransactionConfiguration txCfg = c.getTransactionConfiguration();

    txCfg.setDefaultTxConcurrency(txConcurrency);
    txCfg.setDefaultTxIsolation(txIsolation);
    txCfg.setTxSerializableEnabled(true);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(TRANSACTIONAL);

    cc.setSwapEnabled(false);

    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cc.setEvictionPolicy(plc);
    cc.setEvictSynchronizedKeyBufferSize(1);

    cc.setEvictSynchronized(true);

    if (testStore != null) {
      cc.setCacheStoreFactory(singletonFactory(testStore));
      cc.setReadThrough(true);
      cc.setWriteThrough(true);
      cc.setLoadPreviousValue(true);
    } else cc.setCacheStoreFactory(null);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    return c;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setPeerClassLoadingEnabled(false);

    cfg.setDeploymentMode(depMode);

    if (initGar) {
      UriDeploymentSpi depSpi = new UriDeploymentSpi();

      depSpi.setUriList(Collections.singletonList(garFile));

      cfg.setDeploymentSpi(depSpi);
    }

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setHeartbeatFrequency(500);

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(ipFinder);

    c.setDiscoverySpi(spi);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName("test");
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setNearConfiguration(null);

    c.setCacheConfiguration(cc);

    return c;
  }
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    cfg.setIncludeProperties();

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    cfg.setConnectorConfiguration(null);

    cfg.setPeerClassLoadingEnabled(true);

    if (useCache) {
      CacheConfiguration cc = defaultCacheConfiguration();

      cc.setCacheMode(PARTITIONED);

      cc.setNearConfiguration(null);
      cc.setWriteSynchronizationMode(FULL_SYNC);
      cc.setStartSize(ENTRY_CNT / GRID_CNT);
      cc.setSwapEnabled(false);

      cc.setBackups(1);

      cfg.setCacheSanityCheckEnabled(false);
      cfg.setCacheConfiguration(cc);
    } else cfg.setCacheConfiguration();

    return cfg;
  }