private void createRegion(boolean accessor, int redundantCopies, InterestPolicy interestPolicy) {
   AttributesFactory af = new AttributesFactory();
   af.setScope(Scope.DISTRIBUTED_ACK);
   af.setDataPolicy(DataPolicy.REPLICATE);
   af.setCloningEnabled(true);
   getCache().createRegion(D_REFERENCE, af.create());
   af = new AttributesFactory();
   af.setCloningEnabled(true);
   if (interestPolicy != null) {
     af.setSubscriptionAttributes(new SubscriptionAttributes(interestPolicy));
   }
   af.setPartitionAttributes(
       new PartitionAttributesFactory<CustId, Customer>()
           .setTotalNumBuckets(4)
           .setLocalMaxMemory(accessor ? 0 : 1)
           .setPartitionResolver(new CustomerIDPartitionResolver("resolver1"))
           .setRedundantCopies(redundantCopies)
           .create());
   getCache().createRegion(CUSTOMER, af.create());
   af.setPartitionAttributes(
       new PartitionAttributesFactory<OrderId, Order>()
           .setTotalNumBuckets(4)
           .setLocalMaxMemory(accessor ? 0 : 1)
           .setPartitionResolver(new CustomerIDPartitionResolver("resolver2"))
           .setRedundantCopies(redundantCopies)
           .setColocatedWith(CUSTOMER)
           .create());
   getCache().createRegion(ORDER, af.create());
 }
 public void DISABLED_testTxWithCloning() {
   AttributesFactory af = new AttributesFactory();
   af.setDataPolicy(DataPolicy.REPLICATE);
   af.setScope(Scope.DISTRIBUTED_ACK);
   af.setCloningEnabled(true);
   basicTest(af.create());
 }
  /**
   * Creates the server cache, and configure wan
   *
   * @param site - used to configure gateway endpoint
   * @param name - used to generate name
   * @param ePort1 - GatewayHub port
   * @param ePort2 - other GatewayHub port
   * @throws Exception - thrown if any problem occurs in setting up the server
   */
  public static Object createServerCache(
      String myHubId,
      String hubImSendingTo,
      Integer listenOnPort,
      Integer sendToPort,
      String host,
      int mcast_port,
      boolean enableStorage,
      boolean enableGateway)
      throws Exception {
    Properties props = new Properties();

    props.setProperty(DistributionConfig.MCAST_PORT_NAME, mcast_port + "");
    props.setProperty(DistributionConfig.LOCATORS_NAME, "");
    cache = impl.createCache(props);
    AttributesFactory factory = impl.getServerCacheAttributesFactory(enableStorage);
    factory.setEnableGateway(true);
    factory.setCloningEnabled(false);
    factory.setCacheListener(
        new CacheListener() {

          public void afterCreate(EntryEvent event) {
            // TODO Auto-generated method stub
          }

          public void afterDestroy(EntryEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterInvalidate(EntryEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterRegionClear(RegionEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterRegionCreate(RegionEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterRegionDestroy(RegionEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterRegionInvalidate(RegionEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterRegionLive(RegionEvent event) {
            // TODO Auto-generated method stub

          }

          public void afterUpdate(EntryEvent event) {
            // TODO Auto-generated method stub

          }

          public void close() {
            // TODO Auto-generated method stub

          }
        });

    RegionAttributes attrs = factory.create();

    cache.createRegion(REGION_NAME, attrs);

    if (enableGateway) {
      GatewayHub hub1 = cache.addGatewayHub(myHubId, listenOnPort.intValue());
      Gateway gateway1 = hub1.addGateway(hubImSendingTo);
      gateway1.addEndpoint("dont matter", host, sendToPort.intValue());

      GatewayQueueAttributes queueAttributes = gateway1.getQueueAttributes();
      queueAttributes.setMaximumQueueMemory(1);
      queueAttributes.setBatchSize(1);
      setDiskStoreForGateway(cache, gateway1.getId(), queueAttributes);
      hub1.start();
      gateway1.start();
    }
    return new Integer(0);
  }