public static void createClientCache(String host, Integer port1, Integer port2) throws Exception {
    PORT1 = port1.intValue();
    PORT2 = port2.intValue();
    Properties props = new Properties();
    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
    props.setProperty(DistributionConfig.LOCATORS_NAME, "");
    new DestroyEntryPropagationDUnitTest("temp").createCache(props);
    CacheServerTestUtil.disableShufflingOfEndpoints();
    Pool p;
    try {
      p =
          PoolManager.createFactory()
              .addServer(host, PORT1)
              .addServer(host, PORT2)
              .setSubscriptionEnabled(true)
              .setSubscriptionRedundancy(-1)
              .setReadTimeout(2000)
              .setSocketBufferSize(1000)
              .setMinConnections(4)
              // .setRetryAttempts(2)
              // .setRetryInterval(250)
              .create("EntryPropagationDUnitTestPool");
    } finally {
      CacheServerTestUtil.enableShufflingOfEndpoints();
    }

    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    factory.setCacheListener(new CertifiableTestCacheListener(getLogWriter()));
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
  }
  @Test
  public void testContextCreated() throws Exception {

    ClientCache cache = context.getBean("gemfireCache", ClientCache.class);
    Pool pool = context.getBean("gemfirePool", Pool.class);
    assertEquals("gemfirePool", pool.getName());
    assertEquals(1, cache.getDefaultPool().getServers().size());
    assertEquals(pool.getServers().get(0), cache.getDefaultPool().getServers().get(0));

    context.getBean("r1", Region.class);
  }
 protected void initializeQueryService() {
   try {
     String usingPool = TestConfig.tab().stringAt(CQUtilPrms.QueryServiceUsingPool, "false");
     boolean queryServiceUsingPool = Boolean.valueOf(usingPool).booleanValue();
     if (queryServiceUsingPool) {
       Pool pool = PoolHelper.createPool(CQUtilPrms.getQueryServicePoolName());
       qService = pool.getQueryService();
       Log.getLogWriter()
           .info("Initializing QueryService using Pool. PoolName: " + pool.getName());
     } else {
       qService = CacheHelper.getCache().getQueryService();
       Log.getLogWriter().info("Initializing QueryService using Cache.");
     }
   } catch (Exception e) {
     throw new TestException(TestHelper.getStackTrace(e));
   }
 }
  /**
   * Create client regions each with their own BridgeWriter instance.
   *
   * @param props
   * @param regionName1
   * @param regionName2
   * @throws Exception
   */
  public static void createCacheClients(
      Pool poolAttr, String regionName1, String regionName2, Properties dsProperties)
      throws Exception {
    new CacheServerTestUtil("temp").createCache(dsProperties);

    // Initialize region1
    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
    pf.init(poolAttr);
    Pool p = pf.create("CacheServerTestUtil1");
    AttributesFactory factory1 = new AttributesFactory();
    factory1.setScope(Scope.LOCAL);
    factory1.setPoolName(p.getName());
    cache.createRegion(regionName1, factory1.create());

    // Initialize region2
    p = pf.create("CacheServerTestUtil2");
    AttributesFactory factory2 = new AttributesFactory();
    factory2.setScope(Scope.LOCAL);
    factory2.setPoolName(p.getName());
    cache.createRegion(regionName2, factory2.create());
  }
 /**
  * Sets the pool used by this client.
  *
  * @param pool
  */
 public void setPool(Pool pool) {
   Assert.notNull(pool, "pool cannot be null");
   setPoolName(pool.getName());
 }
 public static void createClientCache(Pool poolAttr, String regionName, Properties dsProperties)
     throws Exception {
   ClientCacheFactory ccf = new ClientCacheFactory(dsProperties);
   if (poolAttr != null) {
     ccf.setPoolFreeConnectionTimeout(poolAttr.getFreeConnectionTimeout())
         .setPoolLoadConditioningInterval(poolAttr.getLoadConditioningInterval())
         .setPoolSocketBufferSize(poolAttr.getSocketBufferSize())
         .setPoolMinConnections(poolAttr.getMinConnections())
         .setPoolMaxConnections(poolAttr.getMaxConnections())
         .setPoolIdleTimeout(poolAttr.getIdleTimeout())
         .setPoolPingInterval(poolAttr.getPingInterval())
         .setPoolStatisticInterval(poolAttr.getStatisticInterval())
         .setPoolRetryAttempts(poolAttr.getRetryAttempts())
         .setPoolThreadLocalConnections(poolAttr.getThreadLocalConnections())
         .setPoolReadTimeout(poolAttr.getReadTimeout())
         .setPoolSubscriptionEnabled(poolAttr.getSubscriptionEnabled())
         .setPoolPRSingleHopEnabled(poolAttr.getPRSingleHopEnabled())
         .setPoolSubscriptionRedundancy(poolAttr.getSubscriptionRedundancy())
         .setPoolSubscriptionMessageTrackingTimeout(
             poolAttr.getSubscriptionMessageTrackingTimeout())
         .setPoolSubscriptionAckInterval(poolAttr.getSubscriptionAckInterval())
         .setPoolServerGroup(poolAttr.getServerGroup())
         .setPoolMultiuserAuthentication(poolAttr.getMultiuserAuthentication());
     for (InetSocketAddress locator : poolAttr.getLocators()) {
       ccf.addPoolLocator(locator.getHostName(), locator.getPort());
     }
     for (InetSocketAddress server : poolAttr.getServers()) {
       ccf.addPoolServer(server.getHostName(), server.getPort());
     }
   }
   new CacheServerTestUtil("temp").createClientCache(dsProperties, ccf);
   ClientCache cc = (ClientCache) cache;
   cc.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create(regionName);
   pool = (PoolImpl) ((GemFireCacheImpl) cc).getDefaultPool();
 }