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

    c.setLocalHost(HOST);

    assert c.getClientConnectionConfiguration() == null;

    GridClientConnectionConfiguration clientCfg = new GridClientConnectionConfiguration();

    clientCfg.setRestTcpPort(REST_TCP_PORT_BASE);

    GridSslContextFactory sslCtxFactory = sslContextFactory();

    if (sslCtxFactory != null) {
      clientCfg.setRestTcpSslEnabled(true);
      clientCfg.setRestTcpSslContextFactory(sslCtxFactory);
    }

    c.setClientConnectionConfiguration(clientCfg);

    GridTcpDiscoverySpi disco = new GridTcpDiscoverySpi();

    disco.setIpFinder(IP_FINDER);

    c.setDiscoverySpi(disco);

    TestCommunicationSpi spi = new TestCommunicationSpi();

    spi.setLocalPort(GridTestUtils.getNextCommPort(getClass()));

    c.setCommunicationSpi(spi);

    c.setCacheConfiguration(
        cacheConfiguration(null),
        cacheConfiguration(PARTITIONED_CACHE_NAME),
        cacheConfiguration(REPLICATED_CACHE_NAME),
        cacheConfiguration(REPLICATED_ASYNC_CACHE_NAME));

    ThreadPoolExecutor exec =
        new ThreadPoolExecutor(40, 40, 0, MILLISECONDS, new LinkedBlockingQueue<Runnable>());

    exec.prestartAllCoreThreads();

    c.setExecutorService(exec);

    c.setExecutorServiceShutdown(true);

    ThreadPoolExecutor sysExec =
        new ThreadPoolExecutor(40, 40, 0, MILLISECONDS, new LinkedBlockingQueue<Runnable>());

    sysExec.prestartAllCoreThreads();

    c.setSystemExecutorService(sysExec);

    c.setSystemExecutorServiceShutdown(true);

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

    GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration();

    ggfsCfg.setDataCacheName("partitioned");
    ggfsCfg.setMetaCacheName("replicated");
    ggfsCfg.setName("ggfs");
    ggfsCfg.setManagementPort(GridGgfsConfiguration.DFLT_MGMT_PORT + cnt);

    ggfsCfg.setIpcEndpointConfiguration(
        new HashMap<String, String>() {
          {
            put("type", "shmem");
            put("port", String.valueOf(GridIpcSharedMemoryServerEndpoint.DFLT_IPC_PORT + cnt));
          }
        });

    ggfsCfg.setBlockSize(
        512 * 1024); // Together with group blocks mapper will yield 64M per node groups.

    cfg.setGgfsConfiguration(ggfsCfg);

    cfg.setCacheConfiguration(cacheConfiguration());

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    GridTcpCommunicationSpi commSpi = new GridTcpCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);

    cfg.setCommunicationSpi(commSpi);

    cnt++;

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

    GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();
    discoSpi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(discoSpi);

    cfg.setCommunicationSpi(new CommunicationSpi());
    cfg.setMarshaller(new GridOptimizedMarshaller(false));

    GridCacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setCacheMode(PARTITIONED);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
  }