/** {@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;
  }
  /** @throws Exception If failed. */
  public void testEmptyProjections() throws Exception {
    final GridClientCompute dflt = client.compute();

    Collection<? extends GridClientNode> nodes = dflt.nodes();

    assertEquals(NODES_CNT, nodes.size());

    Iterator<? extends GridClientNode> iter = nodes.iterator();

    final GridClientCompute singleNodePrj = dflt.projection(Collections.singletonList(iter.next()));

    final GridClientNode second = iter.next();

    final GridClientPredicate<GridClientNode> noneFilter =
        new GridClientPredicate<GridClientNode>() {
          @Override
          public boolean apply(GridClientNode node) {
            return false;
          }
        };

    final GridClientPredicate<GridClientNode> targetFilter =
        new GridClientPredicate<GridClientNode>() {
          @Override
          public boolean apply(GridClientNode node) {
            return node.nodeId().equals(second.nodeId());
          }
        };

    GridTestUtils.assertThrows(
        log(),
        new Callable<Object>() {
          @Override
          public Object call() throws Exception {
            return dflt.projection(noneFilter).log(-1, -1);
          }
        },
        GridServerUnreachableException.class,
        null);

    GridTestUtils.assertThrows(
        log(),
        new Callable<Object>() {
          @Override
          public Object call() throws Exception {
            return singleNodePrj.projection(second);
          }
        },
        GridClientException.class,
        null);

    GridTestUtils.assertThrows(
        log(),
        new Callable<Object>() {
          @Override
          public Object call() throws Exception {
            return singleNodePrj.projection(targetFilter);
          }
        },
        GridClientException.class,
        null);
  }