You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/20 16:29:32 UTC

[01/49] incubator-geode git commit: GEODE-1203: include spring-web in gfshDependency.jar

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-835-test b64517096 -> 955275f41


GEODE-1203: include spring-web in gfshDependency.jar


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/43a038e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/43a038e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/43a038e9

Branch: refs/heads/feature/GEODE-835-test
Commit: 43a038e9c6c9db32884b43cf2aa2d8348dc89789
Parents: 123ddb7
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu May 12 07:52:33 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu May 12 07:52:33 2016 -0700

----------------------------------------------------------------------
 geode-assembly/src/test/resources/expected_jars.txt | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/43a038e9/geode-assembly/src/test/resources/expected_jars.txt
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/resources/expected_jars.txt b/geode-assembly/src/test/resources/expected_jars.txt
index da05d54..bb2ba19 100644
--- a/geode-assembly/src/test/resources/expected_jars.txt
+++ b/geode-assembly/src/test/resources/expected_jars.txt
@@ -1,5 +1,6 @@
 activation
 antlr
+aopalliance
 classmate
 commons-beanutils
 commons-collections


[02/49] incubator-geode git commit: GEODE-11: Tests of indexes on regions with overflow, eviction, expiration

Posted by kl...@apache.org.
GEODE-11: Tests of indexes on regions with overflow,eviction,expiration

Adding integration tests of indexes on these types of regions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/665471ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/665471ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/665471ae

Branch: refs/heads/feature/GEODE-835-test
Commit: 665471aea91528a660079ff51e274127381a055d
Parents: a83e428
Author: Dan Smith <up...@apache.org>
Authored: Wed May 11 17:51:12 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 12 11:11:48 2016 -0700

----------------------------------------------------------------------
 .../LuceneIndexCreationIntegrationTest.java     | 75 +++++++++++++++++---
 1 file changed, 67 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/665471ae/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index 1dfaf51..2d16e32 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -29,7 +29,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
+import java.util.function.Function;
 
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.lucene.LuceneIndex;
@@ -74,26 +77,82 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
   }
 
   @Test
-  public void verifyLuceneRegionInternal() {
+  public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertEquals(1, region.getAttributes().getPartitionAttributes().getRedundantCopies());
+    });
+  }
+
+  @Test
+  public void shouldNotUseEvictionForInternalRegionsWhenUserRegionHasEviction() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1))
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      assertEquals(true, region.getAttributes().getEvictionAttributes().getAction().isNone());
+    });
+  }
+
+  @Test
+  public void shouldNotUseIdleTimeoutForInternalRegionsWhenUserRegionHasIdleTimeout() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setEntryIdleTimeout(new ExpirationAttributes(5))
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      assertEquals(0, region.getAttributes().getEntryIdleTimeout().getTimeout());
+    });
+  }
+
+  @Test
+  public void shouldNotUseTTLForInternalRegionsWhenUserRegionHasTTL() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setEntryTimeToLive(new ExpirationAttributes(5))
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      assertEquals(0, region.getAttributes().getEntryTimeToLive().getTimeout());
+    });
+  }
+
+  @Test
+  public void shouldNotUseOverflowForInternalRegionsWhenUserRegionHasOverflow() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertTrue(region.getAttributes().getEvictionAttributes().getAction().isNone());
+    });
+  }
+
+  @Test
+  public void shouldCreateInternalRegionsForIndex() {
     createIndex("text");
 
     // Create partitioned region
     createRegion();
 
+    verifyInternalRegions(region -> {
+      region.isInternalRegion();
+      cache.rootRegions().contains(region);
+    });
+  }
+
+  private void verifyInternalRegions(Consumer<LocalRegion> verify) {
     // Get index
     LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
 
     // Verify the meta regions exist and are internal
     LocalRegion chunkRegion = (LocalRegion) cache.getRegion(index.createChunkRegionName());
-    assertTrue(chunkRegion.isInternalRegion());
     LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
-    assertTrue(fileRegion.isInternalRegion());
+    verify.accept(chunkRegion);
+    verify.accept(fileRegion);
 
-    // Verify the meta regions are not contained in the root regions
-    for (Region region : cache.rootRegions()) {
-      assertNotEquals(chunkRegion.getFullPath(), region.getFullPath());
-      assertNotEquals(fileRegion.getFullPath(), region.getFullPath());
-    }
   }
 
   private Region createRegion() {


[40/49] incubator-geode git commit: Writing tests

Posted by kl...@apache.org.
Writing tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e3889387
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e3889387
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e3889387

Branch: refs/heads/feature/GEODE-835-test
Commit: e38893870ebb2f2e67a32ce142960b8491329336
Parents: b645170
Author: Kirk Lund <kl...@apache.org>
Authored: Tue May 17 13:22:53 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue May 17 13:22:53 2016 -0700

----------------------------------------------------------------------
 .../gemfire/management/internal/cli/JoptOptionParserTest.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e3889387/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
index 435e99e..564ec37 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
@@ -71,7 +71,7 @@ public class JoptOptionParserTest {
   @Test
   public void foo() throws Exception {
     //assertThatThrownBy(() -> this.defaultJoptOptionParser.parse(null)
-}
+  }
 
 
 }


[28/49] incubator-geode git commit: GEODE-1393 locator returns incorrect server information when starting up

Posted by kl...@apache.org.
GEODE-1393 locator returns incorrect server information when starting up

When a locator auto-reconnects its ServerLocator needs to initialize its
ControllerAdvisor so that it has server information to give to clients.
The ServerLocator was creating a new ControllerAdvisor but didn't ask it
to perform a handshake to fill in its profiles.

ReconnectDUnitTest had an existing testReconnectWithQuorum test that
wasn't doing what it was supposed to.  I've removed the TODO from that
test and modified it to force-disconnect the tests Locator.  The
locator must restart its TcpServer component before it can start
a DistributedSystem, so this exercises the path in
InternalLocator.attemptReconnect() that boots the TcpServer prior to
connecting the DistributedSystem.  After the DistributedSystem
finishes reconnecting the ServerLocator's distribution advisor
should have been initialized by performing the handshake.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/6523c97c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/6523c97c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/6523c97c

Branch: refs/heads/feature/GEODE-835-test
Commit: 6523c97c92f607746d80b11c7cb5315b1137f5a2
Parents: 92805bb
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Mon May 16 08:05:00 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Mon May 16 08:06:49 2016 -0700

----------------------------------------------------------------------
 .../distributed/internal/InternalLocator.java   |  1 +
 .../distributed/internal/LocatorStats.java      | 31 -----------
 .../distributed/internal/ServerLocator.java     | 44 +++++++--------
 .../gemfire/cache30/ReconnectDUnitTest.java     | 57 ++++++++++----------
 .../internal/ServerLocatorJUnitTest.java        |  0
 5 files changed, 53 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6523c97c/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
index 7effa3d..7ad57ad 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalLocator.java
@@ -1350,6 +1350,7 @@ public class InternalLocator extends Locator implements ConnectListener {
         return response;
       }
     }
+
     private JmxManagerLocatorResponse findJmxManager(JmxManagerLocatorRequest request) {
       JmxManagerLocatorResponse result = null;
       // NYI

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6523c97c/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/LocatorStats.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/LocatorStats.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/LocatorStats.java
old mode 100644
new mode 100755
index d42a2b4..1140b1f
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/LocatorStats.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/LocatorStats.java
@@ -117,13 +117,6 @@ public class LocatorStats {
   }
   
   
-  /**
-   * Used by tests to create an instance given its already existings stats.
-   */
-  public LocatorStats(Statistics stats) {
-    this._stats = stats;
-  }
-
   public final void setServerCount(int sc) {
     if(this._stats==null) {
       this.endpoints_known.set(sc);
@@ -140,14 +133,6 @@ public class LocatorStats {
     }
   }
   
-  public final void incLocatorRequests() {
-    if(this._stats==null) {
-      this.requests_to_locator.incrementAndGet();
-    } else {
-      this._stats.incLong(_REQUESTS_TO_LOCATOR, 1);
-    }
-  }  
-  
   public final void endLocatorRequest(long startTime) {
     long took = DistributionStats.getStatTime()-startTime;
     if(this._stats==null) {
@@ -180,14 +165,6 @@ public class LocatorStats {
   
   
   
-  public final void incLocatorResponses() {
-    if(this._stats==null) {
-      this.responses_from_locator.incrementAndGet();
-    } else {
-      this._stats.incLong(_RESPONSES_FROM_LOCATOR, 1);
-    }
-  }  
-  
   public final void setLocatorRequests(long rl) {
     if(this._stats==null) {
       this.requests_to_locator.set(rl);
@@ -218,14 +195,6 @@ public class LocatorStats {
     } else {
       this._stats.incLong(_SERVER_LOAD_UPDATES, 1);
     }
-  }  
-  
-  public void setRequestInProgress(int threads) {
-    if(this._stats!=null) {
-      this._stats.setInt(_REQUESTS_IN_PROGRESS, threads);
-    } else {
-      requestsInProgress.set(threads);
-    }
   }
   
   public void incRequestInProgress(int threads) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6523c97c/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java
old mode 100644
new mode 100755
index e535b97..b37a50b
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ServerLocator.java
@@ -24,12 +24,12 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.CancelCriterion;
@@ -42,7 +42,6 @@ import com.gemstone.gemfire.cache.client.internal.locator.GetAllServersRequest;
 import com.gemstone.gemfire.cache.client.internal.locator.GetAllServersResponse;
 import com.gemstone.gemfire.cache.client.internal.locator.LocatorListRequest;
 import com.gemstone.gemfire.cache.client.internal.locator.LocatorListResponse;
-import com.gemstone.gemfire.cache.client.internal.locator.LocatorStatusRequest;
 import com.gemstone.gemfire.cache.client.internal.locator.LocatorStatusResponse;
 import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest;
 import com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionResponse;
@@ -176,34 +175,34 @@ public class ServerLocator implements TcpHandler, DistributionAdvisee {
       logger.debug("ServerLocator: Received request {}", request);
     }
 
-    Object response;
+    if ( ! (request instanceof ServerLocationRequest) ) {
+      throw new InternalGemFireException("Expected ServerLocationRequest, got " + request.getClass());
+    }
 
-    if (request instanceof ServerLocationRequest) {
-      if (request instanceof LocatorStatusRequest) {
+    Object response;
+    int id = ((DataSerializableFixedID)request).getDSFID();
+    switch (id) {
+      case DataSerializableFixedID.LOCATOR_STATUS_REQUEST:
         response = new LocatorStatusResponse()
           .initialize(this.port, this.hostName, this.logFile, this.memberName);
-      }
-      else if (request instanceof LocatorListRequest) {
+        break;
+      case DataSerializableFixedID.LOCATOR_LIST_REQUEST:
         response = getLocatorListResponse((LocatorListRequest) request);
-      }
-      else if (request instanceof ClientReplacementRequest) {
+        break;
+      case DataSerializableFixedID.CLIENT_REPLACEMENT_REQUEST:
         response = pickReplacementServer((ClientReplacementRequest) request);
-      }
-      else if (request instanceof GetAllServersRequest) {
+        break;
+      case DataSerializableFixedID.GET_ALL_SERVERS_REQUEST:
         response = pickAllServers((GetAllServersRequest) request);
-      }
-      else if (request instanceof ClientConnectionRequest) {
+        break;
+      case DataSerializableFixedID.CLIENT_CONNECTION_REQUEST:
         response = pickServer((ClientConnectionRequest) request);
-      }
-      else if (request instanceof QueueConnectionRequest) {
+        break;
+      case DataSerializableFixedID.QUEUE_CONNECTION_REQUEST:
         response = pickQueueServers((QueueConnectionRequest) request);
-      }
-      else {
+        break;
+      default:
         throw new InternalGemFireException("Unknown ServerLocationRequest: " + request.getClass());
-      }
-    }
-    else {
-      throw new InternalGemFireException("Expected ServerLocationRequest, got " + request.getClass());
     }
 
     if(logger.isDebugEnabled()) {
@@ -290,6 +289,9 @@ public class ServerLocator implements TcpHandler, DistributionAdvisee {
       this.loadSnapshot = new LocatorLoadSnapshot();
       this.ds = (InternalDistributedSystem)ds;
       this.advisor = ControllerAdvisor.createControllerAdvisor(this); // escapes constructor but allows field to be final
+      if (ds.isConnected()) {
+        this.advisor.handshake();  // GEODE-1393: need to get server information during restart
+      }
     }
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6523c97c/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
index ca2c17b..6c63def 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
@@ -27,6 +27,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.ReconnectListener;
 import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.ServerLocator;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
 import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
@@ -78,6 +79,7 @@ public class ReconnectDUnitTest extends CacheTestCase
           locatorPort = locPort;
           Properties props = getDistributedSystemProperties();
           locator = Locator.startLocatorAndDS(locatorPort, new File(""), props);
+          ReconnectDUnitTest.savedSystem = InternalDistributedSystem.getConnectedInstance();
           IgnoredException.addIgnoredException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
 //          MembershipManagerHelper.getMembershipManager(InternalDistributedSystem.getConnectedInstance()).setDebugJGroups(true);
         } catch (IOException e) {
@@ -163,10 +165,6 @@ public class ReconnectDUnitTest extends CacheTestCase
     return factory.create();
   }
 
-  /*
-  TODO this test is not actually using quorum checks.  To do that it needs to
-  have the locator disconnect & reconnect
-   */
 
   public void testReconnectWithQuorum() throws Exception {
     // quorum check fails, then succeeds
@@ -174,7 +172,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
+    VM locatorVm = host.getVM(locatorVMNumber);
     
     final int locPort = locatorPort;
 
@@ -210,33 +208,23 @@ public class ReconnectDUnitTest extends CacheTestCase
       }
     };
     
-    System.out.println("creating caches in vm0, vm1 and vm2");
+    System.out.println("creating caches in vm0 and vm1");
     vm0.invoke(create);
     vm1.invoke(create);
-    vm2.invoke(create);
-    
+
     // view is [locator(3), vm0(15), vm1(10), vm2(10)]
     
-    /* now we want to cause vm0 and vm1 to force-disconnect.  This may cause the other
-     * non-locator member to also disconnect, depending on the timing
+    /* now we want to kick out the locator and observe that it reconnects
+     * using its rebooted location service
      */
-    System.out.println("disconnecting vm0");
-    forceDisconnect(vm0);
-    Wait.pause(10000);
-    System.out.println("disconnecting vm1");
-    forceDisconnect(vm1);
+    System.out.println("disconnecting locator");
+    forceDisconnect(locatorVm);
+    waitForReconnect(locatorVm);
+
+    // if the locator reconnected it did so with its own location
+    // service since it doesn't know about any other locators
+    ensureLocationServiceRunning(locatorVm);
 
-    /* now we wait for them to auto-reconnect */
-    try {
-      System.out.println("waiting for vm0 to reconnect");
-      waitForReconnect(vm0);
-      System.out.println("waiting for vm1 to reconnect");
-      waitForReconnect(vm1);
-      System.out.println("done reconnecting vm0 and vm1");
-    } catch (Exception e) {
-      ThreadUtils.dumpAllStacks();
-      throw e;
-    }
   }
   
   public void testReconnectOnForcedDisconnect() throws Exception  {
@@ -418,6 +406,19 @@ public class ReconnectDUnitTest extends CacheTestCase
       }
     });
   }
+
+  /** this will throw an exception if location services aren't running */
+  private void ensureLocationServiceRunning(VM vm) {
+    vm.invoke(new SerializableRunnable("ensureLocationServiceRunning") {
+      public void run() {
+        InternalLocator intloc = (InternalLocator)locator;
+        ServerLocator serverLocator = intloc.getServerLocatorAdvisee();
+        // the initialization flag in the locator's ControllerAdvisor will
+        // be set if a handshake has been performed
+        assertTrue(serverLocator.getDistributionAdvisor().isInitialized());
+      }
+    });
+  }
   
   private DistributedMember waitForReconnect(VM vm) {
     return (DistributedMember)vm.invoke(new SerializableCallable("wait for Reconnect and return ID") {
@@ -456,7 +457,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    VM vm3 = host.getVM(3);
+    VM locatorVm = host.getVM(3);
     DistributedMember dm, newdm;
     
     final int locPort = locatorPort;
@@ -467,7 +468,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     final String xmlFileLoc = (new File(".")).getAbsolutePath();
 
     //This locator was started in setUp.
-    File locatorViewLog = new File(vm3.getWorkingDirectory(), "locator"+locatorPort+"views.log");
+    File locatorViewLog = new File(locatorVm.getWorkingDirectory(), "locator"+locatorPort+"views.log");
     assertTrue("Expected to find " + locatorViewLog.getPath() + " file", locatorViewLog.exists());
     long logSize = locatorViewLog.length();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6523c97c/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ServerLocatorJUnitTest.java
old mode 100644
new mode 100755


[09/49] incubator-geode git commit: GEODE-1376: remove hydra.Log from DUnitLauncher

Posted by kl...@apache.org.
GEODE-1376: remove hydra.Log from DUnitLauncher

* remove call to Log.createLogWriter to prevent hydra.HydraRuntimeException: Log writer has already been created
* remove use of hydra.Log from HADispatcherDUnitTest
* cleanup imports


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/819bf650
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/819bf650
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/819bf650

Branch: refs/heads/feature/GEODE-835-test
Commit: 819bf650b1d1165e6409ac9082af5943fe2a0974
Parents: c33efb6
Author: Kirk Lund <kl...@apache.org>
Authored: Thu May 12 16:32:35 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu May 12 16:32:35 2016 -0700

----------------------------------------------------------------------
 .../test/dunit/standalone/DUnitLauncher.java    |  17 +-
 .../cache/ha/HADispatcherDUnitTest.java         | 608 ++++++-------------
 2 files changed, 199 insertions(+), 426 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/819bf650/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
index 4e7095c..0c600ab 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
@@ -38,10 +38,6 @@ import java.rmi.server.UnicastRemoteObject;
 import java.util.List;
 import java.util.Properties;
 
-import batterytest.greplogs.ExpectedStrings;
-import batterytest.greplogs.LogConsumer;
-import hydra.Log;
-import hydra.MethExecutorResult;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.core.LoggerContext;
@@ -50,6 +46,10 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.junit.Assert;
 
+import batterytest.greplogs.ExpectedStrings;
+import batterytest.greplogs.LogConsumer;
+import hydra.MethExecutorResult;
+
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave;
@@ -68,8 +68,6 @@ import com.gemstone.gemfire.test.dunit.VM;
  * 
  * Also, it's a good idea to set your working directory, because the test code
  * a lot of files that it leaves around.
- * 
- *
  */
 public class DUnitLauncher {
 
@@ -115,6 +113,7 @@ public class DUnitLauncher {
       return false;
     }
   }
+
   /**
    * Launch DUnit. If the unit test was launched through
    * the hydra framework, leave the test alone.
@@ -145,11 +144,7 @@ public class DUnitLauncher {
     return "localhost[" + locatorPort + "]";
   }
 
-  
-  private static void launch() throws URISyntaxException, AlreadyBoundException, IOException, InterruptedException, NotBoundException  {
-//  initialize the log writer that hydra uses
-    Log.createLogWriter( "dunit-master", LOG_LEVEL );
-
+  private static void launch() throws URISyntaxException, AlreadyBoundException, IOException, InterruptedException, NotBoundException {
     DUNIT_SUSPECT_FILE = new File(SUSPECT_FILENAME);
     DUNIT_SUSPECT_FILE.delete();
     DUNIT_SUSPECT_FILE.deleteOnExit();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/819bf650/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/ha/HADispatcherDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/ha/HADispatcherDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/ha/HADispatcherDUnitTest.java
index aaf8b6f..fd7c559 100755
--- a/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/ha/HADispatcherDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/internal/cache/ha/HADispatcherDUnitTest.java
@@ -16,11 +16,20 @@
  */
 package com.gemstone.gemfire.internal.cache.ha;
 
-import hydra.Log;
-
+import static com.gemstone.gemfire.internal.AvailablePort.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Host.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
+import static com.gemstone.gemfire.test.dunit.Wait.*;
+
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.Properties;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheException;
@@ -36,16 +45,18 @@ import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.cache.query.CqAttributes;
 import com.gemstone.gemfire.cache.query.CqAttributesFactory;
+import com.gemstone.gemfire.cache.query.CqException;
+import com.gemstone.gemfire.cache.query.CqExistsException;
 import com.gemstone.gemfire.cache.query.CqListener;
 import com.gemstone.gemfire.cache.query.CqQuery;
 import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
 import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryTestListener;
 import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.Conflatable;
 import com.gemstone.gemfire.internal.cache.HARegion;
@@ -54,13 +65,10 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest;
 import com.gemstone.gemfire.internal.cache.tier.sockets.HAEventWrapper;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * This Dunit test is to verify that when the dispatcher of CS dispatches the
@@ -76,118 +84,136 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
  * 7. Again the entry in the regionque of client2 on server2.It should not be present.
  * 8. close client1 and client2
  * 9. close server1 and server2
- *
  */
-
-public class HADispatcherDUnitTest extends DistributedTestCase
-{
-
-  VM server1 = null;
-
-  VM server2 = null;
-
-  VM client1 = null;
-
-  VM client2 = null;
-
-  public int PORT1;
-
-  public int PORT2;
-
-  private static final String REGION_NAME = "HADispatcherDUnitTest_region";
-
-  protected static Cache cache = null;
-
-  public static final Object dummyObj = "dummyObject";
-
-  static volatile boolean isObjectPresent = false;
-
-  final static String KEY1 = "KEY1";
-
-  final static String VALUE1 = "VALUE1";
-
-  final static String KEY2 = "KEY2";
-
-  final static String VALUE2 = "VALUE2";
-
-  static volatile boolean waitFlag = true;
-
-  public HADispatcherDUnitTest(String name) {
-    super(name);
-  }
+@Category(DistributedTest.class)
+public class HADispatcherDUnitTest extends JUnit4DistributedTestCase {
+
+  private static final String REGION_NAME = HADispatcherDUnitTest.class.getSimpleName() + "_region";
+  private static final Object dummyObj = "dummyObject";
+  private static final String KEY1 = "KEY1";
+  private static final String VALUE1 = "VALUE1";
+  private static final String KEY2 = "KEY2";
+  private static final String VALUE2 = "VALUE2";
+
+  private static Cache cache = null;
+  private static volatile boolean isObjectPresent = false;
+  private static volatile boolean waitFlag = true;
+
+  private VM server1 = null;
+  private VM server2 = null;
+  private VM client1 = null;
+  private VM client2 = null;
+  private int PORT1;
+  private int PORT2;
 
   @Override
   public final void postSetUp() throws Exception {
-    final Host host = Host.getHost(0);
-    
+    String serverHostName = getServerHostName(getHost(0));
+
     // Server1 VM
-    server1 = host.getVM(0);
+    server1 = getHost(0).getVM(0);
 
     // Server2 VM
-    server2 = host.getVM(1);
+    server2 = getHost(0).getVM(1);
 
     // Client 1 VM
-    client1 = host.getVM(2);
+    client1 = getHost(0).getVM(2);
 
     // client 2 VM
-    client2 = host.getVM(3);
+    client2 = getHost(0).getVM(3);
+
+    PORT1 = ((Integer) server1.invoke(() -> createServerCache(new Boolean(false)))).intValue();
 
-    PORT1 = ((Integer)server1.invoke(() -> HADispatcherDUnitTest.createServerCache( new Boolean(false) ))).intValue();
     server1.invoke(() -> ConflationDUnitTest.setIsSlowStart());
-    server1.invoke(() -> HADispatcherDUnitTest.makeDispatcherSlow());
-    server1.invoke(() -> HADispatcherDUnitTest.setQRMslow());
-    PORT2 = ((Integer)server2.invoke(() -> HADispatcherDUnitTest.createServerCache( new Boolean(true) ))).intValue();
+    server1.invoke(() -> makeDispatcherSlow());
+    server1.invoke(() -> setQRMslow());
+
+    PORT2 = ((Integer) server2.invoke(() -> createServerCache(new Boolean(true)))).intValue();
 
     client1.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints());
     client2.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints());
-    client1.invoke(() -> HADispatcherDUnitTest.createClientCache(
-            NetworkUtils.getServerHostName(host),
-            new Integer(PORT1), new Integer(PORT2),
-            new Boolean(false) ));
-    client2.invoke(() -> HADispatcherDUnitTest.createClientCache(
-            NetworkUtils.getServerHostName(host),
-            new Integer(PORT1), new Integer(PORT2),
-            new Boolean(true) ));
+    client1.invoke(() -> createClientCache(serverHostName, new Integer(PORT1), new Integer(PORT2), new Boolean(false)));
+    client2.invoke(() -> createClientCache(serverHostName, new Integer(PORT1), new Integer(PORT2), new Boolean(true)));
   }
 
   @Override
   public final void preTearDown() throws Exception {
-    client1.invoke(() -> HADispatcherDUnitTest.closeCache());
-    client2.invoke(() -> HADispatcherDUnitTest.closeCache());
+    client1.invoke(() -> closeCache());
+    client2.invoke(() -> closeCache());
     // close server
-    server1.invoke(() -> HADispatcherDUnitTest.resetQRMslow());
-    server1.invoke(() -> HADispatcherDUnitTest.closeCache());
-    server2.invoke(() -> HADispatcherDUnitTest.closeCache());
+    server1.invoke(() -> resetQRMslow());
+    server1.invoke(() -> closeCache());
+    server2.invoke(() -> closeCache());
+  }
+
+  @Test
+  public void testDispatcher() throws Exception {
+    clientPut(client1, KEY1, VALUE1);
+    // Waiting in the client2 till it receives the event for the key.
+    checkFromClient(client2);
+
+    // performing check in the regionqueue of the server2
+    checkFromServer(server2, KEY1);
+
+    // For CQ Only.
+    // performing put from the client1
+    clientPut(client1, KEY2, VALUE2);
+    checkFromClient(client2);
+    checkFromServer(server2, KEY2);
+
+    getLogWriter().info("testDispatcher() completed successfully");
   }
 
-  public static void closeCache()
-  {
+  /**
+   * This is to test the serialization mechanism of ClientUpdateMessage.
+   * Added after CQ support.
+   * This could be done in different way, by overflowing the HARegion queue.
+   */
+  @Test
+  public void testClientUpdateMessageSerialization() throws Exception {
+    // Update Value.
+    clientPut(client1, KEY1, VALUE1);
+    getLogWriter().fine(">>>>>>>> after clientPut(c1, k1, v1)");
+    // Waiting in the client2 till it receives the event for the key.
+    checkFromClient(client2);
+    getLogWriter().fine("after checkFromClient(c2)");
+
+    // performing check in the regionqueue of the server2
+    checkFromServer(server2, KEY1);
+    getLogWriter().fine("after checkFromServer(s2, k1)");
+
+    // UPDATE.
+    clientPut(client1, KEY1, VALUE1);
+    getLogWriter().fine("after clientPut 2 (c1, k1, v1)");
+    // Waiting in the client2 till it receives the event for the key.
+    checkFromClient(client2);
+    getLogWriter().fine("after checkFromClient 2 (c2)");
+
+    // performing check in the regionqueue of the server2
+    checkFromServer(server2, KEY1);
+    getLogWriter().fine("after checkFromServer 2 (s2, k1)");
+
+    getLogWriter().info("testClientUpdateMessageSerialization() completed successfully");
+  }
+
+  private void closeCache() {
     if (cache != null && !cache.isClosed()) {
       cache.close();
       cache.getDistributedSystem().disconnect();
     }
   }
 
-  public static void setQRMslow()
-  {
+  private void setQRMslow() throws InterruptedException {
     int oldMessageSyncInterval = cache.getMessageSyncInterval();
     cache.setMessageSyncInterval(6);
-    try {
-      Thread.sleep((oldMessageSyncInterval + 1)*1000);
-    }
-    catch (InterruptedException e) {
-      fail("Unexcepted InterruptedException Occurred");
-    }
+    Thread.sleep((oldMessageSyncInterval + 1) * 1000);
   }
 
-  public static void resetQRMslow()
-  {
+  private void resetQRMslow() {
     cache.setMessageSyncInterval(HARegionQueue.DEFAULT_MESSAGE_SYNC_INTERVAL);
   }
 
-
-  public static void makeDispatcherSlow()
-  {
+  private void makeDispatcherSlow() {
     System.setProperty("slowStartTimeForTesting", "5000");
   }
 
@@ -195,8 +221,7 @@ public class HADispatcherDUnitTest extends DistributedTestCase
     // performing put from the client1
     vm.invoke(new CacheSerializableRunnable("putFromClient") {
       @Override
-      public void run2() throws CacheException
-      {
+      public void run2() throws CacheException {
         Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
         assertNotNull(region);
         region.put(key, value);
@@ -208,18 +233,16 @@ public class HADispatcherDUnitTest extends DistributedTestCase
     // Waiting in the client till it receives the event for the key.
     vm.invoke(new CacheSerializableRunnable("checkFromClient") {
       @Override
-      public void run2() throws CacheException
-      {
+      public void run2() throws CacheException {
         Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
         assertNotNull(region);
-        cache.getLogger().fine("starting the wait");        
+        cache.getLogger().fine("starting the wait");
         synchronized (dummyObj) {
           while (waitFlag) {
             try {
               dummyObj.wait(30000);
-            }
-            catch (InterruptedException e) {
-              fail("interrupted");
+            } catch (InterruptedException e) {
+              fail("interrupted", e);
             }
           }
         }
@@ -231,117 +254,41 @@ public class HADispatcherDUnitTest extends DistributedTestCase
   }
 
   private void checkFromServer(VM vm, final Object key) {
-    // Thread.sleep(10000); // why sleep if the invoke will retry?
-    //  performing check in the regionqueue of the server2
     vm.invoke(new CacheSerializableRunnable("checkFromServer") {
       @Override
-      public void run2() throws CacheException
-      {
+      public void run2() throws CacheException {
         Iterator iter = cache.getCacheServers().iterator();
-        CacheServerImpl server = (CacheServerImpl)iter.next();
-        Iterator iter_prox = server.getAcceptor().getCacheClientNotifier()
-          .getClientProxies().iterator();
+        CacheServerImpl server = (CacheServerImpl) iter.next();
+        Iterator iter_prox = server.getAcceptor().getCacheClientNotifier().getClientProxies().iterator();
         isObjectPresent = false;
+
         while (iter_prox.hasNext()) {
-          final CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
-//          ClientProxyMembershipID proxyID = proxy.getProxyID();
-/* Conflict from CQ branch ------------------------------------------------------
-          Region regionqueue = cache.getRegion(Region.SEPARATOR
-              + HARegionQueue.createRegionName(proxyID.toString()));
-          assertNotNull(regionqueue);
-          Iterator itr = regionqueue.values().iterator();
-          while (itr.hasNext()) {
-            Object obj = itr.next();
-            if (obj
-                .getClass()
-                .getName()
-                .equals(
-                "com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage")) {
-              Conflatable confObj = (Conflatable)obj;
-              Log.getLogWriter().info("value of the object ");
-              if (key.equals(confObj.getKeyToConflate()))
-                isObjectPresent = true;
--------------------------------------------------------------------------------*/
-            //HARegion region = (HARegion)cache.getRegion(Region.SEPARATOR
-            //    + HAHelper.getRegionQueueName(proxyID.toString()));
-            //assertNotNull(region);
-            HARegion region = (HARegion) proxy.getHARegion();
-            assertNotNull(region);
-            final HARegionQueue regionQueue = region.getOwner();
-
-            WaitCriterion wc = new WaitCriterion() {
-
-              public boolean done() {
-                int sz = regionQueue.size();
-                cache.getLogger().fine("regionQueue.size()::"+ sz);
-                return sz == 0 || !proxy.isConnected();
-              }
+          final CacheClientProxy proxy = (CacheClientProxy) iter_prox.next();
+          HARegion region = (HARegion) proxy.getHARegion();
+          assertNotNull(region);
+          final HARegionQueue regionQueue = region.getOwner();
+
+          WaitCriterion wc = new WaitCriterion() {
+            @Override
+            public boolean done() {
+              int sz = regionQueue.size();
+              cache.getLogger().fine("regionQueue.size()::" + sz);
+              return sz == 0 || !proxy.isConnected();
+            }
+            @Override
+            public String description() {
+              return "regionQueue not empty with size " + regionQueue.size() + " for proxy " + proxy;
+            }
+          };
+          waitForCriterion(wc, 60 * 1000, 1000, true);
 
-              public String description() {
-                return "regionQueue not empty with size " + regionQueue.size()
-                    + " for proxy " + proxy;
-              }
-            };
-            Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
-            cache.getLogger().fine("processed a proxy");
+          cache.getLogger().fine("processed a proxy");
         }
       }
     });
-  }    
-  
-  public void testDispatcher() throws Exception
-  {
-    clientPut(client1, KEY1, VALUE1);
-    // Waiting in the client2 till it receives the event for the key.
-    checkFromClient(client2);
-
-    // performing check in the regionqueue of the server2
-    checkFromServer(server2, KEY1);
-    
-    // For CQ Only.
-    // performing put from the client1
-    clientPut(client1, KEY2, VALUE2);
-    checkFromClient(client2);
-    checkFromServer(server2, KEY2);
-    
-    Log.getLogWriter().info("testDispatcher() completed successfully");
   }
 
-  /*
-   * This is to test the serialization mechanism of ClientUpdateMessage.
-   * Added after CQ support. 
-   * This could be done in different way, by overflowing the HARegion queue.
-   * 
-   */
-  public void /*test*/ClientUpdateMessageSerialization() throws Exception
-  {
-    // Update Value.
-    clientPut(client1, KEY1, VALUE1);
-    Log.getLogWriter().fine(">>>>>>>> after clientPut(c1, k1, v1)");
-    // Waiting in the client2 till it receives the event for the key.
-    checkFromClient(client2);
-    Log.getLogWriter().fine("after checkFromClient(c2)");
-
-    // performing check in the regionqueue of the server2
-    checkFromServer(server2, KEY1);
-    Log.getLogWriter().fine("after checkFromServer(s2, k1)");
-
-    // UPDATE.
-    clientPut(client1, KEY1, VALUE1);
-    Log.getLogWriter().fine("after clientPut 2 (c1, k1, v1)");
-    // Waiting in the client2 till it receives the event for the key.
-    checkFromClient(client2);
-    Log.getLogWriter().fine("after checkFromClient 2 (c2)");
-
-    // performing check in the regionqueue of the server2
-    checkFromServer(server2, KEY1);
-    Log.getLogWriter().fine("after checkFromServer 2 (s2, k1)");
-
-    Log.getLogWriter().info("testClientUpdateMessageSerialization() completed successfully");
-  }
-
-  private void createCache(Properties props) throws Exception
-  {
+  private void createCache(Properties props) {
     DistributedSystem ds = getSystem(props);
     assertNotNull(ds);
     ds.disconnect();
@@ -350,10 +297,8 @@ public class HADispatcherDUnitTest extends DistributedTestCase
     assertNotNull(cache);
   }
 
-  public static Integer createServerCache(Boolean isListenerPresent)
-      throws Exception
-  {
-    new HADispatcherDUnitTest("temp").createCache(new Properties());
+  private Integer createServerCache(Boolean isListenerPresent) throws IOException {
+    createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -363,27 +308,25 @@ public class HADispatcherDUnitTest extends DistributedTestCase
     }
     RegionAttributes attrs = factory.create();
     cache.createRegion(REGION_NAME, attrs);
-    CacheServerImpl server = (CacheServerImpl)cache.addCacheServer();
+    CacheServerImpl server = (CacheServerImpl) cache.addCacheServer();
     assertNotNull(server);
-    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+    int port = getRandomAvailablePort(SOCKET);
     server.setPort(port);
     server.setNotifyBySubscription(true);
     server.start();
     return new Integer(server.getPort());
   }
 
-  public static void createClientCache(String hostName, Integer port1, Integer port2,
-      Boolean isListenerPresent) throws Exception
-  {
+  private void createClientCache(String hostName, Integer port1, Integer port2, Boolean isListenerPresent) throws CqException, CqExistsException, RegionNotFoundException {
     int PORT1 = port1.intValue();
     int PORT2 = port2.intValue();
     Properties props = new Properties();
     props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, "");
-    new HADispatcherDUnitTest("temp").createCache(props);
+    createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
-    ClientServerTestCase.configureConnectionPool(factory, hostName, new int[] {PORT1,PORT2}, true, -1, 2, null);
+    ClientServerTestCase.configureConnectionPool(factory, hostName, new int[]{PORT1, PORT2}, true, -1, 2, null);
     if (isListenerPresent.booleanValue() == true) {
       CacheListener clientListener = new HAClientListener();
       factory.setCacheListener(clientListener);
@@ -394,40 +337,42 @@ public class HADispatcherDUnitTest extends DistributedTestCase
     assertNotNull(region);
 
     {
-      LocalRegion lr = (LocalRegion)region;
-      final PoolImpl pool = (PoolImpl)(lr.getServerProxy().getPool());
+      LocalRegion lr = (LocalRegion) region;
+      final PoolImpl pool = (PoolImpl) (lr.getServerProxy().getPool());
       WaitCriterion ev = new WaitCriterion() {
         public boolean done() {
           return pool.getPrimary() != null;
         }
+
         public String description() {
           return null;
         }
       };
-      Wait.waitForCriterion(ev, 30 * 1000, 200, true);
+      waitForCriterion(ev, 30 * 1000, 200, true);
       ev = new WaitCriterion() {
         public boolean done() {
           return pool.getRedundants().size() >= 1;
         }
+
         public String description() {
           return null;
         }
       };
-      Wait.waitForCriterion(ev, 30 * 1000, 200, true);
-      
+      waitForCriterion(ev, 30 * 1000, 200, true);
+
       assertNotNull(pool.getPrimary());
-      assertTrue("backups="+pool.getRedundants() + " expected=" + 1,
-                 pool.getRedundants().size() >= 1);
+      assertTrue("backups=" + pool.getRedundants() + " expected=" + 1,
+              pool.getRedundants().size() >= 1);
       assertEquals(PORT1, pool.getPrimaryPort());
     }
 
     region.registerInterest(KEY1);
 
     // Register CQ.
-    createCQ(); 
+    createCQ();
   }
 
-  private static void createCQ(){
+  private void createCQ() throws CqException, CqExistsException, RegionNotFoundException {
     QueryService cqService = null;
     try {
       cqService = cache.getQueryService();
@@ -435,253 +380,86 @@ public class HADispatcherDUnitTest extends DistributedTestCase
       cqe.printStackTrace();
       fail("Failed to getCQService.");
     }
-    
+
     // Create CQ Attributes.
     CqAttributesFactory cqf = new CqAttributesFactory();
-    CqListener[] cqListeners = {new CqQueryTestListener(LogWriterUtils.getLogWriter())};    
+    CqListener[] cqListeners = {new CqQueryTestListener(getLogWriter())};
     cqf.initCqListeners(cqListeners);
     CqAttributes cqa = cqf.create();
-    
+
     String cqName = "CQForHARegionQueueTest";
     String queryStr = "Select * from " + Region.SEPARATOR + REGION_NAME;
-    
+
     // Create CQ.
-    try {
-      CqQuery cq1 = cqService.newCq(cqName, queryStr, cqa);
-      cq1.execute();
-    } catch (Exception ex){
-      LogWriterUtils.getLogWriter().info("CQService is :" + cqService);
-      ex.printStackTrace();
-      AssertionError err = new AssertionError("Failed to create/execute CQ " + cqName + " . ");
-      err.initCause(ex);
-      throw err;
-    }
+    CqQuery cq1 = cqService.newCq(cqName, queryStr, cqa);
+    cq1.execute();
   }
 
-
   /**
    * This is the client listener which notifies the waiting thread when it
    * receives the event.
    */
-  protected static class HAClientListener extends CacheListenerAdapter implements Declarable  {
-    public void afterCreate(EntryEvent event)
-    {
-      synchronized (HADispatcherDUnitTest.dummyObj) {
+  private static class HAClientListener extends CacheListenerAdapter implements Declarable {
+
+    @Override
+    public void afterCreate(EntryEvent event) {
+      synchronized (dummyObj) {
         try {
           Object value = event.getNewValue();
-          if (value.equals(HADispatcherDUnitTest.VALUE1)) {
-            HADispatcherDUnitTest.waitFlag = false;
-            HADispatcherDUnitTest.dummyObj.notifyAll();
+          if (value.equals(VALUE1)) {
+            waitFlag = false;
+            dummyObj.notifyAll();
           }
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
           e.printStackTrace();
         }
       }
     }
 
-    public void afterUpdate(EntryEvent event)
-    {
-
-    }
-
-    public void afterInvalidate(EntryEvent event)
-    {
-
-    }
-
-    public void afterDestroy(EntryEvent event)
-    {
-
-    }
-
-    public void afterRegionInvalidate(RegionEvent event)
-    {
-
-    }
-
-    public void afterRegionDestroy(RegionEvent event)
-    {
-
-    }
-
-    public void close()
-    {
-
-    }
-
-    public void init(Properties props)
-    {
-
-    }
-    public void afterRegionCreate(RegionEvent event)
-    {
-      // TODO Auto-generated method stub
-
-    }
-    public void afterRegionClear(RegionEvent event)
-    {
-      // TODO Auto-generated method stub
-
-    }
-    public void afterRegionLive(RegionEvent event)
-    {
-      // TODO NOT Auto-generated method stub, added by vrao
-
+    @Override
+    public void init(Properties props) {
     }
   }
 
   /**
    * This is the server listener which ensures that regionqueue is properly populated
    */
-  protected static class HAServerListener extends CacheListenerAdapter {
+  private static class HAServerListener extends CacheListenerAdapter {
     @Override
-    public void afterCreate(EntryEvent event)
-    {
+    public void afterCreate(EntryEvent event) {
       Cache cache = event.getRegion().getCache();
       Iterator iter = cache.getCacheServers().iterator();
-      CacheServerImpl server = (CacheServerImpl)iter.next();
-      HADispatcherDUnitTest.isObjectPresent = false;
+      CacheServerImpl server = (CacheServerImpl) iter.next();
+      isObjectPresent = false;
 
       // The event not be there in the region first time; try couple of time.
       // This should have been replaced by listener on the HARegion and doing wait for event arrival in that.
-      while (true) { 
-        Iterator iter_prox = server.getAcceptor().getCacheClientNotifier()
-        .getClientProxies().iterator();
-        while (iter_prox.hasNext()) {
-          CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
-//          ClientProxyMembershipID proxyID = proxy.getProxyID();
-          HARegion regionForQueue = (HARegion)proxy.getHARegion();
+      while (true) {
+        for (Iterator iter_prox = server.getAcceptor().getCacheClientNotifier().getClientProxies().iterator(); iter_prox.hasNext();) {
+          CacheClientProxy proxy = (CacheClientProxy) iter_prox.next();
+          HARegion regionForQueue = (HARegion) proxy.getHARegion();
 
-          Iterator itr = regionForQueue.values().iterator();
-          while (itr.hasNext()) {
+          for (Iterator itr = regionForQueue.values().iterator(); itr.hasNext();) {
             Object obj = itr.next();
             if (obj instanceof HAEventWrapper) {
-              Conflatable confObj = (Conflatable)obj;
-              if ((HADispatcherDUnitTest.KEY1).equals(confObj.getKeyToConflate()) ||
-                  (HADispatcherDUnitTest.KEY2).equals(confObj.getKeyToConflate())) {
-                HADispatcherDUnitTest.isObjectPresent = true;
+              Conflatable confObj = (Conflatable) obj;
+              if (KEY1.equals(confObj.getKeyToConflate()) || KEY2.equals(confObj.getKeyToConflate())) {
+                isObjectPresent = true;
               }
             }
           }
         }
-        if (HADispatcherDUnitTest.isObjectPresent == true) {
+
+        if (isObjectPresent) {
           break; // From while.
         }
+
         try {
           Thread.sleep(10);
-        } catch (InterruptedException ex) {fail("interrupted");}
+        } catch (InterruptedException e) {
+          fail("interrupted", e);
+        }
       }
     }
-
-    // this test is no longer needed since these
-    // messages are not longer Externalizable
-//  /*
-//  * This is for testing ClientUpdateMessage's serialization code.
-//  */
-//  public void afterUpdate(EntryEvent event)
-//  {
-//  Log.getLogWriter().info("In HAServerListener::AfterUpdate::Event=" + event);
-//  Cache cache = event.getRegion().getCache();
-//  Iterator iter = cache.getCacheServers().iterator();
-//  BridgeServerImpl server = (BridgeServerImpl)iter.next();
-//  HADispatcherDUnitTest.isObjectPresent = false;
-
-//  // The event not be there in the region first time; try couple of time.
-//  // This should have been replaced by listener on the HARegion and doing wait for event arrival in that.
-//  while (true) { 
-
-//  Iterator iter_prox = server.getAcceptor().getCacheClientNotifier()
-//  .getClientProxies().iterator();
-//  while (iter_prox.hasNext()) {
-//  CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
-//  ClientProxyMembershipID proxyID = proxy.getProxyID();
-//  HARegion regionForQueue = (HARegion)cache.getRegion(Region.SEPARATOR
-//  + HARegionQueue.createRegionName(proxyID.toString()));
-//  if (regionForQueue == null) {
-//  // I observed dunit throwing an NPE here.
-//  // I changed it to just keep retrying which caused dunit to hang.
-//  // The queue is gone we are shutting down so just return
-//  return;
-//  }
-//  Iterator itr = regionForQueue.values().iterator();
-//  while (itr.hasNext()) {
-//  Object obj = itr.next();
-//  if (obj.getClass().getName().equals(
-//  "com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage")) {
-//  com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage clientUpdateMessage = 
-//  (com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage)obj;
-//  try{
-//  // Test for readExternal(), writeExternal().
-//  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-//  ObjectOutputStream out = new ObjectOutputStream(outStream);
-//  clientUpdateMessage.writeExternal(out);
-//  out.flush();
-//  ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(outStream.toByteArray()));
-
-//  com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage newClientUpdateMessage = 
-//  new com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessageImpl();
-
-//  newClientUpdateMessage.readExternal(in);
-
-//  Log.getLogWriter().info("Newly constructed ClientUpdateMessage is :" + newClientUpdateMessage.toString());
-//  if (!newClientUpdateMessage.hasCqs() || 
-//  ((ClientUpdateMessageImpl)newClientUpdateMessage).getClientCqs() == null ||
-//  ((ClientUpdateMessageImpl)newClientUpdateMessage).getClientCqs().size() != 2){
-//  throw new Exception("CQ Info not present");
-//  }
-//  HashMap clientCQs = ((ClientUpdateMessageImpl)newClientUpdateMessage).getClientCqs();
-
-//  // Try to print CQ details - debug.
-//  for (Iterator cciter = clientCQs.keySet().iterator(); cciter.hasNext();) {
-//  ClientProxyMembershipID proxyId = (ClientProxyMembershipID)cciter.next();
-
-//  HashMap cqs = (HashMap)clientCQs.get(proxyId);
-//  Log.getLogWriter().info("Client ID is :" + proxyId); 
-
-//  for (Iterator cqIter = cqs.keySet().iterator();cqIter.hasNext();){
-//  // Add CQ Name.
-//  String cq = (String)cqIter.next();
-//  // Add CQ Op.
-//  Log.getLogWriter().info("CQ Name :" + cq + " CQ OP :" + ((Integer)cqs.get(cq)).intValue());
-//  }
-
-//  }
-
-//  // Test for toData(), fromData().
-//  ByteArrayOutputStream dataOutStream = new ByteArrayOutputStream();
-//  DataOutputStream dataout = new DataOutputStream(dataOutStream);
-//  clientUpdateMessage.toData(dataout);
-//  dataOutStream.flush();
-//  DataInputStream datain = new DataInputStream(new ByteArrayInputStream(dataOutStream.toByteArray()));
-
-//  com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage newClientUpdateMessage2 = 
-//  new com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessageImpl();
-
-//  newClientUpdateMessage2.fromData(datain);
-
-//  Log.getLogWriter().info("Newly constructed ClientUpdateMessage is :" + newClientUpdateMessage2.toString());
-//  if (!newClientUpdateMessage2.hasCqs() || 
-//  ((ClientUpdateMessageImpl)newClientUpdateMessage2).getClientCqs() == null ||
-//  ((ClientUpdateMessageImpl)newClientUpdateMessage2).getClientCqs().size() != 2){
-//  throw new Exception("CQ Info not present");
-//  }
-
-//  } catch (Exception ex) {
-//  Log.getLogWriter().info("Exception while serializing ClientUpdateMessage.", ex);
-//  return;
-//  }
-//  HADispatcherDUnitTest.isObjectPresent = true;
-//  }
-//  }
-//  }
-//  if (HADispatcherDUnitTest.isObjectPresent == true) {
-//  break; // From while.
-//  }
-//  try {
-//  Thread.sleep(10);
-//  } catch (Exception ex) {}
-//  }
-//  }
   }
 }


[11/49] incubator-geode git commit: GEODE-1350: Add test category

Posted by kl...@apache.org.
GEODE-1350: Add test category


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f5949777
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f5949777
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f5949777

Branch: refs/heads/feature/GEODE-835-test
Commit: f59497776ccc8186fe62626198cd38605fae405a
Parents: 973c86c
Author: Jens Deppe <jd...@pivotal.io>
Authored: Fri May 13 09:03:15 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Fri May 13 09:03:15 2016 -0700

----------------------------------------------------------------------
 .../junit/runners/CategoryWithParameterizedRunnerFactoryTest.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f5949777/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
index 63a579b..40fda16 100644
--- a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
@@ -41,6 +41,7 @@ import java.util.List;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+@Category(UnitTest.class)
 public class CategoryWithParameterizedRunnerFactoryTest {
 
   /**


[42/49] incubator-geode git commit: GEODE-1209: Added new attribute to forward eviction/expiration to AEQ. Following changes are made: 1. Added new attribue/flag to forward eviction and expiration destroy events. 2. Added new option in CreateAsyncEventQu

Posted by kl...@apache.org.
GEODE-1209: Added new attribute to forward eviction/expiration to AEQ.
Following changes are made:
1. Added new attribue/flag to forward eviction and expiration destroy events.
2. Added new option in CreateAsyncEventQueue Gfsh command. Also cleaned up arguments for create AEQ function invoked by gfsh. Instead of object array the args are wrapped in args object.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/46056a66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/46056a66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/46056a66

Branch: refs/heads/feature/GEODE-835-test
Commit: 46056a6611970c06ab1414900e35e4135533af87
Parents: 8266f6b
Author: Anil <ag...@pivotal.io>
Authored: Tue May 3 13:52:18 2016 -0700
Committer: Anil <ag...@pivotal.io>
Committed: Tue May 17 15:59:39 2016 -0700

----------------------------------------------------------------------
 .../SharedConfigurationEndToEndDUnitTest.java   |   1 +
 .../cache/asyncqueue/AsyncEventQueue.java       |   9 +
 .../asyncqueue/AsyncEventQueueFactory.java      |  13 +
 .../internal/AsyncEventQueueFactoryImpl.java    |   8 +-
 .../internal/AsyncEventQueueImpl.java           |   9 +-
 .../gemfire/cache/wan/GatewaySender.java        |   2 +
 .../gemfire/internal/cache/LocalRegion.java     |  52 ++-
 .../cache/wan/AbstractGatewaySender.java        | 100 +++---
 .../cache/wan/GatewaySenderAttributes.java      |   7 +
 .../cache/xmlcache/AsyncEventQueueCreation.java |  11 +
 .../internal/cache/xmlcache/CacheXml.java       |   1 +
 .../cache/xmlcache/CacheXmlGenerator.java       |   8 +
 .../internal/cache/xmlcache/CacheXmlParser.java |   7 +
 .../internal/cli/commands/QueueCommands.java    |  18 +-
 .../functions/AsyncEventQueueFunctionArgs.java  | 134 +++++++
 .../CreateAsyncEventQueueFunction.java          |  54 ++-
 .../internal/cli/i18n/CliStrings.java           |   2 +
 .../controllers/QueueCommandsController.java    |   1 +
 .../geode.apache.org/schema/cache/cache-1.0.xsd |   1 +
 ...ventQueueEvictionAndExpirationJUnitTest.java | 346 +++++++++++++++++++
 .../cache30/CacheXmlGeode10DUnitTest.java       |  78 +++++
 .../cli/commands/QueueCommandsDUnitTest.java    |   2 +
 .../codeAnalysis/sanctionedSerializables.txt    |   1 +
 23 files changed, 747 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
index a6221e9..5f3bf1f 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
@@ -226,6 +226,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISPATCHERTHREADS, "4");
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__ENABLEBATCHCONFLATION, "true");
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS, "true");
+      csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION, "true");
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY, "1000");
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__ORDERPOLICY, OrderPolicy.KEY.toString());
       csb.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PERSISTENT, "true");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
index a2b8b0f..c2d04a1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueue.java
@@ -147,4 +147,13 @@ public interface AsyncEventQueue {
    *         <code>AsyncEventQueue</code>
    */
   public GatewayEventSubstitutionFilter getGatewayEventSubstitutionFilter();
+ 
+  /**
+   * Represents if eviction and expiration events/operations are ignored (not passed)
+   * with <code>AsyncEventListener</code>.
+   * 
+   * @return boolen True if eviction and expiration operations are ignored.
+   */
+  public boolean isIgnoreEvictionAndExpiration();
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueFactory.java
index 3e30b38..c607142 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueFactory.java
@@ -170,7 +170,20 @@ public interface AsyncEventQueueFactory {
   public AsyncEventQueueFactory setGatewayEventSubstitutionListener(
       GatewayEventSubstitutionFilter filter);
 
+  /**
+   * Ignores the eviction and expiration events.
+   * By default its set to ignore eviction and expiration events (true), by
+   * setting it to false, the AEQ will receive destroy events due to eviction
+   * and expiration action.
+   * Note, setting this to false doesn't propagate invalidate events due to
+   * expiration action.
+   *
+   * @param ignore 
+   *        boolean to indicate whether to ignore eviction and expiration events. 
+   */
+  public AsyncEventQueueFactory setIgnoreEvictionAndExpiration(boolean ignore);
 
+  
   /**
    * Creates the <code>AsyncEventQueue</code>. It accepts Id of AsyncEventQueue
    * and instance of AsyncEventListener. Multiple queues can be created using

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
index 312e880..1ec3ba0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
@@ -277,7 +277,7 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
     this.attrs.eventFilters = asyncQueueCreation.getGatewayEventFilters();
     this.attrs.eventSubstitutionFilter = asyncQueueCreation.getGatewayEventSubstitutionFilter();
     this.attrs.isForInternalUse = true;
-
+    this.attrs.ignoreEvictionAndExpiration = asyncQueueCreation.isIgnoreEvictionAndExpiration();
   }
 
   public AsyncEventQueueFactory setParallel(boolean isParallel) {
@@ -292,4 +292,10 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
     this.attrs.isMetaQueue = isMetaQueue;
     return this;
   }
+
+  @Override
+  public AsyncEventQueueFactory setIgnoreEvictionAndExpiration(boolean ignore) {
+    this.attrs.ignoreEvictionAndExpiration = ignore;
+    return this;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java
index 6b3eb4a..5a0b370 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java
@@ -36,7 +36,7 @@ public class AsyncEventQueueImpl implements AsyncEventQueue {
   private GatewaySender sender = null;
   
   private AsyncEventListener asyncEventListener = null;
-  
+    
   public static final String ASYNC_EVENT_QUEUE_PREFIX = "AsyncEventQueue_";
   
   public AsyncEventQueueImpl(GatewaySender sender, AsyncEventListener eventListener) {
@@ -200,6 +200,9 @@ public class AsyncEventQueueImpl implements AsyncEventQueue {
    public boolean isBucketSorted() {
     // TODO Auto-generated method stub
     return false;
-  }
-  
+  }     
+   
+   public boolean isIgnoreEvictionAndExpiration() {
+     return ((AbstractGatewaySender)this.sender).isIgnoreEvictionAndExpiration();
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
index c5b5d3a..b0ad410 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/wan/GatewaySender.java
@@ -96,6 +96,8 @@ public interface GatewaySender {
 
   public static final int DEFAULT_DISPATCHER_THREADS = 5;
   
+  public static final boolean DEFAULT_IGNORE_EVICTION_EXPIRATION = true;
+  
   public static final OrderPolicy DEFAULT_ORDER_POLICY = OrderPolicy.KEY;
   /**
    * The default maximum amount of memory (MB) to allow in the queue before

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
index e9f5819..b5ff7ee 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
@@ -1147,8 +1147,7 @@ public class LocalRegion extends AbstractRegion
   @Override
   public boolean generateEventID()
   {     
-    return !(isUsedForPartitionedRegionAdmin()
-        || isUsedForPartitionedRegionBucket() );
+    return !isUsedForPartitionedRegionAdmin();
   }
 
   public final Object destroy(Object key, Object aCallbackArgument)
@@ -6647,10 +6646,10 @@ public class LocalRegion extends AbstractRegion
   protected void notifyGatewaySender(EnumListenerEvent operation,
       EntryEventImpl event) {
     
-    if (event.isConcurrencyConflict()) { // usually concurrent cache modification problem
+    if (isPdxTypesRegion() || event.isConcurrencyConflict() /* usually concurrent cache modification problem */) { 
       return;
     }
-    
+
     // Return if the inhibit all notifications flag is set
     if (event.inhibitAllNotifications()){
       if(logger.isDebugEnabled()) {
@@ -6659,34 +6658,31 @@ public class LocalRegion extends AbstractRegion
       return;
     }
     
-    if (!event.getOperation().isLocal()) {
-      Set<String> allGatewaySenderIds = null;
-      checkSameSenderIdsAvailableOnAllNodes();
-      if (event.getOperation() == Operation.UPDATE_VERSION_STAMP) {
-        allGatewaySenderIds = getGatewaySenderIds();
-      } else {
-        allGatewaySenderIds = getAllGatewaySenderIds();
-      }
-      
-      List<Integer> allRemoteDSIds = getRemoteDsIds(allGatewaySenderIds);
+    
+    Set<String> allGatewaySenderIds = null;
+    checkSameSenderIdsAvailableOnAllNodes();
+    if (event.getOperation() == Operation.UPDATE_VERSION_STAMP) {
+      allGatewaySenderIds = getGatewaySenderIds();
+    } else {
+      allGatewaySenderIds = getAllGatewaySenderIds();
+    }
 
-      if (allRemoteDSIds != null) {
-        for (GatewaySender sender : getCache().getAllGatewaySenders()) {
-          if (!isPdxTypesRegion()) {
-            if (allGatewaySenderIds.contains(sender.getId())) {
-              //TODO: This is a BUG. Why return and not continue?
-              if((!this.getDataPolicy().withStorage()) && sender.isParallel()){
-                return;
-              }
-              if(logger.isDebugEnabled()) {
-                logger.debug("Notifying the GatewaySender : {}", sender.getId());
-              }
-              ((AbstractGatewaySender)sender).distribute(operation, event,
-                  allRemoteDSIds);
-            }
+    List<Integer> allRemoteDSIds = getRemoteDsIds(allGatewaySenderIds);
+    if (allRemoteDSIds != null) {
+      for (GatewaySender sender : getCache().getAllGatewaySenders()) {
+        if (allGatewaySenderIds.contains(sender.getId())) {
+          //TODO: This is a BUG. Why return and not continue?
+          if((!this.getDataPolicy().withStorage()) && sender.isParallel()){
+            return;
+          }
+          if(logger.isDebugEnabled()) {
+            logger.debug("Notifying the GatewaySender : {}", sender.getId());
           }
+          ((AbstractGatewaySender)sender).distribute(operation, event,
+              allRemoteDSIds);
         }
       }
+
       
 //      if (shouldNotifyGatewaySender()) {
 //        // Get All WAN site DSID's to be sent to each WAN site so that they

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
index fe09d03..713023f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
@@ -34,6 +34,7 @@ import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Operation;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.RegionDestroyedException;
@@ -137,6 +138,8 @@ public abstract class AbstractGatewaySender implements GatewaySender,
 
   protected List<AsyncEventListener> listeners;
   
+  protected boolean ignoreEvictionAndExpiration;
+  
   protected GatewayEventSubstitutionFilter substitutionFilter;
   
   protected LocatorDiscoveryCallback locatorDiscoveryCallback;
@@ -269,55 +272,7 @@ public abstract class AbstractGatewaySender implements GatewaySender,
       initializeEventIdIndex();
     }
     this.isBucketSorted = attrs.isBucketSorted();
-  }
-  
-  public void createSender(Cache cache, GatewaySenderAttributes attrs){
-    this.cache = cache;
-    this.id = attrs.getId();
-    this.socketBufferSize = attrs.getSocketBufferSize();
-    this.socketReadTimeout = attrs.getSocketReadTimeout();
-    this.queueMemory = attrs.getMaximumQueueMemory();
-    this.batchSize = attrs.getBatchSize();
-    this.batchTimeInterval = attrs.getBatchTimeInterval();
-    this.isConflation = attrs.isBatchConflationEnabled();
-    this.isPersistence = attrs.isPersistenceEnabled();
-    this.alertThreshold = attrs.getAlertThreshold();
-    this.manualStart = attrs.isManualStart();
-    this.isParallel = attrs.isParallel();
-    this.isForInternalUse = attrs.isForInternalUse();
-    this.diskStoreName = attrs.getDiskStoreName();
-    this.remoteDSId = attrs.getRemoteDSId();
-    this.eventFilters = attrs.getGatewayEventFilters();
-    this.transFilters = attrs.getGatewayTransportFilters();
-    this.listeners = attrs.getAsyncEventListeners();
-    this.substitutionFilter = attrs.getGatewayEventSubstitutionFilter();
-    this.locatorDiscoveryCallback = attrs.getGatewayLocatoDiscoveryCallback();
-    this.isDiskSynchronous = attrs.isDiskSynchronous();
-    this.policy = attrs.getOrderPolicy();
-    this.dispatcherThreads = attrs.getDispatcherThreads();
-    this.parallelismForReplicatedRegion = attrs.getParallelismForReplicatedRegion();
-    //divide the maximumQueueMemory of sender equally using number of dispatcher threads.
-    //if dispatcherThreads is 1 then maxMemoryPerDispatcherQueue will be same as maximumQueueMemory of sender
-    this.maxMemoryPerDispatcherQueue = this.queueMemory / this.dispatcherThreads;
-    this.myDSId = InternalDistributedSystem.getAnyInstance().getDistributionManager().getDistributedSystemId();
-    this.serialNumber = DistributionAdvisor.createSerialNumber();
-    if (!(this.cache instanceof CacheCreation)) {
-      this.stopper = new Stopper(cache.getCancelCriterion());
-      this.senderAdvisor = GatewaySenderAdvisor.createGatewaySenderAdvisor(this);
-      if (!this.isForInternalUse()) {
-        this.statistics = new AsyncEventQueueStats(cache.getDistributedSystem(),
-            id);
-      }
-      else {// this sender lies underneath the AsyncEventQueue. Need to have
-            // AsyncEventQueueStats
-        this.statistics = new AsyncEventQueueStats(
-            cache.getDistributedSystem(), AsyncEventQueueImpl
-                .getAsyncEventQueueIdFromSenderId(id));
-      }
-      initializeEventIdIndex();
-    }
-    this.isBucketSorted = attrs.isBucketSorted();
-
+    this.ignoreEvictionAndExpiration = attrs.isIgnoreEvictionAndExpiration();
   }
   
   public GatewaySenderAdvisor getSenderAdvisor() {
@@ -392,6 +347,10 @@ public abstract class AbstractGatewaySender implements GatewaySender,
     return !this.listeners.isEmpty();
   }
   
+  public boolean isIgnoreEvictionAndExpiration() {
+    return this.ignoreEvictionAndExpiration;
+  }
+  
   public boolean isManualStart() {
     return this.manualStart;
   }
@@ -839,16 +798,49 @@ public abstract class AbstractGatewaySender implements GatewaySender,
     return this.eventProcessor;
   }
 
+  /**
+   * Check if this event can be distributed by senders.
+   * @param event
+   * @param stats
+   * @return boolean True if the event is allowed.
+   */
+  private boolean checkForDistribution(EntryEventImpl event, GatewaySenderStats stats) {
+    if (event.getRegion().getDataPolicy().equals(DataPolicy.NORMAL))
+    {
+      return false;
+    }
+    
+    // Eviction and expirations are not passed to WAN.
+    // Eviction and Expiration are passed to AEQ based on its configuration.
+    if (event.getOperation().isLocal() || event.getOperation().isExpiration()) {
+      // Check if its AEQ and AEQ is configured to forward eviction/expiration events.
+      if (this.isAsyncEventQueue() && !this.isIgnoreEvictionAndExpiration()) {
+        return true;
+      }
+      return false;
+    }
+    
+    return true;
+  }
+  
+  
   public void distribute(EnumListenerEvent operation, EntryEventImpl event,
       List<Integer> allRemoteDSIds) {
+    
     final boolean isDebugEnabled = logger.isDebugEnabled();
     
+    // If this gateway is not running, return
+    if (!isRunning()) {
+      if (isDebugEnabled) {
+        logger.debug("Returning back without putting into the gateway sender queue");
+      }
+      return;
+    }
+    
     final GatewaySenderStats stats = getStatistics();
     stats.incEventsReceived();
-    // If the event is local (see bug 35831) or an expiration ignore it.
-    //removed the check of isLocal as in notifyGAtewayHub this has been taken care
-    if (/*event.getOperation().isLocal() || */event.getOperation().isExpiration()
-        || event.getRegion().getDataPolicy().equals(DataPolicy.NORMAL)) {
+   
+    if (!checkForDistribution(event, stats)) {
       getStatistics().incEventsNotQueued();
       return;
     }
@@ -941,6 +933,7 @@ public abstract class AbstractGatewaySender implements GatewaySender,
     }
     try {
       // If this gateway is not running, return
+      // The sender may have stopped, after we have checked the status in the beginning. 
       if (!isRunning()) {
         if (isDebugEnabled) {
           logger.debug("Returning back without putting into the gateway sender queue");
@@ -988,6 +981,7 @@ public abstract class AbstractGatewaySender implements GatewaySender,
     }
   }
   
+
   /**
    * During sender is getting started, if there are any cache operation on queue then that event will be stored in temp queue. 
    * Once sender is started, these event from tmp queue will be added to sender queue.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java
index 1cef940..163943f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java
@@ -83,6 +83,8 @@ public class GatewaySenderAttributes {
   
   public boolean isMetaQueue = GatewaySenderAttributes.DEFAULT_IS_META_QUEUE;
   
+  public boolean ignoreEvictionAndExpiration = GatewaySender.DEFAULT_IGNORE_EVICTION_EXPIRATION;
+  
   public int getSocketBufferSize() {
     return this.socketBufferSize;
   }
@@ -192,4 +194,9 @@ public class GatewaySenderAttributes {
   public boolean isMetaQueue() {
     return this.isMetaQueue;
   }
+  
+  public boolean isIgnoreEvictionAndExpiration() {
+    return this.ignoreEvictionAndExpiration;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/AsyncEventQueueCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/AsyncEventQueueCreation.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/AsyncEventQueueCreation.java
index 0015665..4c2943e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/AsyncEventQueueCreation.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/AsyncEventQueueCreation.java
@@ -43,6 +43,7 @@ public class AsyncEventQueueCreation implements AsyncEventQueue {
   private boolean isBucketSorted = false;
   private int dispatcherThreads = 1;
   private OrderPolicy orderPolicy = OrderPolicy.KEY;
+  private boolean ignoreEvictionAndExpiration = true;
   
   public AsyncEventQueueCreation() {
   }
@@ -62,6 +63,7 @@ public class AsyncEventQueueCreation implements AsyncEventQueue {
     this.asyncEventListener = eventListener;
     this.isBucketSorted = senderAttrs.isBucketSorted; 
     this.gatewayEventSubstitutionFilter = senderAttrs.eventSubstitutionFilter;
+    this.ignoreEvictionAndExpiration = senderAttrs.ignoreEvictionAndExpiration;
   }
   
   @Override
@@ -211,4 +213,13 @@ public class AsyncEventQueueCreation implements AsyncEventQueue {
   public void setBucketSorted(boolean isBucketSorted) {
     this.isBucketSorted = isBucketSorted;
   }
+
+  public void setIgnoreEvictionAndExpiration(boolean ignore) {
+    this.ignoreEvictionAndExpiration = ignore;
+  }
+  
+  @Override
+  public boolean isIgnoreEvictionAndExpiration() {
+    return this.ignoreEvictionAndExpiration;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
index aa7d49a..c3eccd2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXml.java
@@ -762,6 +762,7 @@ public abstract class CacheXml implements EntityResolver2, ErrorHandler {
   protected static final String ASYNC_EVENT_LISTENER = "async-event-listener";
   public static final String ASYNC_EVENT_QUEUE = "async-event-queue";
   protected static final String ASYNC_EVENT_QUEUE_IDS = "async-event-queue-ids";
+  protected static final String IGNORE_EVICTION_AND_EXPIRATION = "ignore-eviction-expiration";
   
   /** The name of the <code>compressor</code> attribute */
   protected static final String COMPRESSOR = "compressor";

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
index ea3c975..f0b1368 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlGenerator.java
@@ -1521,10 +1521,18 @@ public class CacheXmlGenerator extends CacheXml implements XMLReader {
         atts.addAttribute("", "", ORDER_POLICY, "", String.valueOf(asyncEventQueue
           .getOrderPolicy()));
       }
+      // eviction and expiration events
+      if (this.version.compareTo(CacheXmlVersion.GEODE_1_0) >= 0) {
+        if (generateDefaults() || asyncEventQueue.isIgnoreEvictionAndExpiration() != (GatewaySender.DEFAULT_IGNORE_EVICTION_EXPIRATION))
+          atts.addAttribute("", "", IGNORE_EVICTION_AND_EXPIRATION, "", String.valueOf(asyncEventQueue
+              .isIgnoreEvictionAndExpiration()));
+      }
       // disk-synchronous
       if (generateDefaults() || asyncEventQueue.isDiskSynchronous() != GatewaySender.DEFAULT_DISK_SYNCHRONOUS)
       atts.addAttribute("", "", DISK_SYNCHRONOUS, "", String.valueOf(asyncEventQueue
           .isDiskSynchronous()));
+      
+      // AsyncEventQueue element start
       handler.startElement("", ASYNC_EVENT_QUEUE, ASYNC_EVENT_QUEUE, atts);
     
       List<GatewayEventFilter> eventFilters = asyncEventQueue.getGatewayEventFilters();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
index f344938..aec2dc3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheXmlParser.java
@@ -2313,6 +2313,12 @@ public class CacheXmlParser extends CacheXml implements ContentHandler {
       }
     }
     
+    // forward eviction and expiration events.
+    String ignoreEvictionExpiration = atts.getValue(IGNORE_EVICTION_AND_EXPIRATION);
+    if (ignoreEvictionExpiration != null) {
+      asyncEventQueueCreation.setIgnoreEvictionAndExpiration(Boolean.parseBoolean(ignoreEvictionExpiration));
+    }
+    
     stack.push(asyncEventQueueCreation);
   }
   
@@ -2346,6 +2352,7 @@ public class CacheXmlParser extends CacheXml implements ContentHandler {
     factory.setMaximumQueueMemory(asyncEventChannelCreation.getMaximumQueueMemory());
     factory.setDispatcherThreads(asyncEventChannelCreation.getDispatcherThreads());
     factory.setOrderPolicy(asyncEventChannelCreation.getOrderPolicy());
+    factory.setIgnoreEvictionAndExpiration(asyncEventChannelCreation.isIgnoreEvictionAndExpiration());
     List<GatewayEventFilter> gatewayEventFilters = asyncEventChannelCreation.getGatewayEventFilters();
     for (GatewayEventFilter gatewayEventFilter : gatewayEventFilters) {
       factory.addGatewayEventFilter(gatewayEventFilter);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommands.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommands.java
index 89534a6..b9c853d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommands.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommands.java
@@ -25,6 +25,7 @@ import com.gemstone.gemfire.management.cli.Result;
 import com.gemstone.gemfire.management.cli.Result.Status;
 import com.gemstone.gemfire.management.internal.cli.CliUtil;
 import com.gemstone.gemfire.management.internal.cli.domain.AsyncEventQueueDetails;
+import com.gemstone.gemfire.management.internal.cli.functions.AsyncEventQueueFunctionArgs;
 import com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult;
 import com.gemstone.gemfire.management.internal.cli.functions.CreateAsyncEventQueueFunction;
 import com.gemstone.gemfire.management.internal.cli.functions.ListAsyncEventQueuesFunction;
@@ -36,6 +37,7 @@ import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.configuration.SharedConfigurationWriter;
 import com.gemstone.gemfire.management.internal.configuration.domain.XmlEntity;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
+
 import org.springframework.shell.core.CommandMarker;
 import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
 import org.springframework.shell.core.annotation.CliCommand;
@@ -105,6 +107,11 @@ public class QueueCommands implements CommandMarker {
                  specifiedDefaultValue = "true",
                  help = CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS__HELP) 
       Boolean diskSynchronous,
+      @CliOption(key = CliStrings.CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION,
+                 unspecifiedDefaultValue = "true",
+                 specifiedDefaultValue = "true",
+                 help = CliStrings.CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION__HELP) 
+      Boolean ignoreEvictionAndExpiration,
       @CliOption(key = CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY,
                  unspecifiedDefaultValue = "100", 
                  help = CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY__HELP)
@@ -159,8 +166,15 @@ public class QueueCommands implements CommandMarker {
         return crex.getResult();
       }
 
-      ResultCollector<?, ?> rc = CliUtil.executeFunction(new CreateAsyncEventQueueFunction(), new Object[] { id, parallel, enableBatchConflation, batchSize,batchTimeInterval,
-          persistent, diskStore, diskSynchronous, maxQueueMemory, dispatcherThreads, orderPolicy, gatewayEventFilters, gatewaySubstitutionListener, listener, listenerProperties }, targetMembers);
+      AsyncEventQueueFunctionArgs aeqArgs = new AsyncEventQueueFunctionArgs(id, parallel, 
+          enableBatchConflation, batchSize,batchTimeInterval,
+          persistent, diskStore, diskSynchronous, maxQueueMemory, dispatcherThreads, orderPolicy, 
+          gatewayEventFilters, gatewaySubstitutionListener, listener, listenerProperties, 
+          ignoreEvictionAndExpiration);
+
+      ResultCollector<?, ?> rc = CliUtil.executeFunction(new CreateAsyncEventQueueFunction(), 
+          aeqArgs, targetMembers);
+
       List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>) rc.getResult());
 
       XmlEntity xmlEntity = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
new file mode 100644
index 0000000..2066628
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/AsyncEventQueueFunctionArgs.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli.functions;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+/**
+ * This class stores the arguments provided for create async event queue command.
+ */
+public class AsyncEventQueueFunctionArgs implements Serializable {
+  
+  private static final long serialVersionUID = -6524494645663740872L;
+
+  private String asyncEventQueueId;
+  private boolean isParallel;
+  private boolean enableBatchConflation;
+  private int batchSize;
+  private int batchTimeInterval;
+  private boolean persistent;
+  private String diskStoreName;
+  private boolean diskSynchronous;
+  private int maxQueueMemory;
+  private int dispatcherThreads; 
+  private String orderPolicy;
+  private String[] gatewayEventFilters;
+  private String gatewaySubstitutionFilter;
+  private String listenerClassName;
+  private Properties listenerProperties;
+  private boolean ignoreEvictionAndExpiration;
+
+  public AsyncEventQueueFunctionArgs(String asyncEventQueueId,
+      boolean isParallel, boolean enableBatchConflation, int batchSize,
+      int batchTimeInterval, boolean persistent, String diskStoreName,
+      boolean diskSynchronous, int maxQueueMemory, int dispatcherThreads,
+      String orderPolicy, String[] gatewayEventFilters,
+      String gatewaySubstitutionFilter, String listenerClassName,
+      Properties listenerProperties, boolean ignoreEvictionAndExpiration) {
+    this.asyncEventQueueId = asyncEventQueueId;
+    this.isParallel = isParallel;
+    this.enableBatchConflation = enableBatchConflation;
+    this.batchSize = batchSize;
+    this.batchTimeInterval = batchTimeInterval;
+    this.persistent = persistent;
+    this.diskStoreName = diskStoreName;
+    this.diskSynchronous = diskSynchronous;
+    this.maxQueueMemory = maxQueueMemory;
+    this.dispatcherThreads = dispatcherThreads;
+    this.orderPolicy = orderPolicy;
+    this.gatewayEventFilters = gatewayEventFilters;
+    this.gatewaySubstitutionFilter = gatewaySubstitutionFilter;
+    this.listenerClassName = listenerClassName;
+    this.listenerProperties = listenerProperties;
+    this.ignoreEvictionAndExpiration = ignoreEvictionAndExpiration;
+  }
+
+  public String getAsyncEventQueueId() {
+    return asyncEventQueueId;
+  }
+
+  public boolean isParallel() {
+    return isParallel;
+  }
+
+  public boolean isEnableBatchConflation() {
+    return enableBatchConflation;
+  }
+
+  public int getBatchSize() {
+    return batchSize;
+  }
+
+  public int getBatchTimeInterval() {
+    return batchTimeInterval;
+  }
+
+  public boolean isPersistent() {
+    return persistent;
+  }
+
+  public String getDiskStoreName() {
+    return diskStoreName;
+  }
+
+  public boolean isDiskSynchronous() {
+    return diskSynchronous;
+  }
+
+  public int getMaxQueueMemory() {
+    return maxQueueMemory;
+  }
+
+  public int getDispatcherThreads() {
+    return dispatcherThreads;
+  }
+
+  public String getOrderPolicy() {
+    return orderPolicy;
+  }
+
+  public String[] getGatewayEventFilters() {
+    return gatewayEventFilters;
+  }
+
+  public String getGatewaySubstitutionFilter() {
+    return gatewaySubstitutionFilter;
+  }
+
+  public String getListenerClassName() {
+    return listenerClassName;
+  }
+
+  public Properties getListenerProperties() {
+    return listenerProperties;
+  }
+
+  public boolean isIgnoreEvictionAndExpiration() {
+    return ignoreEvictionAndExpiration;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateAsyncEventQueueFunction.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
index 7481c0e..695fbfb 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/functions/CreateAsyncEventQueueFunction.java
@@ -62,23 +62,8 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
     String memberId = "";
 
     try {
-      final Object[] args = (Object[]) context.getArguments();
-      final String asyncEventQueueId = (String) args[0];
-      final boolean isParallel = (Boolean) args[1];
-      final boolean enableBatchConflation = (Boolean) args[2];
-      final int batchSize = (Integer) args[3];
-      final int batchTimeInterval =(Integer) args[4];
-      final boolean persistent = (Boolean) args[5];
-      final String diskStoreName = (String) args[6];
-      final boolean diskSynchronous =(Boolean) args[7];
-      final int maxQueueMemory = (Integer) args[8];
-      final int dispatcherThreads =(Integer) args[9]; 
-      final String orderPolicy= (String) args[10];
-      final String[] gatewayEventFilters =(String[]) args[11];
-      final String gatewaySubstitutionFilter = (String) args[12];
-      final String listenerClassName = (String) args[13];
-      final Properties listenerProperties = (Properties) args[14];
-
+      AsyncEventQueueFunctionArgs aeqArgs =  (AsyncEventQueueFunctionArgs)context.getArguments();
+      
       GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
@@ -89,32 +74,39 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
         memberId = member.getName();
       }
 
-      AsyncEventQueueFactory asyncEventQueueFactory = cache.createAsyncEventQueueFactory();
-      asyncEventQueueFactory.setParallel(isParallel);
-      asyncEventQueueFactory.setBatchConflationEnabled(enableBatchConflation);
-      asyncEventQueueFactory.setBatchSize(batchSize);
-      asyncEventQueueFactory.setBatchTimeInterval(batchTimeInterval);
-      asyncEventQueueFactory.setPersistent(persistent);
-      asyncEventQueueFactory.setDiskStoreName(diskStoreName);
-      asyncEventQueueFactory.setDiskSynchronous(diskSynchronous);
-      asyncEventQueueFactory.setMaximumQueueMemory(maxQueueMemory);
-      asyncEventQueueFactory.setDispatcherThreads(dispatcherThreads);
-      asyncEventQueueFactory.setOrderPolicy(OrderPolicy.valueOf(orderPolicy));
+      AsyncEventQueueFactory asyncEventQueueFactory = cache.createAsyncEventQueueFactory()
+          .setParallel(aeqArgs.isParallel())
+          .setBatchConflationEnabled(aeqArgs.isEnableBatchConflation())
+          .setBatchSize(aeqArgs.getBatchSize())
+          .setBatchTimeInterval(aeqArgs.getBatchTimeInterval())
+          .setPersistent(aeqArgs.isPersistent())
+          .setDiskStoreName(aeqArgs.getDiskStoreName())
+          .setDiskSynchronous(aeqArgs.isDiskSynchronous())
+          .setIgnoreEvictionAndExpiration(aeqArgs.isIgnoreEvictionAndExpiration())
+          .setMaximumQueueMemory(aeqArgs.getMaxQueueMemory())
+          .setDispatcherThreads(aeqArgs.getDispatcherThreads())
+          .setOrderPolicy(OrderPolicy.valueOf(aeqArgs.getOrderPolicy()));
+
+      String[] gatewayEventFilters = aeqArgs.getGatewayEventFilters();
       if (gatewayEventFilters != null) {
         for (String gatewayEventFilter : gatewayEventFilters) {
           Class<?> gatewayEventFilterKlass = forName(gatewayEventFilter, CliStrings.CREATE_ASYNC_EVENT_QUEUE__GATEWAYEVENTFILTER);
           asyncEventQueueFactory.addGatewayEventFilter((GatewayEventFilter) newInstance(gatewayEventFilterKlass, CliStrings.CREATE_ASYNC_EVENT_QUEUE__GATEWAYEVENTFILTER));
         }
       }
+      
+      String gatewaySubstitutionFilter = aeqArgs.getGatewaySubstitutionFilter();
       if (gatewaySubstitutionFilter != null) {
         Class<?> gatewayEventSubstitutionFilterKlass = forName(gatewaySubstitutionFilter, CliStrings.CREATE_ASYNC_EVENT_QUEUE__SUBSTITUTION_FILTER);
         asyncEventQueueFactory.setGatewayEventSubstitutionListener((GatewayEventSubstitutionFilter<?,?>) newInstance(gatewayEventSubstitutionFilterKlass, CliStrings.CREATE_ASYNC_EVENT_QUEUE__SUBSTITUTION_FILTER));
       }
-      
+    
+      String listenerClassName = aeqArgs.getListenerClassName();
       Object listenerInstance;
       Class<?> listenerClass = InternalDataSerializer.getCachedClass(listenerClassName);
       listenerInstance = listenerClass.newInstance();
 
+      Properties listenerProperties = aeqArgs.getListenerProperties();
       if (listenerProperties != null && !listenerProperties.isEmpty()) {
         if (!(listenerInstance instanceof Declarable)) {
           throw new IllegalArgumentException("Listener properties were provided, but the listener specified does not implement Declarable.");
@@ -127,9 +119,9 @@ public class CreateAsyncEventQueueFunction extends FunctionAdapter implements In
         cache.addDeclarableProperties(declarablesMap);
       }
 
-      asyncEventQueueFactory.create(asyncEventQueueId, (AsyncEventListener) listenerInstance);
+      asyncEventQueueFactory.create(aeqArgs.getAsyncEventQueueId(), (AsyncEventListener) listenerInstance);
 
-      XmlEntity xmlEntity = new XmlEntity(CacheXml.ASYNC_EVENT_QUEUE, "id", asyncEventQueueId);
+      XmlEntity xmlEntity = new XmlEntity(CacheXml.ASYNC_EVENT_QUEUE, "id", aeqArgs.getAsyncEventQueueId());
       context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity, "Success"));
 
     } catch (CacheClosedException cce) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
index 28ba856..241c9e2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
@@ -423,6 +423,8 @@ public class CliStrings {
   public static final String CREATE_ASYNC_EVENT_QUEUE__DISK_STORE__HELP = "Disk store to be used by this queue.";
   public static final String CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS = "disk-synchronous";
   public static final String CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS__HELP = "Whether disk writes are synchronous.";
+  public static final String CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION = "ignore-eviction-expiration";
+  public static final String CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION__HELP = "Whether to ignore eviction and expiration events.";
   public static final String CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY = "max-queue-memory";
   public static final String CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY__HELP = "Maximum amount of memory, in megabytes, that the queue can consume before overflowing to disk.";
   public static final String CREATE_ASYNC_EVENT_QUEUE__GATEWAYEVENTFILTER = "gateway-event-filter";

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/QueueCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/QueueCommandsController.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/QueueCommandsController.java
index b8353fa..83d7bc1 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/QueueCommandsController.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/web/controllers/QueueCommandsController.java
@@ -58,6 +58,7 @@ public class QueueCommandsController extends AbstractCommandsController {
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__PERSISTENT, defaultValue = "false") final Boolean persistent,
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISK_STORE, required = false) final String diskStore,
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS, defaultValue = "true") final Boolean diskSynchronous,
+                                      @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION, defaultValue = "true") final Boolean isIgnoreEvictionAndExpiration,
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__MAXIMUM_QUEUE_MEMORY, defaultValue = "100") final Integer maxQueueMemory,
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISPATCHERTHREADS, defaultValue = "1") final Integer dispatcherThreads,
                                       @RequestParam(value = CliStrings.CREATE_ASYNC_EVENT_QUEUE__ORDERPOLICY, defaultValue = "KEY") final String orderPolicy,

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
----------------------------------------------------------------------
diff --git a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
index cc6d189..688ff1f 100755
--- a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
+++ b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
@@ -254,6 +254,7 @@ declarative caching XML file elements unless indicated otherwise.
             <xsd:attribute name="disk-synchronous" type="xsd:boolean" use="optional" />
             <xsd:attribute name="dispatcher-threads" type="xsd:string" use="optional" />
             <xsd:attribute name="order-policy" type="xsd:string" use="optional" />
+            <xsd:attribute default="true" name="ignore-eviction-expiration" type="xsd:boolean" use="optional" />
           </xsd:complexType>
         </xsd:element>
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java
new file mode 100644
index 0000000..5efac05
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/AsyncEventQueueEvictionAndExpirationJUnitTest.java
@@ -0,0 +1,346 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.asyncqueue;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAction;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.jayway.awaitility.Awaitility;
+
+import static org.mockito.Mockito.*;
+
+@Category(IntegrationTest.class)
+public class AsyncEventQueueEvictionAndExpirationJUnitTest {
+  
+  private AsyncEventQueue aeq;
+  private Cache cache;
+  
+  @Rule 
+  public TestName name = new TestName();
+  
+  @Before
+  public void getCache() {
+    try {
+       cache = CacheFactory.getAnyInstance();
+    } catch (Exception e) {
+      //ignore
+    }
+    if (null == cache) {
+      cache = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0").create();
+    }
+  }
+
+  @After
+  public void destroyCache() {
+    if (cache != null && !cache.isClosed()) {
+      cache.close();
+      cache = null;
+    }
+  }
+
+  
+  @Test
+  public void isIgnoreEvictionAndExpirationAttributeTrueByDefault() {
+    AsyncEventListener al = mock(AsyncEventListener.class);
+    aeq = cache.createAsyncEventQueueFactory().create("aeq", al);
+    // Test for default value of isIgnoreEvictionAndExpiration setting.
+    assertTrue(aeq.isIgnoreEvictionAndExpiration());
+  }
+  
+  @Test
+  public void canSetFalseForIgnoreEvictionAndExpiration() {
+    AsyncEventListener al = mock(AsyncEventListener.class);
+    aeq = cache.createAsyncEventQueueFactory().setIgnoreEvictionAndExpiration(false).create("aeq", al);
+    // Test for default value of isIgnoreEvictionAndExpiration setting.
+    assertFalse(aeq.isIgnoreEvictionAndExpiration());
+  }
+  
+  
+  @Test
+  public void evictionDestroyOpEventsNotPropogatedByDefault() {
+    // For Replicated Region with eviction-destroy op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(false /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , true /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void evictionDestroyOpEventsNotPropogatedByDefaultForPR() {
+    // For PR with eviction-destroy op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(true /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , true /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationDestroyOpEventsNotPropogatedByDefault() {
+    // For Replicated Region with expiration-destroy op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(false /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        true /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationDestroyOpEventsNotPropogatedByDefaultForPR() {
+    // For PR with expiration-destroy op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(true /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        true /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationInvalidOpEventsNotPropogatedByDefault() {
+    // For Replicated Region with expiration-invalid op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(false /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, true /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationInvalidOpEventsNotPropogatedByDefaultForPR() {
+    // For Replicated Region with expiration-invalid op.
+    // Number of expected events 2. Two for create and none for eviction destroy.
+    createPopulateAndVerifyEvents(true /*isPR */, true /* ignoreEvictionExpiration */, 
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, true /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+  
+  @Test
+  public void evictionPropogatedUsingIgnoreEvictionAndExpirationAttribute() {
+    // For Replicated Region with eviction-destroy op.
+    // Number of expected events 3. Two for create and One for eviction destroy.
+    createPopulateAndVerifyEvents(false /*isPR */, false /* ignoreEvictionExpiration */, 
+        3 /* expectedEvents */ , true /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        true /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void evictionPropogatedUsingIgnoreEvictionAndExpirationAttributeForPR() {
+    // For PR with eviction-destroy op.
+    // Number of expected events 3. Two for create and One for eviction destroy.
+    createPopulateAndVerifyEvents(true /*isPR */, false /* ignoreEvictionExpiration */, 
+        3 /* expectedEvents */ , true /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        true /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void overflowNotPropogatedUsingIgnoreEvictionAndExpirationAttribute() {
+    // For Replicated Region with eviction-overflow op.
+    // Number of expected events 2. Two for create and non for eviction overflow.
+    createPopulateAndVerifyEvents(false /*isPR */, false /* ignoreEvictionExpiration */,  
+        2 /* expectedEvents */ , false /* eviction */, true /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void overflowNotPropogatedUsingIgnoreEvictionAndExpirationAttributeForPR() {
+    // For PR with eviction-overflow op.
+    // Number of expected events 2. Two for create and non for eviction overflow.
+    createPopulateAndVerifyEvents(true /*isPR */, false /* ignoreEvictionExpiration */,  
+        2 /* expectedEvents */ , false /* eviction */, true /* evictionOverflow */, 
+        false /* expirationDestroy */, false /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationDestroyPropogatedUsingIgnoreEvictionAndExpirationAttribute() {
+    // For Replicated Region with expiration-destroy op.
+    // Number of expected events 4. Two for create and Two for expiration destroy.
+    createPopulateAndVerifyEvents(false /*isPR */, false /* ignoreEvictionExpiration */,  
+        4 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        true /* expirationDestroy */, false /* expirationInvalidate */, 
+        true /* checkForDestroyOp */, false /* checkForInvalidateOp */);    
+  }
+
+  @Test
+  public void expirationDestroyPropogatedUsingIgnoreEvictionAndExpirationAttributeForPR() {
+    // For PR with expiration-destroy op.
+    // Number of expected events 4. Two for create and Two for expiration destroy.
+    createPopulateAndVerifyEvents(true /*isPR */, false /* ignoreEvictionExpiration */,  
+        4 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        true /* expirationDestroy */, false /* expirationInvalidate */, 
+        true /* checkForDestroyOp */, false /* checkForInvalidateOp */);    
+  }
+
+  @Test
+  public void expirationInvalidateNotPropogatedUsingIgnoreEvictionAndExpirationAttribute() {
+    // For Replicated Region with expiration-invalidate op.
+    // Currently invalidate event callbacks are not made to GateWay sender.
+    // Invalidates are not sent to AEQ.
+    // Number of expected events 2. None for expiration invalidate.
+    createPopulateAndVerifyEvents(false /*isPR */, false /* ignoreEvictionExpiration */,  
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, true /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  @Test
+  public void expirationInvalidateNotPropogatedUsingIgnoreEvictionAndExpirationAttributeForPR() {
+    // For PR with expiration-invalidate op.
+    // Currently invalidate event callbacks are not made to GateWay sender.
+    // Invalidates are not sent to AEQ.
+    // Number of expected events 2. None for expiration invalidate.
+    createPopulateAndVerifyEvents(true /*isPR */, false /* ignoreEvictionExpiration */,  
+        2 /* expectedEvents */ , false /* eviction */, false /* evictionOverflow */, 
+        false /* expirationDestroy */, true /* expirationInvalidate */, 
+        false /* checkForDestroyOp */, false /* checkForInvalidateOp */);
+  }
+
+  
+  
+  private void createPopulateAndVerifyEvents(boolean isPR, boolean ignoreEvictionExpiration, int expectedEvents, boolean eviction, boolean evictionOverflow, 
+      boolean expirationDestroy, boolean expirationInvalidate, boolean checkForDestroyOp, boolean checkForInvalidateOp) {
+    
+    // String aeqId = "AEQTest";
+    String aeqId = name.getMethodName();
+    
+    // To store AEQ events for validation.
+    List<AsyncEvent> events = new ArrayList<AsyncEvent>();
+    
+    // Create AEQ
+    createAsyncEventQueue(aeqId, ignoreEvictionExpiration, events);    
+    
+    // Create region with eviction/expiration
+    Region r = createRegion("ReplicatedRegionForAEQ", isPR, aeqId, eviction, evictionOverflow, expirationDestroy, expirationInvalidate);
+    
+    // Populate region with two entires.
+    r.put("Key-1", "Value-1");
+    r.put("Key-2", "Value-2");
+    
+    // The AQListner should get two events. One for create, one for destroy.
+    Awaitility.await().atMost(100, TimeUnit.SECONDS).until(() -> {return (events.size() == expectedEvents);});
+    
+    // Check for the expected operation.
+    if (checkForDestroyOp) {
+      assertTrue("Expiration event not arrived", checkForOperation(events, false, true));
+    }
+
+    if (checkForInvalidateOp) {
+      assertTrue("Invalidate event not arrived", checkForOperation(events, true, false));
+    }
+    
+    // Test complete. Destroy region.
+    r.destroyRegion();
+  }
+
+  private boolean checkForOperation(List<AsyncEvent> events, boolean invalidate, boolean destroy) {
+    boolean found = false;
+    for (AsyncEvent e : events) {
+      if (invalidate && e.getOperation().isInvalidate()) {
+        found = true;
+        break;
+      }
+      if (destroy && e.getOperation().isDestroy()) {
+        found = true;
+        break;
+      }
+    }
+    return found;
+  }
+
+  private void createAsyncEventQueue(String id, boolean ignoreEvictionExpiration, List<AsyncEvent> storeEvents) {
+    AsyncEventListener al = this.createAsyncListener(storeEvents);
+    aeq = cache.createAsyncEventQueueFactory().setParallel(false)
+        .setIgnoreEvictionAndExpiration(ignoreEvictionExpiration)
+        .setBatchSize(1).setBatchTimeInterval(1).create(id, al);
+  }
+  
+  private Region createRegion(String name, boolean isPR, String aeqId, boolean evictionDestroy, 
+      boolean evictionOverflow, boolean expirationDestroy, boolean expirationInvalidate) {
+    RegionFactory rf;
+    if (isPR) {
+      rf = cache.createRegionFactory(RegionShortcut.PARTITION);
+    } else {
+      rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
+    }
+    // Set AsyncQueue.
+    rf.addAsyncEventQueueId(aeqId);
+    if (evictionDestroy) {
+      rf.setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.LOCAL_DESTROY));
+    }
+    if (evictionOverflow) {
+      rf.setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK)); 
+    }
+    if (expirationDestroy) {
+      rf.setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY));
+    }
+    if (expirationInvalidate) {
+      rf.setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.INVALIDATE));
+    }
+    
+    return rf.create(name);
+  }
+  
+  private AsyncEventListener createAsyncListener(List<AsyncEvent> list) {
+    AsyncEventListener listener = new AsyncEventListener() {
+      private List<AsyncEvent> aeList = list;
+      
+      @Override
+      public void close() {
+        // TODO Auto-generated method stub
+      }
+
+      @Override
+      public boolean processEvents(List<AsyncEvent> arg0) {
+        System.out.println("AEQ Listener.process()");
+        new Exception("Stack trace for AsyncEventQueue").printStackTrace();
+        // TODO Auto-generated method stub
+        aeList.addAll(arg0);
+        System.out.println("AEQ Event :" + arg0);
+        return true;
+      }
+    };
+    return listener;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
index 57e3a13..afcb9b0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlGeode10DUnitTest.java
@@ -20,8 +20,16 @@
  */
 package com.gemstone.gemfire.cache30;
 
+import java.util.List;
+import java.util.Properties;
+
 import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Declarable;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
@@ -231,4 +239,74 @@ public class CacheXmlGeode10DUnitTest extends CacheXml81DUnitTest {
       System.clearProperty("gemfire."+DistributionConfig.OFF_HEAP_MEMORY_SIZE_NAME);
     }
   }
+
+  @SuppressWarnings("rawtypes")
+  public void testAsyncEventQueueIsEnableEvictionAndExpirationAttribute() {
+
+    final String regionName = "testAsyncEventQueueIsEnableEvictionAndExpirationAttribute";
+
+    // Create AsyncEventQueue with Listener
+    final CacheCreation cache = new CacheCreation();
+    AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
+
+    
+    AsyncEventListener listener = new MyAsyncEventListenerGeode10();
+
+    // Test for default ignoreEvictionAndExpiration attribute value (which is true)
+    String aeqId1 = "aeqWithDefaultIgnoreEE";
+    factory.create(aeqId1,listener);
+    AsyncEventQueue aeq1 = cache.getAsyncEventQueue(aeqId1);
+    assertTrue(aeq1.isIgnoreEvictionAndExpiration());
+
+    // Test by setting ignoreEvictionAndExpiration attribute value.
+    String aeqId2 = "aeqWithIgnoreEEsetToFalse";
+    factory.setIgnoreEvictionAndExpiration(false);
+    factory.create(aeqId2,listener);
+
+    AsyncEventQueue aeq2 = cache.getAsyncEventQueue(aeqId2);
+    assertFalse(aeq2.isIgnoreEvictionAndExpiration());
+
+    // Create region and set the AsyncEventQueue
+    final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
+    attrs.addAsyncEventQueueId(aeqId2);
+
+    final Region regionBefore = cache.createRegion(regionName, attrs);
+    assertNotNull(regionBefore);
+    assertTrue(regionBefore.getAttributes().getAsyncEventQueueIds().size() == 1);
+
+
+    testXml(cache);
+
+    final Cache c = getCache();
+    assertNotNull(c);
+
+    aeq1 = c.getAsyncEventQueue(aeqId1);
+    assertTrue(aeq1.isIgnoreEvictionAndExpiration());
+
+    aeq2 = c.getAsyncEventQueue(aeqId2);
+    assertFalse(aeq2.isIgnoreEvictionAndExpiration());
+
+    final Region regionAfter = c.getRegion(regionName);
+    assertNotNull(regionAfter);
+    assertTrue(regionAfter.getAttributes().getAsyncEventQueueIds().size() == 1);
+
+    regionAfter.localDestroyRegion();
+
+    // Clear AsyncEventQueues.
+    c.close();
+  }
+
+  public static class MyAsyncEventListenerGeode10 implements AsyncEventListener, Declarable {
+
+    public boolean processEvents(List<AsyncEvent> events) {
+      return true;
+    }
+
+    public void close() {
+    }
+
+    public void init(Properties properties) {
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
index db14fdc..4472193 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/QueueCommandsDUnitTest.java
@@ -165,6 +165,7 @@ public class QueueCommandsDUnitTest extends CliCommandTestBase {
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__SUBSTITUTION_FILTER,
         "com.qcdunit.QueueCommandsDUnitTestHelper");
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__DISKSYNCHRONOUS, "false");
+    commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__IGNORE_EVICTION_EXPIRATION, "false");
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER,
         "com.qcdunit.QueueCommandsDUnitTestHelper");
     commandStringBuilder.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER_PARAM_AND_VALUE, "param1");
@@ -206,6 +207,7 @@ public class QueueCommandsDUnitTest extends CliCommandTestBase {
         assertEquals(queue.getGatewayEventSubstitutionFilter().getClass().getName(),
             "com.qcdunit.QueueCommandsDUnitTestHelper");
         assertEquals(queue.isDiskSynchronous(), false);
+        assertEquals(queue.isIgnoreEvictionAndExpiration(), false);
         assertEquals(queue.getAsyncEventListener().getClass().getName(), "com.qcdunit.QueueCommandsDUnitTestHelper");
       }
     });

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/46056a66/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
index 1ee16d5..b8ef985 100755
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
@@ -678,6 +678,7 @@ com/gemstone/gemfire/management/internal/cli/exceptions/CliException,false
 com/gemstone/gemfire/management/internal/cli/exceptions/CreateSubregionException,true,4387344870743824916
 com/gemstone/gemfire/management/internal/cli/exceptions/IndexNotFoundException,true,1,indexName:java/lang/String,message:java/lang/String
 com/gemstone/gemfire/management/internal/cli/functions/AlterRuntimeConfigFunction,true,1
+com/gemstone/gemfire/management/internal/cli/functions/AsyncEventQueueFunctionArgs,true,-6524494645663740872,asyncEventQueueId:java/lang/String,batchSize:int,batchTimeInterval:int,diskStoreName:java/lang/String,diskSynchronous:boolean,dispatcherThreads:int,enableBatchConflation:boolean,gatewayEventFilters:java/lang/String[],gatewaySubstitutionFilter:java/lang/String,ignoreEvictionAndExpiration:boolean,isParallel:boolean,listenerClassName:java/lang/String,listenerProperties:java/util/Properties,maxQueueMemory:int,orderPolicy:java/lang/String,persistent:boolean
 com/gemstone/gemfire/management/internal/cli/functions/ChangeLogLevelFunction,true,1
 com/gemstone/gemfire/management/internal/cli/functions/CloseDurableClientFunction,true,1
 com/gemstone/gemfire/management/internal/cli/functions/CloseDurableCqFunction,true,1


[45/49] incubator-geode git commit: GEODE-1293: Revert some changes which broke publishing

Posted by kl...@apache.org.
GEODE-1293: Revert some changes which broke publishing

- Reinstate 'classifier' for the internal modules jar. This is still
  broken as the published jars are not correctly named. Will need to fix
  this in the near future.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/00c794b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/00c794b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/00c794b4

Branch: refs/heads/feature/GEODE-835-test
Commit: 00c794b4cbc186da419cce28c1bf62a977bf2829
Parents: fcd5491
Author: Jens Deppe <jd...@pivotal.io>
Authored: Wed May 18 08:40:52 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Wed May 18 08:40:52 2016 -0700

----------------------------------------------------------------------
 extensions/geode-modules-session/build.gradle | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00c794b4/extensions/geode-modules-session/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session/build.gradle b/extensions/geode-modules-session/build.gradle
index 765bdd9..5f25d97 100644
--- a/extensions/geode-modules-session/build.gradle
+++ b/extensions/geode-modules-session/build.gradle
@@ -45,6 +45,7 @@ task internalJar(type: Jar) {
   from sourceSets.main.output
   include '**/internal/**/*'
   includeEmptyDirs = false
+  classifier = 'internal'
   baseName = 'geode-modules-session-internal'
 }
 


[17/49] incubator-geode git commit: Revert "GEODE-1376: Cleaned up server port to be '0'."

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
index 176fbea..9ef87d2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
@@ -16,6 +16,17 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Assert;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest;
@@ -39,31 +50,24 @@ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
 import com.gemstone.gemfire.test.dunit.VM;
-import com.jayway.awaitility.Awaitility;
-import org.junit.Assert;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  *
  */
 public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
-
+  
   /**
    * The number of connections that we can be off by in the balancing tests
    * We need this little fudge factor, because the locator can receive an update
    * from the bridge server after it has made incremented its counter for a client
    * connection, but the client hasn't connected yet. This wipes out the estimation
    * on the locator.  This means that we may be slighly off in our balance.
-   * <p>
+   * 
    * TODO grid fix this hole in the locator.
    */
   private static final int ALLOWABLE_ERROR_IN_COUNT = 1;
@@ -74,144 +78,149 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
   }
 
   /**
-   * Test the locator discovers a bridge server and is initialized with
+   * Test the locator discovers a bridge server and is initialized with 
    * the correct load for that bridge server.
    */
   public void testDiscovery() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-
+    VM vm2 = host.getVM(2);
+//    vm0.invoke(new SerializableRunnable() {
+//      public void run() {
+//        System.setProperty("gemfire.DistributionAdvisor.VERBOSE", "true");
+//      }
+//    });
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-
+    startLocatorInVM(vm0, locatorPort, "");
+    
     String locators = getLocatorString(host, locatorPort);
-
-    int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-
+    
+    int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
+    
     ServerLoad expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(vm0
         .getHost()), serverPort);
     Map expected = new HashMap();
     expected.put(expectedLocation, expectedLoad);
-
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
-    int serverPort2 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-
+    
+    checkLocatorLoad(vm0, expected);
+    
+    int serverPort2 = startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
+    
     ServerLocation expectedLocation2 = new ServerLocation(NetworkUtils.getServerHostName(vm0
         .getHost()), serverPort2);
-
+    
     expected.put(expectedLocation2, expectedLoad);
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+    checkLocatorLoad(vm0, expected);
   }
-
+  
   /**
    * Test that the locator will properly estimate the load for servers when
-   * it receives connection requests.
+   * it receives connection requests. 
    */
-  public void testEstimation() throws IOException, ClassNotFoundException {
+  public void testEstimation() throws UnknownHostException, IOException, ClassNotFoundException {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    startLocatorInVM(vm0, locatorPort, "");
     String locators = getLocatorString(host, locatorPort);
-
-    int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-
-    ServerLoad expectedLoad = new ServerLoad(2 / 800f, 1 / 800.0f, 0f, 1f);
+    
+    int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
+    
+    ServerLoad expectedLoad = new ServerLoad(2/800f, 1 / 800.0f, 0f, 1f);
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort);
     Map expected = new HashMap();
     expected.put(expectedLocation, expectedLoad);
-
+    
     ClientConnectionResponse response;
     response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress
-            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new ClientConnectionRequest(Collections.EMPTY_SET, null), 10000);
     Assert.assertEquals(expectedLocation, response.getServer());
-
+    
     response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress
-            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new ClientConnectionRequest(Collections.EMPTY_SET, null), 10000, true);
     Assert.assertEquals(expectedLocation, response.getServer());
-
+    
     //we expect that the connection load load will be 2 * the loadPerConnection
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
+    checkLocatorLoad(vm0, expected);
+    
     QueueConnectionResponse response2;
     response2 = (QueueConnectionResponse) TcpClient.requestToServer(InetAddress
-            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new QueueConnectionRequest(null, 2,
             Collections.EMPTY_SET, null, false), 10000, true);
     Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());
-
+    
     response2 = (QueueConnectionResponse) TcpClient
         .requestToServer(InetAddress.getByName(NetworkUtils.getServerHostName(host)),
             locatorPort, new QueueConnectionRequest(null, 5, Collections.EMPTY_SET, null,
                 false), 10000, true);
-
+    
     Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());
 
     //we expect that the queue load will increase by 2
     expectedLoad.setSubscriptionConnectionLoad(2f);
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+    checkLocatorLoad(vm0, expected);
   }
-
+  
   /**
    * Test to make sure the bridge servers communicate
    * their updated load to the controller when the load
    * on the bridge server changes.
-   *
-   * @throws Exception
+   * @throws Exception 
    */
   public void testLoadMessaging() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    startLocatorInVM(vm0, locatorPort, "");
     String locators = getLocatorString(host, locatorPort);
-
-    final int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-
+    
+    final int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
+    
     //We expect 0 load
     Map expected = new HashMap();
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort);
     ServerLoad expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     expected.put(expectedLocation, expectedLoad);
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
+    checkLocatorLoad(vm0, expected);
+    
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addServer(NetworkUtils.getServerHostName(host), serverPort);
     pf.setMinConnections(8);
     pf.setMaxConnections(8);
     pf.setSubscriptionEnabled(true);
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME }));
-
+    startBridgeClientInVM(vm2, pf.getPoolAttributes(), new String[] {REGION_NAME});
+    
     //We expect 8 client to server connections. The queue requires
     //an additional client to server connection, but that shouldn't show up here.
-    expectedLoad = new ServerLoad(8 / 800f, 1 / 800.0f, 1f, 1f);
+    expectedLoad = new ServerLoad(8/800f, 1 / 800.0f, 1f, 1f);
     expected.put(expectedLocation, expectedLoad);
-
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
+    
+    
+    checkLocatorLoad(vm0, expected);
+    
     stopBridgeMemberVM(vm2);
-
+    
     //Now we expect 0 load
     expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     expected.put(expectedLocation, expectedLoad);
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+    checkLocatorLoad(vm0, expected);
   }
-
+  
   /**
    * Test to make sure that the locator
    * balancing load between two servers.
-   *
-   * @throws Exception
+   * @throws Exception 
    */
   public void testBalancing() throws Exception {
     final Host host = Host.getHost(0);
@@ -219,60 +228,87 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    startLocatorInVM(vm0, locatorPort, "");
     String locators = getLocatorString(host, locatorPort);
-
-    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-
+    
+    startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
+    startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
+    
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(80);
     pf.setMaxConnections(80);
     pf.setSubscriptionEnabled(false);
     pf.setIdleTimeout(-1);
-    vm3.invoke("StartBridgeClient", () -> startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME }));
-
-    vm3.invoke("waitForPrefilledConnections", () -> waitForPrefilledConnections(80));
-
-    vm1.invoke("check connection count", () -> checkConnectionCount(40));
-    vm2.invoke("check connection count", () -> checkConnectionCount(40));
+    startBridgeClientInVM(vm3, pf.getPoolAttributes(), new String[] {REGION_NAME});
+    
+    waitForPrefilledConnections(vm3, 80);
+    
+    checkConnectionCount(vm1, 40);
+    checkConnectionCount(vm2, 40);
   }
 
-  private void checkConnectionCount(final int count) {
-    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-    final CacheServerImpl server = (CacheServerImpl)
-        cache.getCacheServers().get(0);
-    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
-        .timeout(300, TimeUnit.SECONDS).until(() -> {
-      int sz = server.getAcceptor().getStats().getCurrentClientConnections();
-      if (Math.abs(sz - count) <= ALLOWABLE_ERROR_IN_COUNT) {
-        return true;
+  private void checkConnectionCount(VM vm, final int count) {
+    SerializableRunnableIF checkConnectionCount = new SerializableRunnable("checkConnectionCount") {
+      public void run() {
+        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+        final CacheServerImpl server = (CacheServerImpl)
+            cache.getCacheServers().get(0);
+        WaitCriterion wc = new WaitCriterion() {
+          String excuse;
+          public boolean done() {
+            int sz = server.getAcceptor().getStats()
+                .getCurrentClientConnections();
+            if (Math.abs(sz - count) <= ALLOWABLE_ERROR_IN_COUNT) {
+              return true;
+            }
+            excuse = "Found " + sz + " connections, expected " + count;
+            return false;
+          }
+          public String description() {
+            return excuse;
+          }
+        };
+        Wait.waitForCriterion(wc, 5 * 60 * 1000, 1000, true);
       }
-      System.out.println("Found " + sz + " connections, expected " + count);
-      return false;
-    });
+    };
+    
+    vm.invoke(checkConnectionCount);
   }
-
-  private void waitForPrefilledConnections(final int count) throws Exception {
-    waitForPrefilledConnections(count, POOL_NAME);
+  
+  private void waitForPrefilledConnections(VM vm, final int count) throws Exception {
+    waitForPrefilledConnections(vm, count, POOL_NAME);
   }
 
-  private void waitForPrefilledConnections(final int count, final String poolName) throws Exception {
-    final PoolImpl pool = (PoolImpl) PoolManager.getAll().get(poolName);
-    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
-        .timeout(300, TimeUnit.SECONDS).until(() -> pool.getConnectionCount() >= count);
+  private void waitForPrefilledConnections(VM vm, final int count, final String poolName) throws Exception {
+    SerializableRunnable runnable = new SerializableRunnable("waitForPrefilledConnections") {
+      public void run() {
+        final PoolImpl pool = (PoolImpl) PoolManager.getAll().get(poolName);
+        WaitCriterion ev = new WaitCriterion() {
+          public boolean done() {
+            return pool.getConnectionCount() >= count; 
+          }
+          public String description() {
+            return "connection count never reached " + count;
+          }
+        };
+        Wait.waitForCriterion(ev, MAX_WAIT, 200, true);
+      }
+    };
+    if(vm == null) {
+      runnable.run();
+    } else {
+      vm.invoke(runnable);
+    }
   }
-
-  /**
-   * Test that the locator balances load between
+  
+  /** Test that the locator balances load between
    * three servers with intersecting server groups.
    * Server:    1       2       3
    * Groups:    a       a,b     b
-   *
-   * @throws Exception
+   * @throws Exception 
    */
   public void testIntersectingServerGroups() throws Exception {
     final Host host = Host.getHost(0);
@@ -280,158 +316,175 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    startLocatorInVM(vm0, locatorPort, "");
     String locators = getLocatorString(host, locatorPort);
-
-    int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a" }, locators));
-    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
-    vm3.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "b" }, locators));
-
+    
+    int serverPort1 = startBridgeServerInVM(vm1, new String[] {"a"},  locators);
+    startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
+    startBridgeServerInVM(vm3, new String[] {"b"},  locators);
+    
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(12);
     pf.setSubscriptionEnabled(false);
     pf.setServerGroup("a");
     pf.setIdleTimeout(-1);
-    startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME });
-    waitForPrefilledConnections(12);
-
-    vm1.invoke("Check Connection Count", () -> checkConnectionCount(6));
-    vm2.invoke("Check Connection Count", () -> checkConnectionCount(6));
-    vm3.invoke("Check Connection Count", () -> checkConnectionCount(0));
-
+    startBridgeClientInVM(null, pf.getPoolAttributes(), new String[] {REGION_NAME});
+    waitForPrefilledConnections(null, 12);
+    
+    checkConnectionCount(vm1, 6);
+    checkConnectionCount(vm2, 6);
+    checkConnectionCount(vm3, 0);
+    
     LogWriterUtils.getLogWriter().info("pool1 prefilled");
-
+    
     PoolFactoryImpl pf2 = (PoolFactoryImpl) PoolManager.createFactory();
     pf2.init(pf.getPoolAttributes());
     pf2.setServerGroup("b");
-    PoolImpl pool2 = (PoolImpl) pf2.create("testPool2");
-    waitForPrefilledConnections(12, "testPool2");
+    PoolImpl pool2= (PoolImpl) pf2.create("testPool2");
+    waitForPrefilledConnections(null, 12, "testPool2");
 
     // The load will not be perfect, because we created all of the connections
     //for group A first.
-    vm1.invoke("Check Connection Count", () -> checkConnectionCount(6));
-    vm2.invoke("Check Connection Count", () -> checkConnectionCount(9));
-    vm3.invoke("Check Connection Count", () -> checkConnectionCount(9));
-
+    checkConnectionCount(vm1, 6);
+    checkConnectionCount(vm2, 9);
+    checkConnectionCount(vm3, 9);
+    
     LogWriterUtils.getLogWriter().info("pool2 prefilled");
-
+    
     ServerLocation location1 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort1);
     PoolImpl pool1 = (PoolImpl) PoolManager.getAll().get(POOL_NAME);
     Assert.assertEquals("a", pool1.getServerGroup());
-
+    
     //Use up all of the pooled connections on pool1, and acquire 3 more
-    for (int i = 0; i < 15; i++) {
+    for(int i = 0; i < 15; i++) {
       pool1.acquireConnection();
     }
-
+    
     LogWriterUtils.getLogWriter().info("aquired 15 connections in pool1");
-
+    
     //now the load should be equal
-    vm1.invoke("Check Connection Count", () -> checkConnectionCount(9));
-    vm2.invoke("Check Connection Count", () -> checkConnectionCount(9));
-    vm3.invoke("Check Connection Count", () -> checkConnectionCount(9));
-
+    checkConnectionCount(vm1, 9);
+    checkConnectionCount(vm2, 9);
+    checkConnectionCount(vm3, 9);
+    
     //use up all of the pooled connections on pool2
-    for (int i = 0; i < 12; i++) {
+    for(int i = 0; i < 12; i++) {
       pool2.acquireConnection();
     }
-
+    
     LogWriterUtils.getLogWriter().info("aquired 12 connections in pool2");
-
+    
     //interleave creating connections in both pools
-    for (int i = 0; i < 6; i++) {
+    for(int i = 0; i < 6; i++) {
       pool1.acquireConnection();
       pool2.acquireConnection();
     }
-
+    
     LogWriterUtils.getLogWriter().info("interleaved 6 connections from pool1 with 6 connections from pool2");
-
+    
     //The load should still be balanced
-    vm1.invoke("Check Connection Count", () -> checkConnectionCount(13));
-    vm2.invoke("Check Connection Count", () -> checkConnectionCount(13));
-    vm3.invoke("Check Connection Count", () -> checkConnectionCount(13));
-
+    checkConnectionCount(vm1, 13);
+    checkConnectionCount(vm2, 13);
+    checkConnectionCount(vm3, 13);
+    
   }
-
+  
   public void testCustomLoadProbe() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-    //    VM vm3 = host.getVM(3);
-
+//    VM vm3 = host.getVM(3);
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    startLocatorInVM(vm0, locatorPort, "");
     String locators = getLocatorString(host, locatorPort);
-
-    final ServerLoad load1 = new ServerLoad(.3f, .01f, .44f, 4564f);
-    final ServerLoad load2 = new ServerLoad(23.2f, 1.1f, 22.3f, .3f);
-    int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators, new String[] { REGION_NAME }, new MyLoadProbe(load1)));
-    int serverPort2 = vm2.invoke("Start BridgeServer", () -> startBridgeServer(null, locators, new String[] { REGION_NAME }, new MyLoadProbe(load2)));
-
+    
+    ServerLoad load1= new ServerLoad(.3f, .01f, .44f, 4564f);
+    ServerLoad load2= new ServerLoad(23.2f, 1.1f, 22.3f, .3f);
+    int serverPort1 = startBridgeServerInVM(vm1, null, locators, new String[] {REGION_NAME}, new MyLoadProbe(load1 ));
+    int serverPort2 = startBridgeServerInVM(vm2, null, locators, new String[] {REGION_NAME}, new MyLoadProbe(load2 ));
+    
     HashMap expected = new HashMap();
     ServerLocation l1 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort1);
     ServerLocation l2 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort2);
     expected.put(l1, load1);
     expected.put(l2, load2);
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
+    checkLocatorLoad(vm0, expected);
+    
     load1.setConnectionLoad(25f);
-    vm1.invoke("changeLoad", () -> changeLoad(load1));
+    changeLoad(vm1, load1);
     load2.setSubscriptionConnectionLoad(3.5f);
-    vm2.invoke("changeLoad", () -> changeLoad(load2));
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
-    final ServerLoad load1Updated = new ServerLoad(1f, .1f, 0f, 1f);
-    final ServerLoad load2Updated = new ServerLoad(2f, 5f, 0f, 2f);
-    expected.put(l1, load1Updated);
-    expected.put(l2, load2Updated);
-    vm1.invoke("changeLoad", () -> changeLoad(load1Updated));
-    vm2.invoke("changeLoad", () -> changeLoad(load2Updated));
-    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
-
+    changeLoad(vm2, load2);
+    checkLocatorLoad(vm0, expected);
+    
+    load1 = new ServerLoad(1f, .1f, 0f, 1f);
+    load2 = new ServerLoad(2f, 5f, 0f, 2f);
+    expected.put(l1, load1);
+    expected.put(l2, load2);
+    changeLoad(vm1, load1);
+    changeLoad(vm2, load2);
+    checkLocatorLoad(vm0, expected);
+    
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(20);
     pf.setSubscriptionEnabled(true);
     pf.setIdleTimeout(-1);
-    startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME });
-    waitForPrefilledConnections(20);
-
+    startBridgeClientInVM(null, pf.getPoolAttributes(), new String[] {REGION_NAME});
+    waitForPrefilledConnections(null, 20);
+    
     //The first 10 connection should to go vm1, then 1 to vm2, then another 9 to vm1
     //because have unequal values for loadPerConnection
-    vm1.invoke("Check Connection Count", () -> checkConnectionCount(19));
-    vm2.invoke("Check Connection Count", () -> checkConnectionCount(1));
+    checkConnectionCount(vm1, 19);
+    checkConnectionCount(vm2, 1);
   }
-
-  public void checkLocatorLoad(final Map expected) {
-    List locators = Locator.getLocators();
-    Assert.assertEquals(1, locators.size());
-    InternalLocator locator = (InternalLocator) locators.get(0);
-    final ServerLocator sl = locator.getServerLocatorAdvisee();
-    InternalLogWriter log = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out);
-    sl.getDistributionAdvisor().dumpProfiles("PROFILES= ");
-    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
-        .timeout(300, TimeUnit.SECONDS).until(() -> expected.equals(sl.getLoadMap()));
+  
+  public void checkLocatorLoad(VM vm, final Map expected) {
+    vm.invoke(new SerializableRunnable() {
+      public void run() {
+        List locators = Locator.getLocators();
+        Assert.assertEquals(1, locators.size());
+        InternalLocator locator = (InternalLocator) locators.get(0);
+        final ServerLocator sl = locator.getServerLocatorAdvisee();
+        InternalLogWriter log = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out);
+        sl.getDistributionAdvisor().dumpProfiles("PROFILES= ");
+        WaitCriterion ev = new WaitCriterion() {
+          public boolean done() {
+            return expected.equals(sl.getLoadMap());
+          }
+          public String description() {
+            return "load map never became equal to " + expected;
+          }
+        };
+        Wait.waitForCriterion(ev, MAX_WAIT, 200, true);
+      }
+    });
   }
-
-  private void changeLoad(final ServerLoad newLoad) {
-    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-    CacheServer server = cache.getCacheServers().get(0);
-    MyLoadProbe probe = (MyLoadProbe) server.getLoadProbe();
-    probe.setLoad(newLoad);
+  
+  private void changeLoad(VM vm, final ServerLoad newLoad) {
+    vm.invoke(new SerializableRunnable() {
+
+      public void run() {
+        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+        CacheServer server = (CacheServer) cache.getCacheServers().get(0);
+        MyLoadProbe probe = (MyLoadProbe) server.getLoadProbe();
+        probe.setLoad(newLoad);
+      }
+      
+    });
   }
-
+  
   private static class MyLoadProbe extends ServerLoadProbeAdapter implements Serializable {
     private ServerLoad load;
-
+    
     public MyLoadProbe(ServerLoad load) {
       this.load = load;
     }
-
+    
     public ServerLoad getLoad(ServerMetrics metrics) {
       float connectionLoad = load.getConnectionLoad()
           + metrics.getConnectionCount() * load.getLoadPerConnection();
@@ -440,7 +493,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
       return new ServerLoad(connectionLoad, load.getLoadPerConnection(),
           queueLoad, load.getLoadPerSubscriptionConnection());
     }
-
+    
     public void setLoad(ServerLoad load) {
       this.load = load;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
index af5ba9c..2207e1d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
@@ -16,35 +16,52 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import com.gemstone.gemfire.cache.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache.server.ServerLoadProbe;
+import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
 
 /**
  *
  */
-public abstract class LocatorTestBase extends DistributedTestCase {
+public abstract class LocatorTestBase  extends DistributedTestCase {
   protected static final String CACHE_KEY = "CACHE";
   protected static final String LOCATOR_KEY = "LOCATOR";
   protected static final String REGION_NAME = "A_REGION";
   protected static final String POOL_NAME = "daPool";
   protected static final Object CALLBACK_KEY = "callback";
-  /**
-   * A map for storing temporary objects in a remote VM so that they can be used
+  /** A map for storing temporary objects in a remote VM so that they can be used
    * between calls. Cleared after each test.
    */
   protected static final HashMap remoteObjects = new HashMap();
@@ -52,211 +69,264 @@ public abstract class LocatorTestBase extends DistributedTestCase {
   public LocatorTestBase(String name) {
     super(name);
   }
-
+  
   @Override
   public final void preTearDown() throws Exception {
-
+    
     SerializableRunnable tearDown = new SerializableRunnable("tearDown") {
       public void run() {
         Locator locator = (Locator) remoteObjects.get(LOCATOR_KEY);
-        if (locator != null) {
+        if(locator != null) {
           try {
             locator.stop();
-          } catch (Exception e) {
+          } catch(Exception e) {
             //do nothing
           }
         }
-
+        
         Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-        if (cache != null) {
+        if(cache != null) {
           try {
             cache.close();
-          } catch (Exception e) {
+          } catch(Exception e) {
             //do nothing
           }
         }
         remoteObjects.clear();
-
+        
       }
     };
     //We seem to like leaving the DS open if we can for
     //speed, but lets at least destroy our cache and locator.
     Invoke.invokeInEveryVM(tearDown);
     tearDown.run();
-
+    
     postTearDownLocatorTestBase();
   }
-
+  
   protected void postTearDownLocatorTestBase() throws Exception {
   }
+  
+  protected void startLocatorInVM(final VM vm, final int locatorPort, final String otherLocators) {
+    vm.invoke(new SerializableRunnable("Create Locator") {
 
-  protected void startLocator(final Host vmHost, final int locatorPort, final String otherLocators) {
-    disconnectFromDS();
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
-    props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
-    props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
-    File logFile = new File(getUniqueName() + "-locator" + locatorPort + ".log");
-    try {
-      InetAddress bindAddress = InetAddress.getByName(NetworkUtils.getServerHostName(vmHost));
-      Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddress, props);
-      remoteObjects.put(LOCATOR_KEY, locator);
-    } catch (UnknownHostException uhe) {
-      Assert.fail("While resolving bind address ", uhe);
-    } catch (IOException ex) {
-      Assert.fail("While starting locator on port " + locatorPort, ex);
-    }
+      final String testName= getUniqueName();
+      public void run() {
+        disconnectFromDS();
+        Properties props = new Properties();
+        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+        props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
+        props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+        props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+        try {
+          File logFile = new File(testName + "-locator" + locatorPort
+              + ".log");
+          InetAddress bindAddr = null;
+          try {
+            bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vm.getHost()));
+          } catch (UnknownHostException uhe) {
+            Assert.fail("While resolving bind address ", uhe);
+          }
+          Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
+          remoteObjects.put(LOCATOR_KEY, locator);
+        } catch (IOException ex) {
+          Assert.fail("While starting locator on port " + locatorPort, ex);
+        }
+      }
+    });
   }
-
-  protected void stopLocator() {
-    Locator locator = (Locator) remoteObjects.remove(LOCATOR_KEY);
-    locator.stop();
+  
+  
+  
+  protected void stopLocatorInVM(VM vm) {
+    vm.invoke(new SerializableRunnable("Stop Locator") {
+      public void run() {
+        Locator locator = (Locator) remoteObjects.remove(LOCATOR_KEY);
+        locator.stop();
+      }
+    });
   }
-
-  protected int startBridgeServer(String[] groups, String locators) throws IOException {
-    return startBridgeServer(groups, locators, new String[] { REGION_NAME });
+  
+  protected int startBridgeServerInVM(VM vm, String[] groups, String locators) {
+    return startBridgeServerInVM(vm, groups, locators, new String[] {REGION_NAME});
   }
+  
+  protected int addCacheServerInVM(VM vm, final String[] groups) {
+    SerializableCallable connect =
+      new SerializableCallable("Add Bridge server") {
 
-  protected int addCacheServer(final String[] groups) throws IOException {
-    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-    CacheServer server = cache.addCacheServer();
-    server.setPort(0);
-    server.setGroups(groups);
-    server.start();
-    return new Integer(server.getPort());
+      public Object call() throws Exception {
+        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+        CacheServer server = cache.addCacheServer();
+        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        server.setPort(serverPort);
+        server.setGroups(groups);
+        server.start();
+        return new Integer(serverPort);
+      }
+    };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
-
-  protected int startBridgeServer(final String[] groups, final String locators, final String[] regions) throws IOException {
-    return startBridgeServer(groups, locators, regions, CacheServer.DEFAULT_LOAD_PROBE);
+  
+  protected int startBridgeServerInVM(VM vm, final String[] groups, final String locators, final String[] regions) {
+    return startBridgeServerInVM(vm, groups, locators, regions, CacheServer.DEFAULT_LOAD_PROBE);
   }
-
-  protected int startBridgeServer(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException {
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    AttributesFactory factory = new AttributesFactory();
-    factory.setScope(Scope.DISTRIBUTED_ACK);
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attributes = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attributes);
-    }
-    CacheServer server = cache.addCacheServer();
-    server.setPort(0);
-    server.setGroups(groups);
-    server.setLoadProbe(probe);
-    server.start();
-
-    remoteObjects.put(CACHE_KEY, cache);
-
-    return new Integer(server.getPort());
+  
+  protected int startBridgeServerInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+    SerializableCallable connect =
+      new SerializableCallable("Start bridge server") {
+          public Object call() throws IOException  {
+            Properties props = new Properties();
+            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+            props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+            DistributedSystem ds = getSystem(props);
+            Cache cache = CacheFactory.create(ds);
+            AttributesFactory factory = new AttributesFactory();
+            factory.setScope(Scope.DISTRIBUTED_ACK);
+            factory.setEnableBridgeConflation(true);
+            factory.setDataPolicy(DataPolicy.REPLICATE);
+            RegionAttributes attrs = factory.create();
+            for(int i = 0; i < regions.length; i++) {
+              cache.createRegion(regions[i], attrs);
+            }
+            CacheServer server = cache.addCacheServer();
+            final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+            server.setPort(serverPort);
+            server.setGroups(groups);
+            server.setLoadProbe(probe);
+            server.start();
+            
+            remoteObjects.put(CACHE_KEY, cache);
+            
+            return new Integer(serverPort);
+          }
+        };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
-
-  protected int startBridgeServerWithEmbeddedLocator(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe)
-      throws IOException {
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    AttributesFactory factory = new AttributesFactory();
-    factory.setScope(Scope.DISTRIBUTED_ACK);
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attrs = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
-    }
-    CacheServer server = cache.addCacheServer();
-    server.setGroups(groups);
-    server.setLoadProbe(probe);
-    server.setPort(0);
-    server.start();
-
-    remoteObjects.put(CACHE_KEY, cache);
-
-    return new Integer(server.getPort());
+  
+  protected int startBridgeServerWithEmbeddedLocator(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+    SerializableCallable connect =
+      new SerializableCallable("Start bridge server") {
+          public Object call() throws IOException  {
+            Properties props = new Properties();
+            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+            props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
+            props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+            DistributedSystem ds = getSystem(props);
+            Cache cache = CacheFactory.create(ds);
+            AttributesFactory factory = new AttributesFactory();
+            factory.setScope(Scope.DISTRIBUTED_ACK);
+            factory.setEnableBridgeConflation(true);
+            factory.setDataPolicy(DataPolicy.REPLICATE);
+            RegionAttributes attrs = factory.create();
+            for(int i = 0; i < regions.length; i++) {
+              cache.createRegion(regions[i], attrs);
+            }
+            CacheServer server = cache.addCacheServer();
+            server.setGroups(groups);
+            server.setLoadProbe(probe);
+            final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+            server.setPort(serverPort);
+            server.start();
+            
+            remoteObjects.put(CACHE_KEY, cache);
+            
+            return new Integer(serverPort);
+          }
+        };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
-
-  protected void startBridgeClient(final String group, final String host, final int port) throws Exception {
-    startBridgeClient(group, host, port, new String[] { REGION_NAME });
+  
+  protected void  startBridgeClientInVM(VM vm, final String group, final String host, final int port) throws Exception {
+    startBridgeClientInVM(vm, group, host, port, new String[] {REGION_NAME});
   }
+  
 
-  protected void startBridgeClient(final String group, final String host, final int port, final String[] regions) throws Exception {
+  protected void startBridgeClientInVM(VM vm, final String group, final String host, final int port, final String[] regions) throws Exception {
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(host, port)
-        .setServerGroup(group)
-        .setPingInterval(200)
-        .setSubscriptionEnabled(true)
-        .setSubscriptionRedundancy(-1);
-    startBridgeClient(pf.getPoolAttributes(), regions);
+    .setServerGroup(group)
+    .setPingInterval(200)
+    .setSubscriptionEnabled(true)
+    .setSubscriptionRedundancy(-1);
+    startBridgeClientInVM(vm, pf.getPoolAttributes(), regions);
   }
-
-  protected void startBridgeClient(final Pool pool, final String[] regions) throws Exception {
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, "");
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    AttributesFactory factory = new AttributesFactory();
-    factory.setScope(Scope.LOCAL);
-    //            factory.setEnableBridgeConflation(true);
-    //            factory.setDataPolicy(DataPolicy.NORMAL);
-    factory.setPoolName(POOL_NAME);
-    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
-    pf.init(pool);
-    LocatorDiscoveryCallback locatorCallback = new MyLocatorCallback();
-    remoteObjects.put(CALLBACK_KEY, locatorCallback);
-    pf.setLocatorDiscoveryCallback(locatorCallback);
-    pf.create(POOL_NAME);
-
-    RegionAttributes attrs = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
+  
+  protected void  startBridgeClientInVM(VM vm, final Pool pool, final String[] regions) throws Exception {
+    SerializableRunnable connect =
+      new SerializableRunnable("Start bridge client") {
+          public void run() {
+            Properties props = new Properties();
+            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+            props.setProperty(DistributionConfig.LOCATORS_NAME, "");
+            DistributedSystem ds = getSystem(props);
+            Cache cache = CacheFactory.create(ds);
+            AttributesFactory factory = new AttributesFactory();
+            factory.setScope(Scope.LOCAL);
+//            factory.setEnableBridgeConflation(true);
+//            factory.setDataPolicy(DataPolicy.NORMAL);
+            factory.setPoolName(POOL_NAME);
+            PoolFactoryImpl pf= (PoolFactoryImpl) PoolManager.createFactory();
+            pf.init(pool);
+            LocatorDiscoveryCallback locatorCallback = new MyLocatorCallback();
+            remoteObjects.put(CALLBACK_KEY, locatorCallback);
+            pf.setLocatorDiscoveryCallback(locatorCallback);
+            pf.create(POOL_NAME);
+
+
+            RegionAttributes attrs = factory.create();
+            for(int i = 0; i < regions.length; i++) {
+              cache.createRegion(regions[i], attrs);
+            }
+            
+            remoteObjects.put(CACHE_KEY, cache);
+          }
+    };
+    
+    if(vm == null) {
+      connect.run();
+    } else {
+      vm.invoke(connect);
     }
-
-    remoteObjects.put(CACHE_KEY, cache);
   }
-
+  
   protected void stopBridgeMemberVM(VM vm) {
-    vm.invoke(new SerializableRunnable("Stop bridge member") {
-      public void run() {
-        Cache cache = (Cache) remoteObjects.remove(CACHE_KEY);
-        cache.close();
-        disconnectFromDS();
-      }
-    });
+   vm.invoke(new SerializableRunnable("Stop bridge member") {
+    public void run() {
+      Cache cache = (Cache) remoteObjects.remove(CACHE_KEY);
+      cache.close();
+      disconnectFromDS();
+    }
+   });
   }
-
+  
   public String getLocatorString(Host host, int locatorPort) {
-    return getLocatorString(host, new int[] { locatorPort });
+    return getLocatorString(host, new int[] {locatorPort});
   }
-
+  
   public String getLocatorString(Host host, int[] locatorPorts) {
     StringBuffer str = new StringBuffer();
-    for (int i = 0; i < locatorPorts.length; i++) {
+    for(int i = 0; i < locatorPorts.length; i++) {
       str.append(NetworkUtils.getServerHostName(host))
           .append("[")
           .append(locatorPorts[i])
           .append("]");
-      if (i < locatorPorts.length - 1) {
+      if(i < locatorPorts.length - 1) {
         str.append(",");
       }
     }
-
+    
     return str.toString();
   }
-
+  
   protected static class MyLocatorCallback extends LocatorDiscoveryCallbackAdapter {
 
     private final Set discoveredLocators = new HashSet();
     private final Set removedLocators = new HashSet();
-
+    
     public synchronized void locatorsDiscovered(List locators) {
       discoveredLocators.addAll(locators);
       notifyAll();
@@ -266,29 +336,29 @@ public abstract class LocatorTestBase extends DistributedTestCase {
       removedLocators.addAll(locators);
       notifyAll();
     }
-
+    
     public boolean waitForDiscovery(InetSocketAddress locator, long time) throws InterruptedException {
       return waitFor(discoveredLocators, locator, time);
     }
-
+    
     public boolean waitForRemove(InetSocketAddress locator, long time) throws InterruptedException {
       return waitFor(removedLocators, locator, time);
     }
-
+    
     private synchronized boolean waitFor(Set set, InetSocketAddress locator, long time) throws InterruptedException {
       long remaining = time;
       long endTime = System.currentTimeMillis() + time;
-      while (!set.contains(locator) && remaining >= 0) {
+      while(!set.contains(locator) && remaining >= 0) {
         wait(remaining);
-        remaining = endTime - System.currentTimeMillis();
+        remaining = endTime - System.currentTimeMillis(); 
       }
       return set.contains(locator);
     }
-
+    
     public synchronized Set getDiscovered() {
       return new HashSet(discoveredLocators);
     }
-
+    
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
index 0f08456..de43c29 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
@@ -56,11 +56,11 @@ public class Bug47667DUnitTest extends LocatorTestBase {
 
     final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     final String locatorHost = NetworkUtils.getServerHostName(host);
-    locator.invoke("Start Locator",() ->startLocator(locator.getHost(), locatorPort, ""));
+    startLocatorInVM(locator, locatorPort, "");
 
     String locString = getLocatorString(host, locatorPort);
-    server1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] {"R1"}, locString, new String[] {"R1"}));
-    server2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] {"R2"}, locString, new String[] {"R2"}));
+    startBridgeServerInVM(server1, new String[] {"R1"}, locString, new String[] {"R1"});
+    startBridgeServerInVM(server2, new String[] {"R2"}, locString, new String[] {"R2"});
 
     client.invoke(new SerializableCallable() {
       @Override
@@ -70,15 +70,15 @@ public class Bug47667DUnitTest extends LocatorTestBase {
         ClientCache cache = ccf.create();
         PoolManager.createFactory().addLocator(locatorHost, locatorPort).setServerGroup("R1").create("R1");
         PoolManager.createFactory().addLocator(locatorHost, locatorPort).setServerGroup("R2").create("R2");
-        Region region1 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R1").create("R1");
-        Region region2 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R2").create("R2");
-        CacheTransactionManager transactionManager = cache.getCacheTransactionManager();
-        transactionManager.begin();
-        region1.put(1, "value1");
-        transactionManager.commit();
-        transactionManager.begin();
-        region2.put(2, "value2");
-        transactionManager.commit();
+        Region r1 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R1").create("R1");
+        Region r2 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R2").create("R2");
+        CacheTransactionManager mgr = cache.getCacheTransactionManager();
+        mgr.begin();
+        r1.put(1, "value1");
+        mgr.commit();
+        mgr.begin();
+        r2.put(2, "value2");
+        mgr.commit();
         return null;
       }
     });

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
index 167cc3a..d784397 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
@@ -16,9 +16,26 @@
  */
 package com.gemstone.gemfire.management;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collections;
+import java.util.Properties;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.client.internal.LocatorTestBase;
-import com.gemstone.gemfire.cache.query.*;
+import com.gemstone.gemfire.cache.query.IndexExistsException;
+import com.gemstone.gemfire.cache.query.IndexInvalidException;
+import com.gemstone.gemfire.cache.query.IndexNameConflictException;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.RegionNotFoundException;
 import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryDUnitTest;
 import com.gemstone.gemfire.cache.query.internal.cq.CqService;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -29,34 +46,37 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.management.internal.JmxManagerLocatorRequest;
+import com.gemstone.gemfire.management.internal.JmxManagerLocatorResponse;
 import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
 import com.gemstone.gemfire.management.internal.SystemManagementService;
-import com.gemstone.gemfire.test.dunit.*;
-
-import javax.management.*;
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.Properties;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Cache Server related management test cases
+ * 
+ * 
  */
 public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   private static final long serialVersionUID = 1L;
-
-  private static int CONNECT_LOCATOR_TIMEOUT_MS = 30000;
+  
+  private static int CONNECT_LOCATOR_TIMEOUT_MS = 30000; 
 
   private ManagementTestBase helper;
 
   private static final String queryName = "testClientWithFeederAndCQ_0";
 
   private static final String indexName = "testIndex";
-
+  
   private static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
+  
 
   protected CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest(
       "CqDataDUnitTest");
@@ -64,7 +84,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
   public CacheServerManagementDUnitTest(String name) {
     super(name);
     this.helper = new ManagementTestBase(name);
-
+    
   }
 
   @Override
@@ -78,6 +98,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
   }
 
   /**
+   * 
    * @throws Exception
    */
   public void testCacheServerMBean() throws Exception {
@@ -91,11 +112,12 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     helper.startManagingNode(managingNode);
     //helper.createCache(server);
     int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    cqDUnitTest.createServer(server, serverPort);
-
+    cqDUnitTest.createServer(server,serverPort);
+    
+   
     DistributedMember member = helper.getMember(server);
-
-    verifyCacheServer(server, serverPort);
+    
+    verifyCacheServer(server,serverPort);
 
     final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
@@ -123,10 +145,10 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     // Close.
 
     Wait.pause(2000);
-    checkNavigation(managingNode, member, serverPort);
-    verifyIndex(server, serverPort);
+    checkNavigation(managingNode,member,serverPort);
+    verifyIndex(server,serverPort);
     // This will test all CQs and will close the cq in its final step
-    verifyCacheServerRemote(managingNode, member, serverPort);
+    verifyCacheServerRemote(managingNode, member,serverPort);
 
     verifyClosedCQ(server);
 
@@ -140,30 +162,30 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Test for client server connection related management artifacts
-   * like notifications
-   *
+   * like notifications 
    * @throws Exception
    */
-
+  
   public void testCacheClient() throws Exception {
-
+    
     final Host host = Host.getHost(0);
     VM locator = host.getVM(0);
     VM server = host.getVM(1);
     VM client = host.getVM(2);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
-
-    String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
-
-    int serverPort = server.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
-    addClientNotifListener(server, serverPort);
+    startLocatorInVM(locator, locatorPort, "");
+    
+    String locators = NetworkUtils.getServerHostName(locator.getHost())+ "[" + locatorPort + "]";
+    
+   
+    int serverPort = startBridgeServerInVM(server, null, locators);
+    
+    addClientNotifListener(server,serverPort);
 
     // Start a client and make sure that proper notification is received
-    client.invoke("Start BridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(locator.getHost()), locatorPort));
-
+    startBridgeClientInVM(client, null, NetworkUtils.getServerHostName(locator.getHost()), locatorPort);
+    
     //stop the client and make sure the bridge server notifies
     stopBridgeMemberVM(client);
     helper.closeCache(locator);
@@ -171,14 +193,13 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     helper.closeCache(client);
 
   }
-
+  
   /**
    * Intention of this test is to check if a node becomes manager after all the nodes are alive
    * it should have all the information of all  the members.
-   * <p>
+   * 
    * Thats why used  service.getLocalManager().runManagementTaskAdhoc() to make node
    * ready for federation when manager node comes up
-   *
    * @throws Exception
    */
 
@@ -187,72 +208,96 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     final Host host = Host.getHost(0);
     VM locator = host.getVM(0);
     VM server = host.getVM(1);
-
+    
     //Step 1:
     final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
-
-    String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
+    startLocator(locator, locatorPort, "");
 
+    String locators = NetworkUtils.getServerHostName(locator.getHost())+ "[" + locatorPort + "]";
+    
     //Step 2:
-    server.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
+    int serverPort = startBridgeServerInVM(server, null, locators);
+    
     //Step 3:
-    server.invoke("Check Server", () -> {
-      Cache cache = GemFireCacheImpl.getInstance();
-      assertNotNull(cache);
-      SystemManagementService service = (SystemManagementService) ManagementService
-          .getExistingManagementService(cache);
-      assertNotNull(service);
-      assertFalse(service.isManager());
-      assertNotNull(service.getMemberMXBean());
-      service.getLocalManager().runManagementTaskAdhoc();
+    server.invoke(new SerializableRunnable("Check Server") {
+
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        assertNotNull(cache);
+        SystemManagementService service = (SystemManagementService)ManagementService
+            .getExistingManagementService(cache);
+        assertNotNull(service);
+        assertFalse(service.isManager());
+        assertNotNull(service.getMemberMXBean());
+        service.getLocalManager().runManagementTaskAdhoc();
+
+
+      }
     });
+    
+  //Step 4:
+    JmxManagerLocatorResponse locRes = JmxManagerLocatorRequest.send(locator
+        .getHost().getHostName(), locatorPort, CONNECT_LOCATOR_TIMEOUT_MS, Collections.<String, String> emptyMap());
+    
+  //Step 5:
+    locator.invoke(new SerializableRunnable("Check locator") {
 
-    //Step 4:
-    JmxManagerLocatorRequest.send(locator
-        .getHost().getHostName(), locatorPort, CONNECT_LOCATOR_TIMEOUT_MS, Collections.<String, String>emptyMap());
-
-    //Step 5:
-    locator.invoke("Check locator", () -> {
-      Cache cache = GemFireCacheImpl.getInstance();
-      assertNotNull(cache);
-      ManagementService service = ManagementService
-          .getExistingManagementService(cache);
-      assertNotNull(service);
-      assertTrue(service.isManager());
-      LocatorMXBean bean = service.getLocalLocatorMXBean();
-      assertEquals(locatorPort, bean.getPort());
-      DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
-
-      assertEquals(2, dsBean.listMemberObjectNames().length);
+      public void run() {
+        Cache cache = GemFireCacheImpl.getInstance();
+        assertNotNull(cache);
+        ManagementService service = ManagementService
+            .getExistingManagementService(cache);
+        assertNotNull(service);
+        assertTrue(service.isManager());
+        LocatorMXBean bean = service.getLocalLocatorMXBean();
+        assertEquals(locatorPort, bean.getPort());
+        DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
+        ObjectName[] names = dsBean.listMemberObjectNames();
+       
+        assertEquals(2,dsBean.listMemberObjectNames().length);
+
+      }
     });
+    
+
 
     helper.closeCache(locator);
     helper.closeCache(server);
-
+    
+ 
   }
+  
+  
+  protected void startLocator(final VM vm, final int locatorPort, final String otherLocators) {
+    vm.invoke(new SerializableRunnable("Create Locator") {
 
-  protected void startLocator(Host vmHost, final int locatorPort, final String otherLocators) {
-    disconnectFromDS();
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
-    props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
-    props.setProperty(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME, "0");
-    props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
-    File logFile = new File(getUniqueName() + "-locator" + locatorPort + ".log");
-    try {
-      InetAddress bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vmHost));
-      Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
-      remoteObjects.put(LOCATOR_KEY, locator);
-    } catch (UnknownHostException uhe) {
-      Assert.fail("While resolving bind address ", uhe);
-    } catch (IOException ex) {
-      Assert.fail("While starting locator on port " + locatorPort, ex);
-    }
+      final String testName= getUniqueName();
+      public void run() {
+        disconnectFromDS();
+        Properties props = new Properties();
+        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+        props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
+        props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+        props.setProperty(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME, "0");
+        props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+        try {
+          File logFile = new File(testName + "-locator" + locatorPort
+              + ".log");
+          InetAddress bindAddr = null;
+          try {
+            bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vm.getHost()));
+          } catch (UnknownHostException uhe) {
+            Assert.fail("While resolving bind address ", uhe);
+          }
+          Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
+          remoteObjects.put(LOCATOR_KEY, locator);
+        } catch (IOException ex) {
+          Assert.fail("While starting locator on port " + locatorPort, ex);
+        }
+      }
+    });
   }
-
+  
   protected void checkNavigation(final VM vm,
       final DistributedMember cacheServerMember, final int serverPort) {
     SerializableRunnable checkNavigation = new SerializableRunnable(
@@ -282,14 +327,14 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     };
     vm.invoke(checkNavigation);
   }
-
+  
   /**
    * Verify the Cache Server details
-   *
+   * 
    * @param vm
    */
   @SuppressWarnings("serial")
-  protected void addClientNotifListener(final VM vm, final int serverPort) throws Exception {
+  protected void addClientNotifListener(final VM vm , final int serverPort) throws Exception {
     SerializableRunnable addClientNotifListener = new SerializableRunnable(
         "Add Client Notif Listener") {
       public void run() {
@@ -314,19 +359,18 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
         TestCacheServerNotif nt = new TestCacheServerNotif();
         try {
           mbeanServer.addNotificationListener(MBeanJMXAdapter
-              .getClientServiceMBeanName(serverPort, cache.getDistributedSystem().getMemberId()), nt, null, null);
+              .getClientServiceMBeanName(serverPort,cache.getDistributedSystem().getMemberId()), nt, null, null);
         } catch (InstanceNotFoundException e) {
           fail("Failed With Exception " + e);
         }
-
+        
       }
     };
     vm.invoke(addClientNotifListener);
   }
-
   /**
    * Verify the closed CQ which is closed from Managing Node
-   *
+   * 
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -361,7 +405,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
           bean.removeIndex(indexName);
         } catch (Exception e) {
           fail("Failed With Exception " + e);
-
+        
         }
         assertEquals(bean.getIndexCount(), 0);
 
@@ -372,7 +416,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Verify the closed CQ which is closed from Managing Node
-   *
+   * 
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -390,9 +434,11 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     vm.invoke(verifyClosedCQ);
   }
 
+ 
+
   /**
    * Verify the Cache Server details
-   *
+   * 
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -450,7 +496,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Verify the Cache Server details
-   *
+   * 
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -476,14 +522,14 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
           LogWriterUtils.getLogWriter().info(
               "<ExpectedString> Active Query Count  "
                   + bean.getActiveCQCount() + "</ExpectedString> ");
-
+          
           LogWriterUtils.getLogWriter().info(
               "<ExpectedString> Registered Query Count  "
                   + bean.getRegisteredCQCount() + "</ExpectedString> ");
 
-          assertTrue(bean.showAllClientStats()[0].getClientCQCount() == 1);
-          int numQueues = bean.getNumSubscriptions();
-          assertEquals(numQueues, 1);
+          assertTrue(bean.showAllClientStats()[0].getClientCQCount() == 1); 
+          int numQueues = bean.getNumSubscriptions(); 
+          assertEquals(numQueues, 1); 
           // test for client connection Count
           
           /* @TODO */
@@ -506,9 +552,11 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     };
     vm.invoke(verifyCacheServerRemote);
   }
-
+  
   /**
    * Notification handler
+   * 
+   * 
    */
   private static class TestCacheServerNotif implements
       NotificationListener {


[15/49] incubator-geode git commit: GEODE-1390: Move gfsh help tests from closed to open

Posted by kl...@apache.org.
GEODE-1390: Move gfsh help tests from closed to open


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/04a00042
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/04a00042
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/04a00042

Branch: refs/heads/feature/GEODE-835-test
Commit: 04a000422103887da13d7fd6422995a5bbe06a51
Parents: 7051c7a
Author: Jens Deppe <jd...@pivotal.io>
Authored: Thu May 12 13:53:49 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Fri May 13 10:24:38 2016 -0700

----------------------------------------------------------------------
 .../cli/commands/CliCommandTestBase.java        |    4 +-
 .../cli/commands/HelpCommandsJUnitTest.java     |  120 +
 .../cli/commands/golden-help-offline.properties | 2997 ++++++++++++++++++
 .../cli/commands/golden-help-online.properties  |  657 ++++
 4 files changed, 3775 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04a00042/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 0486c5a..4b25165 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -43,8 +43,6 @@ import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
-import org.junit.runners.Parameterized;
-
 import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
 
@@ -396,7 +394,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     printStream.print(commandResultToString(commandResult));
   }
 
-  protected String commandResultToString(final CommandResult commandResult) {
+  protected static String commandResultToString(final CommandResult commandResult) {
     assertNotNull(commandResult);
 
     commandResult.resetToFirstLine();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04a00042/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
new file mode 100644
index 0000000..7cbe85a
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli.commands;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.management.internal.cli.CommandManager;
+import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
+import com.gemstone.gemfire.management.internal.cli.shell.GfshConfig;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Map;
+import java.util.Properties;
+
+import static com.gemstone.gemfire.management.internal.cli.commands.CliCommandTestBase.commandResultToString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@Category(IntegrationTest.class)
+public class HelpCommandsJUnitTest extends JUnit4DistributedTestCase {
+
+  private int jmxPort;
+
+  @Before
+  public void setup() {
+    jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
+
+    Properties localProps = new Properties();
+    localProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
+    localProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
+    localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
+    getSystem(localProps);
+
+  }
+
+  @Test
+  public void testOfflineHelp() throws Exception {
+    Properties helpProps = new Properties();
+    helpProps.load(HelpCommandsJUnitTest.class.getResourceAsStream("golden-help-offline.properties"));
+
+    Gfsh gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
+
+    CommandManager cm = CommandManager.getInstance();
+    for (Map.Entry<String, CommandTarget> e : cm.getCommands().entrySet()) {
+      // Mock commands may have been produced in the VM by other tests
+      // 'quit' is an alias for 'exit' and doesn't produce help
+      if (e.getKey().contains("mock") || e.getKey().contains("quit")) {
+        continue;
+      }
+
+      CommandResult cr = (CommandResult) gfsh.executeCommand("help " + e.getKey()).getResult();
+      String gfshResult = commandResultToString(cr);
+
+      String goldParam = e.getKey().replace(" ", "-") + ".help";
+      String goldResult = helpProps.getProperty(goldParam);
+      assertNotNull("No golden text for: " + goldParam, goldResult);
+      assertEquals(goldResult.trim(), gfshResult.trim());
+
+      helpProps.remove(goldParam);
+    }
+
+    // No help should remain unchecked
+    assertEquals(0, helpProps.size());
+  }
+
+  @Test
+  public void testOnlineHelp() throws Exception {
+    Properties helpProps = new Properties();
+    helpProps.load(HelpCommandsJUnitTest.class.getResourceAsStream("golden-help-online.properties"));
+
+    Gfsh gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
+    gfsh.executeCommand("connect --jmx-manager=localhost[" + jmxPort + "]");
+
+    CommandManager cm = CommandManager.getInstance();
+    for (Map.Entry<String, CommandTarget> e : cm.getCommands().entrySet()) {
+      // Mock commands may have been produced in the VM by other tests
+      // 'quit' is an alias for 'exit' and doesn't produce help
+      if (e.getKey().contains("mock") || e.getKey().contains("quit")) {
+        continue;
+      }
+
+      CommandResult cr = (CommandResult) gfsh.executeCommand("help " + e.getKey()).getResult();
+      String gfshResult = commandResultToString(cr);
+
+      String goldParam = e.getKey().replace(" ", "-") + ".help";
+      String goldResult = helpProps.getProperty(goldParam);
+      assertNotNull("No golden text for: " + goldParam, goldResult);
+
+      String[] lines = gfshResult.split("\n");
+      gfshResult = String.join("\n", lines[0], lines[1], lines[2], lines[3]);
+
+      assertEquals(goldResult.trim(), gfshResult.trim());
+
+      helpProps.remove(goldParam);
+    }
+
+    // No help should remain unchecked
+    assertEquals(0, helpProps.size());
+  }
+}


[23/49] incubator-geode git commit: GEODE-17: pulse not started with gemfire security enabled

Posted by kl...@apache.org.
GEODE-17: pulse not started with gemfire security enabled


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/97d61726
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/97d61726
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/97d61726

Branch: refs/heads/feature/GEODE-835-test
Commit: 97d61726e61c43bdada362b8b1ab867f954794dc
Parents: c4b9756
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Fri May 13 07:20:14 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 13 14:07:46 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/management/internal/ManagementAgent.java | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/97d61726/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
index adc69c4..af35c1b 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
@@ -201,10 +201,9 @@ public class ManagementAgent {
         if (logger.isDebugEnabled()) {
           logger.debug(message);
         }
-
-        if (isCustomAuthorizer()){
-          System.setProperty("spring.profiles.active", "pulse.authentication.gemfire");
-        }
+      }
+      else if (isCustomAuthenticator()){
+        System.setProperty("spring.profiles.active", "pulse.authentication.gemfire");
       }
 
       // Find developer REST WAR file


[49/49] incubator-geode git commit: Complete JoptOptionParserTest. Refactor CLI exceptions.

Posted by kl...@apache.org.
Complete JoptOptionParserTest. Refactor CLI exceptions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/955275f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/955275f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/955275f4

Branch: refs/heads/feature/GEODE-835-test
Commit: 955275f41911a656ba5a99b3d820115c7ad909e8
Parents: 45b4247
Author: Kirk Lund <kl...@apache.org>
Authored: Fri May 20 09:28:57 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 20 09:28:57 2016 -0700

----------------------------------------------------------------------
 .../management/internal/cli/CommandManager.java |   4 +-
 .../cli/exceptions/CliCommandException.java     |  37 +-
 .../exceptions/CliCommandInvalidException.java  |  16 +-
 .../CliCommandMultiModeOptionException.java     |  16 +-
 .../CliCommandNotAvailableException.java        |  12 +-
 .../exceptions/CliCommandOptionException.java   |  36 +-
 ...CommandOptionHasMultipleValuesException.java |  17 +-
 .../CliCommandOptionInvalidException.java       |  14 +-
 .../CliCommandOptionMissingException.java       |  17 +-
 .../CliCommandOptionNotApplicableException.java |  20 +-
 ...liCommandOptionValueConversionException.java |  16 +-
 .../CliCommandOptionValueException.java         |  25 +-
 .../CliCommandOptionValueMissingException.java  |  20 +-
 .../internal/cli/exceptions/CliException.java   |  17 +-
 .../cli/exceptions/ExceptionGenerator.java      |  28 +-
 .../management/internal/cli/parser/Option.java  |   2 +-
 .../cli/parser/jopt/JoptOptionParser.java       |  27 +-
 .../internal/cli/JoptOptionParserTest.java      | 466 ++++++++++++++++++-
 18 files changed, 636 insertions(+), 154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/CommandManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/CommandManager.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/CommandManager.java
index 46a8226..9c8025e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/CommandManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/CommandManager.java
@@ -365,8 +365,8 @@ public class CommandManager {
           for (Annotation annotation : annotations) {
             if (annotation instanceof CliArgument) {
               // Here we need to create the argument Object
-              arguments.add(createArgument((CliArgument) annotation,
-                  parameterType, parameterNo));
+              Argument argumentToAdd = createArgument((CliArgument) annotation, parameterType, parameterNo);
+              arguments.add(argumentToAdd);
               parameterNo++;
             } else if (annotation instanceof CliOption) {
               Option createdOption = createOption((CliOption) annotation, parameterType, parameterNo);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandException.java
index eb019a7..29358f3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandException.java
@@ -16,50 +16,51 @@
  */
 package com.gemstone.gemfire.management.internal.cli.exceptions;
 
-import java.util.List;
-
 import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandException extends CliException {
+
   private CommandTarget commandTarget;
   private OptionSet optionSet;
 
-  public OptionSet getOptionSet() {
-    return optionSet;
+  public CliCommandException(final CommandTarget commandTarget) {
+    this(commandTarget, null, null);
   }
 
-  public CommandTarget getCommandTarget() {
-    return commandTarget;
+  public CliCommandException(final CommandTarget commandTarget, final OptionSet optionSet) {
+    this(commandTarget, optionSet, null);
   }
 
-  public CliCommandException(CommandTarget commandTarget) {
+  public CliCommandException(final CommandTarget commandTarget, final OptionSet optionSet, final Throwable cause) {
+    super(cause);
     this.setCommandTarget(commandTarget);
-  }
-
-  public CliCommandException(CommandTarget commandTarget, OptionSet optionSet) {
-    this(commandTarget);
     this.setOptionSet(optionSet);
   }
 
-  public CliCommandException(CommandTarget commandTarget2,
-      List<String> nonOptionArguments) {
+  public CommandTarget getCommandTarget() {
+    return commandTarget;
   }
 
   /**
-   * @param commandTarget
-   *          the commandTarget to set
+   * TODO: make this immutable
+   *
+   * @param commandTarget the commandTarget to set
    */
   public void setCommandTarget(CommandTarget commandTarget) {
     this.commandTarget = commandTarget;
   }
 
+  public OptionSet getOptionSet() {
+    return optionSet;
+  }
+
   /**
-   * @param optionSet
-   *          the optionSet to set
+   * TODO: make this immutable
+   *
+   * @param optionSet the optionSet to set
    */
   public void setOptionSet(OptionSet optionSet) {
     this.optionSet = optionSet;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandInvalidException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandInvalidException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandInvalidException.java
index 6fde9db..b3d3775 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandInvalidException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandInvalidException.java
@@ -21,13 +21,19 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandInvalidException extends CliCommandException {
 
-  public CliCommandInvalidException(CommandTarget commandTarget) {
-    super(commandTarget);
+  public CliCommandInvalidException(final CommandTarget commandTarget) {
+    this(commandTarget, null, null);
   }
 
-  public CliCommandInvalidException(CommandTarget commandTarget,
-      OptionSet optionSet) {
-    super(commandTarget, optionSet);
+  public CliCommandInvalidException(final CommandTarget commandTarget, OptionSet optionSet) {
+    this(commandTarget, optionSet, null);
   }
 
+  public CliCommandInvalidException(final Throwable cause) {
+    this(null, null, cause);
+  }
+
+  public CliCommandInvalidException(final CommandTarget commandTarget, OptionSet optionSet, Throwable cause) {
+    super(commandTarget, optionSet, cause);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandMultiModeOptionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandMultiModeOptionException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandMultiModeOptionException.java
index 5f5cbfd..3259406 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandMultiModeOptionException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandMultiModeOptionException.java
@@ -22,15 +22,18 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandMultiModeOptionException extends CliCommandOptionException {
   
-  public static final int MULTIPLE_LEAD_OPTIONS=1;
-  public static final int OPTIONS_FROM_MULTIPLE_MODES=2;
+  public static final int MULTIPLE_LEAD_OPTIONS = 1; // TODO: move or delete
+  public static final int OPTIONS_FROM_MULTIPLE_MODES = 2; // TODO: move or delete
   
   private String leadOptionString;
   private int code;
 
-  public CliCommandMultiModeOptionException(CommandTarget commandTarget,
-      Option option, String string, int code) {
-    super(commandTarget, option);
+  public CliCommandMultiModeOptionException(final CommandTarget commandTarget, final Option option, final String string, final int code) {
+    this(commandTarget, option, string, code, null);
+  }
+
+  public CliCommandMultiModeOptionException(final CommandTarget commandTarget, final Option option, final String string, final int code, final Throwable cause) {
+    super(commandTarget, option, cause);
     this.leadOptionString = string;
     this.code = code;
   }
@@ -42,7 +45,4 @@ public class CliCommandMultiModeOptionException extends CliCommandOptionExceptio
   public int getCode() {
     return code;
   }
-  
-  
 }
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandNotAvailableException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandNotAvailableException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandNotAvailableException.java
index cf8bc06..c1e1358 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandNotAvailableException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandNotAvailableException.java
@@ -21,13 +21,15 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandNotAvailableException extends CliCommandException {
 
-  public CliCommandNotAvailableException(CommandTarget commandTarget) {
-    super(commandTarget);
+  public CliCommandNotAvailableException(final CommandTarget commandTarget) {
+    this(commandTarget, null, null);
   }
 
-  public CliCommandNotAvailableException(CommandTarget commandTarget,
-      OptionSet optionSet) {
-    super(commandTarget, optionSet);
+  public CliCommandNotAvailableException(final CommandTarget commandTarget, final OptionSet optionSet) {
+    this(commandTarget, optionSet, null);
   }
 
+  public CliCommandNotAvailableException(final CommandTarget commandTarget, final OptionSet optionSet, final Throwable cause) {
+    super(commandTarget, optionSet, cause);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionException.java
index bfe6c3a..3fdec10 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionException.java
@@ -24,30 +24,36 @@ public class CliCommandOptionException extends CliCommandException {
 
   private Option option;
 
+  public CliCommandOptionException(final CommandTarget commandTarget, final Option option) {
+    this(commandTarget, option, null, null);
+  }
+
+  public CliCommandOptionException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet) {
+    this(commandTarget, option, optionSet, null);
+  }
+
+  public CliCommandOptionException(final CommandTarget commandTarget, final Option option, final Throwable cause) {
+    this(commandTarget, option, null, cause);
+  }
+
+  public CliCommandOptionException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final Throwable cause) {
+    super(commandTarget, optionSet, cause);
+    this.setOption(option);
+  }
+
   /**
-   * @return option for which the exception occured
+   * @return option for which the exception occurred
    */
   public Option getOption() {
     return option;
   }
 
   /**
-   * @param option
-   *          the option to set
+   * TODO: make this immutable
+   *
+   * @param option the option to set
    */
   public void setOption(Option option) {
     this.option = option;
   }
-
-  public CliCommandOptionException(CommandTarget commandTarget, Option option) {
-    super(commandTarget);
-    this.setOption(option);
-  }
-
-  public CliCommandOptionException(CommandTarget commandTarget, Option option,
-      OptionSet optionSet) {
-    super(commandTarget, optionSet);
-    this.setOption(option);
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionHasMultipleValuesException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionHasMultipleValuesException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionHasMultipleValuesException.java
index 3932636..2439945 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionHasMultipleValuesException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionHasMultipleValuesException.java
@@ -21,13 +21,22 @@ import com.gemstone.gemfire.management.internal.cli.parser.Option;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandOptionHasMultipleValuesException extends CliCommandOptionValueException {
+
   private static final long serialVersionUID = -5277268341319591711L;
 
-  public CliCommandOptionHasMultipleValuesException(CommandTarget commandTarget, Option option, String value) {
-    super(commandTarget, option, value);
+  public CliCommandOptionHasMultipleValuesException(final CommandTarget commandTarget, final Option option, final String value) {
+    this(commandTarget, option, null, value, null);
+  }
+
+  public CliCommandOptionHasMultipleValuesException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value) {
+    this(commandTarget, option, optionSet, value, null);
+  }
+
+  public CliCommandOptionHasMultipleValuesException(final Throwable cause) {
+    this(null, null, null, null, cause);
   }
 
-  public CliCommandOptionHasMultipleValuesException(CommandTarget commandTarget, Option option, OptionSet optionSet, String value) {
-    super(commandTarget, option, optionSet, value);
+  public CliCommandOptionHasMultipleValuesException(final CommandTarget commandTarget, Option option, final OptionSet optionSet, final String value, final Throwable cause) {
+    super(commandTarget, option, optionSet, value, cause);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionInvalidException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionInvalidException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionInvalidException.java
index af7e44a..7ce747a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionInvalidException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionInvalidException.java
@@ -22,13 +22,15 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandOptionInvalidException extends CliCommandOptionException {
 
-  public CliCommandOptionInvalidException(CommandTarget commandTarget,
-      Option option) {
-    super(commandTarget, option);
+  public CliCommandOptionInvalidException(final CommandTarget commandTarget, final Option option) {
+    this(commandTarget, option, null, null);
   }
 
-  public CliCommandOptionInvalidException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet) {
-    super(commandTarget, option, optionSet);
+  public CliCommandOptionInvalidException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet) {
+    this(commandTarget, option, optionSet, null);
+  }
+
+  public CliCommandOptionInvalidException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final Throwable cause) {
+    super(commandTarget, option, optionSet, cause);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionMissingException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionMissingException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionMissingException.java
index 00481fc..1a2c8fe 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionMissingException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionMissingException.java
@@ -22,14 +22,19 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandOptionMissingException extends CliCommandOptionException {
 
-  public CliCommandOptionMissingException(CommandTarget commandTarget,
-      Option option) {
-    super(commandTarget, option);
+  public CliCommandOptionMissingException(final CommandTarget commandTarget, final Option option) {
+    this(commandTarget, option, null, null);
   }
 
-  public CliCommandOptionMissingException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet) {
-    super(commandTarget, option, optionSet);
+  public CliCommandOptionMissingException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet) {
+    this(commandTarget, option, optionSet, null);
   }
 
+  public CliCommandOptionMissingException(final Throwable cause) {
+    this(null, null, null, cause);
+  }
+
+  public CliCommandOptionMissingException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final Throwable cause) {
+    super(commandTarget, option, optionSet, cause);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionNotApplicableException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionNotApplicableException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionNotApplicableException.java
index 4e99ba1..1e9f726 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionNotApplicableException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionNotApplicableException.java
@@ -20,17 +20,21 @@ import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.parser.Option;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
-public class CliCommandOptionNotApplicableException extends
-    CliCommandOptionException {
+public class CliCommandOptionNotApplicableException extends CliCommandOptionException {
 
-  public CliCommandOptionNotApplicableException(CommandTarget commandTarget,
-      Option option) {
-    super(commandTarget, option);
+  public CliCommandOptionNotApplicableException(final CommandTarget commandTarget, final Option option) {
+    this(commandTarget, option, null, null);
   }
 
-  public CliCommandOptionNotApplicableException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet) {
-    super(commandTarget, option, optionSet);
+  public CliCommandOptionNotApplicableException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet) {
+    this(commandTarget, option, optionSet, null);
   }
 
+  public CliCommandOptionNotApplicableException(final Throwable cause) {
+    this(null, null, null, cause);
+  }
+
+  public CliCommandOptionNotApplicableException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, Throwable cause) {
+    super(commandTarget, option, optionSet, cause);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueConversionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueConversionException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueConversionException.java
index b16c8f2..8330f79 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueConversionException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueConversionException.java
@@ -20,17 +20,17 @@ import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.parser.Option;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
-public class CliCommandOptionValueConversionException extends
-    CliCommandOptionValueException {
+public class CliCommandOptionValueConversionException extends CliCommandOptionValueException {
 
-  public CliCommandOptionValueConversionException(CommandTarget commandTarget,
-      Option option, String value) {
-    super(commandTarget, option, value);
+  public CliCommandOptionValueConversionException(final CommandTarget commandTarget, final Option option, final String value) {
+    this(commandTarget, option, null, value, null);
   }
 
-  public CliCommandOptionValueConversionException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet, String value) {
-    super(commandTarget, option, optionSet, value);
+  public CliCommandOptionValueConversionException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value) {
+    this(commandTarget, option, optionSet, value, null);
   }
 
+  public CliCommandOptionValueConversionException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value, final Throwable cause) {
+    super(commandTarget, option, optionSet, value, null);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueException.java
index 774a8b1..4e04578 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueException.java
@@ -22,21 +22,26 @@ import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
 public class CliCommandOptionValueException extends CliCommandOptionException {
 
-  private String value;
+  private final String value;
 
-  public String getValue() {
-    return value;
+  public CliCommandOptionValueException(final CommandTarget commandTarget, final Option option, final String value) {
+    this(commandTarget, option, null, value, null);
   }
 
-  public CliCommandOptionValueException(CommandTarget commandTarget,
-      Option option, String value) {
-    super(commandTarget, option);
-    this.value = value;
+  public CliCommandOptionValueException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value) {
+    this(commandTarget, option, null, value, null);
+  }
+
+  public CliCommandOptionValueException(final Throwable cause) {
+    this(null, null, null, null, cause);
   }
 
-  public CliCommandOptionValueException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet, String value) {
-    super(commandTarget, option, optionSet);
+  public CliCommandOptionValueException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value, final Throwable cause) {
+    super(commandTarget, option, optionSet, cause);
     this.value = value;
   }
+
+  public String getValue() {
+    return value;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueMissingException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueMissingException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueMissingException.java
index 4eb2a6b..5fa02d9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueMissingException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliCommandOptionValueMissingException.java
@@ -20,17 +20,21 @@ import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.parser.Option;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
 
-public class CliCommandOptionValueMissingException extends
-    CliCommandOptionValueException {
+public class CliCommandOptionValueMissingException extends CliCommandOptionValueException {
 
-  public CliCommandOptionValueMissingException(CommandTarget commandTarget,
-      Option option, String value) {
-    super(commandTarget, option, value);
+  public CliCommandOptionValueMissingException(final CommandTarget commandTarget, final Option option, final String value) {
+    this(commandTarget, option, null, value, null);
   }
 
-  public CliCommandOptionValueMissingException(CommandTarget commandTarget,
-      Option option, OptionSet optionSet, String value) {
-    super(commandTarget, option, optionSet, value);
+  public CliCommandOptionValueMissingException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value) {
+    this(commandTarget, option, optionSet, value, null);
+  }
+
+  public CliCommandOptionValueMissingException(final Throwable cause) {
+    this(null, null, null, null, cause);
   }
 
+  public CliCommandOptionValueMissingException(final CommandTarget commandTarget, final Option option, final OptionSet optionSet, final String value, final Throwable cause) {
+    super(commandTarget, option, optionSet, value);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliException.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliException.java
index bc0db3f..3e0551e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliException.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/CliException.java
@@ -16,6 +16,21 @@
  */
 package com.gemstone.gemfire.management.internal.cli.exceptions;
 
-public class CliException extends Exception {
+public abstract class CliException extends Exception {
 
+  public CliException() {
+    this(null, null);
+  }
+
+  public CliException(String message) {
+    this(message, null);
+  }
+
+  public CliException(Throwable cause) {
+    super(null, cause);
+  }
+
+  public CliException(String message, Throwable cause) {
+    super(message, cause);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/ExceptionGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/ExceptionGenerator.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/ExceptionGenerator.java
index 6824735..61af7a4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/ExceptionGenerator.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/exceptions/ExceptionGenerator.java
@@ -22,22 +22,26 @@ import joptsimple.OptionException;
 import joptsimple.OptionMissingRequiredArgumentException;
 import joptsimple.UnrecognizedOptionException;
 
+import com.gemstone.gemfire.management.internal.cli.parser.Option;
+
 /**
- * 
- *         Converts joptsimple exceptions into corresponding exceptions for cli
- * 
+ * Converts joptsimple exceptions into corresponding exceptions for cli
  */
 public class ExceptionGenerator {
 
-  public static CliException generate(OptionException oe) {
-    if (oe instanceof MissingRequiredOptionException) {
-      return new CliCommandOptionMissingException(null, null, null);
-    } else if (oe instanceof OptionMissingRequiredArgumentException) {
-      return new CliCommandOptionValueMissingException(null, null, null, null);
-    } else if (oe instanceof UnrecognizedOptionException) {
-      return new CliCommandOptionNotApplicableException(null, null, null);
-    } else if (oe instanceof MultipleArgumentsForOptionException) {
-      return new CliCommandOptionHasMultipleValuesException(null, null, null);
+  public static CliCommandOptionException generate(Option option, OptionException e) {
+    if (MissingRequiredOptionException.class.isInstance(e)) {
+      return new CliCommandOptionMissingException(e);
+
+    } else if (OptionMissingRequiredArgumentException.class.isInstance(e)) {
+      return new CliCommandOptionValueMissingException(e);
+
+    } else if (UnrecognizedOptionException.class.isInstance(e)) {
+      return new CliCommandOptionNotApplicableException(e);
+
+    } else if (MultipleArgumentsForOptionException.class.isInstance(e)) {
+      return new CliCommandOptionHasMultipleValuesException(e);
+
     } else {
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/Option.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/Option.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/Option.java
index 09aabd8..1d115ce 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/Option.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/Option.java
@@ -124,7 +124,7 @@ public class Option extends Parameter {
     return true;
   }
 
-  public final List<String> getAggregate() {
+  public List<String> getAggregate() {
     return aggregate;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
index 6e56bf4..4ea9516 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
@@ -44,9 +44,11 @@ import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedI
 /**
  * Implementation of {@link GfshOptionParser} which internally makes use of
  * {@link joptsimple.OptionParser}
+ *
+ * Newly constructed JoptOptionParser must be loaded with arguments and
+ * options before parsing command strings.
  * 
  * @since 7.0
- * 
  */
 public class JoptOptionParser implements GfshOptionParser {
 
@@ -119,11 +121,9 @@ public class JoptOptionParser implements GfshOptionParser {
       // int factor = 0;
       try {
         joptOptionSet = parser.parse(preProcessedInput);
-      } catch (Exception e) {
-        if (e instanceof OptionException) {
-          ce = processException(e);
-          joptOptionSet = ((OptionException) e).getDetected();
-        }
+      } catch (OptionException e) {
+        ce = processException(e);
+        joptOptionSet = e.getDetected();
       }
       if (joptOptionSet != null) {
 
@@ -244,19 +244,8 @@ public class JoptOptionParser implements GfshOptionParser {
     return optionSet;
   }
 
-  private CliCommandOptionException processException(Exception e) {
-    CliCommandOptionException ce = null;
-    if (e instanceof OptionException) {
-      ce = (CliCommandOptionException) ExceptionGenerator
-          .generate((OptionException) e);
-      if (ce != null) {
-        if (ce instanceof CliCommandOptionException) {
-          ((CliCommandOptionException) ce)
-              .setOption(getOption((OptionException) e));
-        }
-      }
-    }
-    return ce;
+  private CliCommandOptionException processException(final OptionException exception) {
+    return ExceptionGenerator.generate(getOption(exception), exception);
   }
 
   private Option getOption(OptionException oe) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/955275f4/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
index 564ec37..ad82a94 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
@@ -17,11 +17,21 @@
 package com.gemstone.gemfire.management.internal.cli;
 
 import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
 
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
+import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionMissingException;
+import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionNotApplicableException;
 import com.gemstone.gemfire.management.internal.cli.parser.Argument;
 import com.gemstone.gemfire.management.internal.cli.parser.Option;
 import com.gemstone.gemfire.management.internal.cli.parser.OptionSet;
@@ -29,49 +39,469 @@ import com.gemstone.gemfire.management.internal.cli.parser.jopt.JoptOptionParser
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
+@RunWith(JUnitParamsRunner.class)
 public class JoptOptionParserTest {
 
-  private JoptOptionParser defaultJoptOptionParser;
-  private OptionSet defaultOptionSet;
+  private JoptOptionParser emptyOptionParser;
+  private OptionSet emptyOptionSet;
+
+  private Argument requiredArgument;
+  private Argument optionalArgument;
+
+  private Option requiredOption;
+  private Option optionalOption;
+
+  private JoptOptionParser simpleOptionParser;
+  private JoptOptionParser exampleOptionParser;
 
   @Before
   public void setUp() throws Exception {
-    this.defaultJoptOptionParser = new JoptOptionParser();
-    this.defaultOptionSet = new OptionSet();
+    this.emptyOptionParser = new JoptOptionParser();
+    this.emptyOptionSet = new OptionSet();
+    defineSimpleOptionParser();
+    defineExampleOptionParser();
   }
 
   @Test
   public void getArgumentsIsEmptyByDefault() throws Exception {
-    assertThat(this.defaultJoptOptionParser.getArguments()).isEmpty();
+    assertThat(this.emptyOptionParser.getArguments()).isEmpty();
   }
 
   @Test
   public void getOptionsIsNullByDefault() throws Exception {
-    assertThat(this.defaultJoptOptionParser.getOptions()).isNull();
+    assertThat(this.emptyOptionParser.getOptions()).isNull();
   }
 
   @Test
   public void parseNullReturnsDefaultOptionSet() throws Exception {
-    OptionSet optionSet = this.defaultJoptOptionParser.parse(null);
-    assertThat(optionSet.areArgumentsPresent()).isEqualTo(defaultOptionSet.areArgumentsPresent());
-    assertThat(optionSet.areOptionsPresent()).isEqualTo(defaultOptionSet.areOptionsPresent());
-    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(defaultOptionSet.getNoOfSpacesRemoved());
-    assertThat(optionSet.getSplit()).isEqualTo(defaultOptionSet.getSplit());
-    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(defaultOptionSet.getNoOfSpacesRemoved());
-    assertThat(optionSet.getUserInput()).isEqualTo(""); //defaultOptionSet.getUserInput());
-    assertThat(optionSet.getValue((Argument)null)).isEqualTo(defaultOptionSet.getValue((Argument)null));
-    assertThat(optionSet.getValue((Option)null)).isEqualTo(defaultOptionSet.getValue((Option)null));
+    OptionSet optionSet = this.emptyOptionParser.parse(null);
+    assertThat(optionSet.areArgumentsPresent()).isEqualTo(emptyOptionSet.areArgumentsPresent());
+    assertThat(optionSet.areOptionsPresent()).isEqualTo(emptyOptionSet.areOptionsPresent());
+    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(emptyOptionSet.getNoOfSpacesRemoved());
+    assertThat(optionSet.getSplit()).isEqualTo(emptyOptionSet.getSplit());
+    assertThat(optionSet.getNoOfSpacesRemoved()).isEqualTo(emptyOptionSet.getNoOfSpacesRemoved());
+    assertThat(optionSet.getUserInput()).isEqualTo(""); //emptyOptionSet.getUserInput());
+    assertThat(optionSet.getValue((Argument)null)).isEqualTo(emptyOptionSet.getValue((Argument)null));
+    assertThat(optionSet.getValue((Option)null)).isEqualTo(emptyOptionSet.getValue((Option)null));
   }
 
   @Test
   public void parseEmptyThrowsNullPointerException() throws Exception {
-    assertThatThrownBy(() -> this.defaultJoptOptionParser.parse("")).isInstanceOf(NullPointerException.class);
+    assertThatThrownBy(() -> this.emptyOptionParser.parse("")).isInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void setArgumentsShouldCreateCopy() throws Exception {
+    Argument argument = mock(Argument.class);
+    when(argument.isRequired()).thenReturn(true);
+
+    LinkedList<Argument> arguments = new LinkedList<>();
+    arguments.add(argument);
+
+    this.emptyOptionParser.setArguments(arguments);
+
+    assertThat(this.emptyOptionParser.getArguments()).isNotSameAs(arguments);
+    assertThat(this.emptyOptionParser.getArguments()).hasSize(1);
+
+    arguments.clear();
+
+    assertThat(arguments).hasSize(0);
+    assertThat(this.emptyOptionParser.getArguments()).hasSize(1);
+  }
+
+  @Test
+  public void setArgumentsShouldKeepRequiredBeforeOptional() throws Exception {
+    Argument requiredArgument1 = mock(Argument.class);
+    when(requiredArgument1.isRequired()).thenReturn(true);
+    Argument optionalArgument1 = mock(Argument.class);
+    when(optionalArgument1.isRequired()).thenReturn(false);
+
+    LinkedList<Argument> arguments = new LinkedList<>();
+    arguments.add(requiredArgument1);
+    arguments.add(optionalArgument1);
+
+    this.emptyOptionParser.setArguments(arguments);
+
+    LinkedList<Argument> argumentsReturned = this.emptyOptionParser.getArguments();
+
+    assertThat(argumentsReturned).hasSize(2);
+    assertThat(argumentsReturned.getFirst()).isSameAs(requiredArgument1);
+    assertThat(argumentsReturned.getLast()).isSameAs(optionalArgument1);
   }
 
   @Test
-  public void foo() throws Exception {
-    //assertThatThrownBy(() -> this.defaultJoptOptionParser.parse(null)
+  public void setArgumentsShouldMoveRequiredBeforeOptional() throws Exception {
+    Argument requiredArgument1 = mock(Argument.class);
+    when(requiredArgument1.isRequired()).thenReturn(true);
+    Argument optionalArgument1 = mock(Argument.class);
+    when(optionalArgument1.isRequired()).thenReturn(false);
+
+    LinkedList<Argument> arguments = new LinkedList<>();
+    arguments.add(optionalArgument1);
+    arguments.add(requiredArgument1);
+
+    this.emptyOptionParser.setArguments(arguments);
+
+    LinkedList<Argument> argumentsReturned = this.emptyOptionParser.getArguments();
+
+    assertThat(argumentsReturned).hasSize(2);
+    assertThat(argumentsReturned.getFirst()).isSameAs(requiredArgument1);
+    assertThat(argumentsReturned.getLast()).isSameAs(optionalArgument1);
   }
 
+  @Test
+  public void setOptionsShouldKeepSameInstance() throws Exception {
+    Option option = mock(Option.class);
+    ArrayList aggregate = new ArrayList<String>();
+    aggregate.add("option");
+    when(option.getAggregate()).thenReturn(aggregate);
+    when(option.getHelp()).thenReturn("help text");
+
+    LinkedList<Option> options = new LinkedList<>();
+    options.add(option);
+
+    this.emptyOptionParser.setOptions(options);
+
+    assertThat(this.emptyOptionParser.getOptions()).isSameAs(options);
+    assertThat(this.emptyOptionParser.getOptions()).hasSize(1);
+
+    options.clear();
+
+    assertThat(options).hasSize(0);
+    assertThat(this.emptyOptionParser.getOptions()).hasSize(0);
+  }
+
+  @Test
+  public void parseInputWithDefinedArgumentShouldWork() throws Exception {
+    LinkedList<Argument> arguments = new LinkedList<>();
+    LinkedList<Option> options = new LinkedList<>();
+
+    arguments.add(this.requiredArgument);
+
+    JoptOptionParser optionParser = new JoptOptionParser();
+    optionParser.setArguments(arguments);
+    optionParser.setOptions(options);
+
+    OptionSet optionSet = optionParser.parse("command1 argument1_value");
+    assertThat(optionSet.areArgumentsPresent()).isTrue();
+    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
+  }
+
+  @Test
+  public void parseInputWithOneArgumentShouldFindJustOneArgument() throws Exception {
+    LinkedList<Argument> arguments = new LinkedList<>();
+    LinkedList<Option> options = new LinkedList<>();
+
+    arguments.add(this.requiredArgument);
+
+    JoptOptionParser optionParser = new JoptOptionParser();
+    optionParser.setArguments(arguments);
+    optionParser.setOptions(options);
+
+    OptionSet optionSet = optionParser.parse("command1 argument1_value");
+    assertThat(optionSet.areArgumentsPresent()).isTrue();
+    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
+    assertThat(optionSet.hasArgument(this.optionalArgument)).isFalse();
+  }
+
+  @Test
+  public void parseInputWithTwoArgumentsShouldFindTwoArguments() throws Exception {
+    LinkedList<Argument> arguments = new LinkedList<>();
+    LinkedList<Option> options = new LinkedList<>();
+
+    arguments.add(this.requiredArgument);
+    arguments.add(this.optionalArgument);
+
+    JoptOptionParser optionParser = new JoptOptionParser();
+    optionParser.setArguments(arguments);
+    optionParser.setOptions(options);
+
+    OptionSet optionSet = optionParser.parse("command1 argument1_value? argument2_value");
+    assertThat(optionSet.areArgumentsPresent()).isTrue();
+    assertThat(optionSet.hasArgument(this.requiredArgument)).isTrue();
+    assertThat(optionSet.hasArgument(this.optionalArgument)).isTrue();
+  }
+
+  @Test
+  public void parseInputWithUndefinedArgumentShouldThrow() throws Exception {
+    LinkedList<Argument> arguments = new LinkedList<>();
+    LinkedList<Option> options = new LinkedList<>();
+
+    arguments.add(this.requiredArgument);
 
+    JoptOptionParser optionParser = new JoptOptionParser();
+    optionParser.setArguments(arguments);
+    optionParser.setOptions(options);
+
+    assertThatThrownBy(() -> optionParser.parse("command1 argument1_value? argument2_value")).isOfAnyClassIn(CliCommandOptionNotApplicableException.class);
+  }
+
+  @Test
+  public void parseInputWithUndefinedOptionShouldThrow() throws Exception {
+    assertThatThrownBy(() -> this.simpleOptionParser.parse("command1 argument1_value argument2_value --undefinedOption")).isExactlyInstanceOf(CliCommandOptionNotApplicableException.class);
+  }
+
+  @Test
+  public void parseInputWithOneOptionShouldFindOneOption() throws Exception {
+    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1");
+    assertThat(optionSet.areOptionsPresent()).isTrue();
+    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
+    assertThat(optionSet.hasOption(this.optionalOption)).isFalse();
+  }
+
+  @Test
+  public void parseInputWithTwoOptionsShouldFindTwoOptions() throws Exception {
+    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1 --option2");
+    assertThat(optionSet.areOptionsPresent()).isTrue();
+    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
+    assertThat(optionSet.hasOption(this.optionalOption)).isTrue();
+  }
+
+  @Test
+  public void parseInputWithOptionWithValueShouldFindOption() throws Exception {
+    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1=value");
+    assertThat(optionSet.areOptionsPresent()).isTrue();
+    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
+  }
+
+  @Test
+  public void parseInputWithOptionWithoutValueShouldFindOption() throws Exception {
+    OptionSet optionSet = this.simpleOptionParser.parse("command1 argument1_value --option1");
+    assertThat(optionSet.areOptionsPresent()).isTrue();
+    assertThat(optionSet.hasOption(this.requiredOption)).isTrue();
+  }
+
+  @Test
+  public void parseInputWithoutOptionShouldNotFindOptions() throws Exception {
+    LinkedList<Argument> arguments = new LinkedList<>();
+    LinkedList<Option> options = new LinkedList<>();
+
+    arguments.add(this.requiredArgument);
+
+    JoptOptionParser optionParser = new JoptOptionParser();
+    optionParser.setArguments(arguments);
+    optionParser.setOptions(options);
+
+    OptionSet optionSet = optionParser.parse("command1 argument1_value");
+    assertThat(optionSet.areOptionsPresent()).isFalse();
+    assertThat(optionSet.hasOption(this.requiredOption)).isFalse();
+  }
+
+  @Test
+  @Parameters(method = "exampleInputParameters")
+  public void parseInputWithExampleInputParametesr(String command, boolean expectException, boolean hasArguments, boolean hasOptions) throws Exception {
+    if (expectException) {
+      assertThatThrownBy(() -> this.exampleOptionParser.parse(command)).isExactlyInstanceOf(CliCommandOptionMissingException.class);
+      return;
+    }
+
+    OptionSet options = this.exampleOptionParser.parse(command);
+    assertThat(options).isNotNull();
+    assertThat(options.areArgumentsPresent()).isEqualTo(hasArguments);
+    assertThat(options.areOptionsPresent()).isEqualTo(hasOptions);
+  }
+
+  private static Object[] exampleInputParameters() {
+    return new Object[]{
+      // 0
+      new Object[] { " ARGUMENT1_VALUE \u2014option1=somevalue", false, true, false },
+      // 1
+      new Object[] { " ARGUMENT1_VALUE?      ARGUMENT2_VALUE -- ----------", false, true, false },
+      // 2
+      new Object[] { " --option1=value", false, false, true },
+      // 3
+      new Object[] { "         ARGUMENT1_VALUE?       ARGUMENT2_VALUE --option1=option1value --option2", false, true, true },
+      // 4
+      new Object[] { "         ARGUMENT1_VALUE?       ARGUMENT2_VALUE --option1=option1value --option2=option2value --option3=option3value", false, true, true },
+      // 5
+      new Object[] { " --string=string1 --stringArray=1,2 --stringArray=3,4 --stringList=11,12,13 --integer=10 --stringArray=5 --stringList=14,15", false, false, true },
+      // 6
+      new Object[] { " --stringArray=1,2 --stringArray='3,4'", false, false, true },
+      // 7
+      new Object[] { " --string=\"1\" --colonArray=2:3:4 --stringArray=5,\"6,7\",8 --stringList=\"9,10,11,12\"", false, false, true },
+      // 8
+      new Object[] { " --string=string1 --stringArray=1,2 --string=string2", false, false, true },
+      // 9
+      new Object[] { " this is just one argument?this is a second argument", false, true, false }
+    };
+  }
+
+  private void defineSimpleOptionParser() {
+    LinkedList<Argument> arguments = new LinkedList<Argument>();
+    LinkedList<Option> options = new LinkedList<Option>();
+
+    this.requiredArgument = mock(Argument.class);
+    when(this.requiredArgument.getArgumentName()).thenReturn("argument1");
+    when(this.requiredArgument.getContext()).thenReturn("context for argument1");
+    when(this.requiredArgument.getHelp()).thenReturn("help for argument1");
+    when(this.requiredArgument.isRequired()).thenReturn(true);
+    arguments.add(this.requiredArgument);
+
+    this.optionalArgument = mock(Argument.class);
+    when(this.optionalArgument.getArgumentName()).thenReturn("argument2");
+    when(this.optionalArgument.getContext()).thenReturn("context for argument2");
+    when(this.optionalArgument.getHelp()).thenReturn("help for argument2");
+    when(this.optionalArgument.isRequired()).thenReturn(false);
+    when(this.optionalArgument.getUnspecifiedDefaultValue()).thenReturn("{unspecified default value for argument2}");
+    when(this.optionalArgument.isSystemProvided()).thenReturn(false);
+    arguments.add(this.optionalArgument);
+
+    this.requiredOption = mock(Option.class);
+    when(this.requiredOption.getLongOption()).thenReturn("--option1");
+    List<String> aggregate = new ArrayList<>();
+    aggregate.add("option1");
+    when(this.requiredOption.getAggregate()).thenReturn(aggregate);
+    when(this.requiredOption.getLongOption()).thenReturn("option1");
+    when(this.requiredOption.getHelp()).thenReturn("help for option1");
+    when(this.requiredOption.getValueSeparator()).thenReturn("=");
+    when(this.requiredOption.isRequired()).thenReturn(true);
+    assertThat(this.requiredOption.getAggregate()).isNotEmpty();
+    options.add(this.requiredOption);
+
+    this.optionalOption = mock(Option.class);
+    when(this.optionalOption.getLongOption()).thenReturn("--option2");
+    aggregate = new ArrayList<>();
+    aggregate.add("option2");
+    when(this.optionalOption.getAggregate()).thenReturn(aggregate);
+    when(this.optionalOption.getLongOption()).thenReturn("option2");
+    when(this.optionalOption.getHelp()).thenReturn("help for option2");
+    when(this.optionalOption.getValueSeparator()).thenReturn("=");
+    when(this.optionalOption.isRequired()).thenReturn(false);
+    assertThat(this.optionalOption.getAggregate()).isNotEmpty();
+    options.add(this.optionalOption);
+
+    this.simpleOptionParser = new JoptOptionParser();
+    this.simpleOptionParser.setArguments(arguments);
+    this.simpleOptionParser.setOptions(options);
+  }
+
+  private void defineExampleOptionParser() {
+    LinkedList<Argument> arguments = new LinkedList<Argument>();
+    LinkedList<Option> options = new LinkedList<Option>();
+
+    Argument argument1 = mock(Argument.class);
+    when(argument1.getArgumentName()).thenReturn("argument1");
+    when(argument1.getContext()).thenReturn("context for argument1");
+    when(argument1.getHelp()).thenReturn("help for argument1");
+    when(argument1.isRequired()).thenReturn(true);
+    arguments.add(argument1);
+
+    Argument argument2 = mock(Argument.class);
+    when(argument2.getArgumentName()).thenReturn("argument2");
+    when(argument2.getContext()).thenReturn("context for argument2");
+    when(argument2.getHelp()).thenReturn("help for argument2");
+    when(argument2.isRequired()).thenReturn(false);
+    when(argument2.getUnspecifiedDefaultValue()).thenReturn("{unspecified default value for argument2}");
+    when(argument2.isSystemProvided()).thenReturn(false);
+    arguments.add(argument2);
+
+    Argument argument3 = mock(Argument.class);
+    when(argument3.getArgumentName()).thenReturn("argument3");
+    when(argument3.getContext()).thenReturn("context for argument3");
+    when(argument3.getHelp()).thenReturn("help for argument3");
+    when(argument3.isRequired()).thenReturn(false);
+    when(argument3.getUnspecifiedDefaultValue()).thenReturn("{unspecified default value for argument3}");
+    when(argument2.isSystemProvided()).thenReturn(false);
+    arguments.add(argument3);
+
+    Option option1 = mock(Option.class);
+    when(option1.getLongOption()).thenReturn("--option1");
+    List<String> aggregate1 = new ArrayList<>();
+    aggregate1.add("option1");
+    when(option1.getAggregate()).thenReturn(aggregate1);
+    when(option1.getLongOption()).thenReturn("option1");
+    when(option1.getHelp()).thenReturn("help for option1");
+    when(option1.getValueSeparator()).thenReturn("=");
+    when(option1.isRequired()).thenReturn(false);
+    assertThat(option1.getAggregate()).isNotEmpty();
+    options.add(option1);
+
+    Option option2 = mock(Option.class);
+    when(option2.getLongOption()).thenReturn("--option2");
+    List<String> aggregate2 = new ArrayList<>();
+    aggregate2.add("option2");
+    when(option2.getAggregate()).thenReturn(aggregate2);
+    when(option2.getLongOption()).thenReturn("option2");
+    when(option2.getHelp()).thenReturn("help for option2");
+    when(option2.getValueSeparator()).thenReturn("=");
+    when(option2.isRequired()).thenReturn(false);
+    assertThat(option2.getAggregate()).isNotEmpty();
+    options.add(option2);
+
+    Option option3 = mock(Option.class);
+    when(option3.getLongOption()).thenReturn("--option3");
+    List<String> aggregate3 = new ArrayList<>();
+    aggregate3.add("option3");
+    when(option3.getAggregate()).thenReturn(aggregate3);
+    when(option3.getLongOption()).thenReturn("option3");
+    when(option3.getHelp()).thenReturn("help for option3");
+    when(option3.getValueSeparator()).thenReturn("=");
+    when(option3.isRequired()).thenReturn(false);
+    assertThat(option3.getAggregate()).isNotEmpty();
+    options.add(option3);
+
+    Option stringOption = mock(Option.class);
+    when(stringOption.getLongOption()).thenReturn("--string");
+    List<String> aggregateStringOption = new ArrayList<>();
+    aggregateStringOption.add("string");
+    when(stringOption.getAggregate()).thenReturn(aggregateStringOption);
+    when(stringOption.getLongOption()).thenReturn("string");
+    when(stringOption.getHelp()).thenReturn("help for string");
+    when(stringOption.getValueSeparator()).thenReturn("=");
+    when(stringOption.isRequired()).thenReturn(false);
+    assertThat(stringOption.getAggregate()).isNotEmpty();
+    options.add(stringOption);
+
+    Option stringArrayOption = mock(Option.class);
+    when(stringArrayOption.getLongOption()).thenReturn("--stringArray");
+    List<String> aggregateStringArrayOption = new ArrayList<>();
+    aggregateStringArrayOption.add("stringArray");
+    when(stringArrayOption.getAggregate()).thenReturn(aggregateStringArrayOption);
+    when(stringArrayOption.getLongOption()).thenReturn("stringArray");
+    when(stringArrayOption.getHelp()).thenReturn("help for stringArray");
+    when(stringArrayOption.getValueSeparator()).thenReturn("=");
+    when(stringArrayOption.isRequired()).thenReturn(false);
+    assertThat(stringArrayOption.getAggregate()).isNotEmpty();
+    options.add(stringArrayOption);
+
+    Option stringListOption = mock(Option.class);
+    when(stringListOption.getLongOption()).thenReturn("--stringList");
+    List<String> aggregateStringListOption = new ArrayList<>();
+    aggregateStringListOption.add("stringList");
+    when(stringListOption.getAggregate()).thenReturn(aggregateStringListOption);
+    when(stringListOption.getLongOption()).thenReturn("stringList");
+    when(stringListOption.getHelp()).thenReturn("help for stringList");
+    when(stringListOption.getValueSeparator()).thenReturn("=");
+    when(stringListOption.isRequired()).thenReturn(false);
+    assertThat(stringListOption.getAggregate()).isNotEmpty();
+    options.add(stringListOption);
+
+    Option integerOption = mock(Option.class);
+    when(integerOption.getLongOption()).thenReturn("--integer");
+    List<String> aggregateIntegerOption = new ArrayList<>();
+    aggregateIntegerOption.add("integer");
+    when(integerOption.getAggregate()).thenReturn(aggregateIntegerOption);
+    when(integerOption.getLongOption()).thenReturn("integer");
+    when(integerOption.getHelp()).thenReturn("help for integer");
+    when(integerOption.getValueSeparator()).thenReturn("=");
+    when(integerOption.isRequired()).thenReturn(false);
+    assertThat(integerOption.getAggregate()).isNotEmpty();
+    options.add(integerOption);
+
+    Option colonArrayOption = mock(Option.class);
+    when(colonArrayOption.getLongOption()).thenReturn("--colonArray");
+    List<String> aggregateColonArrayOption = new ArrayList<>();
+    aggregateColonArrayOption.add("colonArray");
+    when(colonArrayOption.getAggregate()).thenReturn(aggregateColonArrayOption);
+    when(colonArrayOption.getLongOption()).thenReturn("colonArray");
+    when(colonArrayOption.getHelp()).thenReturn("help for colonArray");
+    when(colonArrayOption.getValueSeparator()).thenReturn("=");
+    when(colonArrayOption.isRequired()).thenReturn(false);
+    assertThat(colonArrayOption.getAggregate()).isNotEmpty();
+    options.add(colonArrayOption);
+
+    this.exampleOptionParser = new JoptOptionParser();
+    this.exampleOptionParser.setArguments(arguments);
+    this.exampleOptionParser.setOptions(options);
+  }
 }


[35/49] incubator-geode git commit: GEODE-1402: use preTearDownAssertions to call checkOrphans

Posted by kl...@apache.org.
GEODE-1402: use preTearDownAssertions to call checkOrphans


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/11da98d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/11da98d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/11da98d4

Branch: refs/heads/feature/GEODE-835-test
Commit: 11da98d4a7139b7c049bc012b7a3f2caaede184a
Parents: 84a9eb1
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon May 16 17:37:27 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Tue May 17 09:55:03 2016 -0700

----------------------------------------------------------------------
 .../cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java   | 2 +-
 .../cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java | 2 +-
 .../gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java   | 2 +-
 .../gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java      | 2 +-
 .../gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java | 2 +-
 .../gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java    | 2 +-
 .../gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java  | 2 +-
 .../com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java | 2 +-
 .../gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java     | 2 +-
 .../gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java         | 2 +-
 .../internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java    | 2 +-
 .../gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java  | 2 +-
 .../gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java      | 2 +-
 .../cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java     | 2 +-
 .../internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java  | 2 +-
 .../tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java      | 2 +-
 .../compression/CompressionCacheListenerOffHeapDUnitTest.java      | 2 +-
 .../compression/CompressionRegionOperationsOffHeapDUnitTest.java   | 2 +-
 .../gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java      | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
index 1f0fbd9..908bc96 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedAckOverflowRegionCCEOffHeapDUnitTest extends Distributed
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
index 431116a..c1bd906 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedAckPersistentRegionCCEOffHeapDUnitTest extends Distribut
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
index 3950dca..ffba1d3 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedAckRegionCCEOffHeapDUnitTest extends DistributedAckRegio
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
index 1b2c6be..08486d4 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedAckRegionOffHeapDUnitTest extends DistributedAckRegionDU
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
index 98e92c0..08a1fcb 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedNoAckRegionCCEOffHeapDUnitTest extends DistributedNoAckR
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
index 8778069..60b0fdf 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class DistributedNoAckRegionOffHeapDUnitTest extends DistributedNoAckRegi
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
index 4311196..6846aa8 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class GlobalRegionCCEOffHeapDUnitTest extends GlobalRegionCCEDUnitTest {
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
index dda4f7c..cb0e7ec 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class GlobalRegionOffHeapDUnitTest extends GlobalRegionDUnitTest {
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
index 8af7b2a..af25980 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
@@ -40,7 +40,7 @@ public class OffHeapLRUEvictionControllerDUnitTest extends
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
index b00d9c0..897e9b9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
@@ -37,7 +37,7 @@ public class PartitionedRegionOffHeapDUnitTest extends PartitionedRegionDUnitTes
   }
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
index b9c90dc..33513b9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
@@ -40,7 +40,7 @@ public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
index 97477fe..d93aa89 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
@@ -42,7 +42,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
   }  
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
index 1f410db..6920e05 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
@@ -38,7 +38,7 @@ public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
index b204453..55e52cb 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionLocalMaxMemoryOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class PartitionedRegionLocalMaxMemoryOffHeapDUnitTest extends Partitioned
   }
   
   @Override
-  protected final void preTearDownPartitionedRegionDUnitTest() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
index 046d787..48f88e8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
@@ -34,7 +34,7 @@ public class PartitionedRegionOffHeapEvictionDUnitTest extends
   }  
   
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
index c62c593..c4fdded 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ForceInvalidateOffHeapEvictionDUnitTest.java
@@ -35,7 +35,7 @@ public class ForceInvalidateOffHeapEvictionDUnitTest extends
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
index ec828fd..0100a05 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
@@ -40,7 +40,7 @@ public class CompressionCacheListenerOffHeapDUnitTest extends
   }
 
   @Override
-  protected final void preTearDownCompressionCacheListenerDUnitTest() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
index d76976f..0cc3bdf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
@@ -33,7 +33,7 @@ public class CompressionRegionOperationsOffHeapDUnitTest extends
   }
   
   @Override
-  protected final void preTearDownCompressionRegionOperationsDUnitTest() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     SerializableRunnable checkOrphans = new SerializableRunnable() {
 
       @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/11da98d4/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
index a1ce952..99fadfc 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
@@ -77,7 +77,7 @@ public class OutOfOffHeapMemoryDUnitTest extends CacheTestCase {
   }
 
   @Override
-  public final void preTearDownCacheTestCase() throws Exception {
+  public final void preTearDownAssertions() throws Exception {
     final SerializableRunnable checkOrphans = new SerializableRunnable() {
       @Override
       public void run() {


[08/49] incubator-geode git commit: GEODE-1376: Cleaned up server port to be '0'. Cleaned up some legacy code and replaced with cleaner Lambda invocation. Replaced waitOnCriterion with Awaitility.

Posted by kl...@apache.org.
GEODE-1376: Cleaned up server port to be '0'.
Cleaned up some legacy code and replaced with cleaner Lambda invocation.
Replaced waitOnCriterion with Awaitility.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c33efb60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c33efb60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c33efb60

Branch: refs/heads/feature/GEODE-835-test
Commit: c33efb60630fe8bed7613c60f941810a7574f16b
Parents: 89b91cb
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Fri May 13 08:28:54 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Fri May 13 08:32:58 2016 +1000

----------------------------------------------------------------------
 ...stAPIOnRegionFunctionExecutionDUnitTest.java |  77 +--
 .../web/controllers/RestAPITestBase.java        |  16 +-
 .../RestAPIsAndInterOpsDUnitTest.java           | 501 ++++++++-----------
 ...tAPIsOnGroupsFunctionExecutionDUnitTest.java |   6 +-
 ...APIsOnMembersFunctionExecutionDUnitTest.java |  19 +-
 .../controllers/RestAPIsWithSSLDUnitTest.java   | 495 +++++++-----------
 .../internal/AutoConnectionSourceDUnitTest.java | 345 +++++++------
 .../AutoConnectionSourceImplJUnitTest.java      |   5 -
 .../internal/LocatorLoadBalancingDUnitTest.java | 439 +++++++---------
 .../cache/client/internal/LocatorTestBase.java  | 396 ++++++---------
 .../internal/cache/Bug47667DUnitTest.java       |  24 +-
 .../CacheServerManagementDUnitTest.java         | 260 ++++------
 12 files changed, 1083 insertions(+), 1500 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
index fedd119..dc3986b 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
@@ -36,6 +36,7 @@ import java.util.*;
 
 /**
  * Dunit Test to validate OnRegion function execution with REST APIs
+ *
  * @since 8.0
  */
 
@@ -58,22 +59,22 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
       if (context instanceof RegionFunctionContext) {
         RegionFunctionContext rfContext = (RegionFunctionContext) context;
         rfContext.getDataSet().getCache().getLogger()
-                .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
+            .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
         if (rfContext.getArguments() instanceof Boolean) {
           /* return rfContext.getArguments(); */
           if (hasResult()) {
             rfContext.getResultSender().lastResult(
-                    (Serializable) rfContext.getArguments());
+                (Serializable) rfContext.getArguments());
           } else {
             rfContext
-                    .getDataSet()
-                    .getCache()
-                    .getLogger()
-                    .info(
-                            "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
+                .getDataSet()
+                .getCache()
+                .getLogger()
+                .info(
+                    "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
             while (true && !rfContext.getDataSet().isDestroyed()) {
               rfContext.getDataSet().getCache().getLogger()
-                      .info("For Bug43513 ");
+                  .info("For Bug43513 ");
               try {
                 Thread.sleep(100);
               } catch (InterruptedException ie) {
@@ -90,7 +91,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
               Thread.sleep(2000);
             } catch (InterruptedException e) {
               rfContext.getDataSet().getCache().getLogger()
-                      .warning("Got Exception : Thread Interrupted" + e);
+                  .warning("Got Exception : Thread Interrupted" + e);
             }
           }
           if (PartitionRegionHelper.isPartitionedRegion(rfContext.getDataSet())) {
@@ -100,11 +101,11 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
              * rfContext).get(key);
              */
             rfContext.getResultSender().lastResult(
-                    (Serializable) PartitionRegionHelper.getLocalDataForContext(
-                            rfContext).get(key));
+                (Serializable) PartitionRegionHelper.getLocalDataForContext(
+                    rfContext).get(key));
           } else {
             rfContext.getResultSender().lastResult(
-                    (Serializable) rfContext.getDataSet().get(key));
+                (Serializable) rfContext.getDataSet().get(key));
           }
           /* return (Serializable)rfContext.getDataSet().get(key); */
         } else if (rfContext.getArguments() instanceof Set) {
@@ -112,7 +113,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           ArrayList vals = new ArrayList();
           for (Object key : origKeys) {
             Object val = PartitionRegionHelper
-                    .getLocalDataForContext(rfContext).get(key);
+                .getLocalDataForContext(rfContext).get(key);
             if (val != null) {
               vals.add(val);
             }
@@ -136,10 +137,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
           LogWriter logger = ds.getLogWriter();
           logger.info("Executing in SampleFunction on Server : "
-                  + ds.getDistributedMember() + "with Context : " + context);
+              + ds.getDistributedMember() + "with Context : " + context);
           while (ds.isConnected()) {
             logger
-                    .fine("Just executing function in infinite loop for Bug43513");
+                .fine("Just executing function in infinite loop for Bug43513");
             try {
               Thread.sleep(250);
             } catch (InterruptedException e) {
@@ -182,7 +183,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
   private boolean createPeerWithPR() {
     RegionAttributes ra = PartitionedRegionTestHelper.createRegionAttrsForPR(0,
-            10);
+        10);
     AttributesFactory raf = new AttributesFactory(ra);
     PartitionAttributesImpl pa = new PartitionAttributesImpl();
     pa.setAll(ra.getPartitionAttributes());
@@ -231,10 +232,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
   }
 
   private void createCacheAndRegisterFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, null)));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, null)));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, null)));
-    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3, null)));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), null)));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), null)));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), null)));
+    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3.getHost().getHostName(), null)));
 
     vm0.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
     vm1.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
@@ -283,7 +284,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion",() -> populatePRRegion());
+    vm3.invoke("populatePRRegion", () -> populatePRRegion());
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", null, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -305,16 +306,16 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion",() -> populatePRRegion());
+    vm3.invoke("populatePRRegion", () -> populatePRRegion());
 
     String jsonBody = "["
-            + "{\"@type\": \"double\",\"@value\": 210}"
-            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-            + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
-            + "\"quantity\":\"2\","
-            + "\"unitprice\":\"5\","
-            + "\"totalprice\":\"10.00\"}"
-            + "]";
+        + "{\"@type\": \"double\",\"@value\": 210}"
+        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+        + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
+        + "\"quantity\":\"2\","
+        + "\"unitprice\":\"5\","
+        + "\"totalprice\":\"10.00\"}"
+        + "]";
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -324,15 +325,15 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
     assertCorrectInvocationCount(4, vm0, vm1, vm2, vm3);
 
     jsonBody = "["
-            + "{\"@type\": \"double\",\"@value\": 220}"
-            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-            + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
-            + "\"quantity\":\"3\","
-            + "\"unitprice\":\"9\","
-            + "\"totalprice\":\"12.00\"}"
-            + "]";
-
-    resetInvocationCounts(vm0,vm1,vm2,vm3);
+        + "{\"@type\": \"double\",\"@value\": 220}"
+        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+        + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
+        + "\"quantity\":\"3\","
+        + "\"unitprice\":\"9\","
+        + "\"totalprice\":\"12.00\"}"
+        + "]";
+
+    resetInvocationCounts(vm0, vm1, vm2, vm3);
 
     response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
index fc71fd8..9e8086c 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
@@ -66,7 +66,6 @@ public class RestAPITestBase extends DistributedTestCase {
     if (agentUtil.findWarLocation("geode-web-api") == null) {
       fail("unable to locate geode-web-api WAR file");
     }
-    Wait.pause(1000); // TODO: replace this with Awaitility
     final Host host = Host.getHost(0);
     vm0 = host.getVM(0);
     vm1 = host.getVM(1);
@@ -102,11 +101,10 @@ public class RestAPITestBase extends DistributedTestCase {
     }
   }
 
-  public String createCacheWithGroups(VM vm, final String groups) {
+  public String createCacheWithGroups(final String hostName, final String groups) {
     RestAPITestBase test = new RestAPITestBase(getTestMethodName());
 
-    final String hostName = vm.getHost().getHostName();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
 
@@ -116,12 +114,12 @@ public class RestAPITestBase extends DistributedTestCase {
 
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
 
     InternalDistributedSystem ds = test.getSystem(props);
     cache = CacheFactory.create(ds);
 
-    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
     return restEndPoint;
   }
 
@@ -132,7 +130,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
   protected CloseableHttpResponse executeFunctionThroughRestCall(String function, String regionName, String filter, String jsonBody, String groups,
                                                                  String members) {
-    LogWriterUtils.getLogWriter().info("Entering executeFunctionThroughRestCall");
+    System.out.println("Entering executeFunctionThroughRestCall");
     try {
       CloseableHttpClient httpclient = HttpClients.createDefault();
       Random randomGenerator = new Random();
@@ -140,7 +138,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
       HttpPost post = createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody);
 
-      LogWriterUtils.getLogWriter().info("Request: POST " + post.toString());
+      System.out.println("Request: POST " + post.toString());
       return httpclient.execute(post);
     } catch (Exception e) {
       throw new RuntimeException("unexpected exception", e);
@@ -185,7 +183,7 @@ public class RestAPITestBase extends DistributedTestCase {
     try {
       String httpResponseString = processHttpResponse(response);
       response.close();
-      LogWriterUtils.getLogWriter().info("Response : " + httpResponseString);
+      System.out.println("Response : " + httpResponseString);
       //verify function execution result
       JSONArray resultArray = new JSONArray(httpResponseString);
       assertEquals(resultArray.length(), expectedServerResponses);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
index 5b0eb17..0f4b2d3 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
@@ -16,38 +16,7 @@
  */
 package com.gemstone.gemfire.rest.internal.web.controllers;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
@@ -64,17 +33,31 @@ import com.gemstone.gemfire.management.ManagementTestBase;
 import com.gemstone.gemfire.pdx.PdxInstance;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.*;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.*;
 
 /**
  * Dunit Test containing inter - operations between REST Client and Gemfire cache client
+ *
  * @since 8.0
  */
 
 public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
-  
+
   private static final long serialVersionUID = -254776154266339226L;
 
   private ManagementTestBase helper;
@@ -89,7 +72,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   private static final String[] PARAM_QUERY_IDS_ARRAY = { "findAllPeople",
       "filterByGender", "filterByLastName" };
-  
+
   final static String QUERY_ARGS = "["
       + "{"
       + "\"@type\": \"string\","
@@ -98,29 +81,29 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       + "]";
 
   final static String PERSON_AS_JSON_CAS = "{"
-      + "\"@old\" :" 
+      + "\"@old\" :"
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 101," + " \"firstName\": \"Mithali\","
       + " \"middleName\": \"Dorai\"," + " \"lastName\": \"Raj\","
-      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\"" 
+      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\""
       + "},"
-      + "\"@new\" :" 
+      + "\"@new\" :"
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 1101," + " \"firstName\": \"Virat\","
       + " \"middleName\": \"Premkumar\"," + " \"lastName\": \"Kohli\","
-      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\"" 
+      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\""
       + "}"
       + "}";
-    
+
   final static String PERSON_AS_JSON_REPLACE = "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 501," + " \"firstName\": \"Barack\","
       + " \"middleName\": \"Hussein\"," + " \"lastName\": \"Obama\","
-      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\"" 
+      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\""
       + "}";
-  
+
   private static final String PERSON_LIST_AS_JSON = "[" + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 3," + " \"firstName\": \"Nishka3\","
@@ -178,86 +161,38 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
   protected final void postTearDownLocatorTestBase() throws Exception {
     disconnectAllFromDS();
   }
-  
-  public static String startBridgeServerWithRestServiceOnInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
-    
-    final String hostName = vm.getHost().getHostName(); 
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    
-    //create Cache of given VM and start HTTP service with REST APIs service
-    new RestAPIsAndInterOpsDUnitTest("temp").startBridgeServer(hostName, serverPort, groups, locators, regions, probe);
-   
-    String restEndPoint =  "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
-    return restEndPoint;
-  }
-  
-  @SuppressWarnings("deprecation")
-  protected int startBridgeServer(String hostName, int restServicerPort, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
-            
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicerPort));
-    
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    ((GemFireCacheImpl)cache).setReadSerialized(true);
-    AttributesFactory factory = new AttributesFactory();
-    
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attrs = factory.create();
-    for(int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
-    }
-    
-    CacheServer server = cache.addCacheServer();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    server.setPort(serverPort);
-    server.setGroups(groups);
-    server.setLoadProbe(probe);
-    try {
-      server.start();
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-    remoteObjects.put(CACHE_KEY, cache);
-    return new Integer(serverPort);
-  }
-  
-  public static void doPutsInClientCache() {
+
+  public void doPutsInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-   
+
     //put person object
     final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE);
     final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE);
     final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE);
     final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE);
     final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE);
-   
+
     region.put("1", person1);
     region.put("2", person2);
     region.put("3", person3);
     region.put("4", person4);
     region.put("5", person5);
-    
+
     final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
     final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE);
     final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE);
     final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE);
     final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE);
-    
+
     final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE);
     final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE);
     final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE);
     final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE);
     final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE);
     final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE);
-    
+
     Map<String, Object> userMap = new HashMap<String, Object>();
     userMap.put("6", person6);
     userMap.put("7", person7);
@@ -270,15 +205,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     userMap.put("14", person14);
     userMap.put("15", person15);
     userMap.put("16", person16);
-    
+
     region.putAll(userMap);
-    
+
     if (cache != null)
       cache.getLogger().info("Gemfire Cache Client: Puts successfully done");
-    
+
   }
 
-  public static void doQueryOpsUsingRestApis(String restEndpoint) {
+  public void doQueryOpsUsingRestApis(String restEndpoint) {
     String currentQueryOp = null;
     try {
       // Query TestCase-1 :: Prepare parameterized Queries
@@ -291,8 +226,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse createNamedQueryResponse = httpclient.execute(post);
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
-        createNamedQueryResponse.close();        
-        
+        createNamedQueryResponse.close();
 
         post = new HttpPost(restEndpoint + findPeopleByGenderQuery);
         post.addHeader("Content-Type", "application/json");
@@ -301,7 +235,6 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
-        
 
         post = new HttpPost(restEndpoint + findPeopleByLastNameQuery);
         post.addHeader("Content-Type", "application/json");
@@ -311,7 +244,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
       }
-      
+
       // Query TestCase-2 :: List all parameterized queries
       {
         currentQueryOp = "listAllQueries";
@@ -320,7 +253,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse listAllQueriesResponse = httpclient.execute(get);
         assertEquals(listAllQueriesResponse.getStatusLine().getStatusCode(), 200);
         assertNotNull(listAllQueriesResponse.getEntity());
-        
+
         HttpEntity entity = listAllQueriesResponse.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -331,19 +264,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         listAllQueriesResponse.close();
-      
+
         // Check whether received response contains expected query IDs.
 
         JSONObject jsonObject = new JSONObject(sb.toString());
         JSONArray jsonArray = jsonObject.getJSONArray("queries");
         for (int i = 0; i < jsonArray.length(); i++) {
           assertTrue(
-            "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
-            Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
-                jsonArray.getJSONObject(i).getString("id")));
+              "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
+              Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
+                  jsonArray.getJSONObject(i).getString("id")));
         }
-      }  
-      
+      }
+
       // Query TestCase-3 :: Run the specified named query passing in scalar values for query parameters.
       {
         currentQueryOp = "filterByLastName";
@@ -351,41 +284,35 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         HttpPost post = new HttpPost(restEndpoint + "/queries/filterByLastName");
         post.addHeader("Content-Type", "application/json");
         post.addHeader("Accept", "application/json");
-        StringEntity entity = new StringEntity(QUERY_ARGS);       
+        StringEntity entity = new StringEntity(QUERY_ARGS);
         post.setEntity(entity);
         CloseableHttpResponse runNamedQueryResponse = httpclient.execute(post);
 
         assertEquals(200, runNamedQueryResponse.getStatusLine().getStatusCode());
         assertNotNull(runNamedQueryResponse.getEntity());
       }
-    } catch ( Exception e ) {
+    } catch (Exception e) {
       throw new RuntimeException("unexpected exception", e);
     }
   }
-  
-  public static void verifyUpdatesInClientCache() {
+
+  public void verifyUpdatesInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-    
+
     {
-      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE );
+      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE);
       Object value = region.get("3");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3  = (PdxInstance) value;
+        PdxInstance pi3 = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        assertEquals(actualPerson.getId(), expectedPerson.getId());
-        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
-        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
-        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
-        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
-        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
+        comparePersonObject(expectedPerson, actualPerson);
       } else if (value instanceof Person) {
         fail("VerifyUpdatesInClientCache, Get on key 3, Expected to get value of type PdxInstance ");
       }
     }
-     
-    
+
     //TODO: uncomment it once following issue encountered in put?op=CAS is fixed or document the issue
     // CAS functionality is not working in following test case
     // step-1: Java client, Region.put("K", A);
@@ -404,43 +331,47 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
     */
-    
+
     //verify update on key "2"
     {
-      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE );
+      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE);
       Object value = region.get("2");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3  = (PdxInstance) value;
+        PdxInstance pi3 = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        assertEquals(actualPerson.getId(), expectedPerson.getId());
-        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
-        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
-        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
-        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
-        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
-      }else {
+        comparePersonObject(expectedPerson, actualPerson);
+      } else {
         fail("VerifyUpdatesInClientCache, Get on key 2, Expected to get value of type PdxInstance ");
       }
     }
-    
+
     //verify Deleted key "13"
     {
       Object obj = region.get("13");
       assertEquals(obj, null);
-      
+
       obj = region.get("14");
       assertEquals(obj, null);
-      
+
       obj = region.get("15");
       assertEquals(obj, null);
-      
+
       obj = region.get("16");
       assertEquals(obj, null);
     }
-    
+
   }
-  
-  public static void doUpdatesUsingRestApis(String restEndpoint) {
+
+  private void comparePersonObject(Person expectedPerson, Person actualPerson) {
+    assertEquals(actualPerson.getId(), expectedPerson.getId());
+    assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
+    assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
+    assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
+    assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
+    assertEquals(actualPerson.getGender(), expectedPerson.getGender());
+  }
+
+  public void doUpdatesUsingRestApis(String restEndpoint) {
     //UPdate keys using REST calls
     {
 
@@ -457,7 +388,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-    
+
     //Delete Single keys
     {
       try {
@@ -470,7 +401,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-    
+
     //Delete set of keys
     {
       try {
@@ -483,7 +414,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-    
+
     //REST put?op=CAS for key 1
     /*
     try {   
@@ -499,15 +430,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     }catch (HttpServerErrorException se) {
       fail("Caught HttpServerErrorException while doing put with op=cas");
     }
-    */ 
-    
+    */
+
     //REST put?op=REPLACE for key 2
     {
       /*HttpEntity<Object> entity = new HttpEntity<Object>(PERSON_AS_JSON_REPLACE, headers);
       ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
         restEndpoint + "/People/2?op=replace",
       HttpMethod.PUT, entity, String.class);*/
-      
+
       try {
         CloseableHttpClient httpclient = HttpClients.createDefault();
         HttpPut put = new HttpPut(restEndpoint
@@ -522,14 +453,14 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
   }
-  
-  public static void fetchRestServerEndpoints(String restEndpoint) {
+
+  public void fetchRestServerEndpoints(String restEndpoint) {
     HttpGet get = new HttpGet(restEndpoint + "/servers");
     get.addHeader("Content-Type", "application/json");
     get.addHeader("Accept", "application/json");
     CloseableHttpClient httpclient = HttpClients.createDefault();
     CloseableHttpResponse response;
-    
+
     try {
       response = httpclient.execute(get);
       HttpEntity entity = response.getEntity();
@@ -541,18 +472,18 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       while ((line = reader.readLine()) != null) {
         str.append(line);
       }
-      
+
       //validate the satus code
       assertEquals(response.getStatusLine().getStatusCode(), 200);
-      
-      if(response.getStatusLine().getStatusCode() == 200) {
+
+      if (response.getStatusLine().getStatusCode() == 200) {
         JSONArray jsonArray = new JSONArray(str.toString());
-        
+
         //verify total number of REST service endpoints in DS
         assertEquals(jsonArray.length(), 2);
       }
-      
-    } catch (ClientProtocolException e) { 
+
+    } catch (ClientProtocolException e) {
       e.printStackTrace();
       fail(" Rest Request should not have thrown ClientProtocolException!");
     } catch (IOException e) {
@@ -562,26 +493,26 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       e.printStackTrace();
       fail(" Rest Request should not have thrown  JSONException!");
     }
-    
+
   }
-  
-  public static void doGetsUsingRestApis(String restEndpoint) {
-    
+
+  public void doGetsUsingRestApis(String restEndpoint) {
+
     //HttpHeaders headers = setAcceptAndContentTypeHeaders(); 
     String currentOperation = null;
     JSONObject jObject;
     JSONArray jArray;
-    try {    
+    try {
       //1. Get on key="1" and validate result.
       {
         currentOperation = "GET on key 1";
-        
+
         HttpGet get = new HttpGet(restEndpoint + "/People/1");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-        
+
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -591,27 +522,26 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-        
+
         jObject = new JSONObject(str.toString());
-      
+
         assertEquals(jObject.get("id"), 101);
         assertEquals(jObject.get("firstName"), "Mithali");
         assertEquals(jObject.get("middleName"), "Dorai");
         assertEquals(jObject.get("lastName"), "Raj");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-      
+
       //2. Get on key="16" and validate result.
       {
         currentOperation = "GET on key 16";
 
-        
         HttpGet get = new HttpGet(restEndpoint + "/People/16");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-        
+
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -621,17 +551,16 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-        
+
         jObject = new JSONObject(str.toString());
-        
-      
+
         assertEquals(jObject.get("id"), 104);
         assertEquals(jObject.get("firstName"), "Shila");
         assertEquals(jObject.get("middleName"), "kumari");
         assertEquals(jObject.get("lastName"), "Dixit");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-      
+
       //3. Get all (getAll) entries in Region
       {
 
@@ -642,7 +571,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse result = httpclient.execute(get);
         assertEquals(result.getStatusLine().getStatusCode(), 200);
         assertNotNull(result.getEntity());
-      
+
         HttpEntity entity = result.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -653,16 +582,16 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         result.close();
-        
+
         try {
           jObject = new JSONObject(sb.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
         }
       }
-      
+
       //4. GetAll?limit=10 (10 entries) and verify results
       {
         HttpGet get = new HttpGet(restEndpoint + "/People?limit=10");
@@ -672,7 +601,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-        
+
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -682,19 +611,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-        
+
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 10);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
         }
       }
-      
+
       //5. Get keys - List all keys in region
-      {  
-        
+      {
+
         HttpGet get = new HttpGet(restEndpoint + "/People/keys");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -702,7 +631,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-        
+
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -712,19 +641,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-        
+
         try {
           jObject = new JSONObject(str.toString());
-          jArray = jObject.getJSONArray("keys"); 
+          jArray = jObject.getJSONArray("keys");
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
         }
-      } 
-      
+      }
+
       //6. Get data for specific keys
-      {  
-       
+      {
+
         HttpGet get = new HttpGet(restEndpoint + "/People/1,3,5,7,9,11");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -732,7 +661,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-        
+
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -742,53 +671,44 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-        
+
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 6);
-          
+
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
         }
-      } 
-    }catch ( Exception e ) {
-      throw new RuntimeException("unexpected exception", e); 
+      }
+    } catch (Exception e) {
+      throw new RuntimeException("unexpected exception", e);
     }
   }
 
-  public static void createRegionInClientCache() {
+  public void createRegionInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     ClientRegionFactory<String, Object> crf = cache
         .createClientRegionFactory(ClientRegionShortcut.PROXY);
-    Region<String, Object> region = crf.create(PEOPLE_REGION_NAME);
-
-  }
-
-  public static void createRegionInManager() {
-    Cache cache = GemFireCacheImpl.getInstance();
-    assertNotNull(cache);
-
-    RegionFactory<String, Object> rf = cache
-        .createRegionFactory(RegionShortcut.REPLICATE);
-    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
+    crf.create(PEOPLE_REGION_NAME);
   }
 
-  public static void createRegionInPeerServer() {
+  public void createRegion() {
     Cache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
 
-    RegionFactory<String, Object> rf = cache
+    RegionFactory<String, Object> regionFactory = cache
         .createRegionFactory(RegionShortcut.REPLICATE);
-    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
+    regionFactory.create(PEOPLE_REGION_NAME);
   }
 
   /**
-   * InterOps Test between REST-client, Peer Cache Client and Client Cache 
+   * InterOps Test between REST-client, Peer Cache Client and Client Cache
+   *
    * @throws Exception
    */
- 
+
   public void testInterOpsWithReplicatedRegion() throws Exception {
 
     final Host host = Host.getHost(0);
@@ -799,47 +719,46 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
     // start locator
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    
-    startLocatorInVM(locator, locatorPort, "");
-    
+
+    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
+
     // find locators
     String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort
         + "]";
 
     // start manager (peer cache)
-    int managerPort = startManagerInVM(manager,/* groups */null, locators,
-        new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE);
-    
+    manager.invoke("Start manager", () -> startManager(null, locators,
+        new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE));
+
     //start startCacheServer With RestService enabled
-    String restEndpoint = (String)server.invoke(RestAPIsAndInterOpsDUnitTest.class,
-        "startBridgeServerWithRestServiceOnInVM", new Object[] { server ,  null, locators, new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE });
-    
+    String restEndpoint = (String) server.invoke(RestAPIsAndInterOpsDUnitTest.class,
+        "startBridgeServerWithRestServiceOnInVM", new Object[] { server, null, locators, new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE });
+
     // create a client cache
-    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()),
-        locatorPort);
-    
+    client.invoke("Create Client", () -> createClientCache(NetworkUtils.getServerHostName(locator.getHost()), locatorPort));
+
     // create region in Manager, peer cache and Client cache nodes
-    manager.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInManager());
-    server.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInPeerServer());
-    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInClientCache());
-    
+    manager.invoke("create region", () -> createRegion());
+    server.invoke("create region", () -> createRegion());
+    client.invoke("create region", () -> createRegionInClientCache());
+
     // do some person puts from clientcache
-    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.doPutsInClientCache());
+    client.invoke("doPutsInClientCache", () -> doPutsInClientCache());
 
     //TEST: fetch all available REST endpoints
-    RestAPIsAndInterOpsDUnitTest.fetchRestServerEndpoints(restEndpoint);
-   
+    fetchRestServerEndpoints(restEndpoint);
+
     // Controller VM - config REST Client and make HTTP calls
-    RestAPIsAndInterOpsDUnitTest.doGetsUsingRestApis(restEndpoint);
-    
+    doGetsUsingRestApis(restEndpoint);
+
     //update Data using REST APIs
-    RestAPIsAndInterOpsDUnitTest.doUpdatesUsingRestApis(restEndpoint);
-    
-    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.verifyUpdatesInClientCache());
+    doUpdatesUsingRestApis(restEndpoint);
+
+    client.invoke("verifyUpdatesInClientCache", () -> verifyUpdatesInClientCache());
 
     //Querying
-    RestAPIsAndInterOpsDUnitTest.doQueryOpsUsingRestApis(restEndpoint);
-    
+    doQueryOpsUsingRestApis(restEndpoint);
+
     // stop the client and make sure the bridge server notifies
     // stopBridgeMemberVM(client);
     helper.closeCache(locator);
@@ -849,66 +768,44 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   }
 
-  private void createClientCacheInVM(VM vm, final String host, final int port) throws Exception {
-    SerializableRunnable connect = new SerializableRunnable(
-        "Start Cache client") {
-      public void run() {
-        // Connect using the GemFire locator and create a Caching_Proxy cache
-        ClientCache c = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port)
-            .create();
-       
-        Region r = c.createClientRegionFactory(
-            ClientRegionShortcut.PROXY).create(REGION_NAME);
-      }
-    };
+  private void createClientCache(final String host, final int port) throws Exception {
+    // Connect using the GemFire locator and create a Caching_Proxy cache
+    ClientCache cache = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port).create();
+    cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+  }
+
+  private int startManager(final String[] groups,
+      final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException {
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
 
-    if (vm == null) {
-      connect.run();
-    } else {
-      vm.invoke(connect);
+    props.setProperty("jmx-manager", "true");
+    props.setProperty("jmx-manager-start", "true");
+    props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
+
+    final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    //Set REST service related configuration
+    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    AttributesFactory factory = new AttributesFactory();
+
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attrs = factory.create();
+    for (int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
     }
-  }
+    CacheServer server = cache.addCacheServer();
+    server.setPort(0);
+    server.setGroups(groups);
+    server.setLoadProbe(probe);
+    server.start();
 
-  private int startManagerInVM(VM vm, final String[] groups,
-      final String locators, final String[] regions, final ServerLoadProbe probe) {
-    SerializableCallable connect = new SerializableCallable("Start Manager ") {
-      public Object call() throws IOException {
-        Properties props = new Properties();
-        props
-            .setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-        props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-
-        props.setProperty("jmx-manager", "true");
-        props.setProperty("jmx-manager-start", "true");
-        props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
-        
-        final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
-        //Set REST service related configuration
-        props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
-        props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
-        props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
-
-        DistributedSystem ds = getSystem(props);
-        Cache cache = CacheFactory.create(ds);
-        AttributesFactory factory = new AttributesFactory();
-        
-        factory.setEnableBridgeConflation(true);
-        factory.setDataPolicy(DataPolicy.REPLICATE);
-        RegionAttributes attrs = factory.create();
-        for (int i = 0; i < regions.length; i++) {
-          cache.createRegion(regions[i], attrs);
-        }
-        CacheServer server = cache.addCacheServer();
-        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-        server.setPort(serverPort);
-        server.setGroups(groups);
-        server.setLoadProbe(probe);
-        server.start();
-        
-        return new Integer(serverPort);
-      }
-    };
-    Integer port = (Integer) vm.invoke(connect);
-    return port.intValue();
+    return new Integer(server.getPort());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
index 61e0925..a567700 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
@@ -39,9 +39,9 @@ public class RestAPIsOnGroupsFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void setupCacheWithGroupsAndFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, "g0,gm")));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, "g1")));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, "g0,g1")));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), "g0,gm")));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), "g1")));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), "g0,g1")));
 
     vm0.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));
     vm1.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
index ca01830..fd6b312 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
@@ -44,7 +44,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     @Override
     public void execute(FunctionContext context) {
 
-      LogWriterUtils.getLogWriter().fine("SWAP:1:executing OnMembersFunction:" + invocationCount);
+      System.out.println("SWAP:1:executing OnMembersFunction:" + invocationCount);
       invocationCount++;
 
       context.getResultSender().lastResult(Boolean.TRUE);
@@ -71,15 +71,14 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     }
   }
 
-  private String createCacheAndRegisterFunction(VM vm, String memberName) {
-    final String hostName = vm.getHost().getHostName();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+  private String createCacheAndRegisterFunction(String hostName, String memberName) {
+    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.NAME_NAME, memberName);
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
 
     Cache c = null;
     try {
@@ -91,7 +90,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     c = CacheFactory.create(new RestAPIsOnMembersFunctionExecutionDUnitTest("temp").getSystem(props));
     FunctionService.registerFunction(new OnMembersFunction());
 
-    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
     return restEndPoint;
 
   }
@@ -115,10 +114,10 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void createCacheForVMs() {
-    restURLs.add(vm0.invoke(() -> createCacheAndRegisterFunction(vm0, "m1")));
-    restURLs.add(vm1.invoke(() -> createCacheAndRegisterFunction(vm1, "m2")));
-    restURLs.add(vm2.invoke(() -> createCacheAndRegisterFunction(vm2, "m3")));
-    restURLs.add(vm3.invoke(() -> createCacheAndRegisterFunction(vm3, "m4")));
+    restURLs.add(vm0.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm0.getHost().getHostName(), "m1")));
+    restURLs.add(vm1.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm1.getHost().getHostName(), "m2")));
+    restURLs.add(vm2.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm2.getHost().getHostName(), "m3")));
+    restURLs.add(vm3.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm3.getHost().getHostName(), "m4")));
   }
 
   public void testFunctionExecutionEOnSelectedMembers() {


[27/49] incubator-geode git commit: GEODE-493 CI failure: PartitionedRegionSingleHopDUnitTest.test_MetadataContents GEODE-699 PartitionedRegionSingleHopDUnitTest.test_MetadataServiceCallAccuracy

Posted by kl...@apache.org.
GEODE-493 CI failure:
PartitionedRegionSingleHopDUnitTest.test_MetadataContents
GEODE-699
PartitionedRegionSingleHopDUnitTest.test_MetadataServiceCallAccuracy

Add a counter fetchTaskCount in ClientMetadataService to count the
number fetch task threads. Make sure the counter is increased before a
fetch task thread is scheduled. And decrease the counter when a thread
is done.

In the test, use Awaitility to make all fetch tasks threads are
completed, i.e. fetchTaskCount == 0, before the next step.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/92805bbb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/92805bbb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/92805bbb

Branch: refs/heads/feature/GEODE-835-test
Commit: 92805bbb97fb1bc62db906f61f89ba71ec66f2da
Parents: 08ef0c1
Author: Jianxia Chen <jc...@pivotal.io>
Authored: Sat May 14 15:59:32 2016 -0700
Committer: Jianxia Chen <jc...@pivotal.io>
Committed: Sat May 14 15:59:32 2016 -0700

----------------------------------------------------------------------
 .../client/internal/ClientMetadataService.java  | 31 ++++++++++++++++++--
 .../PartitionedRegionSingleHopDUnitTest.java    |  8 +++--
 2 files changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92805bbb/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ClientMetadataService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ClientMetadataService.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ClientMetadataService.java
index ed26708..60318b0 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ClientMetadataService.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/ClientMetadataService.java
@@ -72,7 +72,13 @@ public final class ClientMetadataService {
   /** random number generator used in pruning */
   private final Random rand = new Random();
   
-  private volatile boolean isMetadataStable = true; 
+  private volatile boolean isMetadataStable = true;
+
+  private boolean isMetadataRefreshed_TEST_ONLY = false;
+  
+  private int fetchTaskCount = 0;
+  
+  private final Object fetchTaskCountLock = new Object();
   
   public ClientMetadataService(Cache cache) {
     this.cache = cache;
@@ -528,6 +534,9 @@ public final class ClientMetadataService {
       }
     }
     else {
+      synchronized (fetchTaskCountLock){
+        fetchTaskCount++;
+      }
       Runnable fetchTask = new Runnable() {
         @SuppressWarnings("synthetic-access")
         public void run() {
@@ -544,6 +553,11 @@ public final class ClientMetadataService {
               logger.debug("An exception occurred while fetching metadata", e);
             }
           }
+          finally {
+            synchronized (fetchTaskCountLock){
+              fetchTaskCount--;
+            }
+          }
         }
       };
       SingleHopClientExecutor.submitTask(fetchTask);
@@ -630,6 +644,9 @@ public final class ClientMetadataService {
         }
       }
     } else {
+      synchronized (fetchTaskCountLock){
+        fetchTaskCount++;
+      }
       Runnable fetchTask = new Runnable() {
         @SuppressWarnings("synthetic-access")
         public void run() {
@@ -644,6 +661,11 @@ public final class ClientMetadataService {
               logger.debug("An exception occurred while fetching metadata", e);
             }
           }
+          finally {
+            synchronized (fetchTaskCountLock){
+              fetchTaskCount--;
+            }
+          }
         }
       };
       SingleHopClientExecutor.submitTask(fetchTask);
@@ -841,6 +863,9 @@ public final class ClientMetadataService {
     this.isMetadataStable = isMetadataStable;
   }
 
-  private boolean isMetadataRefreshed_TEST_ONLY = false;
-
+  public int getFetchTaskCount() {
+    synchronized(fetchTaskCountLock) {
+      return fetchTaskCount;
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/92805bbb/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
index f79d6c6..65cc7eb 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
@@ -342,7 +342,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
   // Put data, get data and make the metadata stable.
   // Now verify that metadata has all 8 buckets info.
   // Now update and ensure the fetch service is never called.
-  @Category(FlakyTest.class) // GEODE-493: random ports, waitForCriterions
   public void test_MetadataContents() {
     Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
     Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -368,7 +367,6 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
   // once,
   // fetchservice has to be triggered.
   // Now put again from c2.There should be no hop at all.
-  @Category(FlakyTest.class) // GEODE-699: random ports, async actions, time sensitive
   public void test_MetadataServiceCallAccuracy() {
     Integer port0 = (Integer)member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
     Integer port1 = (Integer)member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServer( 1, 4 ));
@@ -391,6 +389,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
 
     Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.isRefreshMetadataTestOnly() == true);
 
+    //make sure all fetch tasks are completed
+    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.getFetchTaskCount() == 0);
+
     cms.satisfyRefreshMetadata_TEST_ONLY(false);
     region.put(new Integer(0), "create0");
     region.put(new Integer(1), "create1");
@@ -1973,6 +1974,9 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
 
   private void verifyMetadata() {
     ClientMetadataService cms = ((GemFireCacheImpl)cache).getClientMetadataService();
+    //make sure all fetch tasks are completed
+    Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> cms.getFetchTaskCount() == 0);
+
     final Map<String, ClientPartitionAdvisor> regionMetaData = cms
         .getClientPRMetadata_TEST_ONLY();
     Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> (regionMetaData.size() == 4));


[05/49] incubator-geode git commit: GEODE-1327 Now parent thread process copy of unresponsive members

Posted by kl...@apache.org.
GEODE-1327 Now parent thread process copy of unresponsive members


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/89b91cbe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/89b91cbe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/89b91cbe

Branch: refs/heads/feature/GEODE-835-test
Commit: 89b91cbe51c04a8b1867a608757585c832006639
Parents: 2c2caae
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Thu May 12 12:49:34 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Thu May 12 12:53:40 2016 -0700

----------------------------------------------------------------------
 .../internal/membership/gms/membership/GMSJoinLeave.java       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/89b91cbe/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 41ec1ea..e12740e 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -2191,7 +2191,11 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
         unresponsive.removeAll(removalReqs);
         unresponsive.removeAll(leaveReqs);
         if (!unresponsive.isEmpty()) {
-          removeHealthyMembers(unresponsive);          
+          removeHealthyMembers(unresponsive);
+          synchronized (viewRequests) {
+            //now lets get copy of it in viewRequests sync, as other thread might be accessing it 
+            unresponsive = new HashSet<>(unresponsive);
+          }
         }
 
         logger.debug("unresponsive members that could not be reached: {}", unresponsive);


[47/49] incubator-geode git commit: GEODE-1391 Update javadocs for JSONFormatter

Posted by kl...@apache.org.
GEODE-1391 Update javadocs for JSONFormatter


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b3d9061e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b3d9061e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b3d9061e

Branch: refs/heads/feature/GEODE-835-test
Commit: b3d9061eaf0b95f6c548c4201c403811a0a2290d
Parents: b1ff33d
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Mon May 16 09:33:36 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Wed May 18 09:36:14 2016 -0700

----------------------------------------------------------------------
 .../com/gemstone/gemfire/pdx/JSONFormatter.java | 45 +++++++++++---------
 1 file changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b3d9061e/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java b/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
index d929cf6..b9b6329 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
@@ -17,8 +17,8 @@
 package com.gemstone.gemfire.pdx;
 
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.math.BigInteger;
-
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.JsonParser;
@@ -32,20 +32,27 @@ import com.gemstone.gemfire.pdx.internal.json.PdxToJSON;
 
 
 /**
- * PdxFormatter class has static methods to convert JSON document into {@link PdxInstance}
- * and methods to convert back {@link PdxInstance} into JSON Document.
+ * PdxFormatter class has static method {@link JSONFormatter#fromJSON(String)} to convert JSON 
+ * document into a {@link PdxInstance} and static method {@link JSONFormatter#toJSON(PdxInstance)} 
+ * to convert back {@link PdxInstance} into a JSON Document.
  * 
- * Using this, application can put json document in gemfire cache. Application can define indexes 
- * on PdxInsatnce and then query those using OQL. Query will return the PdxInstances as results,
- * that needs to convert back into JSON document. 
+ * Using this, application can put PdxInstance(a converted JSON document) in a geode cache. 
+ * Application can define indexes on PdxInstance and then query those using OQL. Query will 
+ * return the PdxInstances as a result, that needs to convert back into JSON document. 
  * 
  * This uses Jackson parser to parse the json document. Parser treats values in json document as 
  * number(byte, short, int, long..), string, array, object, 'true', 'false' or 'null'. Which
- * further treated as corresponding java types in PdxInstance
+ * further treated as following java types in PdxInstance
  * 
- * JSON objects are converted into PdxInstance
- * JSON arrays are converted into List.
- *  
+ * JSON object is converted into {@link PdxInstance}
+ * JSON arrays is converted into {@link java.util.LinkedList}
+ * JSON BigDecimal is converted into {@link BigDecimal}
+ * JSON BigInterger is converted into {@link BigInteger}
+ * JSON Double is converted into java primitive double
+ * JSON float is converted into java primitive float 
+ * JSON boolean is converted into java primitive boolean
+ * JSON Integer is converted based on its range to java byte, short or int.
+ * JSON null is converted java null object.
  */
 
 public class JSONFormatter {
@@ -220,7 +227,7 @@ public class JSONFormatter {
         case VALUE_NULL :
         {
           //write null
-          nullfound(currentState);
+          nullFound(currentState);
           currentState = states.SCALER_FOUND;
           currentPdxInstance.addNullField(currentFieldName);
           currentFieldName = null;
@@ -229,7 +236,7 @@ public class JSONFormatter {
         case VALUE_NUMBER_FLOAT:
         {
           //write double/float
-          doublefound(currentState);
+          doubleFound(currentState);
           currentState = states.SCALER_FOUND;
           //currentPdxInstance.addDoubleField(currentFieldName, jp.getDoubleValue());
           setNumberField(jp, currentPdxInstance, currentFieldName);
@@ -239,7 +246,7 @@ public class JSONFormatter {
         case VALUE_NUMBER_INT:
         {
          //write int
-          doublefound(currentState);
+          intFound(currentState);
           currentState = states.SCALER_FOUND;
           //currentPdxInstance.addIntField(currentFieldName, jp.getIntValue());
           setNumberField(jp, currentPdxInstance, currentFieldName);
@@ -249,7 +256,7 @@ public class JSONFormatter {
         case VALUE_STRING:
         {
           //write string
-          doublefound(currentState);
+          stringFound(currentState);
           currentState = states.SCALER_FOUND;
           currentPdxInstance.addStringField(currentFieldName, new String(jp.getText()));
           currentFieldName = null;
@@ -431,7 +438,7 @@ public class JSONFormatter {
         case VALUE_NULL :
         {
           //write null
-          nullfound(currentState);
+          nullFound(currentState);
           currentState = states.SCALER_FOUND;
           currentPdxList.addNullField(null);          
           break;
@@ -439,7 +446,7 @@ public class JSONFormatter {
         case VALUE_NUMBER_FLOAT:
         {
           //write double/float
-          doublefound(currentState);
+          doubleFound(currentState);
           currentState = states.SCALER_FOUND;
           //currentPdxList.addDoubleField(jp.getDoubleValue());
           setNumberField(jp,currentPdxList);
@@ -448,7 +455,7 @@ public class JSONFormatter {
         case VALUE_NUMBER_INT:
         {
          //write int
-          doublefound(currentState);
+          intFound(currentState);
           currentState = states.SCALER_FOUND;
          // currentPdxList.addIntField(jp.getIntValue());
           setNumberField(jp,currentPdxList);
@@ -590,7 +597,7 @@ public class JSONFormatter {
     }
   }
   
-  private boolean doublefound(states currentState)
+  private boolean doubleFound(states currentState)
   {
     switch(currentState)
     {
@@ -622,7 +629,7 @@ public class JSONFormatter {
     }
   }
   
-  private boolean nullfound(states currentState)
+  private boolean nullFound(states currentState)
   {
     switch(currentState)
     {


[46/49] incubator-geode git commit: GEODE-1133 SeparateClassloaderTestRunner has to be re-implemented

Posted by kl...@apache.org.
GEODE-1133 SeparateClassloaderTestRunner has to be re-implemented

Remove SeparateClassloaderTestRunner since it is not used


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b1ff33dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b1ff33dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b1ff33dd

Branch: refs/heads/feature/GEODE-835-test
Commit: b1ff33dd6e5a095bf3b0ca4f3791f2e651676db8
Parents: 00c794b
Author: Jianxia Chen <jc...@pivotal.io>
Authored: Wed May 18 09:02:26 2016 -0700
Committer: Jianxia Chen <jc...@pivotal.io>
Committed: Wed May 18 09:02:26 2016 -0700

----------------------------------------------------------------------
 .../junit/SeparateClassloaderTestRunner.java    | 56 --------------------
 1 file changed, 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b1ff33dd/extensions/geode-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java b/extensions/geode-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
deleted file mode 100644
index 4337f5a..0000000
--- a/extensions/geode-modules-session/src/test/java/com/gemstone/gemfire/modules/session/junit/SeparateClassloaderTestRunner.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package com.gemstone.gemfire.modules.session.junit;
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.InitializationError;
-
-import java.net.URLClassLoader;
-
-/**
- * @author StackOverflow
- */
-public class SeparateClassloaderTestRunner extends BlockJUnit4ClassRunner {
-
-  public SeparateClassloaderTestRunner(Class<?> clazz) throws InitializationError {
-    super(getFromTestClassloader(clazz));
-  }
-
-  private static Class<?> getFromTestClassloader(Class<?> clazz) throws InitializationError {
-    try {
-      ClassLoader testClassLoader = new TestClassLoader();
-      return Class.forName(clazz.getName(), true, testClassLoader);
-    } catch (ClassNotFoundException e) {
-      throw new InitializationError(e);
-    }
-  }
-
-  public static class TestClassLoader extends URLClassLoader {
-    public TestClassLoader() {
-      super(((URLClassLoader)getSystemClassLoader()).getURLs());
-    }
-
-    @Override
-    public Class<?> loadClass(String name) throws ClassNotFoundException {
-      if (name.startsWith("com.gemstone.gemfire.modules.session.")) {
-        return super.findClass(name);
-      }
-      return super.loadClass(name);
-    }
-  }
-}


[19/49] incubator-geode git commit: Revert "GEODE-1376: Cleaned up server port to be '0'."

Posted by kl...@apache.org.
Revert "GEODE-1376: Cleaned up server port to be '0'."

This reverts commit c33efb60630fe8bed7613c60f941810a7574f16b, which caused
a number of REST test failures in build 467 due to removal/rename of
test methods.

https://builds.apache.org/job/Geode-nightly/467/testReport/


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d1a0748b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d1a0748b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d1a0748b

Branch: refs/heads/feature/GEODE-835-test
Commit: d1a0748baf43c5cb5b2af46411d65d77778d1012
Parents: a881e9c
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Fri May 13 10:29:28 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Fri May 13 10:50:11 2016 -0700

----------------------------------------------------------------------
 ...stAPIOnRegionFunctionExecutionDUnitTest.java |  77 ++-
 .../web/controllers/RestAPITestBase.java        |  16 +-
 .../RestAPIsAndInterOpsDUnitTest.java           | 501 +++++++++++--------
 ...tAPIsOnGroupsFunctionExecutionDUnitTest.java |   6 +-
 ...APIsOnMembersFunctionExecutionDUnitTest.java |  19 +-
 .../controllers/RestAPIsWithSSLDUnitTest.java   | 495 +++++++++++-------
 .../internal/AutoConnectionSourceDUnitTest.java | 345 ++++++-------
 .../AutoConnectionSourceImplJUnitTest.java      |   5 +
 .../internal/LocatorLoadBalancingDUnitTest.java | 439 +++++++++-------
 .../cache/client/internal/LocatorTestBase.java  | 396 +++++++++------
 .../internal/cache/Bug47667DUnitTest.java       |  24 +-
 .../CacheServerManagementDUnitTest.java         | 260 ++++++----
 12 files changed, 1500 insertions(+), 1083 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
index dc3986b..fedd119 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIOnRegionFunctionExecutionDUnitTest.java
@@ -36,7 +36,6 @@ import java.util.*;
 
 /**
  * Dunit Test to validate OnRegion function execution with REST APIs
- *
  * @since 8.0
  */
 
@@ -59,22 +58,22 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
       if (context instanceof RegionFunctionContext) {
         RegionFunctionContext rfContext = (RegionFunctionContext) context;
         rfContext.getDataSet().getCache().getLogger()
-            .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
+                .info("Executing function :  SampleFunction.execute(hasResult=true) with filter: " + rfContext.getFilter() + "  " + rfContext);
         if (rfContext.getArguments() instanceof Boolean) {
           /* return rfContext.getArguments(); */
           if (hasResult()) {
             rfContext.getResultSender().lastResult(
-                (Serializable) rfContext.getArguments());
+                    (Serializable) rfContext.getArguments());
           } else {
             rfContext
-                .getDataSet()
-                .getCache()
-                .getLogger()
-                .info(
-                    "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
+                    .getDataSet()
+                    .getCache()
+                    .getLogger()
+                    .info(
+                            "Executing function :  SampleFunction.execute(hasResult=false) " + rfContext);
             while (true && !rfContext.getDataSet().isDestroyed()) {
               rfContext.getDataSet().getCache().getLogger()
-                  .info("For Bug43513 ");
+                      .info("For Bug43513 ");
               try {
                 Thread.sleep(100);
               } catch (InterruptedException ie) {
@@ -91,7 +90,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
               Thread.sleep(2000);
             } catch (InterruptedException e) {
               rfContext.getDataSet().getCache().getLogger()
-                  .warning("Got Exception : Thread Interrupted" + e);
+                      .warning("Got Exception : Thread Interrupted" + e);
             }
           }
           if (PartitionRegionHelper.isPartitionedRegion(rfContext.getDataSet())) {
@@ -101,11 +100,11 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
              * rfContext).get(key);
              */
             rfContext.getResultSender().lastResult(
-                (Serializable) PartitionRegionHelper.getLocalDataForContext(
-                    rfContext).get(key));
+                    (Serializable) PartitionRegionHelper.getLocalDataForContext(
+                            rfContext).get(key));
           } else {
             rfContext.getResultSender().lastResult(
-                (Serializable) rfContext.getDataSet().get(key));
+                    (Serializable) rfContext.getDataSet().get(key));
           }
           /* return (Serializable)rfContext.getDataSet().get(key); */
         } else if (rfContext.getArguments() instanceof Set) {
@@ -113,7 +112,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           ArrayList vals = new ArrayList();
           for (Object key : origKeys) {
             Object val = PartitionRegionHelper
-                .getLocalDataForContext(rfContext).get(key);
+                    .getLocalDataForContext(rfContext).get(key);
             if (val != null) {
               vals.add(val);
             }
@@ -137,10 +136,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
           DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
           LogWriter logger = ds.getLogWriter();
           logger.info("Executing in SampleFunction on Server : "
-              + ds.getDistributedMember() + "with Context : " + context);
+                  + ds.getDistributedMember() + "with Context : " + context);
           while (ds.isConnected()) {
             logger
-                .fine("Just executing function in infinite loop for Bug43513");
+                    .fine("Just executing function in infinite loop for Bug43513");
             try {
               Thread.sleep(250);
             } catch (InterruptedException e) {
@@ -183,7 +182,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
   private boolean createPeerWithPR() {
     RegionAttributes ra = PartitionedRegionTestHelper.createRegionAttrsForPR(0,
-        10);
+            10);
     AttributesFactory raf = new AttributesFactory(ra);
     PartitionAttributesImpl pa = new PartitionAttributesImpl();
     pa.setAll(ra.getPartitionAttributes());
@@ -232,10 +231,10 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
   }
 
   private void createCacheAndRegisterFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), null)));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), null)));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), null)));
-    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3.getHost().getHostName(), null)));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, null)));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, null)));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, null)));
+    restURLs.add(vm3.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm3, null)));
 
     vm0.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
     vm1.invoke("registerFunction(new SampleFunction())", () -> FunctionService.registerFunction(new SampleFunction()));
@@ -284,7 +283,7 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion", () -> populatePRRegion());
+    vm3.invoke("populatePRRegion",() -> populatePRRegion());
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", null, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -306,16 +305,16 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
 
     createPeersWithPR(vm0, vm1, vm2, vm3);
 
-    vm3.invoke("populatePRRegion", () -> populatePRRegion());
+    vm3.invoke("populatePRRegion",() -> populatePRRegion());
 
     String jsonBody = "["
-        + "{\"@type\": \"double\",\"@value\": 210}"
-        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-        + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
-        + "\"quantity\":\"2\","
-        + "\"unitprice\":\"5\","
-        + "\"totalprice\":\"10.00\"}"
-        + "]";
+            + "{\"@type\": \"double\",\"@value\": 210}"
+            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+            + "\"itemNo\":\"599\",\"description\":\"Part X Free on Bumper Offer\","
+            + "\"quantity\":\"2\","
+            + "\"unitprice\":\"5\","
+            + "\"totalprice\":\"10.00\"}"
+            + "]";
 
     CloseableHttpResponse response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, null, jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());
@@ -325,15 +324,15 @@ public class RestAPIOnRegionFunctionExecutionDUnitTest extends RestAPITestBase {
     assertCorrectInvocationCount(4, vm0, vm1, vm2, vm3);
 
     jsonBody = "["
-        + "{\"@type\": \"double\",\"@value\": 220}"
-        + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
-        + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
-        + "\"quantity\":\"3\","
-        + "\"unitprice\":\"9\","
-        + "\"totalprice\":\"12.00\"}"
-        + "]";
-
-    resetInvocationCounts(vm0, vm1, vm2, vm3);
+            + "{\"@type\": \"double\",\"@value\": 220}"
+            + ",{\"@type\":\"com.gemstone.gemfire.rest.internal.web.controllers.Item\","
+            + "\"itemNo\":\"609\",\"description\":\"Part X Free on Bumper Offer\","
+            + "\"quantity\":\"3\","
+            + "\"unitprice\":\"9\","
+            + "\"totalprice\":\"12.00\"}"
+            + "]";
+
+    resetInvocationCounts(vm0,vm1,vm2,vm3);
 
     response = executeFunctionThroughRestCall("SampleFunction", PR_REGION_NAME, "key2", jsonBody, null, null);
     assertEquals(200, response.getStatusLine().getStatusCode());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
index 9e8086c..fc71fd8 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPITestBase.java
@@ -66,6 +66,7 @@ public class RestAPITestBase extends DistributedTestCase {
     if (agentUtil.findWarLocation("geode-web-api") == null) {
       fail("unable to locate geode-web-api WAR file");
     }
+    Wait.pause(1000); // TODO: replace this with Awaitility
     final Host host = Host.getHost(0);
     vm0 = host.getVM(0);
     vm1 = host.getVM(1);
@@ -101,10 +102,11 @@ public class RestAPITestBase extends DistributedTestCase {
     }
   }
 
-  public String createCacheWithGroups(final String hostName, final String groups) {
+  public String createCacheWithGroups(VM vm, final String groups) {
     RestAPITestBase test = new RestAPITestBase(getTestMethodName());
 
-    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+    final String hostName = vm.getHost().getHostName();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
 
@@ -114,12 +116,12 @@ public class RestAPITestBase extends DistributedTestCase {
 
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
 
     InternalDistributedSystem ds = test.getSystem(props);
     cache = CacheFactory.create(ds);
 
-    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
     return restEndPoint;
   }
 
@@ -130,7 +132,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
   protected CloseableHttpResponse executeFunctionThroughRestCall(String function, String regionName, String filter, String jsonBody, String groups,
                                                                  String members) {
-    System.out.println("Entering executeFunctionThroughRestCall");
+    LogWriterUtils.getLogWriter().info("Entering executeFunctionThroughRestCall");
     try {
       CloseableHttpClient httpclient = HttpClients.createDefault();
       Random randomGenerator = new Random();
@@ -138,7 +140,7 @@ public class RestAPITestBase extends DistributedTestCase {
 
       HttpPost post = createHTTPPost(function, regionName, filter, restURLIndex, groups, members, jsonBody);
 
-      System.out.println("Request: POST " + post.toString());
+      LogWriterUtils.getLogWriter().info("Request: POST " + post.toString());
       return httpclient.execute(post);
     } catch (Exception e) {
       throw new RuntimeException("unexpected exception", e);
@@ -183,7 +185,7 @@ public class RestAPITestBase extends DistributedTestCase {
     try {
       String httpResponseString = processHttpResponse(response);
       response.close();
-      System.out.println("Response : " + httpResponseString);
+      LogWriterUtils.getLogWriter().info("Response : " + httpResponseString);
       //verify function execution result
       JSONArray resultArray = new JSONArray(httpResponseString);
       assertEquals(resultArray.length(), expectedServerResponses);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
index 0f4b2d3..5b0eb17 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsAndInterOpsDUnitTest.java
@@ -16,7 +16,38 @@
  */
 package com.gemstone.gemfire.rest.internal.web.controllers;
 
-import com.gemstone.gemfire.cache.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
@@ -33,31 +64,17 @@ import com.gemstone.gemfire.management.ManagementTestBase;
 import com.gemstone.gemfire.pdx.PdxInstance;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.*;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.*;
 
 /**
  * Dunit Test containing inter - operations between REST Client and Gemfire cache client
- *
  * @since 8.0
  */
 
 public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
-
+  
   private static final long serialVersionUID = -254776154266339226L;
 
   private ManagementTestBase helper;
@@ -72,7 +89,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   private static final String[] PARAM_QUERY_IDS_ARRAY = { "findAllPeople",
       "filterByGender", "filterByLastName" };
-
+  
   final static String QUERY_ARGS = "["
       + "{"
       + "\"@type\": \"string\","
@@ -81,29 +98,29 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       + "]";
 
   final static String PERSON_AS_JSON_CAS = "{"
-      + "\"@old\" :"
+      + "\"@old\" :" 
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 101," + " \"firstName\": \"Mithali\","
       + " \"middleName\": \"Dorai\"," + " \"lastName\": \"Raj\","
-      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\""
+      + " \"birthDate\": \"12/04/1982\"," + "\"gender\": \"FEMALE\"" 
       + "},"
-      + "\"@new\" :"
+      + "\"@new\" :" 
       + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 1101," + " \"firstName\": \"Virat\","
       + " \"middleName\": \"Premkumar\"," + " \"lastName\": \"Kohli\","
-      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\""
+      + " \"birthDate\": \"08/11/1988\"," + "\"gender\": \"MALE\"" 
       + "}"
       + "}";
-
+    
   final static String PERSON_AS_JSON_REPLACE = "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 501," + " \"firstName\": \"Barack\","
       + " \"middleName\": \"Hussein\"," + " \"lastName\": \"Obama\","
-      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\""
+      + " \"birthDate\": \"04/08/1961\"," + "\"gender\": \"MALE\"" 
       + "}";
-
+  
   private static final String PERSON_LIST_AS_JSON = "[" + "{"
       + "\"@type\": \"com.gemstone.gemfire.rest.internal.web.controllers.Person\","
       + "\"id\": 3," + " \"firstName\": \"Nishka3\","
@@ -161,38 +178,86 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
   protected final void postTearDownLocatorTestBase() throws Exception {
     disconnectAllFromDS();
   }
-
-  public void doPutsInClientCache() {
+  
+  public static String startBridgeServerWithRestServiceOnInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+    
+    final String hostName = vm.getHost().getHostName(); 
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    
+    //create Cache of given VM and start HTTP service with REST APIs service
+    new RestAPIsAndInterOpsDUnitTest("temp").startBridgeServer(hostName, serverPort, groups, locators, regions, probe);
+   
+    String restEndPoint =  "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+    return restEndPoint;
+  }
+  
+  @SuppressWarnings("deprecation")
+  protected int startBridgeServer(String hostName, int restServicerPort, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
+            
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicerPort));
+    
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    ((GemFireCacheImpl)cache).setReadSerialized(true);
+    AttributesFactory factory = new AttributesFactory();
+    
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attrs = factory.create();
+    for(int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
+    }
+    
+    CacheServer server = cache.addCacheServer();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    server.setPort(serverPort);
+    server.setGroups(groups);
+    server.setLoadProbe(probe);
+    try {
+      server.start();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    remoteObjects.put(CACHE_KEY, cache);
+    return new Integer(serverPort);
+  }
+  
+  public static void doPutsInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-
+   
     //put person object
     final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE);
     final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE);
     final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE);
     final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE);
     final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE);
-
+   
     region.put("1", person1);
     region.put("2", person2);
     region.put("3", person3);
     region.put("4", person4);
     region.put("5", person5);
-
+    
     final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
     final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE);
     final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE);
     final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE);
     final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE);
-
+    
     final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE);
     final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE);
     final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE);
     final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE);
     final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE);
     final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE);
-
+    
     Map<String, Object> userMap = new HashMap<String, Object>();
     userMap.put("6", person6);
     userMap.put("7", person7);
@@ -205,15 +270,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     userMap.put("14", person14);
     userMap.put("15", person15);
     userMap.put("16", person16);
-
+    
     region.putAll(userMap);
-
+    
     if (cache != null)
       cache.getLogger().info("Gemfire Cache Client: Puts successfully done");
-
+    
   }
 
-  public void doQueryOpsUsingRestApis(String restEndpoint) {
+  public static void doQueryOpsUsingRestApis(String restEndpoint) {
     String currentQueryOp = null;
     try {
       // Query TestCase-1 :: Prepare parameterized Queries
@@ -226,7 +291,8 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse createNamedQueryResponse = httpclient.execute(post);
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
-        createNamedQueryResponse.close();
+        createNamedQueryResponse.close();        
+        
 
         post = new HttpPost(restEndpoint + findPeopleByGenderQuery);
         post.addHeader("Content-Type", "application/json");
@@ -235,6 +301,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertEquals(createNamedQueryResponse.getStatusLine().getStatusCode(), 201);
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
+        
 
         post = new HttpPost(restEndpoint + findPeopleByLastNameQuery);
         post.addHeader("Content-Type", "application/json");
@@ -244,7 +311,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         assertNotNull(createNamedQueryResponse.getEntity());
         createNamedQueryResponse.close();
       }
-
+      
       // Query TestCase-2 :: List all parameterized queries
       {
         currentQueryOp = "listAllQueries";
@@ -253,7 +320,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse listAllQueriesResponse = httpclient.execute(get);
         assertEquals(listAllQueriesResponse.getStatusLine().getStatusCode(), 200);
         assertNotNull(listAllQueriesResponse.getEntity());
-
+        
         HttpEntity entity = listAllQueriesResponse.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -264,19 +331,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         listAllQueriesResponse.close();
-
+      
         // Check whether received response contains expected query IDs.
 
         JSONObject jsonObject = new JSONObject(sb.toString());
         JSONArray jsonArray = jsonObject.getJSONArray("queries");
         for (int i = 0; i < jsonArray.length(); i++) {
           assertTrue(
-              "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
-              Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
-                  jsonArray.getJSONObject(i).getString("id")));
+            "PREPARE_PARAMETERIZED_QUERY: function IDs are not matched",
+            Arrays.asList(PARAM_QUERY_IDS_ARRAY).contains(
+                jsonArray.getJSONObject(i).getString("id")));
         }
-      }
-
+      }  
+      
       // Query TestCase-3 :: Run the specified named query passing in scalar values for query parameters.
       {
         currentQueryOp = "filterByLastName";
@@ -284,35 +351,41 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         HttpPost post = new HttpPost(restEndpoint + "/queries/filterByLastName");
         post.addHeader("Content-Type", "application/json");
         post.addHeader("Accept", "application/json");
-        StringEntity entity = new StringEntity(QUERY_ARGS);
+        StringEntity entity = new StringEntity(QUERY_ARGS);       
         post.setEntity(entity);
         CloseableHttpResponse runNamedQueryResponse = httpclient.execute(post);
 
         assertEquals(200, runNamedQueryResponse.getStatusLine().getStatusCode());
         assertNotNull(runNamedQueryResponse.getEntity());
       }
-    } catch (Exception e) {
+    } catch ( Exception e ) {
       throw new RuntimeException("unexpected exception", e);
     }
   }
-
-  public void verifyUpdatesInClientCache() {
+  
+  public static void verifyUpdatesInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
-
+    
     {
-      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE);
+      Person expectedPerson = new Person(3L, "Nishka3", "Nilkanth3", "Patel3", DateTimeUtils.createDate(2009, Calendar.JULY, 31), Gender.FEMALE );
       Object value = region.get("3");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3 = (PdxInstance) value;
+        PdxInstance pi3  = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        comparePersonObject(expectedPerson, actualPerson);
+        assertEquals(actualPerson.getId(), expectedPerson.getId());
+        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
+        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
+        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
+        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
+        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
       } else if (value instanceof Person) {
         fail("VerifyUpdatesInClientCache, Get on key 3, Expected to get value of type PdxInstance ");
       }
     }
-
+     
+    
     //TODO: uncomment it once following issue encountered in put?op=CAS is fixed or document the issue
     // CAS functionality is not working in following test case
     // step-1: Java client, Region.put("K", A);
@@ -331,47 +404,43 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
     */
-
+    
     //verify update on key "2"
     {
-      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE);
+      Person expectedPerson = new Person(501L, "Barack", "Hussein", "Obama", DateTimeUtils.createDate(1961, Calendar.APRIL, 8), Gender.MALE );
       Object value = region.get("2");
       if (value instanceof PdxInstance) {
-        PdxInstance pi3 = (PdxInstance) value;
+        PdxInstance pi3  = (PdxInstance) value;
         Person actualPerson = (Person) pi3.getObject();
-        comparePersonObject(expectedPerson, actualPerson);
-      } else {
+        assertEquals(actualPerson.getId(), expectedPerson.getId());
+        assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
+        assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
+        assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
+        assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
+        assertEquals(actualPerson.getGender(), expectedPerson.getGender());
+      }else {
         fail("VerifyUpdatesInClientCache, Get on key 2, Expected to get value of type PdxInstance ");
       }
     }
-
+    
     //verify Deleted key "13"
     {
       Object obj = region.get("13");
       assertEquals(obj, null);
-
+      
       obj = region.get("14");
       assertEquals(obj, null);
-
+      
       obj = region.get("15");
       assertEquals(obj, null);
-
+      
       obj = region.get("16");
       assertEquals(obj, null);
     }
-
+    
   }
-
-  private void comparePersonObject(Person expectedPerson, Person actualPerson) {
-    assertEquals(actualPerson.getId(), expectedPerson.getId());
-    assertEquals(actualPerson.getFirstName(), expectedPerson.getFirstName());
-    assertEquals(actualPerson.getMiddleName(), expectedPerson.getMiddleName());
-    assertEquals(actualPerson.getLastName(), expectedPerson.getLastName());
-    assertEquals(actualPerson.getBirthDate(), expectedPerson.getBirthDate());
-    assertEquals(actualPerson.getGender(), expectedPerson.getGender());
-  }
-
-  public void doUpdatesUsingRestApis(String restEndpoint) {
+  
+  public static void doUpdatesUsingRestApis(String restEndpoint) {
     //UPdate keys using REST calls
     {
 
@@ -388,7 +457,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //Delete Single keys
     {
       try {
@@ -401,7 +470,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //Delete set of keys
     {
       try {
@@ -414,7 +483,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         throw new RuntimeException("unexpected exception", e);
       }
     }
-
+    
     //REST put?op=CAS for key 1
     /*
     try {   
@@ -430,15 +499,15 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
     }catch (HttpServerErrorException se) {
       fail("Caught HttpServerErrorException while doing put with op=cas");
     }
-    */
-
+    */ 
+    
     //REST put?op=REPLACE for key 2
     {
       /*HttpEntity<Object> entity = new HttpEntity<Object>(PERSON_AS_JSON_REPLACE, headers);
       ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
         restEndpoint + "/People/2?op=replace",
       HttpMethod.PUT, entity, String.class);*/
-
+      
       try {
         CloseableHttpClient httpclient = HttpClients.createDefault();
         HttpPut put = new HttpPut(restEndpoint
@@ -453,14 +522,14 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       }
     }
   }
-
-  public void fetchRestServerEndpoints(String restEndpoint) {
+  
+  public static void fetchRestServerEndpoints(String restEndpoint) {
     HttpGet get = new HttpGet(restEndpoint + "/servers");
     get.addHeader("Content-Type", "application/json");
     get.addHeader("Accept", "application/json");
     CloseableHttpClient httpclient = HttpClients.createDefault();
     CloseableHttpResponse response;
-
+    
     try {
       response = httpclient.execute(get);
       HttpEntity entity = response.getEntity();
@@ -472,18 +541,18 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       while ((line = reader.readLine()) != null) {
         str.append(line);
       }
-
+      
       //validate the satus code
       assertEquals(response.getStatusLine().getStatusCode(), 200);
-
-      if (response.getStatusLine().getStatusCode() == 200) {
+      
+      if(response.getStatusLine().getStatusCode() == 200) {
         JSONArray jsonArray = new JSONArray(str.toString());
-
+        
         //verify total number of REST service endpoints in DS
         assertEquals(jsonArray.length(), 2);
       }
-
-    } catch (ClientProtocolException e) {
+      
+    } catch (ClientProtocolException e) { 
       e.printStackTrace();
       fail(" Rest Request should not have thrown ClientProtocolException!");
     } catch (IOException e) {
@@ -493,26 +562,26 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
       e.printStackTrace();
       fail(" Rest Request should not have thrown  JSONException!");
     }
-
+    
   }
-
-  public void doGetsUsingRestApis(String restEndpoint) {
-
+  
+  public static void doGetsUsingRestApis(String restEndpoint) {
+    
     //HttpHeaders headers = setAcceptAndContentTypeHeaders(); 
     String currentOperation = null;
     JSONObject jObject;
     JSONArray jArray;
-    try {
+    try {    
       //1. Get on key="1" and validate result.
       {
         currentOperation = "GET on key 1";
-
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/1");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -522,26 +591,27 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         jObject = new JSONObject(str.toString());
-
+      
         assertEquals(jObject.get("id"), 101);
         assertEquals(jObject.get("firstName"), "Mithali");
         assertEquals(jObject.get("middleName"), "Dorai");
         assertEquals(jObject.get("lastName"), "Raj");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-
+      
       //2. Get on key="16" and validate result.
       {
         currentOperation = "GET on key 16";
 
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/16");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
         CloseableHttpClient httpclient = HttpClients.createDefault();
         CloseableHttpResponse response = httpclient.execute(get);
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -551,16 +621,17 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         jObject = new JSONObject(str.toString());
-
+        
+      
         assertEquals(jObject.get("id"), 104);
         assertEquals(jObject.get("firstName"), "Shila");
         assertEquals(jObject.get("middleName"), "kumari");
         assertEquals(jObject.get("lastName"), "Dixit");
         assertEquals(jObject.get("gender"), Gender.FEMALE.name());
       }
-
+      
       //3. Get all (getAll) entries in Region
       {
 
@@ -571,7 +642,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse result = httpclient.execute(get);
         assertEquals(result.getStatusLine().getStatusCode(), 200);
         assertNotNull(result.getEntity());
-
+      
         HttpEntity entity = result.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -582,16 +653,16 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
           sb.append(line);
         }
         result.close();
-
+        
         try {
           jObject = new JSONObject(sb.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
       }
-
+      
       //4. GetAll?limit=10 (10 entries) and verify results
       {
         HttpGet get = new HttpGet(restEndpoint + "/People?limit=10");
@@ -601,7 +672,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -611,19 +682,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 10);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
       }
-
+      
       //5. Get keys - List all keys in region
-      {
-
+      {  
+        
         HttpGet get = new HttpGet(restEndpoint + "/People/keys");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -631,7 +702,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -641,19 +712,19 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
-          jArray = jObject.getJSONArray("keys");
+          jArray = jObject.getJSONArray("keys"); 
           assertEquals(jArray.length(), 16);
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
-      }
-
+      } 
+      
       //6. Get data for specific keys
-      {
-
+      {  
+       
         HttpGet get = new HttpGet(restEndpoint + "/People/1,3,5,7,9,11");
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
@@ -661,7 +732,7 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         CloseableHttpResponse response = httpclient.execute(get);
         assertEquals(response.getStatusLine().getStatusCode(), 200);
         assertNotNull(response.getEntity());
-
+        
         HttpEntity entity = response.getEntity();
         InputStream content = entity.getContent();
         BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -671,44 +742,53 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
         while ((line = reader.readLine()) != null) {
           str.append(line);
         }
-
+        
         try {
           jObject = new JSONObject(str.toString());
           jArray = jObject.getJSONArray("People");
           assertEquals(jArray.length(), 6);
-
+          
         } catch (JSONException e) {
-          fail(" Rest Request ::" + currentOperation + " :: should not have thrown JSONException ");
+          fail(" Rest Request ::" + currentOperation +  " :: should not have thrown JSONException ");
         }
-      }
-    } catch (Exception e) {
-      throw new RuntimeException("unexpected exception", e);
+      } 
+    }catch ( Exception e ) {
+      throw new RuntimeException("unexpected exception", e); 
     }
   }
 
-  public void createRegionInClientCache() {
+  public static void createRegionInClientCache() {
     ClientCache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
     ClientRegionFactory<String, Object> crf = cache
         .createClientRegionFactory(ClientRegionShortcut.PROXY);
-    crf.create(PEOPLE_REGION_NAME);
+    Region<String, Object> region = crf.create(PEOPLE_REGION_NAME);
+
+  }
+
+  public static void createRegionInManager() {
+    Cache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+
+    RegionFactory<String, Object> rf = cache
+        .createRegionFactory(RegionShortcut.REPLICATE);
+    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
   }
 
-  public void createRegion() {
+  public static void createRegionInPeerServer() {
     Cache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
 
-    RegionFactory<String, Object> regionFactory = cache
+    RegionFactory<String, Object> rf = cache
         .createRegionFactory(RegionShortcut.REPLICATE);
-    regionFactory.create(PEOPLE_REGION_NAME);
+    Region<String, Object> region = rf.create(PEOPLE_REGION_NAME);
   }
 
   /**
-   * InterOps Test between REST-client, Peer Cache Client and Client Cache
-   *
+   * InterOps Test between REST-client, Peer Cache Client and Client Cache 
    * @throws Exception
    */
-
+ 
   public void testInterOpsWithReplicatedRegion() throws Exception {
 
     final Host host = Host.getHost(0);
@@ -719,46 +799,47 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
     // start locator
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-
-    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
-
+    
+    startLocatorInVM(locator, locatorPort, "");
+    
     // find locators
     String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort
         + "]";
 
     // start manager (peer cache)
-    manager.invoke("Start manager", () -> startManager(null, locators,
-        new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE));
-
+    int managerPort = startManagerInVM(manager,/* groups */null, locators,
+        new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE);
+    
     //start startCacheServer With RestService enabled
-    String restEndpoint = (String) server.invoke(RestAPIsAndInterOpsDUnitTest.class,
-        "startBridgeServerWithRestServiceOnInVM", new Object[] { server, null, locators, new String[] { REGION_NAME }, CacheServer.DEFAULT_LOAD_PROBE });
-
+    String restEndpoint = (String)server.invoke(RestAPIsAndInterOpsDUnitTest.class,
+        "startBridgeServerWithRestServiceOnInVM", new Object[] { server ,  null, locators, new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE });
+    
     // create a client cache
-    client.invoke("Create Client", () -> createClientCache(NetworkUtils.getServerHostName(locator.getHost()), locatorPort));
-
+    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()),
+        locatorPort);
+    
     // create region in Manager, peer cache and Client cache nodes
-    manager.invoke("create region", () -> createRegion());
-    server.invoke("create region", () -> createRegion());
-    client.invoke("create region", () -> createRegionInClientCache());
-
+    manager.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInManager());
+    server.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInPeerServer());
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.createRegionInClientCache());
+    
     // do some person puts from clientcache
-    client.invoke("doPutsInClientCache", () -> doPutsInClientCache());
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.doPutsInClientCache());
 
     //TEST: fetch all available REST endpoints
-    fetchRestServerEndpoints(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.fetchRestServerEndpoints(restEndpoint);
+   
     // Controller VM - config REST Client and make HTTP calls
-    doGetsUsingRestApis(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.doGetsUsingRestApis(restEndpoint);
+    
     //update Data using REST APIs
-    doUpdatesUsingRestApis(restEndpoint);
-
-    client.invoke("verifyUpdatesInClientCache", () -> verifyUpdatesInClientCache());
+    RestAPIsAndInterOpsDUnitTest.doUpdatesUsingRestApis(restEndpoint);
+    
+    client.invoke(() -> RestAPIsAndInterOpsDUnitTest.verifyUpdatesInClientCache());
 
     //Querying
-    doQueryOpsUsingRestApis(restEndpoint);
-
+    RestAPIsAndInterOpsDUnitTest.doQueryOpsUsingRestApis(restEndpoint);
+    
     // stop the client and make sure the bridge server notifies
     // stopBridgeMemberVM(client);
     helper.closeCache(locator);
@@ -768,44 +849,66 @@ public class RestAPIsAndInterOpsDUnitTest extends LocatorTestBase {
 
   }
 
-  private void createClientCache(final String host, final int port) throws Exception {
-    // Connect using the GemFire locator and create a Caching_Proxy cache
-    ClientCache cache = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port).create();
-    cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-  }
-
-  private int startManager(final String[] groups,
-      final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException {
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-
-    props.setProperty("jmx-manager", "true");
-    props.setProperty("jmx-manager-start", "true");
-    props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
-
-    final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    //Set REST service related configuration
-    props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
-
-    DistributedSystem ds = getSystem(props);
-    Cache cache = CacheFactory.create(ds);
-    AttributesFactory factory = new AttributesFactory();
+  private void createClientCacheInVM(VM vm, final String host, final int port) throws Exception {
+    SerializableRunnable connect = new SerializableRunnable(
+        "Start Cache client") {
+      public void run() {
+        // Connect using the GemFire locator and create a Caching_Proxy cache
+        ClientCache c = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port)
+            .create();
+       
+        Region r = c.createClientRegionFactory(
+            ClientRegionShortcut.PROXY).create(REGION_NAME);
+      }
+    };
 
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attrs = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
+    if (vm == null) {
+      connect.run();
+    } else {
+      vm.invoke(connect);
     }
-    CacheServer server = cache.addCacheServer();
-    server.setPort(0);
-    server.setGroups(groups);
-    server.setLoadProbe(probe);
-    server.start();
+  }
 
-    return new Integer(server.getPort());
+  private int startManagerInVM(VM vm, final String[] groups,
+      final String locators, final String[] regions, final ServerLoadProbe probe) {
+    SerializableCallable connect = new SerializableCallable("Start Manager ") {
+      public Object call() throws IOException {
+        Properties props = new Properties();
+        props
+            .setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+        props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+
+        props.setProperty("jmx-manager", "true");
+        props.setProperty("jmx-manager-start", "true");
+        props.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, "0");
+        
+        final int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        //Set REST service related configuration
+        props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
+        props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, "localhost");
+        props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+
+        DistributedSystem ds = getSystem(props);
+        Cache cache = CacheFactory.create(ds);
+        AttributesFactory factory = new AttributesFactory();
+        
+        factory.setEnableBridgeConflation(true);
+        factory.setDataPolicy(DataPolicy.REPLICATE);
+        RegionAttributes attrs = factory.create();
+        for (int i = 0; i < regions.length; i++) {
+          cache.createRegion(regions[i], attrs);
+        }
+        CacheServer server = cache.addCacheServer();
+        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        server.setPort(serverPort);
+        server.setGroups(groups);
+        server.setLoadProbe(probe);
+        server.start();
+        
+        return new Integer(serverPort);
+      }
+    };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
index a567700..61e0925 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnGroupsFunctionExecutionDUnitTest.java
@@ -39,9 +39,9 @@ public class RestAPIsOnGroupsFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void setupCacheWithGroupsAndFunction() {
-    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0.getHost().getHostName(), "g0,gm")));
-    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1.getHost().getHostName(), "g1")));
-    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2.getHost().getHostName(), "g0,g1")));
+    restURLs.add(vm0.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm0, "g0,gm")));
+    restURLs.add(vm1.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm1, "g1")));
+    restURLs.add(vm2.invoke("createCacheWithGroups", () -> createCacheWithGroups(vm2, "g0,g1")));
 
     vm0.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));
     vm1.invoke("registerFunction(new OnGroupsFunction())", () -> FunctionService.registerFunction(new OnGroupsFunction()));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
index fd6b312..ca01830 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsOnMembersFunctionExecutionDUnitTest.java
@@ -44,7 +44,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     @Override
     public void execute(FunctionContext context) {
 
-      System.out.println("SWAP:1:executing OnMembersFunction:" + invocationCount);
+      LogWriterUtils.getLogWriter().fine("SWAP:1:executing OnMembersFunction:" + invocationCount);
       invocationCount++;
 
       context.getResultSender().lastResult(Boolean.TRUE);
@@ -71,14 +71,15 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     }
   }
 
-  private String createCacheAndRegisterFunction(String hostName, String memberName) {
-    final int servicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+  private String createCacheAndRegisterFunction(VM vm, String memberName) {
+    final String hostName = vm.getHost().getHostName();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.NAME_NAME, memberName);
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(servicePort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(serverPort));
 
     Cache c = null;
     try {
@@ -90,7 +91,7 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
     c = CacheFactory.create(new RestAPIsOnMembersFunctionExecutionDUnitTest("temp").getSystem(props));
     FunctionService.registerFunction(new OnMembersFunction());
 
-    String restEndPoint = "http://" + hostName + ":" + servicePort + "/gemfire-api/v1";
+    String restEndPoint = "http://" + hostName + ":" + serverPort + "/gemfire-api/v1";
     return restEndPoint;
 
   }
@@ -114,10 +115,10 @@ public class RestAPIsOnMembersFunctionExecutionDUnitTest extends RestAPITestBase
   }
 
   private void createCacheForVMs() {
-    restURLs.add(vm0.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm0.getHost().getHostName(), "m1")));
-    restURLs.add(vm1.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm1.getHost().getHostName(), "m2")));
-    restURLs.add(vm2.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm2.getHost().getHostName(), "m3")));
-    restURLs.add(vm3.invoke("createCacheAndRegisterFunction",() -> createCacheAndRegisterFunction(vm3.getHost().getHostName(), "m4")));
+    restURLs.add(vm0.invoke(() -> createCacheAndRegisterFunction(vm0, "m1")));
+    restURLs.add(vm1.invoke(() -> createCacheAndRegisterFunction(vm1, "m2")));
+    restURLs.add(vm2.invoke(() -> createCacheAndRegisterFunction(vm2, "m3")));
+    restURLs.add(vm3.invoke(() -> createCacheAndRegisterFunction(vm3, "m4")));
   }
 
   public void testFunctionExecutionEOnSelectedMembers() {


[31/49] incubator-geode git commit: GEODE-1222: remove InsufficientDiskSpaceException

Posted by kl...@apache.org.
GEODE-1222: remove InsufficientDiskSpaceException


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e1cbc9b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e1cbc9b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e1cbc9b2

Branch: refs/heads/feature/GEODE-835-test
Commit: e1cbc9b25da6353b62e7d59c67babc470e81eb1f
Parents: b6de5a3
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed May 11 16:05:48 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon May 16 11:29:06 2016 -0700

----------------------------------------------------------------------
 .../InsufficientDiskSpaceException.java         | 53 --------------------
 .../gemstone/gemfire/internal/cache/Oplog.java  |  7 ++-
 .../codeAnalysis/sanctionedSerializables.txt    |  1 -
 3 files changed, 3 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1cbc9b2/geode-core/src/main/java/com/gemstone/gemfire/internal/InsufficientDiskSpaceException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/InsufficientDiskSpaceException.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/InsufficientDiskSpaceException.java
deleted file mode 100644
index be87c8b..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/InsufficientDiskSpaceException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.gemstone.gemfire.internal;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import com.gemstone.gemfire.cache.DiskAccessException;
-import com.gemstone.gemfire.cache.DiskStore;
-import com.gemstone.gemfire.internal.Sendable;
-
-/**
- * @since gfxd 1.0.1
- */
-public class InsufficientDiskSpaceException extends DiskAccessException implements Sendable {
-  private static final long serialVersionUID = -6167707908956900841L;
-
-  public InsufficientDiskSpaceException(String msg, Throwable cause, DiskStore ds) {
-    super(msg, cause, ds);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void sendTo(DataOutput out) throws IOException {
-    // send base DiskAccessException to older versions
-    Version peerVersion = InternalDataSerializer.getVersionForDataStream(out);
-    if (Version.GFE_80.compareTo(peerVersion) > 0) {
-      DiskAccessException dae = new DiskAccessException(getMessage(),
-          getCause());
-      InternalDataSerializer.writeSerializableObject(dae, out);
-    }
-    else {
-      InternalDataSerializer.writeSerializableObject(this, out);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1cbc9b2/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
index 4728594..96f616b 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/Oplog.java
@@ -77,7 +77,6 @@ import com.gemstone.gemfire.internal.Assert;
 import com.gemstone.gemfire.internal.ByteArrayDataInput;
 import com.gemstone.gemfire.internal.FileUtil;
 import com.gemstone.gemfire.internal.HeapDataOutputStream;
-import com.gemstone.gemfire.internal.InsufficientDiskSpaceException;
 import com.gemstone.gemfire.internal.InternalDataSerializer;
 import com.gemstone.gemfire.internal.InternalStatisticsDisabledException;
 import com.gemstone.gemfire.internal.Sendable;
@@ -603,7 +602,7 @@ public final class Oplog implements CompactableOplog, Flushable {
     long availableSpace = this.dirHolder.getAvailableSpace();
     if (availableSpace < maxOplogSizeParam) {
       if (DiskStoreImpl.PREALLOCATE_OPLOGS && !DiskStoreImpl.SET_IGNORE_PREALLOCATE) {
-        throw new InsufficientDiskSpaceException(LocalizedStrings.Oplog_PreAllocate_Failure_Init.toLocalizedString(this.dirHolder,
+        throw new DiskAccessException(LocalizedStrings.Oplog_PreAllocate_Failure_Init.toLocalizedString(this.dirHolder,
             maxOplogSizeParam), new IOException("not enough space left to create and pre grow oplog files, available="
             + availableSpace + ", required=" + maxOplogSizeParam), getParent());
       }
@@ -1070,13 +1069,13 @@ public final class Oplog implements CompactableOplog, Flushable {
          * false; } } }
          */
         closeAndDeleteAfterEx(ioe, olf);
-        throw new InsufficientDiskSpaceException(LocalizedStrings.Oplog_PreAllocate_Failure.toLocalizedString(olf.f
+        throw new DiskAccessException(LocalizedStrings.Oplog_PreAllocate_Failure.toLocalizedString(olf.f
             .getAbsolutePath(), maxSize), ioe, getParent());
       }
     }
     // TODO: Perhaps the test flag is not requierd here. Will re-visit.
     else if (DiskStoreImpl.PREALLOCATE_OPLOGS && !DiskStoreImpl.SET_IGNORE_PREALLOCATE) {
-      throw new InsufficientDiskSpaceException(LocalizedStrings.Oplog_PreAllocate_Failure.toLocalizedString(
+      throw new DiskAccessException(LocalizedStrings.Oplog_PreAllocate_Failure.toLocalizedString(
           olf.f.getAbsolutePath(), maxSize), new IOException("not enough space left to pre-blow, available=" + availableSpace
           + ", required=" + maxSize), getParent());
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1cbc9b2/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
index fa02ca3..1ee16d5 100755
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedSerializables.txt
@@ -246,7 +246,6 @@ com/gemstone/gemfire/internal/ConfigSource$Type,false
 com/gemstone/gemfire/internal/CopyOnWriteHashSet,true,8591978652141659932
 com/gemstone/gemfire/internal/DSFIDFactory$SqlfSerializationException,true,5076687296705595933
 com/gemstone/gemfire/internal/DSFIDNotFoundException,true,130596009484324655,dsfid:int,versionOrdinal:short
-com/gemstone/gemfire/internal/InsufficientDiskSpaceException,true,-6167707908956900841
 com/gemstone/gemfire/internal/InternalDataSerializer$SERIALIZATION_VERSION,false
 com/gemstone/gemfire/internal/InternalStatisticsDisabledException,true,4146181546364258311
 com/gemstone/gemfire/internal/LinuxProcFsStatistics$CPU,false


[41/49] incubator-geode git commit: GEODE-1344: fix the testcase to remove the durable client part

Posted by kl...@apache.org.
GEODE-1344: fix the testcase to remove the durable client part

The test case for durable client with 2 cache servers on the same JVM is not
mature. Since we did not change any logic in durable client, remove the test
code for now. This senario will be followed up in GEODE-1102.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8266f6b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8266f6b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8266f6b9

Branch: refs/heads/feature/GEODE-835-test
Commit: 8266f6b9b944adddeea449743f8da611f76d9852
Parents: 8024f33
Author: zhouxh <gz...@pivotal.io>
Authored: Tue May 17 14:13:55 2016 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Tue May 17 14:16:04 2016 -0700

----------------------------------------------------------------------
 .../cache/wan/Simple2CacheServerDUnitTest.java  | 47 ++++++++++++++++----
 1 file changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8266f6b9/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
index 4fdd88d..2b7617d 100755
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
@@ -17,22 +17,31 @@
 package com.gemstone.gemfire.internal.cache.wan;
 
 import java.util.Iterator;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.junit.experimental.categories.Category;
 
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.distributed.internal.ServerLocation;
+import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.ha.HAContainerRegion;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.jayway.awaitility.Awaitility;
 
@@ -45,11 +54,6 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
     super(name);
   }
   
-  // GEODE-1183: random ports, failure to start threads, eats exceptions, time sensitive
-  public void testDurableClient2MultipleCacheServer() throws Exception {
-    doMultipleCacheServer(true);
-  }
-
   public void testNormalClient2MultipleCacheServer() throws Exception {
     doMultipleCacheServer(false);
   }
@@ -80,11 +84,38 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
     Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
     
     // close the current primary cache server, then re-test
-    vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort2));
-    Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
+    int serverPortAtVM1 = vm1.invoke(()-> findCacheServerForPrimaryProxy());
+    if (serverPortAtVM1 != 0) {
+      vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPortAtVM1));
+      LogService.getLogger().info("Closed cache server on vm1:"+serverPortAtVM1);
+      Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0) || checkProxyIsPrimary(vm1); });
+    } else {
+      vm0.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort3));
+      LogService.getLogger().info("Closed cache server on vm0:"+serverPort3);
+      assertTrue(checkProxyIsPrimary(vm1));
+    }
     disconnectAllFromDS();
   }
-
+  
+  private static int findCacheServerForPrimaryProxy() {
+    List<CacheServer> cacheServers = ((GemFireCacheImpl)cache).getCacheServers();
+    CacheServerImpl server = null;
+    for (CacheServer cs:cacheServers) {
+      server = (CacheServerImpl)cs;
+      long acceptorId = server.getAcceptor().getAcceptorId();
+      for (CacheClientProxy proxy:CacheClientNotifier.getInstance().getClientProxies()) {
+        if (proxy.isPrimary() == false) {
+          continue;
+        }
+        if (proxy.getAcceptorId() == acceptorId) {
+          LogService.getLogger().info("Found cache server "+server+" for the primary proxy "+proxy);
+          return server.getPort();
+        }
+      }
+    }
+    return 0;
+  }
+  
   public static void setClientServerObserver()
   {
     PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;


[13/49] incubator-geode git commit: GEODE-1390: Move gfsh help tests from closed to open

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04a00042/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-online.properties
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-online.properties b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-online.properties
new file mode 100644
index 0000000..57f8f37
--- /dev/null
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-online.properties
@@ -0,0 +1,657 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This file is generated with a script something like the following. The resulting output
+# needs a bit of cleanup at the beginning and end.
+#
+#
+#  #!/usr/bin/env bash
+#
+#  set -e
+#
+#  # Preserve leading whitespace for read loops
+#  IFS=''
+#
+#  $GFSH -e "help" | awk '/^[^ ]/ {print $0}' | sed -e "s/\(.*\) (.*/\1/" | \
+#    while read i; do
+#      PARAM="$(echo $i | sed -Ee 's/[[:space:]]+/-/g').help=\\"
+#      echo $PARAM
+#      $GFSH -e "connect --jmx-manager=localhost[1099]" -e "help connect" | head -13 | tail -4 | \
+#        while read j; do
+#          if [ -n "$j" ]; then
+#            echo "$j\\" | sed -E -e ':a' -e 's/^([[:space:]]*)[[:space:]]/\1\\ /;ta'
+#          fi
+#        done
+#        echo ""
+#    done
+
+alter-disk-store.help=\
+NAME\n\
+\ \ \ \ alter disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+alter-region.help=\
+NAME\n\
+\ \ \ \ alter region\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+alter-runtime.help=\
+NAME\n\
+\ \ \ \ alter runtime\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+backup-disk-store.help=\
+NAME\n\
+\ \ \ \ backup disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+change-loglevel.help=\
+NAME\n\
+\ \ \ \ change loglevel\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+clear-defined-indexes.help=\
+NAME\n\
+\ \ \ \ clear defined indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+close-durable-client.help=\
+NAME\n\
+\ \ \ \ close durable-client\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+close-durable-cq.help=\
+NAME\n\
+\ \ \ \ close durable-cq\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+compact-disk-store.help=\
+NAME\n\
+\ \ \ \ compact disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+compact-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ compact offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+configure-pdx.help=\
+NAME\n\
+\ \ \ \ configure pdx\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+connect.help=\
+NAME\n\
+\ \ \ \ connect\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-async-event-queue.help=\
+NAME\n\
+\ \ \ \ create async-event-queue\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-defined-indexes.help=\
+NAME\n\
+\ \ \ \ create defined indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-disk-store.help=\
+NAME\n\
+\ \ \ \ create disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-gateway-receiver.help=\
+NAME\n\
+\ \ \ \ create gateway-receiver\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-gateway-sender.help=\
+NAME\n\
+\ \ \ \ create gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-index.help=\
+NAME\n\
+\ \ \ \ create index\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+create-region.help=\
+NAME\n\
+\ \ \ \ create region\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+debug.help=\
+NAME\n\
+\ \ \ \ debug\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+define-index.help=\
+NAME\n\
+\ \ \ \ define index\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+deploy.help=\
+NAME\n\
+\ \ \ \ deploy\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-client.help=\
+NAME\n\
+\ \ \ \ describe client\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-config.help=\
+NAME\n\
+\ \ \ \ describe config\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-connection.help=\
+NAME\n\
+\ \ \ \ describe connection\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-disk-store.help=\
+NAME\n\
+\ \ \ \ describe disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-member.help=\
+NAME\n\
+\ \ \ \ describe member\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ describe offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+describe-region.help=\
+NAME\n\
+\ \ \ \ describe region\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+destroy-disk-store.help=\
+NAME\n\
+\ \ \ \ destroy disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+destroy-function.help=\
+NAME\n\
+\ \ \ \ destroy function\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+destroy-index.help=\
+NAME\n\
+\ \ \ \ destroy index\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+destroy-region.help=\
+NAME\n\
+\ \ \ \ destroy region\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+disconnect.help=\
+NAME\n\
+\ \ \ \ disconnect\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+echo.help=\
+NAME\n\
+\ \ \ \ echo\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+encrypt-password.help=\
+NAME\n\
+\ \ \ \ encrypt password\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+execute-function.help=\
+NAME\n\
+\ \ \ \ execute function\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+exit.help=\
+NAME\n\
+\ \ \ \ exit\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-cluster-configuration.help=\
+NAME\n\
+\ \ \ \ export cluster-configuration\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-config.help=\
+NAME\n\
+\ \ \ \ export config\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-data.help=\
+NAME\n\
+\ \ \ \ export data\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-logs.help=\
+NAME\n\
+\ \ \ \ export logs\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ export offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+export-stack-traces.help=\
+NAME\n\
+\ \ \ \ export stack-traces\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+gc.help=\
+NAME\n\
+\ \ \ \ gc\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+get.help=\
+NAME\n\
+\ \ \ \ get\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+help.help=\
+NAME\n\
+\ \ \ \ help\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+hint.help=\
+NAME\n\
+\ \ \ \ hint\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+history.help=\
+NAME\n\
+\ \ \ \ history\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+import-cluster-configuration.help=\
+NAME\n\
+\ \ \ \ import cluster-configuration\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+import-data.help=\
+NAME\n\
+\ \ \ \ import data\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-async-event-queues.help=\
+NAME\n\
+\ \ \ \ list async-event-queues\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-clients.help=\
+NAME\n\
+\ \ \ \ list clients\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-deployed.help=\
+NAME\n\
+\ \ \ \ list deployed\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-disk-stores.help=\
+NAME\n\
+\ \ \ \ list disk-stores\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-durable-cqs.help=\
+NAME\n\
+\ \ \ \ list durable-cqs\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-functions.help=\
+NAME\n\
+\ \ \ \ list functions\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-gateways.help=\
+NAME\n\
+\ \ \ \ list gateways\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-indexes.help=\
+NAME\n\
+\ \ \ \ list indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-members.help=\
+NAME\n\
+\ \ \ \ list members\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+list-regions.help=\
+NAME\n\
+\ \ \ \ list regions\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+load-balance-gateway-sender.help=\
+NAME\n\
+\ \ \ \ load-balance gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+locate-entry.help=\
+NAME\n\
+\ \ \ \ locate entry\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+netstat.help=\
+NAME\n\
+\ \ \ \ netstat\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+pause-gateway-sender.help=\
+NAME\n\
+\ \ \ \ pause gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+pdx-rename.help=\
+NAME\n\
+\ \ \ \ pdx rename\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+put.help=\
+NAME\n\
+\ \ \ \ put\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+query.help=\
+NAME\n\
+\ \ \ \ query\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+rebalance.help=\
+NAME\n\
+\ \ \ \ rebalance\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+remove.help=\
+NAME\n\
+\ \ \ \ remove\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+resume-gateway-sender.help=\
+NAME\n\
+\ \ \ \ resume gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+revoke-missing-disk-store.help=\
+NAME\n\
+\ \ \ \ revoke missing-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+run.help=\
+NAME\n\
+\ \ \ \ run\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+set-variable.help=\
+NAME\n\
+\ \ \ \ set variable\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+sh.help=\
+NAME\n\
+\ \ \ \ sh\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+show-dead-locks.help=\
+NAME\n\
+\ \ \ \ show dead-locks\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+show-log.help=\
+NAME\n\
+\ \ \ \ show log\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+show-metrics.help=\
+NAME\n\
+\ \ \ \ show metrics\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+show-missing-disk-stores.help=\
+NAME\n\
+\ \ \ \ show missing-disk-stores\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+show-subscription-queue-size.help=\
+NAME\n\
+\ \ \ \ show subscription-queue-size\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+shutdown.help=\
+NAME\n\
+\ \ \ \ shutdown\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+sleep.help=\
+NAME\n\
+\ \ \ \ sleep\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-gateway-receiver.help=\
+NAME\n\
+\ \ \ \ start gateway-receiver\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-gateway-sender.help=\
+NAME\n\
+\ \ \ \ start gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-jconsole.help=\
+NAME\n\
+\ \ \ \ start jconsole\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-jvisualvm.help=\
+NAME\n\
+\ \ \ \ start jvisualvm\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-locator.help=\
+NAME\n\
+\ \ \ \ start locator\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-pulse.help=\
+NAME\n\
+\ \ \ \ start pulse\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-server.help=\
+NAME\n\
+\ \ \ \ start server\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+start-vsd.help=\
+NAME\n\
+\ \ \ \ start vsd\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+status-cluster-config-service.help=\
+NAME\n\
+\ \ \ \ status cluster-config-service\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+status-gateway-receiver.help=\
+NAME\n\
+\ \ \ \ status gateway-receiver\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+status-gateway-sender.help=\
+NAME\n\
+\ \ \ \ status gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+status-locator.help=\
+NAME\n\
+\ \ \ \ status locator\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+status-server.help=\
+NAME\n\
+\ \ \ \ status server\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+stop-gateway-receiver.help=\
+NAME\n\
+\ \ \ \ stop gateway-receiver\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+stop-gateway-sender.help=\
+NAME\n\
+\ \ \ \ stop gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+stop-locator.help=\
+NAME\n\
+\ \ \ \ stop locator\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+stop-server.help=\
+NAME\n\
+\ \ \ \ stop server\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+undeploy.help=\
+NAME\n\
+\ \ \ \ undeploy\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+upgrade-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ upgrade offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+validate-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ validate offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+
+version.help=\
+NAME\n\
+\ \ \ \ version\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\


[07/49] incubator-geode git commit: GEODE-1376: Cleaned up server port to be '0'. Cleaned up some legacy code and replaced with cleaner Lambda invocation. Replaced waitOnCriterion with Awaitility.

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
index 2e80ebf..692ff19 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@ -19,7 +19,6 @@ package com.gemstone.gemfire.rest.internal.web.controllers;
 import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.internal.LocatorTestBase;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -31,7 +30,10 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.management.ManagementException;
 import com.gemstone.gemfire.management.ManagementTestBase;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.util.test.TestUtil;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -47,13 +49,12 @@ import javax.net.ssl.SSLContext;
 import java.io.*;
 import java.net.BindException;
 import java.security.KeyStore;
-import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
 /**
- * 
  * @since 8.0
  */
 public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
@@ -63,13 +64,13 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
   private ManagementTestBase helper;
 
   private final String PEOPLE_REGION_NAME = "People";
-  
+
   private File jks;
 
   public RestAPIsWithSSLDUnitTest(String name) {
     super(name);
     this.helper = new ManagementTestBase(name);
-    this.jks  = findTrustedJKS();
+    this.jks = findTrustedJKS();
 
   }
 
@@ -85,32 +86,22 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
   }
 
   private File findTrustedJKS() {
-    if(jks == null){
+    if (jks == null) {
       jks = new File(TestUtil.getResourcePath(RestAPIsWithSSLDUnitTest.class, "/ssl/trusted.keystore"));
     }
     return jks;
   }
 
-  public String startBridgeServerWithRestServiceOnInVM(final VM vm, final String locators, final String[] regions,
-      final Properties sslProperties, final boolean clusterLevel) {
-
-    final String hostName = vm.getHost().getHostName();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    vm.invoke("startBridge", () -> startBridgeServer(hostName,serverPort,locators,regions,sslProperties,clusterLevel));
-    return "https://" + hostName + ":" + serverPort + "/gemfire-api/v1";
-
-  }
-
   @SuppressWarnings("deprecation")
-  protected int startBridgeServer(String hostName, int restServicerPort, final String locators, final String[] regions,
+  protected int startBridgeServer(String hostName, int restServicePort, final String locators, final String[] regions,
       final Properties sslProperties, boolean clusterLevel) {
 
     Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
     props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicerPort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicePort));
 
     System.setProperty("javax.net.debug", "ssl,handshake");
     configureSSL(props, sslProperties, clusterLevel);
@@ -118,8 +109,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     DistributedSystem ds = getSystem(props);
     Cache cache = CacheFactory.create(ds);
     ((GemFireCacheImpl) cache).setReadSerialized(true);
-    AttributesFactory factory = new AttributesFactory();
 
+    AttributesFactory factory = new AttributesFactory();
     factory.setEnableBridgeConflation(true);
     factory.setDataPolicy(DataPolicy.REPLICATE);
     RegionAttributes attrs = factory.create();
@@ -128,81 +119,45 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     }
 
     CacheServer server = cache.addCacheServer();
-    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    server.setPort(serverPort);
+    server.setPort(0);
     try {
       server.start();
     } catch (IOException e) {
       e.printStackTrace();
     }
     remoteObjects.put(CACHE_KEY, cache);
-    return new Integer(serverPort);
+    return new Integer(server.getPort());
   }
 
   public void doPutsInClientCache() {
-    ClientCache cache = GemFireCacheImpl.getInstance();
-    assertNotNull(cache);
-    Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
+    ClientCache clientCache = ClientCacheFactory.getAnyInstance();
+    assertNotNull(clientCache);
+    Region<String, Object> region = clientCache.getRegion(PEOPLE_REGION_NAME);
 
     // put person object
-    final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982,
-        Calendar.DECEMBER, 4), Gender.FEMALE);
-    final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975,
-        Calendar.DECEMBER, 14), Gender.MALE);
-    final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972,
-        Calendar.AUGUST, 29), Gender.MALE);
-    final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979,
-        Calendar.MARCH, 17), Gender.MALE);
-    final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983,
-        Calendar.NOVEMBER, 25), Gender.FEMALE);
-
-    region.put("1", person1);
-    region.put("2", person2);
-    region.put("3", person3);
-    region.put("4", person4);
-    region.put("5", person5);
-
-    final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi",
-        DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
-    final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945,
-        Calendar.DECEMBER, 24), Gender.MALE);
-    final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920,
-        Calendar.AUGUST, 9), Gender.MALE);
-    final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH,
-        27), Gender.FEMALE);
-    final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973,
-        Calendar.APRIL, 15), Gender.FEMALE);
-
-    final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923,
-        Calendar.APRIL, 25), Gender.MALE);
-    final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910,
-        Calendar.JANUARY, 01), Gender.MALE);
-    final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943,
-        Calendar.AUGUST, 10), Gender.FEMALE);
-    final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER,
-        27), Gender.MALE);
-    final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER,
-        21), Gender.MALE);
-    final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927,
-        Calendar.FEBRUARY, 15), Gender.FEMALE);
+    region.put("1", new Person(101L, "Mithali", "Dorai", "Raj", new Date(), Gender.FEMALE));
+    region.put("2", new Person(102L, "Sachin", "Ramesh", "Tendulkar", new Date(), Gender.MALE));
+    region.put("3", new Person(103L, "Saurabh", "Baburav", "Ganguly", new Date(), Gender.MALE));
+    region.put("4", new Person(104L, "Rahul", "subrymanyam", "Dravid", new Date(), Gender.MALE));
+    region.put("5", new Person(105L, "Jhulan", "Chidambaram", "Goswami", new Date(), Gender.FEMALE));
 
     Map<String, Object> userMap = new HashMap<String, Object>();
-    userMap.put("6", person6);
-    userMap.put("7", person7);
-    userMap.put("8", person8);
-    userMap.put("9", person9);
-    userMap.put("10", person10);
-    userMap.put("11", person11);
-    userMap.put("12", person12);
-    userMap.put("13", person13);
-    userMap.put("14", person14);
-    userMap.put("15", person15);
-    userMap.put("16", person16);
+    userMap.put("6", new Person(101L, "Rahul", "Rajiv", "Gndhi", new Date(), Gender.MALE));
+    userMap.put("7", new Person(102L, "Narendra", "Damodar", "Modi", new Date(), Gender.MALE));
+    userMap.put("8", new Person(103L, "Atal", "Bihari", "Vajpayee", new Date(), Gender.MALE));
+    userMap.put("9", new Person(104L, "Soniya", "Rajiv", "Gandhi", new Date(), Gender.FEMALE));
+    userMap.put("10", new Person(104L, "Priyanka", "Robert", "Gandhi", new Date(), Gender.FEMALE));
+    userMap.put("11", new Person(104L, "Murali", "Manohar", "Joshi", new Date(), Gender.MALE));
+    userMap.put("12", new Person(104L, "Lalkrishna", "Parmhansh", "Advani", new Date(), Gender.MALE));
+    userMap.put("13", new Person(104L, "Shushma", "kumari", "Swaraj", new Date(), Gender.FEMALE));
+    userMap.put("14", new Person(104L, "Arun", "raman", "jetly", new Date(), Gender.MALE));
+    userMap.put("15", new Person(104L, "Amit", "kumar", "shah", new Date(), Gender.MALE));
+    userMap.put("16", new Person(104L, "Shila", "kumari", "Dixit", new Date(), Gender.FEMALE));
 
     region.putAll(userMap);
 
-    if (cache != null)
-      cache.getLogger().info("Gemfire Cache Client: Puts successfully done");
+    if (clientCache != null)
+      clientCache.getLogger().info("Gemfire Cache Client: Puts successfully done");
 
   }
 
@@ -217,24 +172,30 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     // start locator
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
-    startLocatorInVM(locator, locatorPort, "");
+    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
 
     // find locators
     String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
 
     // start manager (peer cache)
-    startManagerInVM(manager, locators, new String[] { REGION_NAME }, sslProperties);
+    manager.invoke("StartManager", () -> startManager(locators, new String[] { REGION_NAME }, sslProperties));
 
     // start startBridgeServer With RestService enabled
-    String restEndpoint = startBridgeServerWithRestServiceOnInVM(server, locators, new String[] { REGION_NAME },
-        sslProperties, clusterLevel);
+    String restEndpoint = server.invoke("startBridgeServerWithRestServiceOnInVM", () -> {
+      final String hostName = server.getHost().getHostName();
+      final int restServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+      startBridgeServer(hostName, restServicePort, locators, new String[] { REGION_NAME }, sslProperties, clusterLevel);
+      return "https://" + hostName + ":" + restServicePort + "/gemfire-api/v1";
+    });
 
     // create a client cache
-    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()), locatorPort);
+    client.invoke("Create ClientCache", () -> new ClientCacheFactory()
+        .setPdxReadSerialized(true)
+        .addPoolLocator(NetworkUtils.getServerHostName(locator.getHost()), locatorPort).create());
 
     // create region in Manager, peer cache and Client cache nodes
-    manager.invoke("createRegionInManager",() -> createRegionInManager());
-    server.invoke("createRegionInPeerServer", () -> createRegionInPeerServer());
+    manager.invoke("createRegionInManager", () -> createRegionInCache());
+    server.invoke("createRegionInPeerServer", () -> createRegionInCache());
     client.invoke("createRegionInClientCache", () -> createRegionInClientCache());
 
     // do some person puts from clientcache
@@ -260,191 +221,114 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     helper.closeCache(client);
   }
 
-  private void createClientCacheInVM(VM vm, final String host, final int port) throws Exception {
-    SerializableRunnable connect = new SerializableRunnable("Start Cache client") {
-      public void run() {
-        // Connect using the GemFire locator and create a Caching_Proxy cache
-        ClientCache clientCache = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port).create();
-        clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      }
-    };
-
-    if (vm == null) {
-      connect.run();
-    } else {
-      vm.invoke(connect);
+  private void sslPropertyConverter(Properties properties, Properties newProperties, String propertyName, String newPropertyName) {
+    String property = properties.getProperty(propertyName);
+    if (property != null) {
+      newProperties.setProperty((newPropertyName != null ? newPropertyName : propertyName), property);
     }
   }
 
   private void configureSSL(Properties props, Properties sslProperties, boolean clusterLevel) {
 
-    if(clusterLevel){
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_ENABLED_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_PASSWORD_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_TYPE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_PROTOCOLS_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
-        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
-      }
-
-    }else{
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
-      }
-      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
-        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
-            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
-      }
-
+    if (clusterLevel) {
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, DistributionConfig.CLUSTER_SSL_ENABLED_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, DistributionConfig.CLUSTER_SSL_KEYSTORE_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,
+          DistributionConfig.CLUSTER_SSL_KEYSTORE_PASSWORD_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, DistributionConfig.CLUSTER_SSL_KEYSTORE_TYPE_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, DistributionConfig.CLUSTER_SSL_PROTOCOLS_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
+          DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, DistributionConfig.CLUSTER_SSL_TRUSTSTORE_NAME);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
+          DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME);
+    } else {
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, null);
+      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, null);
     }
-    
-   
   }
 
-  private int startManagerInVM(VM vm, final String locators, final String[] regions, final Properties sslProperties) {
-    
+  private void startManager(final String locators, final String[] regions, final Properties sslProperties) throws IOException {
+
     IgnoredException.addIgnoredException("java.net.BindException");
     IgnoredException.addIgnoredException("java.rmi.server.ExportException");
     IgnoredException.addIgnoredException("com.gemstone.gemfire.management.ManagementException");
-    
-    SerializableCallable connect = new SerializableCallable("Start Manager ") {
-      public Object call() throws IOException {
-        Properties props = new Properties();
-        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-        props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-        props.setProperty("jmx-manager", "true");
-        props.setProperty("jmx-manager-start", "true");
-
-        Cache cache = null;
-        while (true) {
-          try {
-            configureSSL(props, sslProperties, false);
-            DistributedSystem ds = getSystem(props);
-            System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port", "7070") 
-            + " and jmx-manager-port " + props.getProperty("jmx-manager-port", "1099"));            
-            cache = CacheFactory.create(ds);
-            System.out.println("Successfully created cache.");
-            break;
+
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+    props.setProperty("jmx-manager", "true");
+    props.setProperty("jmx-manager-start", "true");
+
+    Cache cache = null;
+    configureSSL(props, sslProperties, false);
+    while (true) {
+      try {
+        DistributedSystem ds = getSystem(props);
+        System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port", "7070")
+            + " and jmx-manager-port " + props.getProperty("jmx-manager-port", "1099"));
+        cache = CacheFactory.create(ds);
+        System.out.println("Successfully created cache.");
+        break;
+      } catch (ManagementException ex) {
+        if ((ex.getCause() instanceof BindException)
+            || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) {
+          //close cache and disconnect
+          GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance();
+          if (existingInstance != null) {
+            existingInstance.close();
           }
-          catch (ManagementException ex) {
-            if ((ex.getCause() instanceof BindException) 
-                || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) {
-              //close cache and disconnect
-              GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance();
-              if (existingInstance != null) {
-                existingInstance.close();
-              }
-              InternalDistributedSystem ids = InternalDistributedSystem
-                  .getConnectedInstance();
-              if (ids != null) {
-                ids.disconnect();
-              }
-              //try a different port
-              int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
-              int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort();
-              props.setProperty("http-service-port", Integer.toString(httpServicePort));
-              props.setProperty("jmx-manager-port", Integer.toString(jmxManagerPort));
-              System.out.println("Try a different http-service-port " + httpServicePort);
-              System.out.println("Try a different jmx-manager-port " + jmxManagerPort);
-            }
-            else {
-              throw ex;
-            }
+          InternalDistributedSystem ids = InternalDistributedSystem
+              .getConnectedInstance();
+          if (ids != null) {
+            ids.disconnect();
           }
-        } 
-        AttributesFactory factory = new AttributesFactory();
-
-        factory.setEnableBridgeConflation(true);
-        factory.setDataPolicy(DataPolicy.REPLICATE);
-        RegionAttributes attrs = factory.create();
-        for (int i = 0; i < regions.length; i++) {
-          cache.createRegion(regions[i], attrs);
+          //try a different port
+          int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+          int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort();
+          props.setProperty("http-service-port", Integer.toString(httpServicePort));
+          props.setProperty("jmx-manager-port", Integer.toString(jmxManagerPort));
+          System.out.println("Try a different http-service-port " + httpServicePort);
+          System.out.println("Try a different jmx-manager-port " + jmxManagerPort);
+        } else {
+          throw ex;
         }
-        CacheServer server = cache.addCacheServer();
-        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-        server.setPort(serverPort);
-        server.start();
-
-        return new Integer(serverPort);
       }
-    };
-    Integer port = (Integer) vm.invoke(connect);
-    return port.intValue();
+    }
+    AttributesFactory factory = new AttributesFactory();
+
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attrs = factory.create();
+    for (int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
+    }
+    CacheServer server = cache.addCacheServer();
+    server.setPort(0);
+    server.start();
   }
 
   private void createRegionInClientCache() {
-    ClientCache cache = GemFireCacheImpl.getInstance();
-    assertNotNull(cache);
-    ClientRegionFactory<String, Object> crf = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
-    crf.create(PEOPLE_REGION_NAME);
+    ClientCache clientCache = ClientCacheFactory.getAnyInstance();
+    assertNotNull(clientCache);
+    clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(PEOPLE_REGION_NAME);
+    clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
   }
 
-  private void createRegionInManager() {
+  private void createRegionInCache() {
     Cache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
-    RegionFactory<String, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
-    rf.create(PEOPLE_REGION_NAME);
+    RegionFactory<String, Object> regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE);
+    regionFactory.create(PEOPLE_REGION_NAME);
   }
 
-  private void createRegionInPeerServer() {
-    Cache cache = GemFireCacheImpl.getInstance();
-    assertNotNull(cache);
-    RegionFactory<String, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
-    rf.create(PEOPLE_REGION_NAME);
-  }
-  
-  private CloseableHttpClient getSSLBasedHTTPClient(String algo) throws Exception {
-    
+  private CloseableHttpClient getSSLBasedHTTPClient() throws Exception {
     File jks = findTrustedJKS();
 
     KeyStore clientKeys = KeyStore.getInstance("JKS");
@@ -454,7 +338,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     SSLContext sslcontext = SSLContexts.custom()
         .loadTrustMaterial(clientKeys, new TrustSelfSignedStrategy())
         .loadKeyMaterial(clientKeys, "password".toCharArray())
-    .build();
+        .build();
 
     // Host checking is disabled here , as tests might run on multiple hosts and
     // host entries can not be assumed
@@ -466,7 +350,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     return httpclient;
   }
 
-  private void validateConnection(String restEndpoint, String algo) {
+  private void validateConnection(String restEndpoint) {
 
     try {
       // 1. Get on key="1" and validate result.
@@ -475,8 +359,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
 
-       
-        CloseableHttpClient httpclient = getSSLBasedHTTPClient(algo);
+        CloseableHttpClient httpclient = getSSLBasedHTTPClient();
         CloseableHttpResponse response = httpclient.execute(get);
 
         HttpEntity entity = response.getEntity();
@@ -501,7 +384,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
       throw new RuntimeException("unexpected exception", e);
     }
   }
-  
+
   // Actual Tests starts here.
 
   public void testSimpleSSL() throws Exception {
@@ -511,90 +394,80 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
-    String restEndpoint = startInfraWithSSL(props,false);
-    validateConnection(restEndpoint, "SSL");
+    validateConnection(startInfraWithSSL(props, false));
   }
-  
-  public void testSSLWithoutKeyStoreType() throws Exception {
 
-   
+  public void testSSLWithoutKeyStoreType() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-  
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "SSL");
 
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithSSLProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "SSL");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithTLSProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLS");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLS");
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithTLSv11Protocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLSv1.1");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.1");
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithTLSv12Protocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLSv1.2");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testWithMultipleProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLSv1.2");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL,TLSv1.2");
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithCipherSuite() throws Exception {
 
     System.setProperty("javax.net.debug", "ssl");
@@ -602,57 +475,51 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
-    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+
     SSLContext ssl = SSLContext.getInstance("TLSv1.2");
-    
+
     ssl.init(null, null, new java.security.SecureRandom());
     String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
-    
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]);
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLSv1.2");
+
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0]);
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
+
   public void testSSLWithMultipleCipherSuite() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
-    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+
     SSLContext ssl = SSLContext.getInstance("TLSv1.2");
-    
+
     ssl.init(null, null, new java.security.SecureRandom());
     String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
-    
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]+","+cipherSuites[1]);
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "TLSv1.2");
+
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0] + "," + cipherSuites[1]);
+
+    validateConnection(startInfraWithSSL(props, false));
 
   }
-  
-  
+
   public void testMutualAuthentication() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,"true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
 
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
 
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,"password");
-    
-    String restEndpoint = startInfraWithSSL(props, false);
-    validateConnection(restEndpoint, "SSL");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
+    validateConnection(startInfraWithSSL(props, false));
   }
 
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
index cfcff5e..ad578c5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
@@ -16,15 +16,6 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import java.io.Serializable;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.Assert;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.NoAvailableLocatorsException;
@@ -37,22 +28,23 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.management.membership.ClientMembership;
 import com.gemstone.gemfire.management.membership.ClientMembershipEvent;
 import com.gemstone.gemfire.management.membership.ClientMembershipListenerAdapter;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.*;
+import org.junit.Assert;
+
+import java.io.Serializable;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * Tests cases that are particular for the auto connection source
- * - dynamically discovering servers, locators, handling 
+ * - dynamically discovering servers, locators, handling
  * locator disappearance, etc.
- *
  */
 public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
-  
+
   protected static final Object BRIDGE_LISTENER = "BRIDGE_LISTENER";
   private static final long MAX_WAIT = 60000;
 
@@ -64,84 +56,85 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   public AutoConnectionSourceDUnitTest(String name) {
     super(name);
   }
-  
+
   public void testDiscoverBridgeServers() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
-    
-    String locators = NetworkUtils.getServerHostName(vm0.getHost())+ "[" + locatorPort + "]";
-    
-    startBridgeServerInVM(vm1, null, locators);
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+
+    String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
 
-    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
 
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-    
+
     Assert.assertEquals("value", getInVM(vm1, "key"));
   }
 
   public void testNoLocators() {
-    
+
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
-    
+
     try {
-      startBridgeClientInVM(vm0, null, NetworkUtils.getServerHostName(vm0.getHost()), AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
+      vm0.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost())
+          , AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET)));
       putInVM(vm0, "key", "value");
       fail("Client cache should not have been able to start");
-    } catch(Exception e) {
+    } catch (Exception e) {
       //expected an exception
     }
   }
-  
+
   public void testNoBridgeServer() {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
-    try { 
-      startBridgeClientInVM(vm1, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+    try {
+      vm1.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
       putInVM(vm0, "key", "value");
       fail("Client cache should not have been able to start");
-    } catch(Exception e) {
+    } catch (Exception e) {
       //expected an exception
     }
   }
-  
-  public void testDynamicallyFindBridgeServer() throws Exception  {
+
+  public void testDynamicallyFindBridgeServer() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
-    
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-    
-    startBridgeServerInVM(vm1, null, locators);
-    
-    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
-    
+
+    vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-    
-    startBridgeServerInVM(vm3, null, locators);
-    
+
+    vm3.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
     stopBridgeMemberVM(vm1);
-    
+
     putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
-    
+
     Assert.assertEquals("value2", getInVM(vm3, "key2"));
   }
-  
+
   public void testDynamicallyFindLocators() throws Exception {
     try {
       final Host host = Host.getHost(0);
@@ -150,59 +143,60 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       VM vm1 = host.getVM(1);
       VM vm2 = host.getVM(2);
       VM vm3 = host.getVM(3);
-      
+
       int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
-      
+
       final int locatorPort0 = ports[0];
       final int locatorPort1 = ports[1];
       final int locatorPort3 = ports[2];
-      String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3});
-      startLocatorInVM(vm0, locatorPort0, locators);
-      
-      startLocatorInVM(vm1, locatorPort1, locators);
-      startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0);
-      
-      InetSocketAddress locatorToWaitFor= new InetSocketAddress(hostName, locatorPort1);
+      String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3 });
+      vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort0, locators));
+      vm1.invoke("Start Locator", () -> startLocator(vm1.getHost(), locatorPort1, locators));
+
+      vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0));
+
+      InetSocketAddress locatorToWaitFor = new InetSocketAddress(hostName, locatorPort1);
       waitForLocatorDiscovery(vm2, locatorToWaitFor);
-      
-      stopLocatorInVM(vm0);
-      startBridgeServerInVM(vm0, null, locators);
-      
+
+      vm0.invoke("Stop Locator", () -> stopLocator());
+      vm0.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
       putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
       Assert.assertEquals("value", getInVM(vm0, "key"));
-      
-      startLocatorInVM(vm3, locatorPort3, locators);
+
+      vm3.invoke("Start Locator", () -> startLocator(vm3.getHost(), locatorPort3, locators));
       stopBridgeMemberVM(vm0);
-      locatorToWaitFor= new InetSocketAddress(hostName, locatorPort3);
+      locatorToWaitFor = new InetSocketAddress(hostName, locatorPort3);
       waitForLocatorDiscovery(vm2, locatorToWaitFor);
-      stopLocatorInVM(vm1);
-      startBridgeServerInVM(vm1, null, locators);
+      vm1.invoke("Stop Locator", () -> stopLocator());
+      vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
       putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
       Assert.assertEquals("value2", getInVM(vm1, "key2"));
-    }catch(Exception ec) {
-      if(ec.getCause() != null && (ec.getCause().getCause() instanceof BindException))
+    } catch (Exception ec) {
+      if (ec.getCause() != null && (ec.getCause().getCause() instanceof BindException))
         return;//BindException let it pass
       throw ec;
     }
   }
-  
-  public void testEmbeddedLocator() throws Exception  {
+
+  public void testEmbeddedLocator() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    
+
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-    
-    startBridgeServerWithEmbeddedLocator(vm0, null, locators, new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE);
-    
-    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
-    
+
+    vm0.invoke("Start BridgeServer", () -> startBridgeServerWithEmbeddedLocator(null, locators, new String[] { REGION_NAME }
+        , CacheServer.DEFAULT_LOAD_PROBE));
+
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-    
+
     Assert.assertEquals("value", getInVM(vm2, "key"));
   }
 
@@ -211,7 +205,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws InterruptedException {
         MyLocatorCallback callback = (MyLocatorCallback) remoteObjects.get(CALLBACK_KEY);
-        
+
         boolean discovered = callback.waitForDiscovery(locatorToWaitFor, MAX_WAIT);
         Assert.assertTrue("Waited " + MAX_WAIT + " for " + locatorToWaitFor
             + " to be discovered on client. List is now: "
@@ -220,85 +214,89 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   public void testServerGroups() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
-    
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-    
-    startBridgeServerInVM(vm1, new String[] {"group1", "group2"} , locators, new String[] {"A", "B"});
-    startBridgeServerInVM(vm2, new String[] {"group2", "group3"}, locators, new String[] {"B", "C"});
 
-    
-    startBridgeClientInVM(vm3, "group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
+    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1", "group2" }, locators, new String[] { "A", "B" }));
+    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group2", "group3" }, locators, new String[] { "B", "C" }));
+
+    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group1", NetworkUtils.getServerHostName(vm0.getHost())
+        , locatorPort, new String[] { "A", "B", "C" }));
     putAndWaitForSuccess(vm3, "A", "key", "value");
     Assert.assertEquals("value", getInVM(vm1, "A", "key"));
     try {
       putInVM(vm3, "C", "key2", "value2");
       fail("Should not have been able to find Region C on the server");
-    } catch(Exception expected) {}
-    
+    } catch (Exception expected) {
+    }
+
     stopBridgeMemberVM(vm3);
-    
-    startBridgeClientInVM(vm3, "group3", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
+
+    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group3", NetworkUtils.getServerHostName(vm0.getHost()),
+        locatorPort, new String[] { "A", "B", "C" }));
     try {
       putInVM(vm3, "A", "key3", "value");
       fail("Should not have been able to find Region A on the server");
-    } catch(Exception expected) {}
+    } catch (Exception expected) {
+    }
     putInVM(vm3, "C", "key4", "value");
     Assert.assertEquals("value", getInVM(vm2, "C", "key4"));
-    
+
     stopBridgeMemberVM(vm3);
-    
-    startBridgeClientInVM(vm3, "group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
+
+    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group2", NetworkUtils.getServerHostName(vm0.getHost()),
+        locatorPort, new String[] { "A", "B", "C" }));
     putInVM(vm3, "B", "key5", "value");
     Assert.assertEquals("value", getInVM(vm1, "B", "key5"));
     Assert.assertEquals("value", getInVM(vm2, "B", "key5"));
-    
+
     stopBridgeMemberVM(vm1);
     putInVM(vm3, "B", "key6", "value");
     Assert.assertEquals("value", getInVM(vm2, "B", "key6"));
-    startBridgeServerInVM(vm1, new String[] {"group1", "group2"} , locators, new String[] {"A", "B"});
+    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1", "group2" }, locators, new String[] { "A", "B" }));
     stopBridgeMemberVM(vm2);
-    
+
     putInVM(vm3, "B", "key7", "value");
     Assert.assertEquals("value", getInVM(vm1, "B", "key7"));
   }
-  
+
   public void testTwoServersInSameVM() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-//    VM vm3 = host.getVM(3);
-    
+    //    VM vm3 = host.getVM(3);
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    
-    startLocatorInVM(vm0, locatorPort, "");
-    
+
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+
     final String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-    
-    final int serverPort1 =startBridgeServerInVM(vm1, new String[] {"group1"}, locators);
-    final int serverPort2 =addCacheServerInVM(vm1, new String[] {"group2"});
-    
-    startBridgeClientInVM(vm2, "group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
-    
-    checkEndpoints(vm2, new int[] {serverPort2});
-    
+
+    final int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1" }, locators));
+    final int serverPort2 = vm1.invoke("Start CacheServer", () -> addCacheServer(new String[] { "group2" }));
+
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient("group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+
+    checkEndpoints(vm2, new int[] { serverPort2 });
+
     stopBridgeMemberVM(vm2);
 
-    startBridgeClientInVM(vm2, "group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
-    
-    checkEndpoints(vm2, new int[] {serverPort1});
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient("group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+
+    checkEndpoints(vm2, new int[] { serverPort1 });
   }
-  
+
   public void testClientMembershipListener() throws Exception {
     final Host host = Host.getHost(0);
     VM locatorVM = host.getVM(0);
@@ -306,19 +304,20 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     VM bridge2VM = host.getVM(2);
     VM clientVM = host.getVM(3);
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(locatorVM, locatorPort, "");
+    locatorVM.invoke("Start Locator", () -> startLocator(locatorVM.getHost(), locatorPort, ""));
+
     String locators = NetworkUtils.getServerHostName(locatorVM.getHost()) + "[" + locatorPort + "]";
 
     //start a bridge server with a listener
     addBridgeListener(bridge1VM);
-    int serverPort1 = startBridgeServerInVM(bridge1VM, null, locators);
+    int serverPort1 = bridge1VM.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
 
     //start a bridge client with a listener
     addBridgeListener(clientVM);
-    startBridgeClientInVM(clientVM, null, NetworkUtils.getServerHostName(locatorVM.getHost()), locatorPort);
+    clientVM.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(locatorVM.getHost()), locatorPort));
     // wait for client to connect
-    checkEndpoints(clientVM, new int[] {serverPort1});
-    
+    checkEndpoints(clientVM, new int[] { serverPort1 });
+
     //make sure the client and bridge server both noticed each other
     waitForJoin(bridge1VM);
     MyListener serverListener = getBridgeListener(bridge1VM);
@@ -326,48 +325,48 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(1, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
-    
+
     waitForJoin(clientVM);
-    MyListener clientListener= getBridgeListener(clientVM);
+    MyListener clientListener = getBridgeListener(clientVM);
     Assert.assertEquals(0, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(1, clientListener.getJoins());
     resetBridgeListener(clientVM);
-    
-    checkEndpoints(clientVM, new int[] {serverPort1});
+
+    checkEndpoints(clientVM, new int[] { serverPort1 });
 
     //start another bridge server and make sure it is detected by the client
-    int serverPort2 = startBridgeServerInVM(bridge2VM, null, locators);
-    
-    checkEndpoints(clientVM, new int[] {serverPort1, serverPort2});
+    int serverPort2 = bridge2VM.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
+    checkEndpoints(clientVM, new int[] { serverPort1, serverPort2 });
     serverListener = getBridgeListener(bridge1VM);
     Assert.assertEquals(0, serverListener.getCrashes());
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(0, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
     waitForJoin(clientVM);
-    clientListener= getBridgeListener(clientVM);
+    clientListener = getBridgeListener(clientVM);
     Assert.assertEquals(0, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(1, clientListener.getJoins());
     resetBridgeListener(clientVM);
-    
+
     //stop the second bridge server and make sure it is detected by the client
     stopBridgeMemberVM(bridge2VM);
-    
-    checkEndpoints(clientVM, new int[] {serverPort1});
+
+    checkEndpoints(clientVM, new int[] { serverPort1 });
     serverListener = getBridgeListener(bridge1VM);
     Assert.assertEquals(0, serverListener.getCrashes());
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(0, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
     waitForCrash(clientVM);
-    clientListener= getBridgeListener(clientVM);
+    clientListener = getBridgeListener(clientVM);
     Assert.assertEquals(1, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(0, clientListener.getJoins());
     resetBridgeListener(clientVM);
-    
+
     //stop the client and make sure the bridge server notices
     stopBridgeMemberVM(clientVM);
     waitForDeparture(bridge1VM);
@@ -380,7 +379,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   protected Object getInVM(VM vm, final Serializable key) {
     return getInVM(vm, REGION_NAME, key);
   }
-  
+
   protected Object getInVM(VM vm, final String regionName, final Serializable key) {
     return vm.invoke(new SerializableCallable("Get in VM") {
       public Object call() throws Exception {
@@ -390,23 +389,22 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
-  protected void putAndWaitForSuccess(VM vm,  final String regionName, final Serializable key, final Serializable value) throws InterruptedException
-  {
+
+  protected void putAndWaitForSuccess(VM vm, final String regionName, final Serializable key, final Serializable value) throws InterruptedException {
     long endTime = System.currentTimeMillis() + MAX_WAIT;
     long remaining = MAX_WAIT;
     int i = 0;
-    while(true) {
+    while (true) {
       try {
         System.err.println("Attempt: " + (i++));
         putInVM(vm, regionName, key, value);
         break;
       } catch (NoAvailableLocatorsException | com.gemstone.gemfire.test.dunit.RMIException e) {
-        if( !(e instanceof NoAvailableLocatorsException)
+        if (!(e instanceof NoAvailableLocatorsException)
             && !(e.getCause() instanceof NoAvailableServersException)) {
           throw e;
         }
-        if(remaining <= 0) {
+        if (remaining <= 0) {
           throw e;
         }
         Wait.pause(100);
@@ -418,10 +416,8 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   protected void putInVM(VM vm, final Serializable key, final Serializable value) {
     putInVM(vm, REGION_NAME, key, value);
   }
-  
-  
-  
-  protected void putInVM(VM vm,  final String regionName, final Serializable key, final Serializable value) {
+
+  protected void putInVM(VM vm, final String regionName, final Serializable key, final Serializable value) {
     vm.invoke(new SerializableCallable("Put in VM") {
       public Object call() throws Exception {
         Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
@@ -430,11 +426,12 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   /**
    * Assert that there is one endpoint with the given host in port
    * on the client vm.
-   * @param vm - the vm the client is running in
+   *
+   * @param vm            - the vm the client is running in
    * @param expectedPorts - The server ports we expect the client to be connected to.
    */
   protected void checkEndpoints(VM vm, final int[] expectedPorts) {
@@ -445,14 +442,14 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
         List/*<ServerLocation>*/ endpoints;
         HashSet actualEndpointPorts;
         HashSet expectedEndpointPorts = new HashSet();
-        for(int i = 0; i < expectedPorts.length; i++) {
+        for (int i = 0; i < expectedPorts.length; i++) {
           expectedEndpointPorts.add(new Integer(expectedPorts[i]));
         }
         do {
           endpoints = pool.getCurrentServers();
           actualEndpointPorts = new HashSet();
-          for(Iterator itr = endpoints.iterator(); itr.hasNext();) {
-            ServerLocation sl = (ServerLocation)itr.next();
+          for (Iterator itr = endpoints.iterator(); itr.hasNext(); ) {
+            ServerLocation sl = (ServerLocation) itr.next();
             actualEndpointPorts.add(new Integer(sl.getPort()));
           }
           if (expectedEndpointPorts.size() == actualEndpointPorts.size()) {
@@ -460,12 +457,12 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
           } else {
             Wait.pause(100);
           }
-        } while(retryCount-- > 0);
+        } while (retryCount-- > 0);
         Assert.assertEquals(expectedEndpointPorts, actualEndpointPorts);
       }
     });
   }
-  
+
   protected void addBridgeListener(VM vm) {
     vm.invoke(new SerializableRunnable("Add membership listener") {
       public void run() {
@@ -475,7 +472,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   protected void resetBridgeListener(VM vm) {
     vm.invoke(new SerializableRunnable("Add membership listener") {
       public void run() {
@@ -484,7 +481,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   private MyListener getBridgeListener(VM vm) {
     return (MyListener) vm.invoke(new SerializableCallable("Add membership listener") {
       public Object call() {
@@ -492,17 +489,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   private void waitForJoin(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized(listener) {
+        synchronized (listener) {
           long end = System.currentTimeMillis() + 10000;
           while (listener.joins == 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if(remaining < 0) {
+              if (remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -514,17 +511,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   private void waitForCrash(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized(listener) {
+        synchronized (listener) {
           long end = System.currentTimeMillis() + 10000;
-          while (listener.crashes== 0) {
+          while (listener.crashes == 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if(remaining < 0) {
+              if (remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -536,17 +533,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   private void waitForDeparture(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized(listener) {
+        synchronized (listener) {
           long end = System.currentTimeMillis() + 10000;
           while (listener.departures == 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if(remaining < 0) {
+              if (remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -558,11 +555,11 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-  
+
   public static class MyListener extends ClientMembershipListenerAdapter implements Serializable {
     protected int crashes = 0;
     protected int joins = 0;
-    protected int departures= 0;
+    protected int departures = 0;
 
     @Override
     public synchronized void memberCrashed(ClientMembershipEvent event) {
@@ -596,7 +593,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       return joins;
     }
 
-    public synchronized int  getDepartures() {
+    public synchronized int getDepartures() {
       return departures;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
index 8deedc1..667af89 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
@@ -144,27 +144,22 @@ public class AutoConnectionSourceImplJUnitTest {
   
   @Test
   public void testNoServers() throws Exception {
-    
     startFakeLocator();
     handler.nextConnectionResponse = new ClientConnectionResponse(null);
-    
     assertEquals(null, source.findServer(null));
   }
   
   @Test
   public void testDiscoverServers() throws Exception {
     startFakeLocator();
-    
     ServerLocation loc1 = new ServerLocation("localhost", 4423);
     handler.nextConnectionResponse = new ClientConnectionResponse(loc1);
-    
     assertEquals(loc1, source.findServer(null));
   }
   
   @Test
   public void testDiscoverLocators() throws Exception {
     startFakeLocator();
-    
     int secondPort = AvailablePortHelper.getRandomAvailableTCPPort();
     TcpServer server2 = new TcpServer(secondPort, InetAddress.getLocalHost(), null, null, handler, new FakeHelper(), Thread.currentThread().getThreadGroup(), "tcp server");
     server2.start();


[14/49] incubator-geode git commit: GEODE-1390: Move gfsh help tests from closed to open

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/04a00042/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-offline.properties
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-offline.properties b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-offline.properties
new file mode 100644
index 0000000..a9dc64c
--- /dev/null
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/management/internal/cli/commands/golden-help-offline.properties
@@ -0,0 +1,2997 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# This file is generated with a script something like the following. The resulting output
+# needs a bit of cleanup at the beginning and end.
+#
+#  #!/usr/bin/env bash
+#
+#  set -e
+#
+#  # Preserve leading whitespace for read loops
+#  IFS=''
+#
+#  $GFSH -e "help" | awk '/^[^ ]/ {print $0}' | sed -e "s/\(.*\) (.*/\1/" | \
+#    while read i; do
+#      PARAM="$(echo $i | sed -Ee 's/[[:space:]]+/-/g').help=\\"
+#      echo $PARAM
+#      $GFSH help $i | \
+#        while read j; do
+#          if [ -n "$j" ]; then
+#            echo "$j\\" | sed -E -e ':a' -e 's/^([[:space:]]*)[[:space:]]/\1\\ /;ta'
+#          fi
+#        done
+#        echo ""
+#    done
+
+alter-disk-store.help=\
+NAME\n\
+\ \ \ \ alter disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Alter some options for a region or remove a region in an offline disk store.\n\
+SYNTAX\n\
+\ \ \ \ alter disk-store --name=value --region=value --disk-dirs=value(,value)* [--compressor(=value)?]\n\
+\ \ \ \ [--concurrency-level=value] [--enable-statistics=value] [--initial-capacity=value]\n\
+\ \ \ \ [--load-factor=value] [--lru-action=value] [--lru-algorthm=value] [--lru-limit=value]\n\
+\ \ \ \ [--off-heap=value] [--remove(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store whose contents will be altered.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region in the disk store to alter.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-dirs\n\
+\ \ \ \ \ \ \ \ Directories where data for the disk store was previously written.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ compressor\n\
+\ \ \ \ \ \ \ \ The fully-qualifed class name of the Compressor to use when compressing region entry\n\
+\ \ \ \ \ \ \ \ values. A value of 'none' will remove the Compressor.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): none\n\
+\ \ \ \ concurrency-level\n\
+\ \ \ \ \ \ \ \ An estimate of the maximum number of application threads that will concurrently modify a\n\
+\ \ \ \ \ \ \ \ region at one time. This attribute does not apply to partitioned regions.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-statistics\n\
+\ \ \ \ \ \ \ \ Whether to enable statistics. Valid values are: true and false.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ initial-capacity\n\
+\ \ \ \ \ \ \ \ Together with --load-factor, sets the parameters on the underlying\n\
+\ \ \ \ \ \ \ \ java.util.ConcurrentHashMap used for storing region entries.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ load-factor\n\
+\ \ \ \ \ \ \ \ Together with --initial-capacity, sets the parameters on the underlying\n\
+\ \ \ \ \ \ \ \ java.util.ConcurrentHashMap used for storing region entries. This must be a floating point\n\
+\ \ \ \ \ \ \ \ number between 0 and 1, inclusive.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ lru-action\n\
+\ \ \ \ \ \ \ \ Action to take when evicting entries from the region. Valid values are: none,\n\
+\ \ \ \ \ \ \ \ overflow-to-disk and local-destroy.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ lru-algorthm\n\
+\ \ \ \ \ \ \ \ Least recently used eviction algorithm.  Valid values are: none, lru-entry-count,\n\
+\ \ \ \ \ \ \ \ lru-heap-percentage and lru-memory-size.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ lru-limit\n\
+\ \ \ \ \ \ \ \ Number of entries allowed in the region before eviction will occur.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ off-heap\n\
+\ \ \ \ \ \ \ \ Whether to use off-heap memory for the region. Valid values are: true and false.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ remove\n\
+\ \ \ \ \ \ \ \ Whether to remove the region from the disk store.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+alter-region.help=\
+NAME\n\
+\ \ \ \ alter region\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Alter a region with the given path and configuration.\n\
+SYNTAX\n\
+\ \ \ \ alter region --name=value [--group=value(,value)*] [--entry-idle-time-expiration(=value)?]\n\
+\ \ \ \ [--entry-idle-time-expiration-action(=value)?] [--entry-time-to-live-expiration(=value)?]\n\
+\ \ \ \ [--entry-time-to-live-expiration-action(=value)?] [--region-idle-time-expiration(=value)?]\n\
+\ \ \ \ [--region-idle-time-expiration-action(=value)?] [--region-time-to-live-expiration(=value)?]\n\
+\ \ \ \ [--region-time-to-live-expiration-action(=value)?] [--cache-listener=value(,value)*]\n\
+\ \ \ \ [--cache-loader(=value)?] [--cache-writer(=value)?] [--async-event-queue-id=value(,value)*]\n\
+\ \ \ \ [--gateway-sender-id=value(,value)*] [--enable-cloning(=value)?] [--eviction-max(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name/Path of the region to be altered.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which the region will be altered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ entry-idle-time-expiration\n\
+\ \ \ \ \ \ \ \ How long the region's entries can remain in the cache without being accessed. The default\n\
+\ \ \ \ \ \ \ \ is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): -1\n\
+\ \ \ \ entry-idle-time-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on an entry that has exceeded the idle expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ entry-time-to-live-expiration\n\
+\ \ \ \ \ \ \ \ How long the region's entries can remain in the cache without being accessed or updated.\n\
+\ \ \ \ \ \ \ \ The default is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): -1\n\
+\ \ \ \ entry-time-to-live-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on an entry that has exceeded the TTL expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ region-idle-time-expiration\n\
+\ \ \ \ \ \ \ \ How long the region can remain in the cache without being accessed. The default is no\n\
+\ \ \ \ \ \ \ \ expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): -1\n\
+\ \ \ \ region-idle-time-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on a region that has exceeded the idle expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ region-time-to-live-expiration\n\
+\ \ \ \ \ \ \ \ How long the region can remain in the cache without being accessed or updated. The default\n\
+\ \ \ \ \ \ \ \ is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): -1\n\
+\ \ \ \ region-time-to-live-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on a region that has exceeded the TTL expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ cache-listener\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving after-event\n\
+\ \ \ \ \ \ \ \ notification of changes to the region and its entries. Any number of cache listeners can be\n\
+\ \ \ \ \ \ \ \ configured.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ cache-loader\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving notification of\n\
+\ \ \ \ \ \ \ \ cache misses in the region. At most, one cache loader can be defined in each member for the\n\
+\ \ \ \ \ \ \ \ region. For distributed regions, a cache loader may be invoked remotely from other members\n\
+\ \ \ \ \ \ \ \ that have the region defined.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ cache-writer\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving before-event\n\
+\ \ \ \ \ \ \ \ notification of changes to the region and its entries. The plug-in may cancel the event. At\n\
+\ \ \ \ \ \ \ \ most, one cache writer can be defined in each member for the region.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): __DEFAULT__\n\
+\ \ \ \ async-event-queue-id\n\
+\ \ \ \ \ \ \ \ IDs of the Async Event Queues that will be used for write-behind operations.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-sender-id\n\
+\ \ \ \ \ \ \ \ IDs of the Gateway Senders to which data will be routed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-cloning\n\
+\ \ \ \ \ \ \ \ Determines how fromDelta applies deltas to the local cache for delta propagation. When\n\
+\ \ \ \ \ \ \ \ true, the updates are applied to a clone of the value and then the clone is saved to the\n\
+\ \ \ \ \ \ \ \ cache. When false, the value is modified in place in the cache.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): false\n\
+\ \ \ \ eviction-max\n\
+\ \ \ \ \ \ \ \ Maximum value for the Eviction Attributes which the Eviction Algorithm uses to determine\n\
+\ \ \ \ \ \ \ \ when to perform its Eviction Action. The unit of the maximum value is determined by the\n\
+\ \ \ \ \ \ \ \ Eviction Algorithm.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): 0\n\
+
+alter-runtime.help=\
+NAME\n\
+\ \ \ \ alter runtime\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Alter a subset of member or members configuration properties while running.\n\
+SYNTAX\n\
+\ \ \ \ alter runtime [--member=value] [--group=value] [--archive-disk-space-limit=value]\n\
+\ \ \ \ [--archive-file-size-limit=value] [--log-disk-space-limit=value] [--log-file-size-limit=value]\n\
+\ \ \ \ [--log-level=value] [--statistic-archive-file=value] [--statistic-sample-rate=value]\n\
+\ \ \ \ [--enable-statistics=value] [--copy-on-read(=value)?] [--lock-lease=value]\n\
+\ \ \ \ [--lock-timeout=value] [--message-sync-interval=value] [--search-timeout=value]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member in whose configuration will be altered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Name/Id of the member in whose configuration will be altered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ archive-disk-space-limit\n\
+\ \ \ \ \ \ \ \ Archive disk space limit. Valid values are (in megabytes): 0 - 1000000.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ archive-file-size-limit\n\
+\ \ \ \ \ \ \ \ Archive file size limit. Valid values are (in megabytes): 0 - 1000000.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ log-disk-space-limit\n\
+\ \ \ \ \ \ \ \ Log disk space limit. Valid values are (in megabytes): 0 - 1000000.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ log-file-size-limit\n\
+\ \ \ \ \ \ \ \ Log file size limit. Valid values are (in megabytes): 0 - 1000000.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ log-level\n\
+\ \ \ \ \ \ \ \ Log level. Valid values are: none, error, info, config , warning, severe, fine, finer and\n\
+\ \ \ \ \ \ \ \ finest.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ statistic-archive-file\n\
+\ \ \ \ \ \ \ \ File to which the statistics will be written.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ statistic-sample-rate\n\
+\ \ \ \ \ \ \ \ Statistic sampling rate. Valid values are (in milliseconds): 100 - 60000.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-statistics\n\
+\ \ \ \ \ \ \ \ Whether statistic sampling should be enabled. Valid values are: true and false.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ copy-on-read\n\
+\ \ \ \ \ \ \ \ Sets the "copy on read" feature for cache read operations\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): false\n\
+\ \ \ \ lock-lease\n\
+\ \ \ \ \ \ \ \ Sets the length, in seconds, of distributed lock leases obtained by this cache.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ lock-timeout\n\
+\ \ \ \ \ \ \ \ Sets the number of seconds a cache operation may wait to obtain a distributed lock lease\n\
+\ \ \ \ \ \ \ \ before timing out.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ message-sync-interval\n\
+\ \ \ \ \ \ \ \ Sets the frequency (in seconds) at which a message will be sent by the primary cache-server\n\
+\ \ \ \ \ \ \ \ node to all the secondary cache-server nodes to remove the events which have already been\n\
+\ \ \ \ \ \ \ \ dispatched from the queue\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ search-timeout\n\
+\ \ \ \ \ \ \ \ Sets the number of seconds a cache get operation can spend searching for a value.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+backup-disk-store.help=\
+NAME\n\
+\ \ \ \ backup disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Perform a backup on all members with persistent data. The target directory must exist on all\n\
+\ \ \ \ members, but can be either local or shared. This command can safely be executed on active\n\
+\ \ \ \ members and is strongly recommended over copying files via operating system commands.\n\
+SYNTAX\n\
+\ \ \ \ backup disk-store --dir=value [--baseline-dir=value]\n\
+PARAMETERS\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directory to which backup files will be written.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ baseline-dir\n\
+\ \ \ \ \ \ \ \ Directory which contains the baseline backup used for comparison during an incremental\n\
+\ \ \ \ \ \ \ \ backup.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+change-loglevel.help=\
+NAME\n\
+\ \ \ \ change loglevel\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ This command changes log-level run time on specified servers.\n\
+SYNTAX\n\
+\ \ \ \ change loglevel --loglevel=value [--members=value(nullvalue)*] [--groups=value(nullvalue)*]\n\
+PARAMETERS\n\
+\ \ \ \ members\n\
+\ \ \ \ \ \ \ \ Name/Id of the member to change the log-level\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ groups\n\
+\ \ \ \ \ \ \ \ Groups of members to change the log-level\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ loglevel\n\
+\ \ \ \ \ \ \ \ Log level to change to\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+clear-defined-indexes.help=\
+NAME\n\
+\ \ \ \ clear defined indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Clears all the defined indexes.\n\
+SYNTAX\n\
+\ \ \ \ clear defined indexes\n\
+
+close-durable-client.help=\
+NAME\n\
+\ \ \ \ close durable-client\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Attempts to close the durable client, the client must be disconnected.\n\
+SYNTAX\n\
+\ \ \ \ close durable-client --durable-client-id=value [--member=value] [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ durable-client-id\n\
+\ \ \ \ \ \ \ \ The id used to identify the durable client.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member for which the durable client is to be closed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members for which the subscription queue events are to be counted.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+close-durable-cq.help=\
+NAME\n\
+\ \ \ \ close durable-cq\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Closes the durable cq registered by the durable client and drains events held for the durable\n\
+\ \ \ \ cq from the subscription queue.\n\
+SYNTAX\n\
+\ \ \ \ close durable-cq --durable-client-id=value --durable-cq-name=value [--member=value]\n\
+\ \ \ \ [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ durable-client-id\n\
+\ \ \ \ \ \ \ \ The id of the durable client\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ durable-cq-name\n\
+\ \ \ \ \ \ \ \ Name of the cq to be closed.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member for which the durable client is registered and the cq to be closed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members for which the durable client is registered and the cq to be closed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+compact-disk-store.help=\
+NAME\n\
+\ \ \ \ compact disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Compact a disk store on all members with that disk store. This command uses the compaction\n\
+\ \ \ \ threshold that each member has configured for its disk stores. The disk store must have\n\
+\ \ \ \ "allow-force-compaction" set to true.\n\
+SYNTAX\n\
+\ \ \ \ compact disk-store --name=value [--group=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store to be compacted.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members that will perform disk compaction. If no group is specified the disk\n\
+\ \ \ \ \ \ \ \ store will be compacted by all members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+compact-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ compact offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Compact an offline disk store. If the disk store is large, additional memory may need to be\n\
+\ \ \ \ allocated to the process using the --J=-Xmx??? parameter.\n\
+SYNTAX\n\
+\ \ \ \ compact offline-disk-store --name=value --disk-dirs=value(,value)* [--max-oplog-size=value]\n\
+\ \ \ \ [--J=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the offline disk store to be compacted.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-dirs\n\
+\ \ \ \ \ \ \ \ Directories where data for the disk store was previously written.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ max-oplog-size\n\
+\ \ \ \ \ \ \ \ Maximum size (in megabytes) of the oplogs created by compaction.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): -1\n\
+\ \ \ \ J\n\
+\ \ \ \ \ \ \ \ Arguments passed to the Java Virtual Machine performing the compact operation on the disk\n\
+\ \ \ \ \ \ \ \ store.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+configure-pdx.help=\
+NAME\n\
+\ \ \ \ configure pdx\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Configures GemFire's Portable Data eXchange for all the cache(s) in the cluster. This command\n\
+\ \ \ \ would not take effect on the running members in the system.\n\
+\ \ \ \ \ This command persists the pdx configuration in the locator with cluster configuration service.\n\
+\ \ \ \ \n\
+\ \ \ \ \ This command should be issued before starting any data members.\n\
+SYNTAX\n\
+\ \ \ \ configure pdx [--read-serialized=value] [--ignore-unread-fields=value] [--disk-store=value]\n\
+\ \ \ \ [--auto-serializable-classes=value(,value)*]\n\
+\ \ \ \ [--portable-auto-serializable-classes=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ read-serialized\n\
+\ \ \ \ \ \ \ \ Set to true to have PDX deserialization produce a PdxInstance instead of an instance of the\n\
+\ \ \ \ \ \ \ \ domain class\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ ignore-unread-fields\n\
+\ \ \ \ \ \ \ \ Control whether pdx ignores fields that were unread during deserialization. The default is\n\
+\ \ \ \ \ \ \ \ to preserve unread fields be including their data during serialization. But if you\n\
+\ \ \ \ \ \ \ \ configure the cache to ignore unread fields then their data will be lost during\n\
+\ \ \ \ \ \ \ \ serialization.You should only set this attribute to true if you know this member will only\n\
+\ \ \ \ \ \ \ \ be reading cache data. In this use case you do not need to pay the cost of preserving the\n\
+\ \ \ \ \ \ \ \ unread fields since you will never be reserializing pdx data.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-store\n\
+\ \ \ \ \ \ \ \ Named disk store where the PDX type data will be stored\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ auto-serializable-classes\n\
+\ \ \ \ \ \ \ \ the patterns which are matched against domain class names to determine whether they should\n\
+\ \ \ \ \ \ \ \ be serialized, serialization done by the auto-serializer will throw an exception if the\n\
+\ \ \ \ \ \ \ \ object of these classes are not portable to non-java languages\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ portable-auto-serializable-classes\n\
+\ \ \ \ \ \ \ \ the patterns which are matched against domain class names to determine whether they should\n\
+\ \ \ \ \ \ \ \ be serialized\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+connect.help=\
+NAME\n\
+\ \ \ \ connect\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Connect to a jmx-manager either directly or via a Locator. If connecting via a Locator, and a\n\
+\ \ \ \ jmx-manager doesn't already exist, the Locator will start one.\n\
+SYNTAX\n\
+\ \ \ \ connect [--locator=value] [--jmx-manager=value] [--use-http(=value)?] [--url=value]\n\
+\ \ \ \ [--user=value] [--password=value] [--key-store=value] [--key-store-password=value]\n\
+\ \ \ \ [--trust-store=value] [--trust-store-password=value] [--ciphers=value] [--protocols=value]\n\
+\ \ \ \ [--security-properties-file=value] [--use-ssl(=value)?]\n\
+MODES\n\
+\ \ \ \ Default Options\n\
+\ \ \ \ \ \ \ \ connect  [--use-ssl(=value)?] [--key-store=value] [--key-store-password=value]\n\
+\ \ \ \ \ \ \ \ [--trust-store=value] [--trust-store-password=value] [--ciphers=value] [--protocols=value]\n\
+\ \ \ \ \ \ \ \ [--security-properties-file=value] [--user=value] [--password=value]\n\
+\ \ \ \ Using JMX Manager\n\
+\ \ \ \ \ \ \ \ connect  --jmx-manager=value\n\
+\ \ \ \ Using HTTP REST Mode\n\
+\ \ \ \ \ \ \ \ connect  --use-http(=value)? [--url=value]\n\
+\ \ \ \ Using Locator\n\
+\ \ \ \ \ \ \ \ connect  --locator=value\n\
+PARAMETERS\n\
+\ \ \ \ locator\n\
+\ \ \ \ \ \ \ \ Network address of the Locator in the form: host[port].\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): localhost[10334]\n\
+\ \ \ \ jmx-manager\n\
+\ \ \ \ \ \ \ \ Network address of the jmx-manager in the form: host[port].\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ use-http\n\
+\ \ \ \ \ \ \ \ Connects to Manager by sending HTTP requests to HTTP service hostint the Management REST\n\
+\ \ \ \ \ \ \ \ API.  You must first 'disconnect' in order to reconnect to the Manager via locator or\n\
+\ \ \ \ \ \ \ \ jmx-manager using JMX.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ url\n\
+\ \ \ \ \ \ \ \ Indicates the base URL to the Manager's HTTP service.  For example:\n\
+\ \ \ \ \ \ \ \ 'http://<host>:<port>/gemfire/v1' Default is 'http://localhost:7070/gemfire/v1'\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): http://localhost:7070/gemfire/v1\n\
+\ \ \ \ user\n\
+\ \ \ \ \ \ \ \ User name to securely connect to the jmx-manager. If the --password parameter is not\n\
+\ \ \ \ \ \ \ \ specified then it will be prompted for.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ password\n\
+\ \ \ \ \ \ \ \ Password to securely connect to the jmx-manager.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ key-store\n\
+\ \ \ \ \ \ \ \ Java keystore file containing this application's certificate and private key. If the\n\
+\ \ \ \ \ \ \ \ --key-store-password parameter is not specified then it will be prompted for.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ key-store-password\n\
+\ \ \ \ \ \ \ \ Password to access the private key from the keystore file specified by --key-store.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ trust-store\n\
+\ \ \ \ \ \ \ \ Java keystore file containing the collection of CA certificates trusted by this\n\
+\ \ \ \ \ \ \ \ application. If the --trust-store-password parameter is not specified then it will be\n\
+\ \ \ \ \ \ \ \ prompted for.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ trust-store-password\n\
+\ \ \ \ \ \ \ \ Password to unlock the keystore file specified by --trust-store\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ ciphers\n\
+\ \ \ \ \ \ \ \ SSL/TLS ciphers used when encrypting the connection. The default is "any".\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ protocols\n\
+\ \ \ \ \ \ \ \ SSL/TLS protocol versions to enable when encrypting the connection. The default is "any".\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ security-properties-file\n\
+\ \ \ \ \ \ \ \ The gfsecurity.properties file for configuring gfsh to connect to the Locator/Manager. The\n\
+\ \ \ \ \ \ \ \ file's path can be absolute or relative to gfsh directory.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ use-ssl\n\
+\ \ \ \ \ \ \ \ Whether to use SSL for communication with Locator and/or JMX Manager. If set to "true",\n\
+\ \ \ \ \ \ \ \ will also read "gfsecurity.properties". SSL Options take precedence over proeprties file.\n\
+\ \ \ \ \ \ \ \ If none are specified, defaults will be used. The default value for this options is\n\
+\ \ \ \ \ \ \ \ "false".\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+create-async-event-queue.help=\
+NAME\n\
+\ \ \ \ create async-event-queue\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create Async Event Queue.\n\
+SYNTAX\n\
+\ \ \ \ create async-event-queue --id=value --listener=value [--group=value(nullvalue)*]\n\
+\ \ \ \ [--parallel(=value)?] [--enable-batch-conflation(=value)?] [--batch-size=value]\n\
+\ \ \ \ [--batch-time-interval=value] [--persistent(=value)?] [--disk-store=value]\n\
+\ \ \ \ [--disk-synchronous(=value)?] [--max-queue-memory=value] [--dispatcher-threads=value]\n\
+\ \ \ \ [--order-policy=value] [--gateway-event-filter=value(,value)*]\n\
+\ \ \ \ [--gateway-event-substitution-filter=value] [--listener-param=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ ID of the queue to be created.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which queue will be created. If no group is specified the queue will\n\
+\ \ \ \ \ \ \ \ be created on all members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ parallel\n\
+\ \ \ \ \ \ \ \ Whether this queue is parallel.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ enable-batch-conflation\n\
+\ \ \ \ \ \ \ \ Whether to enable batch conflation.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ batch-size\n\
+\ \ \ \ \ \ \ \ Maximum number of events that a batch can contain.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 100\n\
+\ \ \ \ batch-time-interval\n\
+\ \ \ \ \ \ \ \ Maximum amount of time, in ms, that can elapse before a batch is delivered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 1000\n\
+\ \ \ \ persistent\n\
+\ \ \ \ \ \ \ \ Whether events should be persisted to a disk store.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ disk-store\n\
+\ \ \ \ \ \ \ \ Disk store to be used by this queue.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-synchronous\n\
+\ \ \ \ \ \ \ \ Whether disk writes are synchronous.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+\ \ \ \ max-queue-memory\n\
+\ \ \ \ \ \ \ \ Maximum amount of memory, in megabytes, that the queue can consume before overflowing to\n\
+\ \ \ \ \ \ \ \ disk.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 100\n\
+\ \ \ \ dispatcher-threads\n\
+\ \ \ \ \ \ \ \ Number of threads to use for sending events.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 1\n\
+\ \ \ \ order-policy\n\
+\ \ \ \ \ \ \ \ Policy for dispatching events when --dispatcher-threads is > 1. Possible values are\n\
+\ \ \ \ \ \ \ \ 'THREAD', 'KEY', 'PARTITION'.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): KEY\n\
+\ \ \ \ gateway-event-filter\n\
+\ \ \ \ \ \ \ \ List of fully qualified class names of GatewayEventFilters for this queue.  These classes\n\
+\ \ \ \ \ \ \ \ filter events before dispatching to remote servers.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-event-substitution-filter\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the GatewayEventSubstitutionFilter for this queue.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ listener\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the AsyncEventListener for this queue.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ listener-param\n\
+\ \ \ \ \ \ \ \ Parameter name for the AsyncEventListener.  Optionally, parameter names may be followed by\n\
+\ \ \ \ \ \ \ \ # and a value for the parameter.  Example: --listener-param=loadAll\n\
+\ \ \ \ \ \ \ \ --listener-param=maxRead#1024\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+create-defined-indexes.help=\
+NAME\n\
+\ \ \ \ create defined indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Creates all the defined indexes.\n\
+SYNTAX\n\
+\ \ \ \ create defined indexes [--member=value] [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member in which the index will be created.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members in which the index will be created.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+create-disk-store.help=\
+NAME\n\
+\ \ \ \ create disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create a disk store.\n\
+SYNTAX\n\
+\ \ \ \ create disk-store --name=value --dir=value(,value)* [--allow-force-compaction(=value)?]\n\
+\ \ \ \ [--auto-compact(=value)?] [--compaction-threshold=value] [--max-oplog-size=value]\n\
+\ \ \ \ [--queue-size=value] [--time-interval=value] [--write-buffer-size=value]\n\
+\ \ \ \ [--group=value(,value)*] [--disk-usage-warning-percentage=value]\n\
+\ \ \ \ [--disk-usage-critical-percentage=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store to be created.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ allow-force-compaction\n\
+\ \ \ \ \ \ \ \ Whether to allow manual compaction through the API or command-line tools.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ auto-compact\n\
+\ \ \ \ \ \ \ \ Whether to automatically compact a file when it reaches the compaction-threshold.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+\ \ \ \ compaction-threshold\n\
+\ \ \ \ \ \ \ \ Percentage of garbage allowed in the file before it is eligible for compaction.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 50\n\
+\ \ \ \ max-oplog-size\n\
+\ \ \ \ \ \ \ \ The largest size, in megabytes, to allow an operation log to become before automatically\n\
+\ \ \ \ \ \ \ \ rolling to a new file.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 1024\n\
+\ \ \ \ queue-size\n\
+\ \ \ \ \ \ \ \ For asynchronous queueing. The maximum number of operations to allow into the write queue\n\
+\ \ \ \ \ \ \ \ before automatically flushing the queue. The default of 0 indicates no limit.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 0\n\
+\ \ \ \ time-interval\n\
+\ \ \ \ \ \ \ \ For asynchronous queueing. The number of milliseconds that can elapse before data is\n\
+\ \ \ \ \ \ \ \ flushed to disk. Reaching this limit or the queue-size limit causes the queue to flush.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 1000\n\
+\ \ \ \ write-buffer-size\n\
+\ \ \ \ \ \ \ \ Size of the buffer used to write to disk.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 32768\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directories where the disk store files will be written, the directories will be created if\n\
+\ \ \ \ \ \ \ \ they don't exist.  Optionally, directory names may be followed by # and the maximum number\n\
+\ \ \ \ \ \ \ \ of megabytes that the disk store can use in the directory.  Example: --dir=/data/ds1\n\
+\ \ \ \ \ \ \ \ --dir=/data/ds2#5000\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which the disk store will be created. If no group is specified the\n\
+\ \ \ \ \ \ \ \ disk store will be created on all members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-usage-warning-percentage\n\
+\ \ \ \ \ \ \ \ Warning percentage for disk volume usage.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 90\n\
+\ \ \ \ disk-usage-critical-percentage\n\
+\ \ \ \ \ \ \ \ Critical percentage for disk volume usage.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): 99\n\
+
+create-gateway-receiver.help=\
+NAME\n\
+\ \ \ \ create gateway-receiver\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create the Gateway Receiver on a member or members.\n\
+SYNTAX\n\
+\ \ \ \ create gateway-receiver [--group=value(,value)*] [--member=value(,value)*]\n\
+\ \ \ \ [--manual-start=value] [--start-port=value] [--end-port=value] [--bind-address=value]\n\
+\ \ \ \ [--maximum-time-between-pings=value] [--socket-buffer-size=value]\n\
+\ \ \ \ [--gateway-transport-filter=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which to create the Gateway Receiver.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member on which to create the Gateway Receiver.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ manual-start\n\
+\ \ \ \ \ \ \ \ Whether manual start is to be enabled or the receiver will start automatically after\n\
+\ \ \ \ \ \ \ \ creation.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ start-port\n\
+\ \ \ \ \ \ \ \ Starting value of the port range from which the GatewayReceiver's port will be chosen.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ end-port\n\
+\ \ \ \ \ \ \ \ End value of the port range from which the GatewayReceiver's port will be chosen.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ bind-address\n\
+\ \ \ \ \ \ \ \ The IP address or host name that the receiver's socket will listen on for client\n\
+\ \ \ \ \ \ \ \ connections.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ maximum-time-between-pings\n\
+\ \ \ \ \ \ \ \ The maximum amount of time between client pings.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ socket-buffer-size\n\
+\ \ \ \ \ \ \ \ The buffer size in bytes of the socket connection for this GatewayReceiver.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-transport-filter\n\
+\ \ \ \ \ \ \ \ The fully qualified class names of GatewayTransportFilters (separated by comma) to be added\n\
+\ \ \ \ \ \ \ \ to the GatewayReceiver. e.g.\n\
+\ \ \ \ \ \ \ \ gateway-transport-filter=com.user.filters.MyFilter1,com.user.filters.MyFilters2\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+create-gateway-sender.help=\
+NAME\n\
+\ \ \ \ create gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create the Gateway Sender on a member or members.\n\
+SYNTAX\n\
+\ \ \ \ create gateway-sender --id=value --remote-distributed-system-id=value [--group=value(,value)*]\n\
+\ \ \ \ [--member=value(,value)*] [--parallel=value] [--manual-start=value]\n\
+\ \ \ \ [--socket-buffer-size=value] [--socket-read-timeout=value] [--enable-batch-conflation=value]\n\
+\ \ \ \ [--batch-size=value] [--batch-time-interval=value] [--enable-persistence=value]\n\
+\ \ \ \ [--disk-store-name=value] [--disk-synchronous=value] [--maximum-queue-memory=value]\n\
+\ \ \ \ [--alert-threshold=value] [--dispatcher-threads=value] [--order-policy=value]\n\
+\ \ \ \ [--gateway-event-filter=value(,value)*] [--gateway-transport-filter=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which to create the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member on which to create the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ Id of the GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ remote-distributed-system-id\n\
+\ \ \ \ \ \ \ \ Id of the remote distributed system to which the sender will send events.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ parallel\n\
+\ \ \ \ \ \ \ \ Whether this is Parallel GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ manual-start\n\
+\ \ \ \ \ \ \ \ Whether manual start is to be enabled or the sender will start automatically after\n\
+\ \ \ \ \ \ \ \ creation.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ socket-buffer-size\n\
+\ \ \ \ \ \ \ \ The buffer size of the socket connection between this GatewaySender and its receiving\n\
+\ \ \ \ \ \ \ \ GatewayReceiver.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ socket-read-timeout\n\
+\ \ \ \ \ \ \ \ The amount of time in milliseconds that a socket read between a sending GatewaySender and\n\
+\ \ \ \ \ \ \ \ its receiving GatewayReceiver will block.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-batch-conflation\n\
+\ \ \ \ \ \ \ \ Whether batch conflation is to be enabled for a GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ batch-size\n\
+\ \ \ \ \ \ \ \ The batch size for the GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ batch-time-interval\n\
+\ \ \ \ \ \ \ \ The batch time interval for the GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-persistence\n\
+\ \ \ \ \ \ \ \ Whether persistence is to be enabled for the GatewaySender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-store-name\n\
+\ \ \ \ \ \ \ \ The disk store name to be configured for overflow or persistence.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-synchronous\n\
+\ \ \ \ \ \ \ \ Whether writes to the disk in case of persistence are synchronous.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ maximum-queue-memory\n\
+\ \ \ \ \ \ \ \ The maximum amount of memory (in MB) for a GatewaySender's queue.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ alert-threshold\n\
+\ \ \ \ \ \ \ \ The alert threshold for entries in a GatewaySender's queue.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ dispatcher-threads\n\
+\ \ \ \ \ \ \ \ The number of dispatcher threads working for this GatewaySender. When dispatcher threads is\n\
+\ \ \ \ \ \ \ \ set to > 1, appropriate order policy is required to be set.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ order-policy\n\
+\ \ \ \ \ \ \ \ The order policy followed while dispatching the events to remote distributed system. Order\n\
+\ \ \ \ \ \ \ \ policy is set only when dispatcher threads are > 1. Possible values are 'THREAD', 'KEY',\n\
+\ \ \ \ \ \ \ \ 'PARTITION'.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-event-filter\n\
+\ \ \ \ \ \ \ \ The list of fully qualified class names of GatewayEventFilters (separated by comma) to be\n\
+\ \ \ \ \ \ \ \ associated with the GatewaySender. This serves as a callback for users to filter out events\n\
+\ \ \ \ \ \ \ \ before dispatching to remote distributed system. e.g\n\
+\ \ \ \ \ \ \ \ gateway-event-filter=com.user.filters.MyFilter1,com.user.filters.MyFilters2\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-transport-filter\n\
+\ \ \ \ \ \ \ \ The fully qualified class name of GatewayTransportFilter to be added to the GatewaySender. \n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+create-index.help=\
+NAME\n\
+\ \ \ \ create index\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create an index that can be used when executing queries.\n\
+SYNTAX\n\
+\ \ \ \ create index --name=value --expression=value --region=value [--member=value] [--type=value]\n\
+\ \ \ \ [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the index to create.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ expression\n\
+\ \ \ \ \ \ \ \ Field of the region values that are referenced by the index.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region which corresponds to the "from" clause in a query.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member in which the index will be created.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ type\n\
+\ \ \ \ \ \ \ \ Type of the index. Valid values are: range, key and hash.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): range\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members in which the index will be created.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+create-region.help=\
+NAME\n\
+\ \ \ \ create region\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Create a region with the given path and configuration. Specifying a --key-constraint and\n\
+\ \ \ \ --value-constraint makes object type information available during querying and indexing.\n\
+SYNTAX\n\
+\ \ \ \ create region --name=value [--type=value] [--template-region=value] [--group=value(,value)*]\n\
+\ \ \ \ [--skip-if-exists(=value)?] [--async-event-queue-id=value(,value)*]\n\
+\ \ \ \ [--cache-listener=value(,value)*] [--cache-loader=value] [--cache-writer=value]\n\
+\ \ \ \ [--colocated-with=value] [--compressor=value] [--concurrency-level=value] [--disk-store=value]\n\
+\ \ \ \ [--enable-async-conflation=value] [--enable-cloning=value] [--enable-concurrency-checks=value]\n\
+\ \ \ \ [--enable-multicast=value] [--enable-statistics=value] [--enable-subscription-conflation=value]\n\
+\ \ \ \ [--enable-synchronous-disk=value] [--entry-idle-time-expiration=value]\n\
+\ \ \ \ [--entry-idle-time-expiration-action=value] [--entry-time-to-live-expiration=value]\n\
+\ \ \ \ [--entry-time-to-live-expiration-action=value] [--gateway-sender-id=value(,value)*]\n\
+\ \ \ \ [--key-constraint=value] [--local-max-memory=value] [--off-heap(=value)?]\n\
+\ \ \ \ [--region-idle-time-expiration=value] [--region-idle-time-expiration-action=value]\n\
+\ \ \ \ [--region-time-to-live-expiration=value] [--region-time-to-live-expiration-action=value]\n\
+\ \ \ \ [--recovery-delay=value] [--redundant-copies=value] [--startup-recovery-delay=value]\n\
+\ \ \ \ [--total-max-memory=value] [--total-num-buckets=value] [--value-constraint=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name/Path of the region to be created.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ type\n\
+\ \ \ \ \ \ \ \ Type of region to create. The following types are pre-defined by the product (see\n\
+\ \ \ \ \ \ \ \ RegionShortcut javadocs for more information): PARTITION, PARTITION_REDUNDANT,\n\
+\ \ \ \ \ \ \ \ PARTITION_PERSISTENT, PARTITION_REDUNDANT_PERSISTENT, PARTITION_OVERFLOW,\n\
+\ \ \ \ \ \ \ \ PARTITION_REDUNDANT_OVERFLOW, PARTITION_PERSISTENT_OVERFLOW,\n\
+\ \ \ \ \ \ \ \ PARTITION_REDUNDANT_PERSISTENT_OVERFLOW, PARTITION_HEAP_LRU, PARTITION_REDUNDANT_HEAP_LRU,\n\
+\ \ \ \ \ \ \ \ REPLICATE, REPLICATE_PERSISTENT, REPLICATE_OVERFLOW, REPLICATE_PERSISTENT_OVERFLOW,\n\
+\ \ \ \ \ \ \ \ REPLICATE_HEAP_LRU, LOCAL, LOCAL_PERSISTENT, LOCAL_HEAP_LRU, LOCAL_OVERFLOW,\n\
+\ \ \ \ \ \ \ \ LOCAL_PERSISTENT_OVERFLOW, PARTITION_PROXY, PARTITION_PROXY_REDUNDANT, and REPLICATE_PROXY.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ template-region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region whose attributes should be duplicated when creating this region.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which the region will be created.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ skip-if-exists\n\
+\ \ \ \ \ \ \ \ Skip region ceation if the region already exists.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+\ \ \ \ async-event-queue-id\n\
+\ \ \ \ \ \ \ \ IDs of the Async Event Queues that will be used for write-behind operations.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ cache-listener\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving after-event\n\
+\ \ \ \ \ \ \ \ notification of changes to the region and its entries. Any number of cache listeners can be\n\
+\ \ \ \ \ \ \ \ configured.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ cache-loader\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving notification of\n\
+\ \ \ \ \ \ \ \ cache misses in the region. At most, one cache loader can be defined in each member for the\n\
+\ \ \ \ \ \ \ \ region. For distributed regions, a cache loader may be invoked remotely from other members\n\
+\ \ \ \ \ \ \ \ that have the region defined.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ cache-writer\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of a plug-in to be instantiated for receiving before-event\n\
+\ \ \ \ \ \ \ \ notification of changes to the region and its entries. The plug-in may cancel the event. At\n\
+\ \ \ \ \ \ \ \ most, one cache writer can be defined in each member for the region.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ colocated-with\n\
+\ \ \ \ \ \ \ \ Central Region with which this region should be colocated.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ compressor\n\
+\ \ \ \ \ \ \ \ The fully-qualifed class name of the Compressor to use when compressing region entry\n\
+\ \ \ \ \ \ \ \ values.  The default is no compression.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ concurrency-level\n\
+\ \ \ \ \ \ \ \ An estimate of the maximum number of application threads that will concurrently access a\n\
+\ \ \ \ \ \ \ \ region entry at one time. This attribute does not apply to partitioned regions.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ disk-store\n\
+\ \ \ \ \ \ \ \ Disk Store to be used by this region. "list disk-store" can be used to display existing\n\
+\ \ \ \ \ \ \ \ disk stores.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-async-conflation\n\
+\ \ \ \ \ \ \ \ Whether to allow aggregation of asynchronous TCP/IP messages sent by the producer member of\n\
+\ \ \ \ \ \ \ \ the region. A false value causes all asynchronous messages to be sent individually.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-cloning\n\
+\ \ \ \ \ \ \ \ Determines how fromDelta applies deltas to the local cache for delta propagation. When\n\
+\ \ \ \ \ \ \ \ true, the updates are applied to a clone of the value and then the clone is saved to the\n\
+\ \ \ \ \ \ \ \ cache. When false, the value is modified in place in the cache.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-concurrency-checks\n\
+\ \ \ \ \ \ \ \ Enables a versioning system that detects concurrent modifications and ensures that region\n\
+\ \ \ \ \ \ \ \ contents are consistent across the distributed system.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-multicast\n\
+\ \ \ \ \ \ \ \ Enables multicast messaging on the region.  Multicast must also be enabled in the cache\n\
+\ \ \ \ \ \ \ \ distributed system properties.  This is primarily useful for replicated regions that are in\n\
+\ \ \ \ \ \ \ \ all servers.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-statistics\n\
+\ \ \ \ \ \ \ \ Whether to gather statistics for the region. Must be true to use expiration on the region.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-subscription-conflation\n\
+\ \ \ \ \ \ \ \ Whether the server should conflate its messages to the client. A false value causes all\n\
+\ \ \ \ \ \ \ \ server-client messages to be sent individually.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ enable-synchronous-disk\n\
+\ \ \ \ \ \ \ \ Whether writes are done synchronously for regions that persist data to disk.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ entry-idle-time-expiration\n\
+\ \ \ \ \ \ \ \ How long the region's entries can remain in the cache without being accessed. The default\n\
+\ \ \ \ \ \ \ \ is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ entry-idle-time-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on an entry that has exceeded the idle expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ entry-time-to-live-expiration\n\
+\ \ \ \ \ \ \ \ How long the region's entries can remain in the cache without being accessed or updated.\n\
+\ \ \ \ \ \ \ \ The default is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ entry-time-to-live-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on an entry that has exceeded the TTL expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ gateway-sender-id\n\
+\ \ \ \ \ \ \ \ IDs of the Gateway Senders to which data will be routed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ key-constraint\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the objects allowed as region keys. Ensures that keys for\n\
+\ \ \ \ \ \ \ \ region entries are all of the same class.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ local-max-memory\n\
+\ \ \ \ \ \ \ \ Sets the maximum amount of memory, in megabytes, to be used by the region in this process.\n\
+\ \ \ \ \ \ \ \ (Default: 90% of available heap)\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ off-heap\n\
+\ \ \ \ \ \ \ \ Causes the values of the region to be stored in off-heap memory. The default is on heap.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ region-idle-time-expiration\n\
+\ \ \ \ \ \ \ \ How long the region can remain in the cache without being accessed. The default is no\n\
+\ \ \ \ \ \ \ \ expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region-idle-time-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on a region that has exceeded the idle expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region-time-to-live-expiration\n\
+\ \ \ \ \ \ \ \ How long the region can remain in the cache without being accessed or updated. The default\n\
+\ \ \ \ \ \ \ \ is no expiration of this type.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region-time-to-live-expiration-action\n\
+\ \ \ \ \ \ \ \ Action to be taken on a region that has exceeded the TTL expiration.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ recovery-delay\n\
+\ \ \ \ \ \ \ \ Sets the delay in milliseconds that existing members will wait before satisfying redundancy\n\
+\ \ \ \ \ \ \ \ after another member crashes. -1 (the default) indicates that redundancy will not be\n\
+\ \ \ \ \ \ \ \ recovered after a failure.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ redundant-copies\n\
+\ \ \ \ \ \ \ \ Sets the number of extra copies of buckets desired. Extra copies allow for both high\n\
+\ \ \ \ \ \ \ \ availability in the face of VM departure (intended or unintended) and and load balancing\n\
+\ \ \ \ \ \ \ \ read operations. (Allowed values: 0, 1, 2 and 3)\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ startup-recovery-delay\n\
+\ \ \ \ \ \ \ \ Sets the delay in milliseconds that new members will wait before satisfying redundancy. -1\n\
+\ \ \ \ \ \ \ \ indicates that adding new members will not trigger redundancy recovery. The default is to\n\
+\ \ \ \ \ \ \ \ recover redundancy immediately when a new member is added.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ total-max-memory\n\
+\ \ \ \ \ \ \ \ Sets the maximum amount of memory, in megabytes, to be used by the region in all processes.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ total-num-buckets\n\
+\ \ \ \ \ \ \ \ Sets the total number of hash buckets to be used by the region in all processes. (Default:\n\
+\ \ \ \ \ \ \ \ 113).\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ value-constraint\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the objects allowed as region values. If not specified then\n\
+\ \ \ \ \ \ \ \ region values can be of any class.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+debug.help=\
+NAME\n\
+\ \ \ \ debug\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Enable/Disable debugging output in GFSH.\n\
+SYNTAX\n\
+\ \ \ \ debug --state=value\n\
+PARAMETERS\n\
+\ \ \ \ state\n\
+\ \ \ \ \ \ \ \ ON or OFF to enable or disable debugging output.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): OFF\n\
+
+define-index.help=\
+NAME\n\
+\ \ \ \ define index\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Define an index that can be used when executing queries.\n\
+SYNTAX\n\
+\ \ \ \ define index --name=value --expression=value --region=value [--type=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Define an index that can be used when executing queries.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ expression\n\
+\ \ \ \ \ \ \ \ Field of the region values that are referenced by the index.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region which corresponds to the "from" clause in a query.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ type\n\
+\ \ \ \ \ \ \ \ Type of the index. Valid values are: range, key and hash.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): range\n\
+
+deploy.help=\
+NAME\n\
+\ \ \ \ deploy\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Deploy JARs to a member or members.  Only one of either --jar or --dir may be specified.\n\
+SYNTAX\n\
+\ \ \ \ deploy [--group=value(,value)*] [--jar=value] [--dir=value]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) to which the specified JARs will be deployed. If not specified, deploy will occur\n\
+\ \ \ \ \ \ \ \ on all members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ jar\n\
+\ \ \ \ \ \ \ \ Path of the JAR to deploy.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directory from which to deploy the JARs.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+describe-client.help=\
+NAME\n\
+\ \ \ \ describe client\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display details of specified client\n\
+SYNTAX\n\
+\ \ \ \ describe client --clientID=value\n\
+PARAMETERS\n\
+\ \ \ \ clientID\n\
+\ \ \ \ \ \ \ \ ID of a client for which details are needed\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+describe-config.help=\
+NAME\n\
+\ \ \ \ describe config\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display configuration details of a member or members.\n\
+SYNTAX\n\
+\ \ \ \ describe config --member=value [--hide-defaults(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member whose configuration will be described.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ hide-defaults\n\
+\ \ \ \ \ \ \ \ Whether to hide configuration information for properties with the default value.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+
+describe-connection.help=\
+NAME\n\
+\ \ \ \ describe connection\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Display information about the current connection.\n\
+SYNTAX\n\
+\ \ \ \ describe connection\n\
+
+describe-disk-store.help=\
+NAME\n\
+\ \ \ \ describe disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display information about a member's disk store.\n\
+SYNTAX\n\
+\ \ \ \ describe disk-store --member=value --name=value\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member with the disk store to be described.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store to be described.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+describe-member.help=\
+NAME\n\
+\ \ \ \ describe member\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display information about a member, including name, id, groups, regions, etc.\n\
+SYNTAX\n\
+\ \ \ \ describe member --name=value\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Display information about a member, including name, id, groups, regions, etc.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+describe-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ describe offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Display information about an offline disk store.\n\
+SYNTAX\n\
+\ \ \ \ describe offline-disk-store --name=value --disk-dirs=value(,value)* [--pdx=value]\n\
+\ \ \ \ [--region=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store to be described.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-dirs\n\
+\ \ \ \ \ \ \ \ Directories which contain the disk store files.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ pdx\n\
+\ \ \ \ \ \ \ \ Display all the pdx types stored in the disk store\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region in the disk store to be described.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+describe-region.help=\
+NAME\n\
+\ \ \ \ describe region\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display the attributes and key information of a region.\n\
+SYNTAX\n\
+\ \ \ \ describe region --name=value\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name/Path of the region to be described.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+destroy-disk-store.help=\
+NAME\n\
+\ \ \ \ destroy disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Destroy a disk store, including deleting all files on disk used by the disk store. Data for\n\
+\ \ \ \ closed regions previously using the disk store will be lost.\n\
+SYNTAX\n\
+\ \ \ \ destroy disk-store --name=value [--group=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store that will be destroyed.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which the disk store will be destroyed. If no group is specified the\n\
+\ \ \ \ \ \ \ \ disk store will be destroyed on all members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+destroy-function.help=\
+NAME\n\
+\ \ \ \ destroy function\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Destroy/Unregister a function. The default is for the function to be unregistered from all\n\
+\ \ \ \ members.\n\
+SYNTAX\n\
+\ \ \ \ destroy function --id=value [--groups=value(nullvalue)*] [--member=value]\n\
+PARAMETERS\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ Destroy/Unregister a function. The default is for the function to be unregistered from all\n\
+\ \ \ \ \ \ \ \ members.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ groups\n\
+\ \ \ \ \ \ \ \ Groups of members from which this function will be unregistered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member from which this function will be unregistered.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+destroy-index.help=\
+NAME\n\
+\ \ \ \ destroy index\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Destroy/Remove the specified index.\n\
+SYNTAX\n\
+\ \ \ \ destroy index [--name=value] [--region=value] [--member=value] [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the index to remove.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Name/Path of the region from which the index will be removed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member from which the index will be removed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members from which the index will be removed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+destroy-region.help=\
+NAME\n\
+\ \ \ \ destroy region\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Destroy/Remove a region.\n\
+SYNTAX\n\
+\ \ \ \ destroy region --name=value\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name/Path of the region to be removed.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+disconnect.help=\
+NAME\n\
+\ \ \ \ disconnect\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Close the current connection, if one is open.\n\
+SYNTAX\n\
+\ \ \ \ disconnect\n\
+
+echo.help=\
+NAME\n\
+\ \ \ \ echo\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Echo the given text which may include system and user variables.\n\
+SYNTAX\n\
+\ \ \ \ echo --string=value\n\
+PARAMETERS\n\
+\ \ \ \ string\n\
+\ \ \ \ \ \ \ \ String to be echoed. For example, "SYS_USER variable is set to ${SYS_USER}".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+encrypt-password.help=\
+NAME\n\
+\ \ \ \ encrypt password\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Encrypt a password for use in data source configuration.\n\
+SYNTAX\n\
+\ \ \ \ encrypt password --password=value\n\
+PARAMETERS\n\
+\ \ \ \ password\n\
+\ \ \ \ \ \ \ \ Password to be encrypted.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+execute-function.help=\
+NAME\n\
+\ \ \ \ execute function\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Execute the function with the specified ID. By default will execute on all members.\n\
+SYNTAX\n\
+\ \ \ \ execute function --id=value [--groups=value(nullvalue)*] [--member=value] [--region=value]\n\
+\ \ \ \ [--arguments=value(nullvalue)*] [--result-collector=value] [--filter=value]\n\
+PARAMETERS\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ ID of the function to execute.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ groups\n\
+\ \ \ \ \ \ \ \ Groups of members on which the function will be executed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member on which the function will be executed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region on which the data dependent function will be executed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ arguments\n\
+\ \ \ \ \ \ \ \ Arguments to the function in comma separated String format.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ result-collector\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the ResultCollector to instantiate for gathering results.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ filter\n\
+\ \ \ \ \ \ \ \ Key list which causes the function to only be executed on members which have entries with\n\
+\ \ \ \ \ \ \ \ these keys.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+exit.help=\
+NAME\n\
+\ \ \ \ exit\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNONYMS\n\
+\ \ \ \ quit\n\
+SYNOPSIS\n\
+\ \ \ \ Exit GFSH and return control back to the calling process.\n\
+SYNTAX\n\
+\ \ \ \ exit\n\
+
+export-cluster-configuration.help=\
+NAME\n\
+\ \ \ \ export cluster-configuration\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Exports the cluster configuration artifacts as a zip file.\n\
+SYNTAX\n\
+\ \ \ \ export cluster-configuration --zip-file-name=value [--dir=value]\n\
+PARAMETERS\n\
+\ \ \ \ zip-file-name\n\
+\ \ \ \ \ \ \ \ Name of the zip file containing the exported cluster configuration artifacts\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ The directory in which the exported cluster configuration artifacts will be saved\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+export-config.help=\
+NAME\n\
+\ \ \ \ export config\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Export configuration properties for a member or members.\n\
+SYNTAX\n\
+\ \ \ \ export config [--member=value(,value)*] [--group=value(,value)*] [--dir=value]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member(s) whose configuration will be exported.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members whose configuration will be exported.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directory to which the exported configuration files will be written.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+export-data.help=\
+NAME\n\
+\ \ \ \ export data\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Export user data from a region to a file.\n\
+SYNTAX\n\
+\ \ \ \ export data --region=value --file=value --member=value\n\
+PARAMETERS\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region from which data will be exported.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ file\n\
+\ \ \ \ \ \ \ \ File to which the exported data will be written. The file must have an extension of ".gfd".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of a member which hosts the region. The data will be exported to the specified file\n\
+\ \ \ \ \ \ \ \ on the host where the member is running.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+export-logs.help=\
+NAME\n\
+\ \ \ \ export logs\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Export the log files for a member or members.\n\
+SYNTAX\n\
+\ \ \ \ export logs --dir=value [--group=value(nullvalue)*] [--member=value] [--log-level=value]\n\
+\ \ \ \ [--only-log-level=value] [--merge-log=value] [--start-time=value] [--end-time=value]\n\
+PARAMETERS\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directory to which log files will be written.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members whose log files will be exported.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member whose log files will be exported.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ log-level\n\
+\ \ \ \ \ \ \ \ Minimum level of log entries to export. Valid values are: none, error, info, config , fine,\n\
+\ \ \ \ \ \ \ \ finer and finest.  The default is "info".\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ only-log-level\n\
+\ \ \ \ \ \ \ \ Whether to only include those entries that exactly match the --log-level specified.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ merge-log\n\
+\ \ \ \ \ \ \ \ Whether to merge logs after exporting to the target directory.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+\ \ \ \ start-time\n\
+\ \ \ \ \ \ \ \ Log entries that occurred after this time will be exported. The default is no limit.\n\
+\ \ \ \ \ \ \ \ Format: yyyy/MM/dd/HH/mm/ss/SSS/z OR yyyy/MM/dd\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ end-time\n\
+\ \ \ \ \ \ \ \ Log entries that occurred before this time will be exported. The default is no limit.\n\
+\ \ \ \ \ \ \ \ Format: yyyy/MM/dd/HH/mm/ss/SSS/z OR yyyy/MM/dd\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+export-offline-disk-store.help=\
+NAME\n\
+\ \ \ \ export offline-disk-store\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Export region data from an offline disk store into gemfire snapshot files.\n\
+SYNTAX\n\
+\ \ \ \ export offline-disk-store --name=value --disk-dirs=value(,value)* --dir=value\n\
+PARAMETERS\n\
+\ \ \ \ name\n\
+\ \ \ \ \ \ \ \ Name of the disk store to be exported.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-dirs\n\
+\ \ \ \ \ \ \ \ Directories which contain the disk store files.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ dir\n\
+\ \ \ \ \ \ \ \ Directory to export snapshot files to.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+export-stack-traces.help=\
+NAME\n\
+\ \ \ \ export stack-traces\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Export the stack trace for a member or members.\n\
+SYNTAX\n\
+\ \ \ \ export stack-traces --file=value [--member=value] [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Export the stack trace for a member or members.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ file\n\
+\ \ \ \ \ \ \ \ Name of the file to which the stack traces will be written.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+gc.help=\
+NAME\n\
+\ \ \ \ gc\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Force GC (Garbage Collection) on a member or members. The default is for garbage collection to\n\
+\ \ \ \ occur on all caching members.\n\
+SYNTAX\n\
+\ \ \ \ gc [--group=value(nullvalue)*] [--member=value]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which garbage collection will be done.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member on which garbage collection will be done.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+get.help=\
+NAME\n\
+\ \ \ \ get\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display an entry in a region. If using a region whose key and value classes have been set, then\n\
+\ \ \ \ specifying --key-class and --value-class is unnecessary.\n\
+SYNTAX\n\
+\ \ \ \ get --key=value --region=value [--key-class=value] [--value-class=value]\n\
+\ \ \ \ [--load-on-cache-miss(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ key\n\
+\ \ \ \ \ \ \ \ String or JSON text from which to create the key.  Examples include: "James", "100L" and\n\
+\ \ \ \ \ \ \ \ "('id': 'l34s')".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region from which to get the entry.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ key-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the key's type. The default is the key constraint for the\n\
+\ \ \ \ \ \ \ \ current region or String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ value-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the value's type. The default is the value constraint for the\n\
+\ \ \ \ \ \ \ \ current region or String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ load-on-cache-miss\n\
+\ \ \ \ \ \ \ \ Explicitly enables or disables the use of any registered CacheLoaders on the specified\n\
+\ \ \ \ \ \ \ \ Region when retrieving a value for the specified Key on Cache misses. (Default is true, or\n\
+\ \ \ \ \ \ \ \ enabled)\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+
+help.help=\
+NAME\n\
+\ \ \ \ help\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Display syntax and usage information for all commands or list all available commands if\n\
+\ \ \ \ <command> isn't specified.\n\
+SYNTAX\n\
+\ \ \ \ help [command]\n\
+ARGUMENTS\n\
+\ \ \ \ command\n\
+\ \ \ \ \ \ \ \ Name of the command for which help will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+hint.help=\
+NAME\n\
+\ \ \ \ hint\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Provide hints for a topic or list all available topics if "topic" isn't specified.\n\
+SYNTAX\n\
+\ \ \ \ hint [topic]\n\
+ARGUMENTS\n\
+\ \ \ \ topic\n\
+\ \ \ \ \ \ \ \ topic\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+history.help=\
+NAME\n\
+\ \ \ \ history\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Display or export previously executed GFSH commands.\n\
+SYNTAX\n\
+\ \ \ \ history [--file=value] [--clear(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ file\n\
+\ \ \ \ \ \ \ \ File to which the history will be written.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ clear\n\
+\ \ \ \ \ \ \ \ Clears the history of GFSH commands. Takes value as true or false\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+import-cluster-configuration.help=\
+NAME\n\
+\ \ \ \ import cluster-configuration\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Imports configuration into cluster configuration hosted at the locators\n\
+SYNTAX\n\
+\ \ \ \ import cluster-configuration --zip-file-name=value\n\
+PARAMETERS\n\
+\ \ \ \ zip-file-name\n\
+\ \ \ \ \ \ \ \ The zip file containing the cluster configuration artifacts, which are to be imported\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+import-data.help=\
+NAME\n\
+\ \ \ \ import data\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Import user data from a file to a region.\n\
+SYNTAX\n\
+\ \ \ \ import data --region=value --file=value --member=value\n\
+PARAMETERS\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region into which data will be imported.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ file\n\
+\ \ \ \ \ \ \ \ File from which the imported data will be read. The file must have an extension of ".gfd".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of a member which hosts the region. The data will be imported from the specified\n\
+\ \ \ \ \ \ \ \ file on the host where the member is running.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+list-async-event-queues.help=\
+NAME\n\
+\ \ \ \ list async-event-queues\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display the Async Event Queues for all members.\n\
+SYNTAX\n\
+\ \ \ \ list async-event-queues\n\
+
+list-clients.help=\
+NAME\n\
+\ \ \ \ list clients\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display list of connected clients\n\
+SYNTAX\n\
+\ \ \ \ list clients\n\
+
+list-deployed.help=\
+NAME\n\
+\ \ \ \ list deployed\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display a list of JARs that were deployed to members using the "deploy" command.\n\
+SYNTAX\n\
+\ \ \ \ list deployed [--group=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members for which deployed JARs will be displayed.  If not specified, JARs for\n\
+\ \ \ \ \ \ \ \ all members will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+list-disk-stores.help=\
+NAME\n\
+\ \ \ \ list disk-stores\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display disk stores for all members.\n\
+SYNTAX\n\
+\ \ \ \ list disk-stores\n\
+
+list-durable-cqs.help=\
+NAME\n\
+\ \ \ \ list durable-cqs\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ List durable client cqs associated with the specified durable client id.\n\
+SYNTAX\n\
+\ \ \ \ list durable-cqs --durable-client-id=value [--member=value] [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ durable-client-id\n\
+\ \ \ \ \ \ \ \ The id used to identify the durable client\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member for which the durable client is registered and durable cqs will be\n\
+\ \ \ \ \ \ \ \ displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members for which the durable client is registered and durable cqs will be\n\
+\ \ \ \ \ \ \ \ displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+list-functions.help=\
+NAME\n\
+\ \ \ \ list functions\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display a list of registered functions. The default is to display functions for all members.\n\
+SYNTAX\n\
+\ \ \ \ list functions [--matches=value] [--group=value(,value)*] [--member=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ matches\n\
+\ \ \ \ \ \ \ \ Pattern that the function ID must match in order to be included. Uses Java pattern matching\n\
+\ \ \ \ \ \ \ \ rules, not UNIX. For example, to match any character any number of times use ".*" instead\n\
+\ \ \ \ \ \ \ \ of "*".\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members for which functions will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member(s) for which functions will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+list-gateways.help=\
+NAME\n\
+\ \ \ \ list gateways\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display the Gateway Senders and Receivers for a member or members.\n\
+SYNTAX\n\
+\ \ \ \ list gateways [--member=value(,value)*] [--group=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Member(s) for which Gateway Senders and Receivers will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members for which Gateway Senders and Receivers will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+list-indexes.help=\
+NAME\n\
+\ \ \ \ list indexes\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display the list of indexes created for all members.\n\
+SYNTAX\n\
+\ \ \ \ list indexes [--with-stats(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ with-stats\n\
+\ \ \ \ \ \ \ \ Whether statistics should also be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+list-members.help=\
+NAME\n\
+\ \ \ \ list members\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display all or a subset of members.\n\
+SYNTAX\n\
+\ \ \ \ list members [--group=value]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group name for which members will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+list-regions.help=\
+NAME\n\
+\ \ \ \ list regions\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Display regions of a member or members.\n\
+SYNTAX\n\
+\ \ \ \ list regions [--group=value] [--member=value]\n\
+PARAMETERS\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members for which regions will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member for which regions will be displayed.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+load-balance-gateway-sender.help=\
+NAME\n\
+\ \ \ \ load-balance gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Cause the Gateway Sender to close its current connections so that it reconnects to its remote\n\
+\ \ \ \ receivers in a more balanced fashion.\n\
+SYNTAX\n\
+\ \ \ \ load-balance gateway-sender --id=value\n\
+PARAMETERS\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ ID of the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+locate-entry.help=\
+NAME\n\
+\ \ \ \ locate entry\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Identifies the location, including host, member and region, of entries that have the specified\n\
+\ \ \ \ key.\n\
+SYNTAX\n\
+\ \ \ \ locate entry --key=value --region=value [--key-class=value] [--value-class=value]\n\
+\ \ \ \ [--recursive=value]\n\
+PARAMETERS\n\
+\ \ \ \ key\n\
+\ \ \ \ \ \ \ \ String or JSON text from which to create a key.  Examples include: "James", "100L" and\n\
+\ \ \ \ \ \ \ \ "('id': 'l34s')".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region in which to locate values.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ key-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the key's type. The default is java.lang.String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ value-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the value's type. The default is java.lang.String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ recursive\n\
+\ \ \ \ \ \ \ \ Whether to traverse regions and subregions recursively.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+netstat.help=\
+NAME\n\
+\ \ \ \ netstat\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Report network information and statistics via the "netstat" operating system command.\n\
+SYNTAX\n\
+\ \ \ \ netstat [--member=value(,value)*] [--group=value] [--file=value] [--with-lsof(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member(s) on which to run the netstat command.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group of members on which to run the netstat command.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ file\n\
+\ \ \ \ \ \ \ \ Text file to which output from the netstat command will be written. A ".txt" extention will\n\
+\ \ \ \ \ \ \ \ be added if it's not already a part of the specified name.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ with-lsof\n\
+\ \ \ \ \ \ \ \ Whether lsof (list open files) command output should also be displayed. Not applicable for\n\
+\ \ \ \ \ \ \ \ "Microsoft Windows(TM)" hosts.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+pause-gateway-sender.help=\
+NAME\n\
+\ \ \ \ pause gateway-sender\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Pause the Gateway Sender on a member or members.\n\
+SYNTAX\n\
+\ \ \ \ pause gateway-sender --id=value [--group=value(,value)*] [--member=value(,value)*]\n\
+PARAMETERS\n\
+\ \ \ \ id\n\
+\ \ \ \ \ \ \ \ ID of the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ group\n\
+\ \ \ \ \ \ \ \ Group(s) of members on which to pause the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ member\n\
+\ \ \ \ \ \ \ \ Name/Id of the member on which to pause the Gateway Sender.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+
+pdx-rename.help=\
+NAME\n\
+\ \ \ \ pdx rename\n\
+IS AVAILABLE\n\
+\ \ \ \ true\n\
+SYNOPSIS\n\
+\ \ \ \ Renames PDX types in an offline disk store. \n\
+\ \ \ \ \ Any pdx types that are renamed will be listed in the output. \n\
+\ \ \ \ \ If no renames are done or the disk-store is online then this command will fail.\n\
+SYNTAX\n\
+\ \ \ \ pdx rename --old=value --new=value --disk-store=value --disk-dirs=value(,value)*\n\
+PARAMETERS\n\
+\ \ \ \ old\n\
+\ \ \ \ \ \ \ \ If a PDX type's fully qualified class name has a word that matches this text then it will\n\
+\ \ \ \ \ \ \ \ be renamed. Words are delimited by '.' and '$'.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ new\n\
+\ \ \ \ \ \ \ \ The text to replace the word that matched old\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-store\n\
+\ \ \ \ \ \ \ \ Name of the disk store to operate on\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ disk-dirs\n\
+\ \ \ \ \ \ \ \ Directories which contain the disk store files\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+
+put.help=\
+NAME\n\
+\ \ \ \ put\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Add/Update an entry in a region. If using a region whose key and value classes have been set,\n\
+\ \ \ \ then specifying --key-class and --value-class is unnecessary.\n\
+SYNTAX\n\
+\ \ \ \ put --key=value --value=value --region=value [--key-class=value] [--value-class=value]\n\
+\ \ \ \ [--skip-if-exists=value]\n\
+PARAMETERS\n\
+\ \ \ \ key\n\
+\ \ \ \ \ \ \ \ String or JSON text from which to create the key.  Examples include: "James", "100L" and\n\
+\ \ \ \ \ \ \ \ "('id': 'l34s')".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ value\n\
+\ \ \ \ \ \ \ \ String or JSON text from which to create the value.  Examples include: "manager", "100L"\n\
+\ \ \ \ \ \ \ \ and "('value': 'widget')".\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ region\n\
+\ \ \ \ \ \ \ \ Region into which the entry will be put.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ key-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the key's type. The default is java.lang.String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ value-class\n\
+\ \ \ \ \ \ \ \ Fully qualified class name of the value's type. The default is java.lang.String.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ skip-if-exists\n\
+\ \ \ \ \ \ \ \ Skip the put operation when an entry with the same key already exists. The default is to\n\
+\ \ \ \ \ \ \ \ overwrite the entry (false).\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+query.help=\
+NAME\n\
+\ \ \ \ query\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Run the specified OQL query as a single quoted string and display the results in one or more\n\
+\ \ \ \ pages. Limit will default to the value stored in the "APP_FETCH_SIZE" variable. Page size will\n\
+\ \ \ \ default to the value stored in the "APP_COLLECTION_LIMIT" variable.\n\
+SYNTAX\n\
+\ \ \ \ query --query=value [--step-name=value] [--interactive=value]\n\
+PARAMETERS\n\
+\ \ \ \ query\n\
+\ \ \ \ \ \ \ \ The OQL string.\n\
+\ \ \ \ \ \ \ \ Required: true\n\
+\ \ \ \ step-name\n\
+\ \ \ \ \ \ \ \ Step name\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): ALL\n\
+\ \ \ \ interactive\n\
+\ \ \ \ \ \ \ \ Whether or not this query is interactive. If false then all results will be displayed at\n\
+\ \ \ \ \ \ \ \ once.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): true\n\
+
+rebalance.help=\
+NAME\n\
+\ \ \ \ rebalance\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Rebalance partitioned regions. The default is for all partitioned regions to be rebalanced.\n\
+SYNTAX\n\
+\ \ \ \ rebalance [--include-region=value(nullvalue)*] [--exclude-region=value(nullvalue)*]\n\
+\ \ \ \ [--time-out=value] [--simulate(=value)?]\n\
+PARAMETERS\n\
+\ \ \ \ include-region\n\
+\ \ \ \ \ \ \ \ Partitioned regions to be included when rebalancing. Includes take precedence over\n\
+\ \ \ \ \ \ \ \ excludes.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ exclude-region\n\
+\ \ \ \ \ \ \ \ Partitioned regions to be excluded when rebalancing.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ time-out\n\
+\ \ \ \ \ \ \ \ Time to wait (in seconds) before GFSH returns to a prompt while rebalancing continues in\n\
+\ \ \ \ \ \ \ \ the background. The default is to wait for rebalancing to complete.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): -1\n\
+\ \ \ \ simulate\n\
+\ \ \ \ \ \ \ \ Whether to only simulate rebalancing. The --time-out parameter is not available when\n\
+\ \ \ \ \ \ \ \ simulating.\n\
+\ \ \ \ \ \ \ \ Required: false\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is specified without value): true\n\
+\ \ \ \ \ \ \ \ Default (if the parameter is not specified): false\n\
+
+remove.help=\
+NAME\n\
+\ \ \ \ remove\n\
+IS AVAILABLE\n\
+\ \ \ \ false\n\
+SYNOPSIS\n\
+\ \ \ \ Remove an entry from a region. If using a region whose key class has been set, then specifying\n\
+\ \ \ \ --key-class is unnecessary.\n\
+SYNTAX\n\
+\ \ \ \ remove --region=value [--key=value] [--all(=value)?] [--key-class=value]\n\
+PAR

<TRUNCATED>


[37/49] incubator-geode git commit: GEODE-1256 Alter rat.gradle to exclude copies of website sources

Posted by kl...@apache.org.
GEODE-1256  Alter rat.gradle to exclude copies of website sources

  Added `geode-site/content/**` to the rat.gradle excludes list
  such that there are no longer 10 Unknown Licenses.

This closes #144


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3e181e83
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3e181e83
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3e181e83

Branch: refs/heads/feature/GEODE-835-test
Commit: 3e181e83d4177ac4acf7412430d820a11f81c811
Parents: ab417e3
Author: Karen Miller <km...@pivotal.io>
Authored: Mon May 16 18:22:01 2016 -0700
Committer: Dave Barnes <db...@pivotal.io>
Committed: Tue May 17 10:24:55 2016 -0700

----------------------------------------------------------------------
 gradle/rat.gradle | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e181e83/gradle/rat.gradle
----------------------------------------------------------------------
diff --git a/gradle/rat.gradle b/gradle/rat.gradle
index 3d0826a..f507993 100644
--- a/gradle/rat.gradle
+++ b/gradle/rat.gradle
@@ -117,6 +117,7 @@ rat {
     'geode-site/website/content/css/font-awesome.min.css',
     'geode-site/website/lib/pandoc.template',
     'geode-site/website/content/font/**',
+    'geode-site/content/**',
     // compiled logs and locks
     'geode-site/website/tmp/**',
     'geode-site/website/layouts/**',


[34/49] incubator-geode git commit: GEODE-17: make geode authorization case-sensitive since our region names are case sensitive

Posted by kl...@apache.org.
GEODE-17: make geode authorization case-sensitive since our region names are case sensitive

* Specify case sensitive when creating the permission context
* Specify case sensitive when resolving the permission from shiro-ini file
* rename shiro-init to security-shiro-init since it's security related in DistributionConfig
* For DATA operations, a "NULL" regionName is used when regionName couldn't be resolved yet. Since for permissions,
  DATA:READ is different from DATA:READ:NULL


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/84a9eb1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/84a9eb1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/84a9eb1b

Branch: refs/heads/feature/GEODE-835-test
Commit: 84a9eb1b4c43a1109ac306f7743fc5af0d37827c
Parents: 3e8a610
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Fri May 13 14:04:10 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Tue May 17 08:29:30 2016 -0700

----------------------------------------------------------------------
 .../cache/operations/OperationContext.java      | 10 ++++-
 .../internal/AbstractDistributionConfig.java    |  2 +-
 .../internal/DistributionConfig.java            | 26 ++++++++-----
 .../gemfire/internal/AbstractConfig.java        |  2 +-
 .../internal/security/GeodeSecurityUtil.java    | 41 ++++++++++++++++++++
 .../security/shiro/GeodePermissionResolver.java | 28 +++++++++++++
 .../internal/SystemManagementService.java       | 29 ++------------
 .../security/ResourceOperationContext.java      | 10 ++++-
 .../CacheServerMBeanShiroJUnitTest.java         |  2 +-
 .../security/DataCommandsSecurityTest.java      |  4 +-
 .../GeodeSecurityUtilCustomRealmJUnitTest.java  | 18 ++-------
 .../GeodeSecurityUtilWithIniFileJUnitTest.java  | 15 ++++---
 .../security/GfshCommandsSecurityTest.java      |  2 +-
 .../ResourceOperationContextJUnitTest.java      | 11 ++++--
 .../internal/security/ShiroCacheStartRule.java  |  2 +-
 .../internal/security/TestCommand.java          | 16 ++++----
 16 files changed, 140 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
index dec716c..b81016d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/operations/OperationContext.java
@@ -304,7 +304,7 @@ public abstract class OperationContext extends WildcardPermission{
   }
 
   public String getRegionName(){
-    return "NULL";
+    return null;
   }
 
   /**
@@ -358,4 +358,12 @@ public abstract class OperationContext extends WildcardPermission{
         || opCode.isRegionDestroy() || opCode.isRegionClear());
   }
 
+  @Override
+  public String toString(){
+    if(getRegionName()==null)
+      return getResource()+":"+getOperationCode();
+    else
+      return getResource()+":"+getOperationCode()+":"+getRegionName();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
index d38e1a9..17e7c2b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/AbstractDistributionConfig.java
@@ -1125,7 +1125,7 @@ public abstract class AbstractDistributionConfig
     m.put(LOCK_MEMORY_NAME, LocalizedStrings.AbstractDistributionConfig_LOCK_MEMORY.toLocalizedString(DEFAULT_LOCK_MEMORY));
     m.put(DISTRIBUTED_TRANSACTIONS_NAME, "Flag to indicate whether all transactions including JTA should be distributed transactions.  Default is false, meaning colocated transactions.");
 
-    m.put(SHIRO_INIT_NAME, "The name of the shiro configuration file in the classpath, e.g. shiro.ini");
+    m.put(SECURITY_SHIRO_INIT_NAME, "The name of the shiro configuration file in the classpath, e.g. shiro.ini");
 
     dcAttDescriptions = Collections.unmodifiableMap(m);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
index c0e560c..36ef671 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
@@ -17,6 +17,17 @@
 
 package com.gemstone.gemfire.distributed.internal;
 
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.Config;
 import com.gemstone.gemfire.internal.ConfigSource;
@@ -25,12 +36,6 @@ import com.gemstone.gemfire.internal.logging.LogConfig;
 import com.gemstone.gemfire.internal.tcp.Connection;
 import com.gemstone.gemfire.memcached.GemFireMemcachedServer;
 
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.util.*;
-
 /**
  * Provides accessor (and in some cases mutator) methods for the
  * various GemFire distribution configuration properties.  The
@@ -47,7 +52,8 @@ import java.util.*;
  *
  * @since 2.1
  */
-public interface DistributionConfig extends Config, LogConfig {
+public interface
+DistributionConfig extends Config, LogConfig {
 
   ////////////////////  Instance Methods  ////////////////////
 
@@ -3739,11 +3745,11 @@ public interface DistributionConfig extends Config, LogConfig {
   public void setLockMemory(boolean value);
 
   @ConfigAttribute(type=String.class)
-  public String SHIRO_INIT_NAME="shiro-init";
+  public String SECURITY_SHIRO_INIT_NAME ="security-shiro-init";
 
-  @ConfigAttributeSetter(name=SHIRO_INIT_NAME)
+  @ConfigAttributeSetter(name= SECURITY_SHIRO_INIT_NAME)
   public void setShiroInit(String value);
-  @ConfigAttributeGetter(name=SHIRO_INIT_NAME)
+  @ConfigAttributeGetter(name= SECURITY_SHIRO_INIT_NAME)
   public String getShiroInit();
 
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
index a4c2f2f..93cb9b2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/AbstractConfig.java
@@ -172,7 +172,7 @@ public abstract class AbstractConfig implements Config {
         }
       }
       // hide the shiro-init configuration for now. Remove after we can allow customer to specify shiro.ini file
-      if(attName.equals("shiro-init")){
+      if(attName.equals(DistributionConfig.SECURITY_SHIRO_INIT_NAME)){
         continue;
       }
       pw.print(attName);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index 6e10f3f..236b00b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -18,13 +18,16 @@
 package com.gemstone.gemfire.internal.security;
 
 import java.security.AccessController;
+import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.Callable;
 
 import com.gemstone.gemfire.cache.operations.OperationContext;
 import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
 import com.gemstone.gemfire.cache.operations.OperationContext.Resource;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.security.shiro.CustomAuthRealm;
 import com.gemstone.gemfire.internal.security.shiro.ShiroPrincipal;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
 import com.gemstone.gemfire.management.internal.security.ResourceOperationContext;
@@ -37,6 +40,11 @@ import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.ShiroException;
 import org.apache.shiro.UnavailableSecurityManagerException;
 import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.config.Ini.Section;
+import org.apache.shiro.config.IniSecurityManagerFactory;
+import org.apache.shiro.mgt.DefaultSecurityManager;
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.realm.Realm;
 import org.apache.shiro.subject.Subject;
 import org.apache.shiro.util.ThreadContext;
 
@@ -211,4 +219,37 @@ public class GeodeSecurityUtil {
     return true;
   }
 
+  /**
+   * initialize Shiro's Security Manager and Security Utilities
+   * @param securityProps
+   */
+  public static void initSecurity(Properties securityProps){
+    if(securityProps==null)
+      return;
+
+    String shiroConfig = securityProps.getProperty(DistributionConfig.SECURITY_SHIRO_INIT_NAME);
+    String customAuthenticator =securityProps.getProperty(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME);
+    if (!com.gemstone.gemfire.internal.lang.StringUtils.isBlank(shiroConfig)) {
+      IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:"+shiroConfig);
+
+      // we will need to make sure that shiro uses a case sensitive permission resolver
+      Section main = factory.getIni().addSection("main");
+      main.put("geodePermissionResolver", "com.gemstone.gemfire.internal.security.shiro.GeodePermissionResolver");
+      if(!main.containsKey("iniRealm.permissionResolver")) {
+        main.put("iniRealm.permissionResolver", "$geodePermissionResolver");
+      }
+
+      SecurityManager securityManager = factory.getInstance();
+      SecurityUtils.setSecurityManager(securityManager);
+    }
+    else if (!com.gemstone.gemfire.internal.lang.StringUtils.isBlank(customAuthenticator)) {
+      Realm realm = new CustomAuthRealm(securityProps);
+      SecurityManager securityManager = new DefaultSecurityManager(realm);
+      SecurityUtils.setSecurityManager(securityManager);
+    }
+    else{
+      SecurityUtils.setSecurityManager(null);
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
new file mode 100644
index 0000000..d170756
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.internal.security.shiro;
+
+import org.apache.shiro.authz.Permission;
+import org.apache.shiro.authz.permission.PermissionResolver;
+import org.apache.shiro.authz.permission.WildcardPermission;
+
+public class GeodePermissionResolver implements PermissionResolver {
+  @Override public Permission resolvePermission(final String permissionString) {
+    return new WildcardPermission(permissionString, true);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SystemManagementService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SystemManagementService.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SystemManagementService.java
index fd2a834..b773b94 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SystemManagementService.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/SystemManagementService.java
@@ -28,14 +28,13 @@ import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.execute.FunctionService;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.distributed.internal.ResourceEvent;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.internal.lang.StringUtils;
 import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.management.AlreadyRunningException;
 import com.gemstone.gemfire.management.AsyncEventQueueMXBean;
 import com.gemstone.gemfire.management.CacheServerMXBean;
@@ -54,13 +53,8 @@ import com.gemstone.gemfire.management.RegionMXBean;
 import com.gemstone.gemfire.management.internal.beans.ManagementAdapter;
 import com.gemstone.gemfire.management.membership.MembershipEvent;
 import com.gemstone.gemfire.management.membership.MembershipListener;
-import com.gemstone.gemfire.internal.security.shiro.CustomAuthRealm;
+
 import org.apache.logging.log4j.Logger;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.config.IniSecurityManagerFactory;
-import org.apache.shiro.mgt.DefaultSecurityManager;
-import org.apache.shiro.mgt.SecurityManager;
-import org.apache.shiro.realm.Realm;
 import org.apache.shiro.util.ThreadContext;
 
 /**
@@ -157,24 +151,7 @@ public final class SystemManagementService extends BaseManagementService {
     this.jmxAdapter = new MBeanJMXAdapter();      
     this.repo = new ManagementResourceRepo();
 
-    DistributionConfig config = system.getConfig();
-
-    // setup shiro for authentication and authorization if it's desired
-    String shiroConfig = config.getShiroInit();
-    String customAuthenticator = config.getSecurityClientAuthenticator();
-    if (!StringUtils.isBlank(shiroConfig)) {
-      IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:"+shiroConfig);
-      SecurityManager securityManager = factory.getInstance();
-      SecurityUtils.setSecurityManager(securityManager);
-    }
-    else if (!StringUtils.isBlank(customAuthenticator)) {
-      Realm realm = new CustomAuthRealm(config.getSecurityProps());
-      SecurityManager securityManager = new DefaultSecurityManager(realm);
-      SecurityUtils.setSecurityManager(securityManager);
-    }
-    else{
-      SecurityUtils.setSecurityManager(null);
-    }
+    GeodeSecurityUtil.initSecurity(system.getConfig().getSecurityProps());
 
     this.notificationHub = new NotificationHub(repo);
     if (system.getConfig().getJmxManager()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
index 2e46104..ab49270 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContext.java
@@ -43,7 +43,15 @@ public class ResourceOperationContext extends OperationContext {
     if (operation != null) this.operation = OperationCode.valueOf(operation);
     if (regionName !=null ) this.regionName = regionName;
 
-    setParts(this.resource.name()+":"+this.operation.name()+":"+this.regionName);
+    //for DATA resource, when we construct the lock to guard the operations, there should always be a 3rd part (regionName),
+    // if no regionName is specified, we need to add "NULL" to it.
+    // this means, for general data operations, or operations that we can't put a regionName on yet, like backup diskstore, query data, create regions
+    // it will require DATA:REAT/WRITE:NULL role
+    if(this.resource==Resource.DATA && this.regionName==null){
+      this.regionName = "NULL";
+    }
+
+    setParts(this.resource.name()+":"+this.operation.name()+":"+this.regionName, true);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
index 85a55a7..1c8586f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
@@ -83,7 +83,7 @@ public class CacheServerMBeanShiroJUnitTest {
 
   @Test
   @JMXConnectionConfiguration(user = "dataReader", password = "12345")
-  public void testDataRead() throws Exception{
+  public void ztestDataRead() throws Exception{
     assertThatThrownBy(() -> bean.removeIndex("foo")).hasMessageContaining(TestCommand.dataManage.toString());
     assertThatThrownBy(() -> bean.fetchLoadProbe()).hasMessageContaining(TestCommand.clusterRead.toString());
     assertThatThrownBy(() -> bean.getActiveCQCount()).hasMessageContaining(TestCommand.clusterRead.toString());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
index 97260d8..9c9b4fc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
@@ -74,10 +74,10 @@ public class DataCommandsSecurityTest {
     assertThatThrownBy(() -> bean.processCommand("import data --region=region2 --file=foo.txt --member=value")).isInstanceOf(GemFireSecurityException.class);
 
     assertThatThrownBy(() -> bean.processCommand("put --key=key1 --value=value1 --region=region2")).isInstanceOf(GemFireSecurityException.class)
-        .hasMessageContaining("[data]:[write]:[region2]");
+        .hasMessageContaining("DATA:WRITE:region2");
 
     assertThatThrownBy(() -> bean.processCommand("get --key=key1 --region=region2")).isInstanceOf(GemFireSecurityException.class)
-        .hasMessageContaining("[data]:[read]:[region2]");
+        .hasMessageContaining("DATA:READ:region2");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
index 0bf3cab..52f37e6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
@@ -17,16 +17,10 @@
 
 package com.gemstone.gemfire.management.internal.security;
 
-import java.util.Properties;
-
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.security.shiro.CustomAuthRealm;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.mgt.DefaultSecurityManager;
-import org.apache.shiro.mgt.SecurityManager;
-import org.apache.shiro.realm.Realm;
 import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
 
@@ -39,14 +33,10 @@ import org.junit.experimental.categories.Category;
 public class GeodeSecurityUtilCustomRealmJUnitTest extends GeodeSecurityUtilWithIniFileJUnitTest {
   @BeforeClass
   public static void beforeClass() throws Exception{
-    Properties properties = new Properties();
-    properties.put(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME, JSONAuthorization.class.getName() + ".create");
-    properties.put(DistributionConfig.SECURITY_CLIENT_ACCESSOR_NAME, JSONAuthorization.class.getName() + ".create");
+    props.put(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME, JSONAuthorization.class.getName() + ".create");
+    props.put(DistributionConfig.SECURITY_CLIENT_ACCESSOR_NAME, JSONAuthorization.class.getName() + ".create");
     JSONAuthorization.setUpWithJsonFile("shiro-ini.json");
-
-    Realm realm = new CustomAuthRealm(properties);
-    SecurityManager securityManager = new DefaultSecurityManager(realm);
-    SecurityUtils.setSecurityManager(securityManager);
+    GeodeSecurityUtil.initSecurity(props);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
index fe80180..63bf447 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
@@ -19,14 +19,14 @@ package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
 
+import java.util.Properties;
+
 import com.gemstone.gemfire.cache.operations.OperationContext;
-import com.gemstone.gemfire.security.GemFireSecurityException;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.config.IniSecurityManagerFactory;
-import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.util.ThreadContext;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -39,12 +39,11 @@ import org.junit.experimental.categories.Category;
  */
 @Category(UnitTest.class)
 public class GeodeSecurityUtilWithIniFileJUnitTest {
+  protected static Properties props = new Properties();
   @BeforeClass
   public static void beforeClass() throws Exception{
-    ThreadContext.remove();
-    IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:shiro.ini");
-    SecurityManager securityManager = factory.getInstance();
-    SecurityUtils.setSecurityManager(securityManager);
+    props.setProperty(DistributionConfig.SECURITY_SHIRO_INIT_NAME, "shiro.ini");
+    GeodeSecurityUtil.initSecurity(props);
   }
 
   @AfterClass

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
index 8eaaf6a..377ab77 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
@@ -112,7 +112,7 @@ public class GfshCommandsSecurityTest {
 
 
   private void runCommandsWithAndWithout(String permission) throws Exception{
-    List<TestCommand> permitted = TestCommand.getPermittedCommands(new WildcardPermission(permission));
+    List<TestCommand> permitted = TestCommand.getPermittedCommands(new WildcardPermission(permission, true));
     for(TestCommand clusterRead:permitted) {
       LogService.getLogger().info("Processing authorized command: "+clusterRead.getCommand());gfsh.executeCommand(clusterRead.getCommand());
       CommandResult result = (CommandResult) gfsh.getResult();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
index 9e2e41a..ec89aaa 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ResourceOperationContextJUnitTest.java
@@ -61,6 +61,11 @@ public class ResourceOperationContextJUnitTest {
     context = new ResourceOperationContext("DATA", null, null);
     assertEquals(Resource.DATA, context.getResource());
     assertEquals(OperationCode.NULL, context.getOperationCode());
+    assertEquals("NULL", context.getRegionName());
+
+    context = new ResourceOperationContext("CLUSTER", null, null);
+    assertEquals(Resource.CLUSTER, context.getResource());
+    assertEquals(OperationCode.NULL, context.getOperationCode());
     assertEquals(null, context.getRegionName());
 
     context = new ResourceOperationContext(null, "MANAGE", "REGIONA");
@@ -77,12 +82,12 @@ public class ResourceOperationContextJUnitTest {
   @Test
   public void testToString(){
     context = new ResourceOperationContext();
-    assertEquals("[null]:[null]:[null]", context.toString());
+    assertEquals("NULL:NULL", context.toString());
 
     context = new ResourceOperationContext("DATA", "MANAGE");
-    assertEquals("[data]:[manage]:[null]", context.toString());
+    assertEquals("DATA:MANAGE:NULL", context.toString());
 
     context = new ResourceOperationContext("DATA", "MANAGE", "REGIONA");
-    assertEquals("[data]:[manage]:[regiona]", context.toString());
+    assertEquals("DATA:MANAGE:REGIONA", context.toString());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
index 7d683f3..f4c2e06 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
@@ -43,7 +43,7 @@ public class ShiroCacheStartRule extends ExternalResource {
     properties.put(DistributionConfig.JMX_MANAGER_START_NAME, "true");
     properties.put(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxManagerPort));
     properties.put(DistributionConfig.HTTP_SERVICE_PORT_NAME, "0");
-    properties.put(DistributionConfig.SHIRO_INIT_NAME, shiroFile);
+    properties.put(DistributionConfig.SECURITY_SHIRO_INIT_NAME, shiroFile);
 
     cache = new CacheFactory(properties).create();
     cache.addCacheServer().start();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/84a9eb1b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
index 56eeeec..667330c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
@@ -96,14 +96,14 @@ public class TestCommand {
     createTestCommand("destroy region --name=value", dataManage);
 
     //Data Commands
-    createTestCommand("rebalance --include-region=regionA", dataManage);
-    createTestCommand("export data --region=regionA --file=export.txt --member=exportMember", regionARead);
-    createTestCommand("import data --region=regionA --file=import.txt --member=importMember", regionAWrite);
-    createTestCommand("put --key=key1 --value=value1 --region=regionA", regionAWrite);
-    createTestCommand("get --key=key1 --region=regionA", regionARead);
-    createTestCommand("remove --region=regionA", dataManage);
-    createTestCommand("query --query='SELECT * FROM /region1'", dataRead);
-    createTestCommand("locate entry --key=k1 --region=regionA", regionARead);
+    createTestCommand("rebalance --include-region=RegionA", dataManage);
+    createTestCommand("export data --region=RegionA --file=export.txt --member=exportMember", regionARead);
+    createTestCommand("import data --region=RegionA --file=import.txt --member=importMember", regionAWrite);
+    createTestCommand("put --key=key1 --value=value1 --region=RegionA", regionAWrite);
+    createTestCommand("get --key=key1 --region=RegionA", regionARead);
+    createTestCommand("remove --region=RegionA", dataManage);
+    createTestCommand("query --query='SELECT * FROM /RegionA'", dataRead);
+    createTestCommand("locate entry --key=k1 --region=RegionA", regionARead);
 
     // Deploy commands
     //createTestCommand("deploy --jar=group1_functions.jar --group=Group1", dataManage); // TODO: this command will fail in GfshCommandsSecurityTest at interceptor for jar file checking


[44/49] incubator-geode git commit: GEODE-17: format changes after a review

Posted by kl...@apache.org.
GEODE-17: format changes after a review


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/fcd5491a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/fcd5491a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/fcd5491a

Branch: refs/heads/feature/GEODE-835-test
Commit: fcd5491a70e54d27f1fa6d57a95c91d2a5e51319
Parents: ec1415f
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Wed May 18 07:43:06 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Wed May 18 07:43:06 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/distributed/internal/DistributionConfig.java | 3 +--
 .../gemfire/internal/security/shiro/GeodePermissionResolver.java  | 3 ++-
 .../internal/security/CacheServerMBeanShiroJUnitTest.java         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fcd5491a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
index 36ef671..2dbb5c9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
@@ -52,8 +52,7 @@ import com.gemstone.gemfire.memcached.GemFireMemcachedServer;
  *
  * @since 2.1
  */
-public interface
-DistributionConfig extends Config, LogConfig {
+public interface DistributionConfig extends Config, LogConfig {
 
   ////////////////////  Instance Methods  ////////////////////
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fcd5491a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
index d170756..44f6685 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/GeodePermissionResolver.java
@@ -22,7 +22,8 @@ import org.apache.shiro.authz.permission.PermissionResolver;
 import org.apache.shiro.authz.permission.WildcardPermission;
 
 public class GeodePermissionResolver implements PermissionResolver {
-  @Override public Permission resolvePermission(final String permissionString) {
+  @Override
+  public Permission resolvePermission(final String permissionString) {
     return new WildcardPermission(permissionString, true);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fcd5491a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
index 1c8586f..85a55a7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
@@ -83,7 +83,7 @@ public class CacheServerMBeanShiroJUnitTest {
 
   @Test
   @JMXConnectionConfiguration(user = "dataReader", password = "12345")
-  public void ztestDataRead() throws Exception{
+  public void testDataRead() throws Exception{
     assertThatThrownBy(() -> bean.removeIndex("foo")).hasMessageContaining(TestCommand.dataManage.toString());
     assertThatThrownBy(() -> bean.fetchLoadProbe()).hasMessageContaining(TestCommand.clusterRead.toString());
     assertThatThrownBy(() -> bean.getActiveCQCount()).hasMessageContaining(TestCommand.clusterRead.toString());


[12/49] incubator-geode git commit: Revert "GEODE-1146: Amending Testcase to use proper client caches rather than peer servers. Also amending JUnit4CacheTestCase.java to set "locators" and "mcast-port" to correct settings for clients."

Posted by kl...@apache.org.
Revert "GEODE-1146: Amending Testcase to use proper client caches rather than peer servers. Also amending JUnit4CacheTestCase.java to set "locators" and "mcast-port" to correct settings for clients."

This reverts commit 2c2caae9db8d687107d5d15af44a5f0d14465b35, which caused
a number of tests to fail.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7051c7ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7051c7ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7051c7ad

Branch: refs/heads/feature/GEODE-835-test
Commit: 7051c7ad61ef1c41db192c62277ff2dc0f332842
Parents: f594977
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Fri May 13 10:03:51 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Fri May 13 10:03:51 2016 -0700

----------------------------------------------------------------------
 .../query/dunit/QueryUsingPoolDUnitTest.java    | 192 ++++++++++++-------
 .../cache/internal/JUnit4CacheTestCase.java     |  17 +-
 2 files changed, 136 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7051c7ad/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
index 0e25d05..a87c243 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
@@ -18,11 +18,11 @@ package com.gemstone.gemfire.cache.query.dunit;
 
 import cacheRunner.Portfolio;
 import cacheRunner.Position;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.DataSerializable;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.query.*;
@@ -35,11 +35,16 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.jayway.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -48,7 +53,6 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.Properties;
 import java.util.Set;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Tests remote (client/server) query execution.
@@ -110,24 +114,29 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
   public void createPool(final String poolName, final String[] servers, final int[] ports,
       final boolean subscriptionEnabled) {
     // Create Cache.
-    getCache(true);
+    getCache();
 
-    PoolFactory poolFactory = PoolManager.createFactory();
-    poolFactory.setSubscriptionEnabled(subscriptionEnabled);
+    PoolFactory cpf = PoolManager.createFactory();
+    cpf.setSubscriptionEnabled(subscriptionEnabled);
     for (int i = 0; i < servers.length; i++) {
-      LogService.getLogger().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
-      poolFactory.addServer(servers[i], ports[i]);
+      LogWriterUtils.getLogWriter().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
+      cpf.addServer(servers[i], ports[i]);
     }
-    poolFactory.setMinConnections(1);
-    poolFactory.setMaxConnections(5);
-    poolFactory.setRetryAttempts(5);
-    poolFactory.create(poolName);
+
+    cpf.create(poolName);
   }
 
   public void validateCompiledQuery(final long compiledQueryCount) {
-    Awaitility.await().pollInterval(100, TimeUnit.MILLISECONDS)
-        .pollDelay(100, TimeUnit.MILLISECONDS).timeout(60, TimeUnit.SECONDS)
-        .until(() -> CacheClientNotifier.getInstance().getStats().getCompiledQueryCount() == compiledQueryCount);
+    long count = 0;
+    for (int i = 0; i < 100; i++) {
+      count = CacheClientNotifier.getInstance().getStats().getCompiledQueryCount();
+      if (count == compiledQueryCount) {
+        break;
+      } else {
+        Wait.pause(1 * 100);
+      }
+    }
+    assertEquals(compiledQueryCount, count);
   }
 
   /**
@@ -151,7 +160,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, rootRegionName, factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -277,7 +286,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -404,7 +413,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -587,6 +596,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -790,7 +800,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
         for (int i = 0; i < queryString.length; i++) {
           try {
-            LogService.getLogger().info("### Executing Query :" + queryString[i]);
+            LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
             Query query = qService.newQuery(queryString[i]);
             results = (SelectResults) query.execute(params[i]);
           } catch (Exception e) {
@@ -820,7 +830,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       for (int x = 0; x < useMaintainedCompiledQueries; x++) {
         for (int i = 0; i < queryString.length; i++) {
           try {
-            LogService.getLogger().info("### Executing Query :" + queryString[i]);
+            LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
             Query query = qService.newQuery(queryString[i]);
             results = (SelectResults) query.execute(params[i]);
           } catch (Exception e) {
@@ -901,8 +911,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // Create client region
-    final int port0 = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
-    final int port1 = vm1.invoke("getCacheServerPort", () -> getCacheServerPort());
+    final int port0 = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
+    final int port1 = vm1.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
 
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
@@ -925,7 +935,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < queryString.length; j++) {
           for (int i = 0; i < queryString.length; i++) {
             try {
-              LogService.getLogger().info("### Executing Query :" + queryString[i]);
+              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               results = (SelectResults) query.execute(params[i]);
             } catch (Exception e) {
@@ -968,8 +978,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // recreate clients and execute queries.
-    vm2.invoke("createPool", () -> createPool(poolName, new String[] { host0, host0 }, new int[] { port1, port0 }, true));
-    vm3.invoke("createPool", () -> createPool(poolName, new String[] { host0, host0 }, new int[] { port0, port1 }, true));
+    vm2.invoke("createPool", () -> createPool(poolName, new String[] { host0,host0 }, new int[] { port1, port0 }, true));
+    vm3.invoke("createPool", () -> createPool(poolName, new String[] { host0,host0 }, new int[] { port0, port1 }, true));
 
     vm2.invoke(executeQueries);
     vm3.invoke(executeQueries);
@@ -1124,10 +1134,14 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     // Validate maintained compiled queries.
     vm0.invoke("validate Compiled query", () -> validateCompiledQuery(queryString.length));
 
+    // Let the compiled queries to be idle (not used).
+    Wait.pause(2 * 1000);
+
     // Validate maintained compiled queries.
     vm0.invoke("validate Compiled query", () -> validateCompiledQuery(0));
 
     // Close clients
+
     vm1.invoke("closeClient", () -> closeClient());
     vm2.invoke("closeClient", () -> closeClient());
 
@@ -1247,6 +1261,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
   @Category(FlakyTest.class) // GEODE-1146: time senstiive, thread sleeps, uses zero port for servers (good!), async actions, AsyncInvocation orphans
   public void testBindParamsWithMulitipleClients() throws CacheException {
 
+    final String name = this.getName();
+
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
@@ -1282,7 +1298,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // Create client region
-    final int port0 = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
+    final int port0 = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
 
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
@@ -1308,7 +1324,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < 5; j++) {
           for (int i = 0; i < 2; i++) {
             try {
-              LogService.getLogger().info("### Executing Query :" + queryString[i]);
+              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               rs[0][0] = (SelectResults) query.execute(params[i]);
               Query query2 = qService.newQuery(querys[i]);
@@ -1317,17 +1333,37 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
             } catch (Exception e) {
               Assert.fail("Failed executing " + queryString[i], e);
             }
-            LogService.getLogger().info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+            LogWriterUtils.getLogWriter().info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
             compareQueryResultsWithoutAndWithIndexes(rs, 1);
-            LogService.getLogger().info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+            LogWriterUtils.getLogWriter().info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
           }
         }
       }
     };
 
-    vm1.invoke("executeSameQueries", () -> executeSameQueries);
-    vm2.invoke("executeSameQueries", () -> executeSameQueries);
-    vm3.invoke("executeSameQueries", () -> executeSameQueries);
+    vm1.invokeAsync(executeSameQueries);
+    vm2.invokeAsync(executeSameQueries);
+    vm3.invokeAsync(executeSameQueries);
+
+    // Wait till the query execution completes.
+    vm0.invoke("validate compiled query.", () -> {
+      long compiledQueryUsedCount = -1;
+      while (true) {
+        LogWriterUtils.getLogWriter().info("### CompiledQueryUsedCount :" + compiledQueryUsedCount);
+        if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
+          LogWriterUtils.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
+          break;
+        } else {
+          compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
+          try {
+            Thread.currentThread().sleep(3 * 1000);
+          } catch (Exception ex) {
+            break;
+          }
+        }
+      }
+      return 0;
+    });
 
     // Execute client queries and validate results.
     SerializableRunnable executeQueries = new CacheSerializableRunnable("Execute queries") {
@@ -1343,7 +1379,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < queryString.length; j++) {
           for (int i = 0; i < queryString.length; i++) {
             try {
-              LogService.getLogger().info("### Executing Query :" + queryString[i]);
+              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               rs[0][0] = (SelectResults) query.execute(params[i]);
               Query query2 = qService.newQuery(querys[i]);
@@ -1358,9 +1394,29 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       }
     };
 
-    vm1.invoke("executeQueries", () -> executeQueries);
-    vm2.invoke("executeQueries", () -> executeQueries);
-    vm3.invoke("executeQueries", () -> executeQueries);
+    vm1.invokeAsync("executeQueries", () -> executeQueries);
+    vm2.invokeAsync("executeQueries", () -> executeQueries);
+    vm3.invokeAsync("executeQueries", () -> executeQueries);
+
+    // Wait till the query execution completes.
+    vm0.invoke("validate compiled query.", () -> {
+      long compiledQueryUsedCount = -1;
+      while (true) {
+        LogWriterUtils.getLogWriter().info("### previous CompiledQueryUsedCount :" + compiledQueryUsedCount);
+        if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
+          LogWriterUtils.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
+          break;
+        } else {
+          compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
+          try {
+            Thread.currentThread().sleep(3 * 1000);
+          } catch (Exception ex) {
+            break;
+          }
+        }
+      }
+      return 0;
+    });
 
     vm1.invoke("closeClient", () -> closeClient());
     vm2.invoke("closeClient", () -> closeClient());
@@ -1392,7 +1448,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       factory.setScope(Scope.LOCAL);
       createRegion(name + "1", factory.create());
       createRegion(name + "2", factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1484,7 +1540,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1500,7 +1556,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       }
     });
 
-    final int port = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
+    final int port = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
     final String regionName = "/" + rootRegionName + "/" + name;
@@ -1607,7 +1663,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       Properties config = new Properties();
       config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
       getSystem(config);
-      //      Wait.pause(1000);
+
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1627,7 +1684,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         }
 
       });
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       for (int i = 0; i < numberOfEntries; i++) {
         region1.put("key-" + i, new TestObject(i, "ibm"));
         region2.put("key-" + i, new TestObject(i, "ibm"));
@@ -1693,7 +1750,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      //      Wait.pause(1000);
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1835,7 +1892,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       Properties config = new Properties();
       config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
       getSystem(config);
-      //      Wait.pause(1000);
+
+      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1865,7 +1923,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
     // Execute client queries in VM1      
     vm1.invoke("Execute queries", () -> {
-      final Region region1 = ((ClientCache) getCache()).createClientRegionFactory(ClientRegionShortcut.LOCAL).create(name);
+      AttributesFactory factory = new AttributesFactory();
+      factory.setScope(Scope.LOCAL);
+      final Region region1 = createRegion(name, factory.createRegionAttributes());
 
       String queryString = "select distinct * from " + regionName1 + " where ticker = $1";
       Object[] params = new Object[] { new String("ibm") };
@@ -1966,15 +2026,15 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       type1 = ((SelectResults) r[j][0]).getCollectionType().getElementType();
       type2 = ((SelectResults) r[j][1]).getCollectionType().getElementType();
       if ((type1.getClass().getName()).equals(type2.getClass().getName())) {
-        LogService.getLogger().info("Both SelectResults are of the same Type i.e.--> "
+        LogWriterUtils.getLogWriter().info("Both SelectResults are of the same Type i.e.--> "
             + ((SelectResults) r[j][0]).getCollectionType().getElementType());
       } else {
-        LogService.getLogger().info("Classes are : " + type1.getClass().getName() + " "
+        LogWriterUtils.getLogWriter().info("Classes are : " + type1.getClass().getName() + " "
             + type2.getClass().getName());
         fail("FAILED:Select result Type is different in both the cases");
       }
       if (((SelectResults) r[j][0]).size() == ((SelectResults) r[j][1]).size()) {
-        LogService.getLogger().info("Both SelectResults are of Same Size i.e.  Size= "
+        LogWriterUtils.getLogWriter().info("Both SelectResults are of Same Size i.e.  Size= "
             + ((SelectResults) r[j][1]).size());
       } else {
         fail("FAILED:SelectResults size is different in both the cases. Size1="
@@ -1984,7 +2044,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       set2 = (((SelectResults) r[j][1]).asSet());
       set1 = (((SelectResults) r[j][0]).asSet());
 
-      LogService.getLogger().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
+      LogWriterUtils.getLogWriter().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
 
       //      boolean pass = true;
       itert1 = set1.iterator();
@@ -1994,10 +2054,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
         boolean exactMatch = false;
         while (itert2.hasNext()) {
-          LogService.getLogger().info("### Comparing results..");
+          LogWriterUtils.getLogWriter().info("### Comparing results..");
           Object p2 = itert2.next();
           if (p1 instanceof Struct) {
-            LogService.getLogger().info("ITS a Set");
+            LogWriterUtils.getLogWriter().info("ITS a Set");
             Object[] values1 = ((Struct) p1).getFieldValues();
             Object[] values2 = ((Struct) p2).getFieldValues();
             assertEquals(values1.length, values2.length);
@@ -2009,26 +2069,26 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
             }
             exactMatch = elementEqual;
           } else {
-            LogService.getLogger().info("Not a Set p2:" + p2 + " p1: " + p1);
+            LogWriterUtils.getLogWriter().info("Not a Set p2:" + p2 + " p1: " + p1);
             if (p2 instanceof TestObject) {
-              LogService.getLogger().info("An instance of TestObject");
+              LogWriterUtils.getLogWriter().info("An instance of TestObject");
               exactMatch = p2.equals(p1);
             } else {
-              LogService.getLogger().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
+              LogWriterUtils.getLogWriter().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
               exactMatch = p2.equals(p1);
             }
           }
           if (exactMatch) {
-            LogService.getLogger().info("Exact MATCH");
+            LogWriterUtils.getLogWriter().info("Exact MATCH");
             break;
           }
         }
         if (!exactMatch) {
-          LogService.getLogger().info("NOT A MATCH");
+          LogWriterUtils.getLogWriter().info("NOT A MATCH");
           fail("Atleast one element in the pair of SelectResults supposedly identical, is not equal ");
         }
       }
-      LogService.getLogger().info("### Done Comparing results..");
+      LogWriterUtils.getLogWriter().info("### Done Comparing results..");
     }
   }
 
@@ -2039,7 +2099,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
     createRegion(this.regionName, this.rootRegionName, factory.create());
-    //    Wait.pause(1000);
+    Wait.pause(1000);
     try {
       startBridgeServer(0, false);
     } catch (Exception ex) {
@@ -2058,9 +2118,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
     for (int i = 0; i < queryString.length; i++) {
       try {
-        LogService.getLogger().info("### Executing Query :" + queryString[i]);
+        LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
         Query query = qService.newQuery(queryString[i]);
-        query.execute(params[i]);
+        SelectResults results = (SelectResults) query.execute(params[i]);
       } catch (Exception e) {
         Assert.fail("Failed executing " + queryString[i], e);
       }
@@ -2094,13 +2154,13 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
   /* Close Client */
   public void closeClient() {
-    LogService.getLogger().info("### Close Client. ###");
+    LogWriterUtils.getLogWriter().info("### Close Client. ###");
     try {
       closeCache();
     } catch (Exception ex) {
-      LogService.getLogger().info("### Failed to get close client. ###");
+      LogWriterUtils.getLogWriter().info("### Failed to get close client. ###");
     }
-    //    Wait.pause(2 * 1000);
+    Wait.pause(2 * 1000);
   }
 
   private static int getCacheServerPort() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7051c7ad/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
index fe63813..6a719ab 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -23,9 +23,7 @@ import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Properties;
-import java.util.concurrent.TimeUnit;
 
-import com.jayway.awaitility.Awaitility;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
@@ -111,8 +109,6 @@ public class JUnit4CacheTestCase extends JUnit4DistributedTestCase implements Ca
         System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
         Cache newCache;
         if (client) {
-          System.setProperty("gemfire.locators", "");
-          System.setProperty("gemfire.mcast-port", "0");
           newCache = (Cache)new ClientCacheFactory(getSystem().getProperties()).create();
         } else {
           if(factory == null) {
@@ -244,9 +240,16 @@ public class JUnit4CacheTestCase extends JUnit4DistributedTestCase implements Ca
       final GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
       if (gemFireCache != null && !gemFireCache.isClosed()
               && gemFireCache.getCancelCriterion().cancelInProgress() != null) {
-        Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS)
-            .pollInterval(100,TimeUnit.MILLISECONDS).timeout(60,TimeUnit.SECONDS)
-            .until(() -> gemFireCache.isClosed());
+        Wait.waitForCriterion(new WaitCriterion() { // TODO: replace with Awaitility
+          @Override
+          public boolean done() {
+            return gemFireCache.isClosed();
+          }
+          @Override
+          public String description() {
+            return "waiting for cache to close";
+          }
+        }, 30 * 1000, 300, true);
       }
       if (cache == null || cache.isClosed()) {
         cache = null;


[33/49] incubator-geode git commit: GEODE-1351: let the waitForFlush() to return false if timeout

Posted by kl...@apache.org.
GEODE-1351: let the waitForFlush() to return false if timeout

also apply it on some unit tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/3e8a610e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/3e8a610e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/3e8a610e

Branch: refs/heads/feature/GEODE-835-test
Commit: 3e8a610e99bc005bcc56c378e3d1e2274a3d468c
Parents: 34d3791
Author: zhouxh <gz...@pivotal.io>
Authored: Mon May 16 17:12:15 2016 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Mon May 16 17:12:15 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/lucene/LuceneIndex.java       |  4 +++-
 .../cache/lucene/internal/LuceneIndexImpl.java  | 11 ++++-----
 .../internal/xml/LuceneIndexCreation.java       |  3 ++-
 .../LuceneIndexCreationIntegrationTest.java     | 25 ++++++++++----------
 .../LuceneIndexRecoveryHAIntegrationTest.java   | 14 +++++------
 5 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e8a610e/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
index be329f7..6b1a4b4 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
@@ -58,7 +58,9 @@ public interface LuceneIndex {
   
   /* 
    * wait until the current entries in cache are indexed
+   * @param maxWaitInMilliseconds max wait time in millisecond
+   * @return if entries are flushed within maxWait
    */
-  public void waitUntilFlushed(int maxWait);
+  public boolean waitUntilFlushed(int maxWaitInMillisecond);
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e8a610e/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
index 981d9e4..c165085 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
@@ -81,19 +81,17 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
     searchableFieldNames = fields;
   }
 
-  /*
-   *  For test and demo purpose. To use it, the data region should stop feeding
-   *  A more advanced version is under-development
-   */
   @Override
-  public void waitUntilFlushed(int maxWait) {
+  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
     String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
     AsyncEventQueue queue = (AsyncEventQueue)cache.getAsyncEventQueue(aeqId);
+    boolean flushed = false;
     if (queue != null) {
       long start = System.nanoTime();
-      while (System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(maxWait)) {
+      while (System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(maxWaitInMillisecond)) {
         if (0 == queue.size()) {
           logger.debug("waitUntilFlushed: Queue size is 0");
+          flushed = true;
           break;
         } else {
           try {
@@ -105,6 +103,7 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
     } else { 
       throw new IllegalArgumentException("The AEQ does not exist for the index "+indexName+" region "+regionPath);
     }
+    return flushed;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e8a610e/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
index b54f51b..a3bdd24 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
@@ -116,6 +116,7 @@ public class LuceneIndexCreation implements LuceneIndex, Extension<Region<?, ?>>
   }
 
   @Override
-  public void waitUntilFlushed(int maxWait) {
+  public boolean waitUntilFlushed(int maxWaitInMillisecond) {
+    return true;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e8a610e/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index 6429143..fe754a4 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -44,7 +44,6 @@ import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.jayway.awaitility.Awaitility;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordTokenizer;
@@ -71,12 +70,10 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
     Region region = createRegion();
     final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
     region.put("key1", new TestObject());
-
+    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
     assertEquals(analyzers, index.getFieldAnalyzers());
-    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
-      assertEquals(Arrays.asList("field1"), field1Analyzer.analyzedfields);
-      assertEquals(Arrays.asList("field2"), field2Analyzer.analyzedfields);
-    });
+    assertEquals(Arrays.asList("field1"), field1Analyzer.analyzedfields);
+    assertEquals(Arrays.asList("field2"), field2Analyzer.analyzedfields);
   }
 
   @Test
@@ -188,26 +185,28 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
     cache.close();
     createCache();
     createIndex("field1", "field2");
+    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
     dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
       .create(REGION_NAME);
     LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
       .create(INDEX_NAME, REGION_NAME,
         "field1:world");
-    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
-      assertEquals(1, query.search().size());
-    });
+    assertEquals(1, query.search().size());
   }
 
+  private void verifyIndexFinishFlushing(String indexName, String regionName) {
+    LuceneIndex index = luceneService.getIndex(indexName, regionName);
+    boolean flushed = index.waitUntilFlushed(60000);
+    assertTrue(flushed);
+  }
+  
   @Test
   public void shouldRecoverPersistentIndexWhenDataIsWrittenToIndex() throws ParseException, InterruptedException {
     createIndex("field1", "field2");
     Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
       .create(REGION_NAME);
     dataRegion.put("A", new TestObject());
-    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue();
-
-    //Wait until the queue has drained
-    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> assertEquals(0, queue.size()));
+    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
     cache.close();
     createCache();
     createIndex("text");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3e8a610e/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
index 77d2a5c..d32e6d8 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexRecoveryHAIntegrationTest.java
@@ -41,6 +41,7 @@ import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionFactory;
 import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
 import com.gemstone.gemfire.cache.lucene.LuceneQuery;
 import com.gemstone.gemfire.cache.lucene.LuceneQueryResults;
 import com.gemstone.gemfire.cache.lucene.LuceneService;
@@ -55,7 +56,6 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.jayway.awaitility.Awaitility;
 
 @Category(IntegrationTest.class)
 public class LuceneIndexRecoveryHAIntegrationTest {
@@ -139,7 +139,7 @@ public class LuceneIndexRecoveryHAIntegrationTest {
     value = new Type1("lucene world", 1, 2L, 3.0, 4.0f);
     userRegion.put("value3", value);
 
-    waitUntilQueueEmpty(aeqId);
+    verifyIndexFinishFlushing(INDEX, REGION);
 
     LuceneQuery<Integer, Type1> query = service.createLuceneQueryFactory().create(INDEX, REGION, "s:world");
     LuceneQueryResults<Integer, Type1> results = query.search();
@@ -190,7 +190,7 @@ public class LuceneIndexRecoveryHAIntegrationTest {
     value = new Type1("lucene world", 1, 2L, 3.0, 4.0f);
     userRegion.put("value3", value);
 
-    waitUntilQueueEmpty(aeqId);
+    verifyIndexFinishFlushing(INDEX, REGION);
 
     PartitionedRegion fileRegion = (PartitionedRegion) cache.getRegion(aeqId + ".files");
     assertNotNull(fileRegion);
@@ -203,9 +203,9 @@ public class LuceneIndexRecoveryHAIntegrationTest {
     Assert.assertEquals(3, results.size());
   }
 
-  private void waitUntilQueueEmpty(final String aeqId) {
-    // TODO flush queue
-    AsyncEventQueue queue = cache.getAsyncEventQueue(aeqId);
-    Awaitility.waitAtMost(1000, TimeUnit.MILLISECONDS).until(() -> assertEquals(0, queue.size()));
+  private void verifyIndexFinishFlushing(String indexName, String regionName) {
+    LuceneIndex index = LuceneServiceProvider.get(cache).getIndex(indexName, regionName);
+    boolean flushed = index.waitUntilFlushed(60000);
+    assertTrue(flushed);
   }
 }


[20/49] incubator-geode git commit: GEODE-1293: Updating module scripts and structure

Posted by kl...@apache.org.
GEODE-1293: Updating module scripts and structure

- Remove cacheserver.sh and gemfire.sh scripts in favor of using gfsh
- Adjust p2p config to always use locators
- Have modify_war reference correct jars


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d216e553
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d216e553
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d216e553

Branch: refs/heads/feature/GEODE-835-test
Commit: d216e55330e794137cee2684d05eaef683ff00f8
Parents: d1a0748
Author: Jens Deppe <jd...@pivotal.io>
Authored: Tue Mar 29 12:46:22 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Fri May 13 11:16:16 2016 -0700

----------------------------------------------------------------------
 extensions/geode-modules-assembly/build.gradle  |  53 ++------
 .../release/conf/cache-client.xml               |  14 +-
 .../release/conf/cache-server.xml               |   6 +-
 .../release/scripts/cacheserver.bat             | 133 -------------------
 .../release/scripts/cacheserver.sh              |  97 --------------
 .../release/scripts/gemfire.bat                 |  41 ------
 .../release/scripts/gemfire.sh                  |  58 --------
 .../release/scripts/setenv.properties           |   1 +
 .../release/session/bin/cacheserver.bat         |  56 --------
 .../release/session/bin/cacheserver.sh          |  57 --------
 .../release/session/bin/gemfire.bat             |  53 --------
 .../release/session/bin/gemfire.sh              |  69 ----------
 .../release/session/bin/modify_war              |  91 +++++++------
 .../release/session/bin/setenv.properties       |   6 -
 .../gemfire-cs-tomcat-7/context-fragment.xml    |  15 ---
 .../tcserver/gemfire-cs-tomcat-7/modules.env    |   1 -
 .../gemfire-cs-tomcat-8/context-fragment.xml    |  15 ---
 .../tcserver/gemfire-cs-tomcat-8/modules.env    |   1 -
 .../gemfire-cs/configuration-prompts.properties |  17 ---
 .../tcserver/gemfire-cs/context-fragment.xml    |  13 --
 .../release/tcserver/gemfire-cs/modules.env     |   1 -
 .../tcserver/gemfire-cs/server-fragment.xml     |  12 --
 .../gemfire-p2p-tomcat-7/context-fragment.xml   |  15 ---
 .../tcserver/gemfire-p2p-tomcat-7/modules.env   |   1 -
 .../gemfire-p2p-tomcat-8/context-fragment.xml   |  15 ---
 .../tcserver/gemfire-p2p-tomcat-8/modules.env   |   1 -
 .../configuration-prompts.properties            |  19 ---
 .../tcserver/gemfire-p2p/context-fragment.xml   |  13 --
 .../release/tcserver/gemfire-p2p/modules.env    |   1 -
 .../tcserver/gemfire-p2p/server-fragment.xml    |  14 --
 .../geode-cs-tomcat-7/context-fragment.xml      |  15 +++
 .../geode-cs-tomcat-8/context-fragment.xml      |  15 +++
 .../geode-cs/configuration-prompts.properties   |  17 +++
 .../tcserver/geode-cs/context-fragment.xml      |  13 ++
 .../tcserver/geode-cs/server-fragment.xml       |  12 ++
 .../geode-p2p-tomcat-7/context-fragment.xml     |  15 +++
 .../geode-p2p-tomcat-8/context-fragment.xml     |  15 +++
 .../geode-p2p/configuration-prompts.properties  |  19 +++
 .../tcserver/geode-p2p/context-fragment.xml     |  13 ++
 .../tcserver/geode-p2p/server-fragment.xml      |  14 ++
 extensions/geode-modules-session/build.gradle   |   3 +-
 .../gemstone/gemfire/modules/util/Banner.java   |  20 +--
 geode-core/build.gradle                         |   2 +-
 gradle/dependency-versions.properties           |   1 +
 44 files changed, 225 insertions(+), 838 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/build.gradle b/extensions/geode-modules-assembly/build.gradle
index 960d924..8109466 100644
--- a/extensions/geode-modules-assembly/build.gradle
+++ b/extensions/geode-modules-assembly/build.gradle
@@ -19,15 +19,12 @@ import org.apache.tools.ant.filters.ReplaceTokens
 
 configurations {
   slf4jDeps
-  servletApiDeps
   moduleDistOutputs
 }
 
 dependencies {
   slf4jDeps 'org.slf4j:slf4j-api:' + project.'slf4j-api.version'
   slf4jDeps 'org.slf4j:slf4j-jdk14:' + project.'slf4j-api.version'
-
-  servletApiDeps 'javax.servlet:servlet-api:2.5'
 }
 
 jar.enabled = false
@@ -42,7 +39,7 @@ disableSigning()
 
 def getJarArtifact(module) {
   project(module).configurations.archives.artifacts.findAll {
-    it instanceof PublishArtifact && it.classifier == '' && it.type == 'jar'
+    it instanceof PublishArtifact && it.type == 'jar' && it.classifier == ''
   }.collect { it.file }
 }
 
@@ -59,10 +56,6 @@ def configureTcServerAssembly = {
     from('release/scripts') {
       include '*'
     }
-    from('release/tcserver/geode-cs') {
-      include 'modules.env'
-    }
-    filter(ReplaceTokens, tokens:['GEMFIRE_MODULES_VERSION': version])
   }
   into('geode-cs/conf') {
     from('release/conf') {
@@ -76,8 +69,6 @@ def configureTcServerAssembly = {
   into('geode-cs') {
     from('release/tcserver/geode-cs') {
       include 'configuration-prompts.properties'
-      include 'README.txt'
-      filter(ReplaceTokens, tokens:['VERSION': version])
     }
   }
 
@@ -87,11 +78,6 @@ def configureTcServerAssembly = {
       include 'context-fragment.xml'
     }
   }
-  into('geode-cs-tomcat-7/bin') {
-    from('release/tcserver/geode-cs-tomcat-7') {
-      include 'modules.env'
-    }
-  }
   // All peer-to-peer files
   into('geode-p2p/lib') {
     from getJarArtifact(':extensions/geode-modules')
@@ -106,9 +92,6 @@ def configureTcServerAssembly = {
       include 'gemfire.*'
       include 'setenv.properties'
     }
-    from('release/tcserver/geode-p2p') {
-      include 'modules.env'
-    }
   }
   into('geode-p2p/conf') {
     from('release/conf') {
@@ -122,8 +105,6 @@ def configureTcServerAssembly = {
   into('geode-p2p') {
     from('release/tcserver/geode-p2p') {
       include 'configuration-prompts.properties'
-      include 'README.txt'
-      filter(ReplaceTokens, tokens:['VERSION': version])
     }
   }
 
@@ -133,32 +114,17 @@ def configureTcServerAssembly = {
       include 'context-fragment.xml'
     }
   }
-  into('geode-p2p-tomcat-7/bin') {
-    from('release/tcserver/geode-p2p-tomcat-7') {
-      include 'modules.env'
-    }
-  }
 }
 
 def configureTcServer30Assembly = {
   archiveName = "Apache_Geode_Modules-${version}-tcServer30.zip"
 
-  into('geode-cs-tomcat-8/bin') {
-    from('release/tcserver/geode-cs-tomcat-8') {
-      include 'modules.env'
-    }
-  }
   into('geode-cs-tomcat-8/conf') {
     from('release/tcserver/geode-cs-tomcat-8') {
       include 'context-fragment.xml'
     }
   }
 
-  into('geode-p2p-tomcat-8/bin') {
-    from('release/tcserver/geode-p2p-tomcat-8') {
-      include 'modules.env'
-    }
-  }
   into('geode-p2p-tomcat-8/conf') {
     from('release/tcserver/geode-p2p-tomcat-8') {
       include 'context-fragment.xml'
@@ -201,23 +167,24 @@ task distAppServer(type: Zip, dependsOn: ':extensions/geode-modules-session:asse
   archiveName = "Apache_Geode_Modules-${version}-AppServer.zip"
 
   into('lib') {
+    // Use a closure here so that the evaluation is deferred. Without this the 'internal'
+    // jar won't be picked up.
+    from { getJarArtifact(':extensions/geode-modules-session') }
     from getJarArtifact(':extensions/geode-modules')
-    from getJarArtifact(':extensions/geode-modules-session')
     from configurations.slf4jDeps
-    from configurations.servletApiDeps
   }
 
   into('bin') {
     from('release/session/bin/') {
-      include 'setenv.properties'
       include 'modify_war'
-      include 'cacheserver.*'
-      include 'gemfire.*'
 
-      filter(ReplaceTokens, tokens:['GEMFIRE_MODULES_VERSION': version])
+      filter(ReplaceTokens, tokens:['GEODE_VERSION': version])
       filter(ReplaceTokens, tokens:['SLF4J_VERSION': project.'slf4j-api.version'])
-      filter(ReplaceTokens, tokens:['SERVLET_API_VERSION': project.'javax.servlet-api.version'])
-      filter(ReplaceTokens, tokens:['GEMFIRE_VERSION': version])
+      filter(ReplaceTokens, tokens:['LOG4J_VERSION': project.'log4j.version'])
+      filter(ReplaceTokens, tokens:['FASTUTIL_VERSION': project.'fastutil.version'])
+      filter(ReplaceTokens, tokens:['ANTLR_VERSION': project.'antlr.version'])
+      filter(ReplaceTokens, tokens:['TX_VERSION': project.'javax.transaction-api.version'])
+      filter(ReplaceTokens, tokens:['JGROUPS_VERSION': project.'jgroups.version'])
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/conf/cache-client.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/conf/cache-client.xml b/extensions/geode-modules-assembly/release/conf/cache-client.xml
index c36e0ef..297b6a6 100755
--- a/extensions/geode-modules-assembly/release/conf/cache-client.xml
+++ b/extensions/geode-modules-assembly/release/conf/cache-client.xml
@@ -21,19 +21,19 @@
     xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
     version="1.0">
 
-  <!-- The default pool connects to a cache server running on  localhost at
-       port 40404. To connect to a different server host and port, modify
-       the following pool server host and port. -->
+  <!-- The default pool connects to a locator running on localhost at
+       port 10334. To connect to a different locator host and port, modify
+       the following pool locator host and port. -->
   <pool name="sessions" subscription-enabled="true">
-    <server host="localhost" port="40404"/>
+    <locator host="localhost" port="10334"/>
   </pool>
 
-  <!-- To configure the client to use a locator instead of a server, replace
-       the server pool above with the locator pool below and modify the locator
+  <!-- To configure the client to use a server instead of a locator, replace
+       the locator pool above with the server pool below and modify the server
        host and port as necessary. -->
   <!--
   <pool name="sessions" subscription-enabled="true">
-    <locator host="localhost" port="10334"/>
+    <server host="localhost" port="40404"/>
   </pool>
   -->
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/conf/cache-server.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/conf/cache-server.xml b/extensions/geode-modules-assembly/release/conf/cache-server.xml
index 9dad75f..67ccbd1 100755
--- a/extensions/geode-modules-assembly/release/conf/cache-server.xml
+++ b/extensions/geode-modules-assembly/release/conf/cache-server.xml
@@ -31,10 +31,8 @@
   </gateway-hub>
   -->
 
-  <!-- Uncomment the following cache-server element to modify the listen port -->
-  <!--
-  <cache-server port="44444"/>
-  -->
+  <!-- Change the following cache-server element to modify the listening port -->
+  <cache-server port="0"/>
 
   <!-- Uncomment the following disk-store element to modify the default disk store directory -->
   <!--

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/scripts/cacheserver.bat
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/scripts/cacheserver.bat b/extensions/geode-modules-assembly/release/scripts/cacheserver.bat
deleted file mode 100755
index ef7f99f..0000000
--- a/extensions/geode-modules-assembly/release/scripts/cacheserver.bat
+++ /dev/null
@@ -1,133 +0,0 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements.  See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License.  You may obtain a copy of the License at
-rem
-rem      http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-setlocal
-setlocal enableextensions
-setlocal enabledelayedexpansion
-set scriptdir=%~dp0
-set gf=%scriptdir:\bin\=%
-if exist "%gf%\lib\gemfire.jar" @goto gfok
-echo Could not determine GEMFIRE location
-rem verify other 2>nul
-goto done
-:gfok
-
-if exist "%gf%\bin\modules.env" (
-  FOR /F "tokens=*" %%i in ('type %gf%\bin\modules.env') do SET %%i
-)
-
-rem Check for the -d argument
-set /a FOUND_ARG=0
-set TC_INSTALL_DIR=
-FOR %%A IN (%*) DO (
-  if !FOUND_ARG! == 1 (
-    set /a FOUND_ARG-=1
-    set TC_INSTALL_DIR=%%~fA
-  )
-  if %%A == -d (
-    set /a FOUND_ARG+=1
-  )
-)
-
-rem Pull out the unused args for the java class
-set CLASS_ARGS=
-:loop
-IF "%1"=="" GOTO ENDLOOP
-  if "%1" == "-d" (
-    shift
-    shift
-  ) else ( 
-    set "CLASS_ARGS=!CLASS_ARGS! %1" 
-    shift
-  )
-GOTO loop
-
-:ENDLOOP
-
-IF NOT "%TC_INSTALL_DIR%" == "" goto SET_TOMCAT_DIR
-FOR /f %%f in ('forfiles /P %gf%\.. /m tomcat-%TOMCAT_MAJOR_VER%* /c "cmd /c echo @path"') do set TOMCAT_DIR=%%f
-REM Strip the surrounding quotes
-set TOMCAT_DIR=%TOMCAT_DIR:"=%
-goto TEST_TOMCAT_DIR
-
-:SET_TOMCAT_DIR
-set /p TOMCAT_VER=<"%gf%\conf\tomcat.version"
-set TOMCAT_DIR="!TC_INSTALL_DIR!\tomcat-!TOMCAT_VER!"
-
-:TEST_TOMCAT_DIR
-if not exist "!TOMCAT_DIR!\lib\catalina.jar" goto TOMCAT_NOT_FOUND
-goto FIND_MOD_JAR
-
-:FIND_MOD_JAR
-FOR %%f in (!gf!\lib\geode-modules-?.*.jar) do set MOD_JAR=%%f
-IF NOT "%MOD_JAR%" == "" goto FIND_LOG_API
-rem This is the default modules jar
-set MOD_JAR="!gf!\lib\geode-modules.jar"
-
-:FIND_LOG_API
-FOR %%f in (!gf!\lib\log4j-api*.jar) do set LOG_API_JAR=%%f
-IF NOT "%LOG_API_JAR%" == "" goto FIND_LOG_CORE
-echo ERROR: Log4J API jar not found.
-goto LIBS_NOT_FOUND
-
-:FIND_LOG_CORE
-FOR %%f in (!gf!\lib\log4j-core*.jar) do set LOG_CORE_JAR=%%f
-IF NOT "%LOG_CORE_JAR%" == "" goto MAIN_PROCESSING
-echo ERROR: Log4J Core jar not found.
-goto LIBS_NOT_FOUND
-
-
-:LIBS_NOT_FOUND
-echo ERROR: The required libraries could not be located. 
-echo Try using the -d ^<tc Server installation directory^> option or make sure it was installed correctly.
-echo Example: cacheserver.bat start -d "c:\Program Files\Pivotal\tcServer\pivotal-tc-server-standard"
-exit /b 1
-
-:TOMCAT_NOT_FOUND
-echo ERROR: The TOMCAT libraries could not be located. 
-echo Try using the -d ^<tc Server installation directory^> option or make sure it was installed correctly.
-echo Example: cacheserver.bat start -d "c:\Program Files\Pivotal\tcServer\pivotal-tc-server-standard"
-exit /b 1
-
-:MAIN_PROCESSING
-REM Initialize classpath
-
-REM Add GemFire classes
-set GEMFIRE_JARS=%MOD_JAR%;%LOG_API_JAR%;%LOG_CORE_JAR%;%gf%/lib/gemfire.jar;%gf%/lib/antlr.jar;%gf%/lib/mail.jar
-
-REM Add Tomcat classes
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%TOMCAT_DIR%/lib/servlet-api.jar;%TOMCAT_DIR%/lib/catalina.jar;%gf%/lib/geode-modules.jar;%TOMCAT_DIR%/bin/tomcat-juli.jar;%TOMCAT_DIR%/lib/tomcat-util.jar
-
-REM Add conf directory
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%/conf
-
-
-if defined CLASSPATH set GEMFIRE_JARS=%GEMFIRE_JARS%;%CLASSPATH%
-
-if not defined GF_JAVA (
-  REM %GF_JAVA% is not defined, assume it is on the PATH
-  set GF_JAVA=java
-)
-
-"%GF_JAVA%" %JAVA_ARGS% -classpath "%GEMFIRE_JARS%" com.gemstone.gemfire.internal.cache.CacheServerLauncher !CLASS_ARGS!
-:done
-set scriptdir=
-set gf=
-set GEMFIRE_JARS=
-
-endlocal

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/scripts/cacheserver.sh
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/scripts/cacheserver.sh b/extensions/geode-modules-assembly/release/scripts/cacheserver.sh
deleted file mode 100755
index 28edc35..0000000
--- a/extensions/geode-modules-assembly/release/scripts/cacheserver.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Set GEMFIRE to the product toplevel directory
-GEMFIRE=`dirname $0`
-OLDPWD=$PWD
-cd $GEMFIRE
-GEMFIRE=`dirname $PWD`
-cd $OLDPWD
-
-TOMCAT_VER=`cat "${GEMFIRE}/conf/tomcat.version"`
-
-if [ -f $GEMFIRE/bin/modules.env ]; then
-  # Pull in TOMCAT_MAJOR_VER
-  . $GEMFIRE/bin/modules.env
-fi
-
-# Pull out the installation directory arguments passed in
-ARGS=( "$@" )
-ARGS_LENGTH=${#ARGS[@]}
-CLASS_ARGS=()
-for (( i=0; i<$ARGS_LENGTH; i++ ));
-do
-	if [ "${ARGS[$i]}" == "-d" ]; then
-		i=$(($i+1))
-	else 
-		CLASS_ARGS="${CLASS_ARGS} ${ARGS[$i]}"
-	fi
-done
-# End pulling out arguments
-
-# See if the user specified the tomcat installation directory location
-while [ $# -gt 0 ]; do
-  case $1 in
-    -d )
-      TC_INSTALL_DIR="$2"
-      break
-      ;;
-  esac
-  shift
-done
-
-
-if [[ -n $TC_INSTALL_DIR && -d $TC_INSTALL_DIR ]]; then
-  TOMCAT_DIR="$TC_INSTALL_DIR/tomcat-${TOMCAT_VER}"
-else
-  TOMCAT_DIR=`ls -d "${GEMFIRE}"/../tomcat-${TOMCAT_MAJOR_VER}* 2> /dev/null`
-fi
-
-if [[ -z "$TOMCAT_DIR" || ! -f "$TOMCAT_DIR/lib/catalina.jar" ]]; then
-  echo "ERROR: Could not determine TOMCAT library location."
-  echo "       Use the -d <tc Server installation directory> option."
-  echo "       Example: ./cacheserver.sh start -d /opt/pivotal/tcserver/pivotal-tc-server-standard"
-  exit 1
-fi
-
-if [ "x$WINDIR" != "x" ]; then
-  echo "ERROR: The variable WINDIR is set indicating this script is running in a Windows OS, please use the .bat file version instead."
-  exit 1
-fi
-
-GEMFIRE_DEP_JAR=$GEMFIRE/lib/geode-dependencies.jar
-if [ ! -f "$GEMFIRE_DEP_JAR" ]; then
-  echo "ERROR: Could not determine GEMFIRE location."
-  exit 1
-fi
-
-MOD_JAR=`ls $GEMFIRE/lib/geode-modules-?.*.jar` 2>/dev/null
-if [ -z "$MOD_JAR" ]; then
-  MOD_JAR=$GEMFIRE/lib/geode-modules.jar
-fi
-
-# Add Tomcat classes
-GEMFIRE_JARS=$GEMFIRE_DEP_JAR:$MOD_JAR:$TOMCAT_DIR/lib/servlet-api.jar:$TOMCAT_DIR/lib/catalina.jar:$TOMCAT_DIR/lib/tomcat-util.jar:$TOMCAT_DIR/bin/tomcat-juli.jar
-
-# Add configuration
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/conf
-
-if [ "x$CLASSPATH" != "x" ]; then
-  GEMFIRE_JARS=$GEMFIRE_JARS:$CLASSPATH
-fi
-
-${GF_JAVA:-java} ${JAVA_ARGS} -classpath ${GEMFIRE_JARS} com.gemstone.gemfire.internal.cache.CacheServerLauncher ${CLASS_ARGS}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/scripts/gemfire.bat
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/scripts/gemfire.bat b/extensions/geode-modules-assembly/release/scripts/gemfire.bat
deleted file mode 100755
index 6102b88..0000000
--- a/extensions/geode-modules-assembly/release/scripts/gemfire.bat
+++ /dev/null
@@ -1,41 +0,0 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements.  See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License.  You may obtain a copy of the License at
-rem
-rem      http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-@setlocal enableextensions
-@set scriptdir=%~dp0
-@set gf=%scriptdir:\bin\=%
-@if exist "%gf%\lib\gemfire.jar" @goto gfok
-@echo Could not determine GEMFIRE location
-@verify other 2>nul
-@goto done
-:gfok
-
-@set GEMFIRE_JARS=%gf%/lib/gemfire.jar;%gf%/lib/antlr.jar;%gf%/lib/mail.jar
-@if defined CLASSPATH set GEMFIRE_JARS=%GEMFIRE_JARS%;%CLASSPATH%
-
-@if not defined GF_JAVA (
-@REM %GF_JAVA% is not defined, assume it is on the PATH
-@set GF_JAVA=java
-)
-
-@"%GF_JAVA%" %JAVA_ARGS% -classpath "%GEMFIRE_JARS%" com.gemstone.gemfire.internal.SystemAdmin %*
-:done
-@set scriptdir=
-@set gf=
-@set GEMFIRE_JARS=
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/scripts/gemfire.sh
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/scripts/gemfire.sh b/extensions/geode-modules-assembly/release/scripts/gemfire.sh
deleted file mode 100755
index 12956cc..0000000
--- a/extensions/geode-modules-assembly/release/scripts/gemfire.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Set GEMFIRE to the product toplevel directory
-GEMFIRE=`dirname $0`
-OLDPWD=$PWD
-cd $GEMFIRE
-GEMFIRE=`dirname $PWD`
-cd $OLDPWD
-
-if [ "x$WINDIR" != "x" ]; then
-  echo "ERROR: The variable WINDIR is set indicating this script is running in a Windows OS, please use the .bat file version instead."
-  exit 1
-fi
-
-GEMFIRE_DEP_JAR=$GEMFIRE/lib/geode-dependencies.jar
-if [ ! -f "$GEMFIRE_DEP_JAR" ]; then
-  echo "ERROR: Could not determine GEMFIRE location."
-  exit 1
-fi
-
-GEMFIRE_JARS=$GEMFIRE_DEP_JAR
-
-if [ "x$CLASSPATH" != "x" ]; then
-  GEMFIRE_JARS=$GEMFIRE_JARS:$CLASSPATH
-fi
-
-# Command line args that start with -J will be passed to the java vm in JARGS.
-# See java --help for a listing of valid vm args.
-# Example: -J-Xmx1g sets the max heap size to 1 gigabyte.
-
-JARGS=
-GEMFIRE_ARGS=
-for i in "$@"
-do
-  if [ "-J" == "${i:0:2}" ]
-  then
-    JARGS="${JARGS} \"${i#-J}\""
-  else
-    GEMFIRE_ARGS="${GEMFIRE_ARGS} \"${i}\""
-  fi
-done
-
-eval ${GF_JAVA:-java} ${JAVA_ARGS} ${JARGS} -classpath ${GEMFIRE_JARS} com.gemstone.gemfire.internal.SystemAdmin ${GEMFIRE_ARGS}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/scripts/setenv.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/scripts/setenv.properties b/extensions/geode-modules-assembly/release/scripts/setenv.properties
index fc8918b..a32aac4 100644
--- a/extensions/geode-modules-assembly/release/scripts/setenv.properties
+++ b/extensions/geode-modules-assembly/release/scripts/setenv.properties
@@ -3,4 +3,5 @@ java.opt.2=-Xmx${maximum.vm.heap.size.mb:512}M
 java.opt.hotspot.1=-XX:+UseParNewGC
 java.opt.hotspot.2=-XX:+UseConcMarkSweepGC
 java.opt.hotspot.3=-XX:CMSInitiatingOccupancyFraction=${cms.initiating.heap.percentage:50}
+java.opt.hotspot.4=-Dgemfire.disableShutdownHook=true
 java.opt.j9.1=-Xgcpolicy:gencon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/cacheserver.bat
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/cacheserver.bat b/extensions/geode-modules-assembly/release/session/bin/cacheserver.bat
deleted file mode 100755
index 2935cde..0000000
--- a/extensions/geode-modules-assembly/release/session/bin/cacheserver.bat
+++ /dev/null
@@ -1,56 +0,0 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements.  See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License.  You may obtain a copy of the License at
-rem
-rem      http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-setlocal enableextensions
-set scriptdir=%~dp0
-set gf=%scriptdir:\bin\=%
-
-set GEMFIRE_JARS=%gf%\lib\gemfire.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\antlr.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\spring-core-3.1.1.RELEASE.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\spring-shell-1.0.0.RC1.jar
-if exist "%GEMFIRE_JARS%" goto gfok
-echo Could not determine GEMFIRE location
-verify other 2>nul
-goto done
-:gfok
-
-REM Initialize classpath
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-session-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-session-external-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\servlet-api-@SERVLET_API_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\slf4j-api-@SLF4J_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\slf4j-jdk14-@SLF4J_VERSION@.jar
-
-REM Add conf directory
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\conf
-
-if defined CLASSPATH set GEMFIRE_JARS=%GEMFIRE_JARS%;%CLASSPATH%
-
-if not defined GF_JAVA (
-REM %GF_JAVA% is not defined, assume it is on the PATH
-set GF_JAVA=java
-)
-
-"%GF_JAVA%" %JAVA_ARGS% -classpath "%GEMFIRE_JARS%" com.gemstone.gemfire.internal.cache.CacheServerLauncher %*
-:done
-set scriptdir=
-set gf=
-set GEMFIRE_JARS=
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/cacheserver.sh
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/cacheserver.sh b/extensions/geode-modules-assembly/release/session/bin/cacheserver.sh
deleted file mode 100755
index 2c12b57..0000000
--- a/extensions/geode-modules-assembly/release/session/bin/cacheserver.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Set GEMFIRE to the product toplevel directory
-GEMFIRE=`dirname $0`
-OLDPWD=$PWD
-cd $GEMFIRE
-GEMFIRE=`dirname $PWD`
-cd $OLDPWD
-
-if [ "x$WINDIR" != "x" ]; then
-  echo "ERROR: The variable WINDIR is set indicating this script is running in a Windows OS, please use the .bat file version instead."
-  exit 1
-fi
-
-GEMFIRE_JARS=$GEMFIRE/lib/gemfire.jar
-
-if [ ! -f "${GEMFIRE_JARS}" ]; then
-  echo "ERROR: Could not determine GEMFIRE location."
-  exit 1
-fi
-
-LOG4J_API=$( ls $GEMFIRE/lib/log4j-api*jar )
-LOG4J_CORE=$( ls $GEMFIRE/lib/log4j-core*jar )
-
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/antlr.jar:$LOG4J_API:$LOG4J_CORE
-
-# Initialize classpath
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-@GEMFIRE_MODULES_VERSION@.jar \
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-session-@GEMFIRE_MODULES_VERSION@.jar \
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/servlet-api-@SERVLET_API_VERSION@.jar \
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-session-external-@GEMFIRE_MODULES_VERSION@.jar \
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/slf4j-api-@SLF4J_VERSION@.jar \
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/slf4j-jdk14-@SLF4J_VERSION@.jar
-
-# Add configuration
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/conf
-
-if [ "x$CLASSPATH" != "x" ]; then
-  GEMFIRE_JARS=$GEMFIRE_JARS:$CLASSPATH
-fi
-
-${GF_JAVA:-java} ${JAVA_ARGS} -classpath ${GEMFIRE_JARS} com.gemstone.gemfire.internal.cache.CacheServerLauncher "$@"

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/gemfire.bat
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/gemfire.bat b/extensions/geode-modules-assembly/release/session/bin/gemfire.bat
deleted file mode 100755
index a66964c..0000000
--- a/extensions/geode-modules-assembly/release/session/bin/gemfire.bat
+++ /dev/null
@@ -1,53 +0,0 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements.  See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License.  You may obtain a copy of the License at
-rem
-rem      http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-setlocal enableextensions
-set scriptdir=%~dp0
-set gf=%scriptdir:\bin\=%
-
-set GEMFIRE_JARS=%gf%\lib\gemfire.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\antlr.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\spring-core-3.1.1.RELEASE.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\spring-shell-1.0.0.RC1.jar
-if exist "%GEMFIRE_JARS%" goto gfok
-echo Could not determine GEMFIRE location
-verify other 2>nul
-goto done
-:gfok
-
-REM Initialize classpath
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-session-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\geode-modules-session-external-@GEMFIRE_MODULES_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\servlet-api-@SERVLET_API_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\slf4j-api-@SLF4J_VERSION@.jar
-set GEMFIRE_JARS=%GEMFIRE_JARS%;%gf%\lib\slf4j-jdk14-@SLF4J_VERSION@.jar
-
-if defined CLASSPATH set GEMFIRE_JARS=%GEMFIRE_JARS%;%CLASSPATH%
-
-if not defined GF_JAVA (
-REM %GF_JAVA% is not defined, assume it is on the PATH
-set GF_JAVA=java
-)
-
-"%GF_JAVA%" %JAVA_ARGS% -classpath "%GEMFIRE_JARS%" com.gemstone.gemfire.internal.SystemAdmin %*
-:done
-set scriptdir=
-set gf=
-set GEMFIRE_JARS=
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/gemfire.sh
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/gemfire.sh b/extensions/geode-modules-assembly/release/session/bin/gemfire.sh
deleted file mode 100755
index ac11a4d..0000000
--- a/extensions/geode-modules-assembly/release/session/bin/gemfire.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Set GEMFIRE to the product toplevel directory
-GEMFIRE=`dirname $0`
-OLDPWD=$PWD
-cd $GEMFIRE
-GEMFIRE=`dirname $PWD`
-cd $OLDPWD
-
-if [ "x$WINDIR" != "x" ]; then
-  echo "ERROR: The variable WINDIR is set indicating this script is running in a Windows OS, please use the .bat file version instead."
-  exit 1
-fi
-
-GEMFIRE_JARS=$GEMFIRE/lib/gemfire.jar
-if [ ! -f "${GEMFIRE_JARS}" ]; then
-  echo "ERROR: Could not determine GEMFIRE location."
-  exit 1
-fi
-
-LOG4J_API=$( ls $GEMFIRE/lib/log4j-api*jar )
-LOG4J_CORE=$( ls $GEMFIRE/lib/log4j-core*jar )
-
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/antlr.jar:$LOG4J_API:$LOG4J_CORE
-
-# Initialize classpath
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-@GEMFIRE_MODULES_VERSION@.jar
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-session-@GEMFIRE_MODULES_VERSION@.jar
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/geode-modules-session-external-@GEMFIRE_MODULES_VERSION@.jar
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/servlet-api-@SERVLET_API_VERSION@.jar
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/slf4j-api-@SLF4J_VERSION@.jar
-GEMFIRE_JARS=$GEMFIRE_JARS:$GEMFIRE/lib/slf4j-jdk14-@SLF4J_VERSION@.jar
-
-if [ "x$CLASSPATH" != "x" ]; then
-  GEMFIRE_JARS=$GEMFIRE_JARS:$CLASSPATH
-fi
-
-# Command line args that start with -J will be passed to the java vm in JARGS.
-# See java --help for a listing of valid vm args.
-# Example: -J-Xmx1g sets the max heap size to 1 gigabyte.
-
-JARGS=
-GEMFIRE_ARGS=
-for i in "$@"
-do
-  if [ "-J" == "${i:0:2}" ]
-  then
-    JARGS="${JARGS} \"${i#-J}\""
-  else
-    GEMFIRE_ARGS="${GEMFIRE_ARGS} \"${i}\""
-  fi
-done
-
-eval ${GF_JAVA:-java} ${JAVA_ARGS} ${JARGS} -classpath ${GEMFIRE_JARS} com.gemstone.gemfire.internal.SystemAdmin ${GEMFIRE_ARGS}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/modify_war
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/modify_war b/extensions/geode-modules-assembly/release/session/bin/modify_war
index 9c87104..7b5db21 100755
--- a/extensions/geode-modules-assembly/release/session/bin/modify_war
+++ b/extensions/geode-modules-assembly/release/session/bin/modify_war
@@ -15,41 +15,6 @@
 # limitations under the License.
 #
 
-X=`dirname $0`
-EXE_DIR=`cd $X; pwd`
-LIB_DIR=`cd ${X}/../lib; pwd`
-
-SESSION_JAR="${LIB_DIR}/geode-modules-session-external-@GEMFIRE_MODULES_VERSION@.jar"
-
-declare -a OTHER_JARS
-OTHER_JARS=(${LIB_DIR}/gemfire.jar \
-    ${LIB_DIR}/antlr.jar
-    ${LIB_DIR}/geode-modules-@GEMFIRE_MODULES_VERSION@.jar \
-    ${LIB_DIR}/geode-modules-session-@GEMFIRE_MODULES_VERSION@.jar \
-    ${LIB_DIR}/slf4j-api-@SLF4J_VERSION@.jar)
-
-# This is required for GemFire 8.1
-LOG4J_API=$(ls ${LIB_DIR}/log4j-api*jar)
-LOG4J_CORE=$(ls ${LIB_DIR}/log4j-core*jar)
-if [ -f ${LOG4J_API} -a -f ${LOG4J_CORE} ]; then
-    OTHER_JARS[${#OTHER_JARS[*]}]=$LOG4J_API
-    OTHER_JARS[${#OTHER_JARS[*]}]=$LOG4J_CORE
-fi
-
-TMP_DIR="/tmp/modify_war.$$"
-
-ARG_INPUT_FILE=""
-ARG_WAR_LIB_DIR="WEB-INF/lib"
-ARG_EAR_LIB_DIR="lib"
-ARG_OUTPUT_FILE=""
-ARG_TEST_RUN=0
-ARG_CACHE_TYPE="peer-to-peer"
-ARG_PROCESS_LIBS=1
-declare -a ARG_GEMFIRE_PARAMETERS=""
-declare -a ARG_WAR_LIBS="$SESSION_JAR"
-declare -a ARG_EAR_LIBS=""
-declare -a ARG_JVM_OPTS=""
-
 function usage() {
     cat <<EOF
 USAGE: modify_war <args>
@@ -119,13 +84,21 @@ WHERE <args>:
                     necessary jars into the file. When this option is used,
                     additional jars will need to be made available to the
                     container:
-                        gemfire.jar
                         geode-modules.jar
-                        geode-modules-session.jar
+                        geode-modules-session-internal.jar
+                        geode-core.jar
+                        geode-json.jar
+                        antlr.jar
+                        log4j-core.jar
+                        log4j-api.jar
+                        log4j-jul.jar
+                        fastutil.jar
+                        javax.transactions-api.jar
+                        jgroups.jar
                         slf4j-api.jar
                         slf4j-jdk14.jar (not for WebLogic)
                         geode-modules-slf4j-weblogic.jar (WebLogic only)
-                    This option still modifes any web.xml files.
+                    This option still modifies any web.xml files.
                         
 EOF
 }
@@ -272,6 +245,48 @@ function process_input_file() {
     done
 }
 
+########  Mainline  #########
+
+X=`dirname $0`
+EXE_DIR=`cd $X; pwd`
+LIB_DIR=`cd ${X}/../lib; pwd`
+VERSION="@GEODE_VERSION@"
+
+if [ -z "$GEODE" ]; then
+    exiting "Please set the GEODE environment variable to the root of the Geode install location" 1
+fi
+
+SESSION_JAR="${LIB_DIR}/geode-modules-session-${VERSION}.jar"
+
+declare -a OTHER_JARS
+OTHER_JARS=(${GEODE}/lib/geode-core-${VERSION}.jar \
+    ${GEODE}/lib/geode-json-${VERSION}.jar \
+    ${GEODE}/lib/antlr-@ANTLR_VERSION@.jar \
+    ${GEODE}/lib/log4j-core-@LOG4J_VERSION@.jar \
+    ${GEODE}/lib/log4j-api-@LOG4J_VERSION@.jar \
+    ${GEODE}/lib/log4j-jul-@LOG4J_VERSION@.jar \
+    ${GEODE}/lib/fastutil-@FASTUTIL_VERSION@.jar \
+    ${GEODE}/lib/javax.transaction-api-@TX_VERSION@.jar \
+    ${GEODE}/lib/jgroups-@JGROUPS_VERSION@.jar
+    ${LIB_DIR}/geode-modules-${VERSION}.jar \
+    ${LIB_DIR}/geode-modules-session-internal-${VERSION}.jar \
+    ${LIB_DIR}/slf4j-api-@SLF4J_VERSION@.jar \
+    ${LIB_DIR}/slf4j-jdk14-@SLF4J_VERSION@.jar)
+
+TMP_DIR="/tmp/modify_war.$$"
+
+ARG_INPUT_FILE=""
+ARG_WAR_LIB_DIR="WEB-INF/lib"
+ARG_EAR_LIB_DIR="lib"
+ARG_OUTPUT_FILE=""
+ARG_TEST_RUN=0
+ARG_CACHE_TYPE=""
+ARG_PROCESS_LIBS=1
+declare -a ARG_GEMFIRE_PARAMETERS=""
+declare -a ARG_WAR_LIBS="$SESSION_JAR"
+declare -a ARG_EAR_LIBS=""
+declare -a ARG_JVM_OPTS=""
+
 trap exiting INT QUIT TERM
 
 mkdir $TMP_DIR

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/session/bin/setenv.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/session/bin/setenv.properties b/extensions/geode-modules-assembly/release/session/bin/setenv.properties
deleted file mode 100644
index fc8918b..0000000
--- a/extensions/geode-modules-assembly/release/session/bin/setenv.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-java.opt.1=-Xms${initial.vm.heap.size.mb:512}M
-java.opt.2=-Xmx${maximum.vm.heap.size.mb:512}M
-java.opt.hotspot.1=-XX:+UseParNewGC
-java.opt.hotspot.2=-XX:+UseConcMarkSweepGC
-java.opt.hotspot.3=-XX:CMSInitiatingOccupancyFraction=${cms.initiating.heap.percentage:50}
-java.opt.j9.1=-Xgcpolicy:gencon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/context-fragment.xml
deleted file mode 100644
index 72faee2..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/context-fragment.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:true}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/modules.env
deleted file mode 100644
index 1c14a6c..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-7/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=7

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/context-fragment.xml
deleted file mode 100644
index 72faee2..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/context-fragment.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:true}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/modules.env
deleted file mode 100644
index d220675..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs-tomcat-8/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=8

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/configuration-prompts.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/configuration-prompts.properties b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/configuration-prompts.properties
deleted file mode 100644
index 0ebae97..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/configuration-prompts.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-cache.configuration.file=Please enter the name of the GemFire cache configuration file. Default '${default}':
-critical.heap.percentage=Please enter the percentage of heap at which updates to the cache are refused. 0.0 means disabled. Default '${default}':
-enable.debug.listener=Please specify whether to enable a GemFire listener that logs session create, update, destroy and expiration events. Default '${default}':
-enable.gateway.replication=Please specify whether session modifications should be replicated across the WAN. Default '${default}':
-enable.local.cache=Please specify whether to maintain a local GemFire cache. Default '${default}':
-enable.commit.valve=Please specify whether to commit sessions once per request. Default '${default}':
-prefer.deserialized.form=Please specify whether to prefer keeping attributes in deserialized form. Default '${default}':
-eviction.heap.percentage=Please enter the percentage of heap at which sessions will be evicted from the local cache. Default '${default}':
-log.file=Please enter the name of the file used to log GemFire messages. Default '${default}':
-region.attributes.id=Please enter the id of the attributes of the GemFire region used to cache sessions. Default '${default}':
-region.name=Please enter the name of the GemFire region used to cache sessions. Default '${default}':
-statistic.archive.file=Please enter the name of the file used to store GemFire statistics. Default '${default}':
-statistic.sampling.enabled=Please specify whether GemFire statistic sampling should be enabled. Default '${default}':
-initial.vm.heap.size.mb=Please specify the initial VM heap size in MB (-Xms). Default '${default}':
-maximum.vm.heap.size.mb=Please specify the maximum VM heap size in MB (-Xmx). Default '${default}':
-cms.initiating.heap.percentage=Please specify the percentage of VM heap utilization before a concurrent collection is initiated (--XX:CMSInitiatingOccupancyFraction [Hotspot-only]). Default '${default}':
-tomcat.version=Please enter the major version of Tomcat you will be using (6, 7 or 8). Default '${default}'

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/context-fragment.xml
deleted file mode 100644
index fac3044..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/context-fragment.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:true}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/modules.env
deleted file mode 100644
index 9c4c00a..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=6

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/server-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/server-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/server-fragment.xml
deleted file mode 100644
index c4adc66..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-cs/server-fragment.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<Server>
-
-    <add:Listener className="com.gemstone.gemfire.modules.session.catalina.ClientServerCacheLifecycleListener"
-      cache-xml-file="${cache.configuration.file:cache-client.xml}"
-      criticalHeapPercentage="${critical.heap.percentage:0.0}"
-      evictionHeapPercentage="${eviction.heap.percentage:80.0}"
-      log-file="${log.file:gemfire_modules.log}"
-      statistic-archive-file="${statistic.archive.file:gemfire_modules.gfs}"
-      statistic-sampling-enabled="${statistic.sampling.enabled:false}"/>
-
-</Server>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/context-fragment.xml
deleted file mode 100644
index 155aa2a..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/context-fragment.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:false}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:REPLICATE}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/modules.env
deleted file mode 100644
index 1c14a6c..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-7/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=7

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/context-fragment.xml
deleted file mode 100644
index 155aa2a..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/context-fragment.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:false}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:REPLICATE}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/modules.env
deleted file mode 100644
index d220675..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p-tomcat-8/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=8

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/configuration-prompts.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/configuration-prompts.properties b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/configuration-prompts.properties
deleted file mode 100644
index fdead44..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/configuration-prompts.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-cache.configuration.file=Please enter the name of the GemFire cache configuration file. Default '${default}':
-critical.heap.percentage=Please enter the percentage of heap at which updates to the cache are refused. 0.0 means disabled. Default '${default}':
-enable.debug.listener=Please specify whether to enable a GemFire listener that logs session create, update, destroy and expiration events. Default '${default}':
-enable.gateway.replication=Please specify whether session modifications should be replicated across the WAN. Default '${default}':
-enable.local.cache=Please specify whether to maintain a local GemFire cache. Default '${default}':
-enable.commit.valve=Please specify whether to commit sessions once per request. Default '${default}':
-prefer.deserialized.form=Please specify whether to prefer keeping attributes in deserialized form. Default '${default}':
-eviction.heap.percentage=Please enter the percentage of heap at which sessions will be evicted from the local cache. Default '${default}':
-locators=Please enter the list of locators used by GemFire members to discover each other. The format is a comma-separated list of host[port]. Default '${default}':
-log.file=Please enter the name of the file used to log GemFire messages. Default '${default}':
-rebalance=Please specify whether to rebalance the GemFire cache at startup. Default '${default}':
-region.attributes.id=Please enter the id of the attributes of the GemFire region used to cache sessions. Default '${default}':
-region.name=Please enter the name of the GemFire region used to cache sessions. Default '${default}':
-statistic.archive.file=Please enter the name of the file used to store GemFire statistics. Default '${default}':
-statistic.sampling.enabled=Please specify whether GemFire statistic sampling should be enabled. Default '${default}':
-initial.vm.heap.size.mb=Please specify the initial VM heap size in MB (-Xms). Default '${default}':
-maximum.vm.heap.size.mb=Please specify the maximum VM heap size in MB (-Xmx). Default '${default}':
-cms.initiating.heap.percentage=Please specify the percentage of VM heap utilization before a concurrent collection is initiated (--XX:CMSInitiatingOccupancyFraction [Hotspot-only]). Default '${default}':
-tomcat.version=Please enter the major version of Tomcat you will be using (6, 7 or 8). Default '${default}':

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/context-fragment.xml
deleted file mode 100644
index 2b3d25c..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/context-fragment.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Context>
-
-    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"
-      enableDebugListener="${enable.debug.listener:false}"
-      enableGatewayReplication="${enable.gateway.replication:false}"
-      enableLocalCache="${enable.local.cache:false}"
-      enableCommitValve="${enable.commit.valve:true}"
-      preferDeserializedForm="${prefer.deserialized.form:true}"
-      regionAttributesId="${region.attributes.id:REPLICATE}"
-      regionName="${region.name:gemfire_modules_sessions}"/>
-
-</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/modules.env
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/modules.env b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/modules.env
deleted file mode 100644
index 9c4c00a..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/modules.env
+++ /dev/null
@@ -1 +0,0 @@
-TOMCAT_MAJOR_VER=6

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/server-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/server-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/server-fragment.xml
deleted file mode 100644
index cf7dc0d..0000000
--- a/extensions/geode-modules-assembly/release/tcserver/gemfire-p2p/server-fragment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<Server>
-
-    <add:Listener className="com.gemstone.gemfire.modules.session.catalina.PeerToPeerCacheLifecycleListener"
-      cache-xml-file="${cache.configuration.file:cache-peer.xml}"
-      criticalHeapPercentage="${critical.heap.percentage:0.0}"
-      evictionHeapPercentage="${eviction.heap.percentage:80.0}"
-      locators="${locators:localhost[10334]}"
-      log-file="${log.file:gemfire_modules.log}"
-      rebalance="${rebalance:false}"
-      statistic-archive-file="${statistic.archive.file:gemfire_modules.gfs}"
-      statistic-sampling-enabled="${statistic.sampling.enabled:false}"/>
-
-</Server>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-7/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-7/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-7/context-fragment.xml
new file mode 100644
index 0000000..72faee2
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-7/context-fragment.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:true}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-8/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-8/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-8/context-fragment.xml
new file mode 100644
index 0000000..72faee2
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-cs-tomcat-8/context-fragment.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:true}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-cs/configuration-prompts.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-cs/configuration-prompts.properties b/extensions/geode-modules-assembly/release/tcserver/geode-cs/configuration-prompts.properties
new file mode 100644
index 0000000..391b86f
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-cs/configuration-prompts.properties
@@ -0,0 +1,17 @@
+cache.configuration.file=Please enter the name of the Geode cache configuration file. Default '${default}':
+critical.heap.percentage=Please enter the percentage of heap at which updates to the cache are refused. 0.0 means disabled. Default '${default}':
+enable.debug.listener=Please specify whether to enable a Geode listener that logs session create, update, destroy and expiration events. Default '${default}':
+enable.gateway.replication=Please specify whether session modifications should be replicated across the WAN. Default '${default}':
+enable.local.cache=Please specify whether to maintain a local Geode cache. Default '${default}':
+enable.commit.valve=Please specify whether to commit sessions once per request. Default '${default}':
+prefer.deserialized.form=Please specify whether to prefer keeping attributes in deserialized form. Default '${default}':
+eviction.heap.percentage=Please enter the percentage of heap at which sessions will be evicted from the local cache. Default '${default}':
+log.file=Please enter the name of the file used to log Geode messages. Default '${default}':
+region.attributes.id=Please enter the id of the attributes of the Geode region used to cache sessions. Default '${default}':
+region.name=Please enter the name of the Geode region used to cache sessions. Default '${default}':
+statistic.archive.file=Please enter the name of the file used to store Geode statistics. Default '${default}':
+statistic.sampling.enabled=Please specify whether Geode statistic sampling should be enabled. Default '${default}':
+initial.vm.heap.size.mb=Please specify the initial VM heap size in MB (-Xms). Default '${default}':
+maximum.vm.heap.size.mb=Please specify the maximum VM heap size in MB (-Xmx). Default '${default}':
+cms.initiating.heap.percentage=Please specify the percentage of VM heap utilization before a concurrent collection is initiated (--XX:CMSInitiatingOccupancyFraction [Hotspot-only]). Default '${default}':
+tomcat.version=Please enter the major version of Tomcat you will be using (6, 7 or 8). Default '${default}'

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-cs/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-cs/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-cs/context-fragment.xml
new file mode 100644
index 0000000..fac3044
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-cs/context-fragment.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:true}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:PARTITION_REDUNDANT}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-cs/server-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-cs/server-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-cs/server-fragment.xml
new file mode 100644
index 0000000..c4adc66
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-cs/server-fragment.xml
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='utf-8'?>
+<Server>
+
+    <add:Listener className="com.gemstone.gemfire.modules.session.catalina.ClientServerCacheLifecycleListener"
+      cache-xml-file="${cache.configuration.file:cache-client.xml}"
+      criticalHeapPercentage="${critical.heap.percentage:0.0}"
+      evictionHeapPercentage="${eviction.heap.percentage:80.0}"
+      log-file="${log.file:gemfire_modules.log}"
+      statistic-archive-file="${statistic.archive.file:gemfire_modules.gfs}"
+      statistic-sampling-enabled="${statistic.sampling.enabled:false}"/>
+
+</Server>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-7/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-7/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-7/context-fragment.xml
new file mode 100644
index 0000000..155aa2a
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-7/context-fragment.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:false}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:REPLICATE}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-8/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-8/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-8/context-fragment.xml
new file mode 100644
index 0000000..155aa2a
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-p2p-tomcat-8/context-fragment.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <remove:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"/>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat7DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:false}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:REPLICATE}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-p2p/configuration-prompts.properties
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-p2p/configuration-prompts.properties b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/configuration-prompts.properties
new file mode 100644
index 0000000..e739513
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/configuration-prompts.properties
@@ -0,0 +1,19 @@
+cache.configuration.file=Please enter the name of the Geode cache configuration file. Default '${default}':
+critical.heap.percentage=Please enter the percentage of heap at which updates to the cache are refused. 0.0 means disabled. Default '${default}':
+enable.debug.listener=Please specify whether to enable a Geode listener that logs session create, update, destroy and expiration events. Default '${default}':
+enable.gateway.replication=Please specify whether session modifications should be replicated across the WAN. Default '${default}':
+enable.local.cache=Please specify whether to maintain a local Geode cache. Default '${default}':
+enable.commit.valve=Please specify whether to commit sessions once per request. Default '${default}':
+prefer.deserialized.form=Please specify whether to prefer keeping attributes in deserialized form. Default '${default}':
+eviction.heap.percentage=Please enter the percentage of heap at which sessions will be evicted from the local cache. Default '${default}':
+locators=Please enter the list of locators used by Geode members to discover each other. The format is a comma-separated list of host[port]. Default '${default}':
+log.file=Please enter the name of the file used to log Geode messages. Default '${default}':
+rebalance=Please specify whether to rebalance the Geode cache at startup. Default '${default}':
+region.attributes.id=Please enter the id of the attributes of the Geode region used to cache sessions. Default '${default}':
+region.name=Please enter the name of the Geode region used to cache sessions. Default '${default}':
+statistic.archive.file=Please enter the name of the file used to store Geode statistics. Default '${default}':
+statistic.sampling.enabled=Please specify whether Geode statistic sampling should be enabled. Default '${default}':
+initial.vm.heap.size.mb=Please specify the initial VM heap size in MB (-Xms). Default '${default}':
+maximum.vm.heap.size.mb=Please specify the maximum VM heap size in MB (-Xmx). Default '${default}':
+cms.initiating.heap.percentage=Please specify the percentage of VM heap utilization before a concurrent collection is initiated (--XX:CMSInitiatingOccupancyFraction [Hotspot-only]). Default '${default}':
+tomcat.version=Please enter the major version of Tomcat you will be using (6, 7 or 8). Default '${default}':

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-p2p/context-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-p2p/context-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/context-fragment.xml
new file mode 100644
index 0000000..2b3d25c
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/context-fragment.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+
+    <add:Manager className="com.gemstone.gemfire.modules.session.catalina.Tomcat6DeltaSessionManager"
+      enableDebugListener="${enable.debug.listener:false}"
+      enableGatewayReplication="${enable.gateway.replication:false}"
+      enableLocalCache="${enable.local.cache:false}"
+      enableCommitValve="${enable.commit.valve:true}"
+      preferDeserializedForm="${prefer.deserialized.form:true}"
+      regionAttributesId="${region.attributes.id:REPLICATE}"
+      regionName="${region.name:gemfire_modules_sessions}"/>
+
+</Context>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-assembly/release/tcserver/geode-p2p/server-fragment.xml
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-assembly/release/tcserver/geode-p2p/server-fragment.xml b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/server-fragment.xml
new file mode 100644
index 0000000..cf7dc0d
--- /dev/null
+++ b/extensions/geode-modules-assembly/release/tcserver/geode-p2p/server-fragment.xml
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='utf-8'?>
+<Server>
+
+    <add:Listener className="com.gemstone.gemfire.modules.session.catalina.PeerToPeerCacheLifecycleListener"
+      cache-xml-file="${cache.configuration.file:cache-peer.xml}"
+      criticalHeapPercentage="${critical.heap.percentage:0.0}"
+      evictionHeapPercentage="${eviction.heap.percentage:80.0}"
+      locators="${locators:localhost[10334]}"
+      log-file="${log.file:gemfire_modules.log}"
+      rebalance="${rebalance:false}"
+      statistic-archive-file="${statistic.archive.file:gemfire_modules.gfs}"
+      statistic-sampling-enabled="${statistic.sampling.enabled:false}"/>
+
+</Server>

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules-session/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session/build.gradle b/extensions/geode-modules-session/build.gradle
index e301a6a..765bdd9 100644
--- a/extensions/geode-modules-session/build.gradle
+++ b/extensions/geode-modules-session/build.gradle
@@ -45,8 +45,7 @@ task internalJar(type: Jar) {
   from sourceSets.main.output
   include '**/internal/**/*'
   includeEmptyDirs = false
-  baseName = 'geode-modules-session'
-  classifier = 'internal'
+  baseName = 'geode-modules-session-internal'
 }
 
 artifacts {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/Banner.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/Banner.java b/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/Banner.java
index dbe8e05..413da07 100644
--- a/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/Banner.java
+++ b/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/Banner.java
@@ -26,19 +26,6 @@ import java.util.Properties;
 
 public class Banner {
 
-  private static String VERSION = "unknown";
-
-  private static Properties props = new Properties();
-
-  static {
-    InputStream is = Banner.class.getResourceAsStream("/modules-version.properties");
-    try {
-      props.load(is);
-      VERSION = props.getProperty("version");
-    } catch (IOException e) {
-    }
-  }
-
   public static String getString() {
     StringWriter sw = new StringWriter();
     PrintWriter pw = new PrintWriter(sw);
@@ -48,12 +35,7 @@ public class Banner {
   }
 
   private static void print(PrintWriter pw) {
-    pw.println("GemFire Modules");
-    pw.print("Modules version: ");
-    pw.println(VERSION);
+    pw.println("Geode Modules");
     GemFireVersion.print(pw);
   }
-
-  private Banner() {
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 8cd5bf3..4877e03 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -32,7 +32,7 @@ dependencies {
   // External 
   provided files("${System.getProperty('java.home')}/../lib/tools.jar")
   compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version'
-  compile 'org.jgroups:jgroups:3.6.8.Final'
+  compile 'org.jgroups:jgroups:' + project.'jgroups.version'
   compile 'antlr:antlr:' + project.'antlr.version'
   compile 'com.fasterxml.jackson.core:jackson-databind:' + project.'jackson.version'
   compile 'commons-io:commons-io:' + project.'commons-io.version'

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d216e553/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 640b175..b6687e5 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -63,6 +63,7 @@ javax.servlet-api.version = 3.1.0
 javax.transaction-api.version = 1.2
 jedis.version = 2.7.2
 jetty.version = 9.3.6.v20151106
+jgroups.version = 3.6.8.Final
 jline.version = 2.12
 jmock.version = 2.8.2
 jna.version = 4.0.0


[29/49] incubator-geode git commit: GEODE-1252: modify bits field atomically

Posted by kl...@apache.org.
GEODE-1252: modify bits field atomically

- AtomicIntegerFieldUpdater now used to modify bits field
- added unit test for bit methods
- removed unused constructors


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/44289546
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/44289546
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/44289546

Branch: refs/heads/feature/GEODE-835-test
Commit: 442895462472c31fb3b9f37ae61f7fe510423bf5
Parents: 6523c97
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed May 11 14:38:09 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon May 16 11:24:13 2016 -0700

----------------------------------------------------------------------
 .../internal/cache/versions/VersionTag.java     | 83 +++++++++++-------
 .../versions/AbstractVersionTagTestBase.java    | 92 ++++++++++++++++++++
 .../cache/versions/VMVersionTagTest.java        | 32 +++++++
 .../sanctionedDataSerializables.txt             |  4 +-
 4 files changed, 179 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44289546/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/versions/VersionTag.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/versions/VersionTag.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/versions/VersionTag.java
index 60e4299..7910996 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/versions/VersionTag.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/versions/VersionTag.java
@@ -19,6 +19,7 @@ package com.gemstone.gemfire.internal.cache.versions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 
 import org.apache.logging.log4j.Logger;
 
@@ -74,6 +75,7 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
   private static final int BITS_TIMESTAMP_APPLIED = 0x20;
 
   private static final int BITS_ALLOWED_BY_RESOLVER = 0x40;
+  // Note: the only valid BITS_* are 0xFFFF.
   
   /**
    * the per-entry version number for the operation
@@ -100,10 +102,19 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
    */
   private byte distributedSystemId;
 
+  // In GEODE-1252 we found that the bits field
+  // was concurrently modified by calls to
+  // setPreviousMemberID and setRecorded.
+  // So bits has been changed to volatile and
+  // all modification to it happens using AtomicIntegerFieldUpdater.
+  private static final AtomicIntegerFieldUpdater<VersionTag> bitsUpdater =
+      AtomicIntegerFieldUpdater.newUpdater(VersionTag.class, "bits");
   /**
    * boolean bits
+   * Note: this is an int field so it has 32 bits BUT only the lower 16 bits are serialized.
+   * So all our code should treat this an an unsigned short field.
    */
-  private int bits;
+  private volatile int bits;
 
   /**
    * the initiator of the operation.  If null, the initiator was the sender
@@ -128,7 +139,11 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
 
   /** record that the timestamp from this tag was applied to the cache */
   public void setTimeStampApplied(boolean isTimeStampUpdated) {
-    this.bits |= BITS_TIMESTAMP_APPLIED;
+    if (isTimeStampUpdated) {
+      setBits(BITS_TIMESTAMP_APPLIED);
+    } else {
+      clearBits(~BITS_TIMESTAMP_APPLIED);
+    }
   }
 
   /**
@@ -152,9 +167,9 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
 
   public void setIsGatewayTag(boolean isGateway) {
     if (isGateway) {
-      this.bits = this.bits | BITS_GATEWAY_TAG;
+      setBits(BITS_GATEWAY_TAG);
     } else {
-      this.bits = this.bits & ~BITS_GATEWAY_TAG;
+      clearBits(~BITS_GATEWAY_TAG);
     }
   }
 
@@ -193,7 +208,7 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
    * set that this tag has been recorded in a receiver's RVV
    */
   public void setRecorded() {
-    this.bits |= BITS_RECORDED;
+    setBits(BITS_RECORDED);
   }
 
   /**
@@ -236,7 +251,7 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
    * @param previousMemberID the previousMemberID to set
    */
   public void setPreviousMemberID(T previousMemberID) {
-    this.bits |= BITS_HAS_PREVIOUS_ID;
+    setBits(BITS_HAS_PREVIOUS_ID);
     this.previousMemberID = previousMemberID;
   }
 
@@ -249,9 +264,9 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
    */
   public VersionTag setPosDup(boolean flag) {
     if (flag) {
-      this.bits |= BITS_POSDUP;
+      setBits(BITS_POSDUP);
     } else {
-      this.bits &= ~BITS_POSDUP;
+      clearBits(~BITS_POSDUP);
     }
     return this;
   }
@@ -268,9 +283,9 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
    */
   public VersionTag setAllowedByResolver(boolean flag) {
     if (flag) {
-      this.bits |= BITS_ALLOWED_BY_RESOLVER;
+      setBits(BITS_ALLOWED_BY_RESOLVER);
     } else {
-      this.bits &= ~BITS_ALLOWED_BY_RESOLVER;
+      clearBits(~BITS_ALLOWED_BY_RESOLVER);
     }
     return this;
   }
@@ -319,21 +334,6 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
     return !(this.entryVersion == 0 && this.regionVersionHighBytes == 0 && this.regionVersionLowBytes == 0);
   }
 
-  public VersionTag() {
-  }
-
-  /**
-   * creates a version tag for a WAN gateway event
-   *
-   * @param timestamp
-   * @param dsid
-   */
-  public VersionTag(long timestamp, int dsid) {
-    this.timeStamp = timestamp;
-    this.distributedSystemId = (byte) (dsid & 0xFF);
-    this.bits = BITS_GATEWAY_TAG + BITS_IS_REMOTE_TAG;
-  }
-
   public void toData(DataOutput out) throws IOException {
     toData(out, true);
   }
@@ -386,7 +386,7 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
     if (logger.isTraceEnabled(LogMarker.VERSION_TAG)) {
       logger.info(LogMarker.VERSION_TAG, "deserializing {} with flags 0x{}", this.getClass(), Integer.toHexString(flags));
     }
-    this.bits = in.readUnsignedShort();
+    bitsUpdater.set(this, in.readUnsignedShort());
     this.distributedSystemId = in.readByte();
     if ((flags & VERSION_TWO_BYTES) != 0) {
       this.entryVersion = in.readShort() & 0xffff;
@@ -408,11 +408,11 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
         this.previousMemberID = readMember(in);
       }
     }
-    this.bits |= BITS_IS_REMOTE_TAG;
+    setIsRemoteForTesting();
   }
   
   public void setIsRemoteForTesting() {
-    this.bits |= BITS_IS_REMOTE_TAG;
+    setBits(BITS_IS_REMOTE_TAG);
   }
 
   public abstract T readMember(DataInput in) throws IOException, ClassNotFoundException;
@@ -440,14 +440,14 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
       if (this.memberID != null) {
         s.append("; mbr=").append(this.memberID);
       }
-      if ((this.bits & BITS_HAS_PREVIOUS_ID) != 0) {
+      if (hasPreviousMemberID()) {
         s.append("; prev=").append(this.previousMemberID);
       }
       if (this.distributedSystemId >= 0) {
         s.append("; ds=").append(this.distributedSystemId);
       }
       s.append("; time=").append(getVersionTimeStamp());
-      if ((this.bits & BITS_IS_REMOTE_TAG) != 0) {
+      if (isFromOtherMember()) {
         s.append("; remote");
       }
       if (this.isAllowedByResolver()) {
@@ -544,4 +544,27 @@ public abstract class VersionTag<T extends VersionSource> implements DataSeriali
     }
     return true;
   }
+  
+  /**
+   * Set any bits in the given bitMask on the bits field
+   */
+  private void setBits(int bitMask) {
+    int oldBits;
+    int newBits;
+    do {
+      oldBits = this.bits;
+      newBits = oldBits | bitMask;
+    } while (!bitsUpdater.compareAndSet(this, oldBits, newBits));
+  }
+  /**
+   * Clear any bits not in the given bitMask from the bits field
+   */
+  private void clearBits(int bitMask) {
+    int oldBits;
+    int newBits;
+    do {
+      oldBits = this.bits;
+      newBits = oldBits & bitMask;
+    } while (!bitsUpdater.compareAndSet(this, oldBits, newBits));
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44289546/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/AbstractVersionTagTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/AbstractVersionTagTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/AbstractVersionTagTestBase.java
new file mode 100644
index 0000000..bf0ce43
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/AbstractVersionTagTestBase.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.versions;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class AbstractVersionTagTestBase {
+  @SuppressWarnings("rawtypes")
+  protected abstract VersionTag createVersionTag();
+  
+  @SuppressWarnings("rawtypes")
+  private VersionTag vt;
+  
+  @Before
+  public void setup() {
+    this.vt = createVersionTag();
+  }
+  @Test
+  public void testFromOtherMemberBit() {
+    assertEquals(false, vt.isFromOtherMember());
+    vt.setIsRemoteForTesting();
+    assertEquals(true, vt.isFromOtherMember());
+  }
+  
+  @Test
+  public void testTimeStampUpdatedBit() {
+    assertEquals(false, vt.isTimeStampUpdated());
+    vt.setTimeStampApplied(true);
+    assertEquals(true, vt.isTimeStampUpdated());
+    vt.setTimeStampApplied(false);
+    assertEquals(false, vt.isTimeStampUpdated());
+  }
+  
+  @Test
+  public void testGatewayTagBit() {
+    assertEquals(false, vt.isGatewayTag());
+    vt.setIsGatewayTag(true);
+    assertEquals(true, vt.isGatewayTag());
+    vt.setIsGatewayTag(false);
+    assertEquals(false, vt.isGatewayTag());
+  }
+  
+  @Test
+  public void testRecordedBit() {
+    assertEquals(false, vt.isRecorded());
+    vt.setRecorded();
+    assertEquals(true, vt.isRecorded());
+  }
+  
+  @SuppressWarnings("unchecked")
+  @Test
+  public void testPreviousMemberIDBit() {
+    assertEquals(false, vt.hasPreviousMemberID());
+    vt.setPreviousMemberID(null);
+    assertEquals(true, vt.hasPreviousMemberID());
+  }
+  
+  @Test
+  public void testPosDupBit() {
+    assertEquals(false, vt.isPosDup());
+    vt.setPosDup(true);
+    assertEquals(true, vt.isPosDup());
+    vt.setPosDup(false);
+    assertEquals(false, vt.isPosDup());
+  }
+  
+  @Test
+  public void testAllowedByResolverBit() {
+    assertEquals(false, vt.isAllowedByResolver());
+    vt.setAllowedByResolver(true);
+    assertEquals(true, vt.isAllowedByResolver());
+    vt.setAllowedByResolver(false);
+    assertEquals(false, vt.isAllowedByResolver());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44289546/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/VMVersionTagTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/VMVersionTagTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/VMVersionTagTest.java
new file mode 100644
index 0000000..4e39f3d
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/versions/VMVersionTagTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache.versions;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class VMVersionTagTest extends AbstractVersionTagTestBase {
+
+  @SuppressWarnings("rawtypes")
+  @Override
+  protected VersionTag createVersionTag() {
+    return new VMVersionTag();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/44289546/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
index fe21fbf..d2204a0 100644
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
@@ -1975,8 +1975,8 @@ fromData,212,2a2a2bb600bdb500132bb900be01003d2a1c047e04a0000704a7000403b500972ab
 toData,239,2ab4001499000dbb00b05912b8b700b2bf2a2ab400132bb600b9033d2ab400979900071c04803d2b1cb900ba02002b2ab4000bb60035b900bb03002b2ab4000cb60035b900bb03002b2ab40025b60033b900ba02002ab40025b60099b9002b01004e2db9002c010099002b2db9002d0100c0002e3a042a1904b9002f0100c0006e2bb600b91904b9003001002bb800bca7ffd22b2ab40026b60033b900ba02002ab40026b60099b9002b01004e2db9002c01009900332db9002d0100c0002e3a042a1904b9002f0100c0006e2bb600b92b1904b900300100c0003eb6003fb900bb0300a7ffca2ab4001f2bb800bcb1
 
 com/gemstone/gemfire/internal/cache/versions/VersionTag,2
-fromData,201,2bb9002001003db20012b20013b900140200990022b20012b20013122105bd001659032ab600175359041cb8001853b9001904002a2bb900200100b500012a2bb900220100b5000d1c077e9900132a2bb900230100121c7eb50003a7000f2a2bb900240100027eb500031c10107e99000d2a2bb900230100b500072a2bb900240100b5000a2a2bb80025b500041c047e99000c2a2a2bb60026b5000b1c057e99001e1c10087e99000e2a2ab4000bb5000ca7000c2a2a2bb60026b5000c2a59b40001101080b50001b1
-toData,269,033e0336042ab400031211a2000a0436041d07803e2ab400079900081d1010803e2ab4000bc6000b1c9900071d04803e2ab4000cc6001b1d05803e2ab4000c2ab4000ba6000c1c9900081d1008803eb20012b20013b900140200990022b20012b20013121505bd001659032ab600175359041db8001853b9001904002b1db9001a02002b2ab40001b9001a02002b2ab4000db9001b020015049900132b2ab40003121c7eb9001a0200a7000d2b2ab40003b9001d02002ab4000799000d2b2ab40007b9001a02002b2ab4000ab9001d02002ab400042bb8001e2ab4000bc600101c99000c2a2ab4000b2bb6001f2ab4000cc6001b2ab4000c2ab4000ba600071c9a000c2a2ab4000c2bb6001fb1
+fromData,197,2bb9002201003db20014b20015b900160200990022b20014b20015122305bd001859032ab600195359041cb8001a53b9001b0400b200242a2bb900220100b600252a2bb900260100b500101c077e9900132a2bb900270100121e7eb50006a7000f2a2bb900280100027eb500061c10107e99000d2a2bb900270100b5000a2a2bb900280100b5000d2a2bb80029b500071c047e99000c2a2a2bb6002ab5000e1c057e99001e1c10087e99000e2a2ab4000eb5000fa7000c2a2a2bb6002ab5000f2ab6002bb1
+toData,269,033e0336042ab400061213a2000a0436041d07803e2ab4000a9900081d1010803e2ab4000ec6000b1c9900071d04803e2ab4000fc6001b1d05803e2ab4000f2ab4000ea6000c1c9900081d1008803eb20014b20015b900160200990022b20014b20015121705bd001859032ab600195359041db8001a53b9001b04002b1db9001c02002b2ab40002b9001c02002b2ab40010b9001d020015049900132b2ab40006121e7eb9001c0200a7000d2b2ab40006b9001f02002ab4000a99000d2b2ab4000ab9001c02002b2ab4000db9001f02002ab400072bb800202ab4000ec600101c99000c2a2ab4000e2bb600212ab4000fc6001b2ab4000f2ab4000ea600071c9a000c2a2ab4000f2bb60021b1
 
 com/gemstone/gemfire/internal/cache/wan/GatewaySenderAdvisor$GatewaySenderProfile,4
 fromData,282,2a2bb700082a2bb80009b5000a2a2bb9000b0100b5000c2a2bb9000d0100b5000e2a2bb9000f0100b500102a2bb9000f0100b500112a2bb9000f0100b500122a2bb9000f0100b500132a2bb9000f0100b500142a2bb9000d0100b500152a2bb9000f0100b500162a2bb80017b500042a2bb80017b500052a2bb80017b500062a2bb9000f0100b500182a2bb9000d0100b500192bb8001ab2001bb6001c9c00552bb8001dc0001e4d2cc600412cb6001fb20020b60021b6002299000d2ab20020b50023a7002c2cb6001fb20024b60021b6002299000d2ab20024b50023a700122ab20025b50023a700082a01b50023a7000e2a2bb8001dc00026b500232bb800273d1c9900162abb002859b70029b5002a2ab4002a2bb8002bb1


[21/49] incubator-geode git commit: Fixing compile errors in eclipse

Posted by kl...@apache.org.
Fixing compile errors in eclipse

We were seeing compile errors in eclipse due to:
1) Missing gradle output dirs in the extensions module. I removed those
dirs from the eclipse classpath

2) Access restrictions on things like Unsafe. This was caused by a
change in gradle 2.12 to add the java 1.8 execution environment, rather
than the direct JDK dependency, to the project. That turned on access
restrictions in eclipse for  the execution environment.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c4b9756d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c4b9756d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c4b9756d

Branch: refs/heads/feature/GEODE-835-test
Commit: c4b9756da6a549cd646fa797200382debf7a102c
Parents: 7908467
Author: Dan Smith <up...@apache.org>
Authored: Thu May 12 17:10:29 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Fri May 13 11:37:02 2016 -0700

----------------------------------------------------------------------
 extensions/geode-modules-tomcat7/build.gradle |  6 ++++++
 gradle/ide.gradle                             | 15 ++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c4b9756d/extensions/geode-modules-tomcat7/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-tomcat7/build.gradle b/extensions/geode-modules-tomcat7/build.gradle
index 975c976..3c75e56 100644
--- a/extensions/geode-modules-tomcat7/build.gradle
+++ b/extensions/geode-modules-tomcat7/build.gradle
@@ -49,4 +49,10 @@ dependencies {
   testCompile project(path: ':geode-junit')
   testCompile files(project(':geode-core').sourceSets.test.output)
   testCompile files(project(':extensions/geode-modules').sourceSets.test.output)
+
+  eclipse.classpath.file {
+    whenMerged { classpath ->
+      classpath.entries.removeAll { entry -> entry.path.contains('geode-modules/build')}
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c4b9756d/gradle/ide.gradle
----------------------------------------------------------------------
diff --git a/gradle/ide.gradle b/gradle/ide.gradle
index adaf8d9..03f6565 100644
--- a/gradle/ide.gradle
+++ b/gradle/ide.gradle
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import org.gradle.plugins.ide.eclipse.model.Container
 allprojects {
   apply plugin: 'idea'
   apply plugin: 'eclipse'
@@ -26,11 +27,19 @@ subprojects {
       downloadSources = true
       plusConfigurations += [ configurations.provided ]
       file {
-        // Remove the gradle output directories from the eclipse classpath.
-        // Unfortunately, using minusConfigurations does not work here, because
-        // it removes the entire geode-core project.
         whenMerged { classpath ->
+            // Remove the gradle output directories from the eclipse classpath.
+            // Unfortunately, using minusConfigurations does not work here, because
+            // it removes the entire geode-core project.
             classpath.entries.removeAll { entry -> entry.path.contains('geode-core/build')}
+
+            //By default, gradle adds the java 1.8 *execution environment*, which has access restrictions on
+            //things like Unsafe. Change it to a direct dependency on the workspace JDK
+            classpath.entries = classpath.entries.collect { entry -> 
+              entry.path.contains('org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE')
+                ? new Container('org.eclipse.jdt.launching.JRE_CONTAINER')
+                : entry
+            }
         }
       }
     }


[36/49] incubator-geode git commit: GEODE-1401: handle NOT_AVAILABLE in callers of getRawOldValue

Posted by kl...@apache.org.
GEODE-1401: handle NOT_AVAILABLE in callers of getRawOldValue


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ab417e32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ab417e32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ab417e32

Branch: refs/heads/feature/GEODE-835-test
Commit: ab417e32deccb4e398d21e182bb738af9ef65e24
Parents: 11da98d
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon May 16 16:57:56 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Tue May 17 09:58:09 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/BucketRegionQueue.java         | 10 ++--------
 .../gemstone/gemfire/internal/cache/EntryEventImpl.java   |  2 +-
 .../gemfire/internal/cache/RemoteDestroyMessage.java      |  2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ab417e32/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegionQueue.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegionQueue.java
index 0243cde..a3d9d97 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegionQueue.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegionQueue.java
@@ -269,10 +269,7 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
         requireOldValue, lastModified, overwriteDestroyed);
 
     if (success) {
-      Object ov = event.getRawOldValue();
-      if (ov instanceof GatewaySenderEventImpl) {
-        ((GatewaySenderEventImpl) ov).release();
-      }
+      GatewaySenderEventImpl.release(event.getRawOldValue());
 
       if (getPartitionedRegion().getColocatedWith() == null) {
         return success;
@@ -370,10 +367,7 @@ public class BucketRegionQueue extends AbstractBucketRegionQueue {
     }
     super.basicDestroy(event, cacheWrite, expectedOldValue);
 
-    Object rov = event.getRawOldValue();
-    if (rov instanceof GatewaySenderEventImpl) {
-      ((GatewaySenderEventImpl) rov).release();
-    }
+    GatewaySenderEventImpl.release(event.getRawOldValue());
     // Primary buckets should already remove the key while peeking
     if (!this.getBucketAdvisor().isPrimary()) {
       if (logger.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ab417e32/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
index e241622..b833ecb 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
@@ -1407,7 +1407,7 @@ public class EntryEventImpl
         importer.importOldObject(cdV, true);
       }
     } else {
-      importer.importOldObject(ov, true);
+      importer.importOldObject(AbstractRegion.handleNotAvailable(ov), true);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ab417e32/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RemoteDestroyMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RemoteDestroyMessage.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RemoteDestroyMessage.java
index bb97d9c..f7109bb 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RemoteDestroyMessage.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/RemoteDestroyMessage.java
@@ -232,7 +232,7 @@ public class RemoteDestroyMessage extends RemoteOperationMessageWithDirectReply
           setOldValBytes((byte[]) old);
         } else {
           this.oldValueIsSerialized = true;
-          setOldValObj(old);
+          setOldValObj(AbstractRegion.handleNotAvailable(old));
         }
       }
     }


[16/49] incubator-geode git commit: GEODE-732 Fixed the issue with List inside list and added test for it

Posted by kl...@apache.org.
GEODE-732 Fixed the issue with List inside list and added test for it


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a881e9cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a881e9cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a881e9cb

Branch: refs/heads/feature/GEODE-835-test
Commit: a881e9cb1b86bfd5b928b8719219421f5a26a954
Parents: 04a0004
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Thu May 12 12:52:41 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Fri May 13 10:32:51 2016 -0700

----------------------------------------------------------------------
 .../com/gemstone/gemfire/pdx/JSONFormatter.java | 21 +++++++--
 .../pdx/internal/json/PdxListHelper.java        |  2 +-
 .../pdx/jsonStrings/jsonListInsideList.txt      | 48 ++++++++++++++++++++
 3 files changed, 65 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a881e9cb/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java b/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
index 220deaf..d929cf6 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/pdx/JSONFormatter.java
@@ -52,7 +52,7 @@ public class JSONFormatter {
   
   public static final String JSON_CLASSNAME = "__GEMFIRE_JSON";
   
-  enum states {NONE, ObJECT_START,  FIELD_NAME, INNER_OBJECT_FOUND, SCALER_FOUND, LIST_FOUND, OBJECT_ENDS};
+  enum states {NONE, ObJECT_START,  FIELD_NAME, SCALER_FOUND, LIST_FOUND, LIST_ENDS, OBJECT_ENDS};
   
   private JSONFormatter() {
   }
@@ -192,9 +192,10 @@ public class JSONFormatter {
         {
           //need to create array; fieldname may be there; will it case it not there
           arrayStarts(currentState);
+          currentState = states.LIST_FOUND;
           PdxListHelper list = getList(jp, currentState, null);
           currentPdxInstance.addListField(currentFieldName, list);
-          currentState = states.LIST_FOUND;
+          currentState = states.LIST_ENDS;
           currentFieldName = null;          
           break;
         }
@@ -409,10 +410,10 @@ public class JSONFormatter {
         {
           //array is end
           arrayEnds(currentState);
+          currentState = states.LIST_ENDS;
           if(currentPdxList.getParent() == null)
             return currentPdxList;
-          currentPdxList = currentPdxList.getParent(); 
-          currentState = states.LIST_FOUND;
+          currentPdxList = currentPdxList.getParent();          
           break;
         }
         case VALUE_EMBEDDED_OBJECT :
@@ -486,6 +487,8 @@ public class JSONFormatter {
     case FIELD_NAME:
     case OBJECT_ENDS://in list
     case SCALER_FOUND://inlist
+    case LIST_FOUND:
+    case LIST_ENDS:
       return true;
       default:
         throw new IllegalStateException("Object start called when state is " +currentState);
@@ -499,7 +502,7 @@ public class JSONFormatter {
     {
     case ObJECT_START: //when empty object on field
     case SCALER_FOUND:
-    case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS://inner object closes
       return true;
       default:
@@ -515,6 +518,7 @@ public class JSONFormatter {
     case SCALER_FOUND:
     case FIELD_NAME:
     case LIST_FOUND:
+    case LIST_ENDS:
       return true;
       default:
         throw new IllegalStateException("Array start called when state is " +currentState);
@@ -529,6 +533,7 @@ public class JSONFormatter {
     case FIELD_NAME://when empty array
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:  
     case OBJECT_ENDS:
       return true;
       default:
@@ -544,6 +549,7 @@ public class JSONFormatter {
     case FIELD_NAME:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:
@@ -559,6 +565,7 @@ public class JSONFormatter {
     case FIELD_NAME:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:
@@ -574,6 +581,7 @@ public class JSONFormatter {
     case FIELD_NAME:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:
@@ -589,6 +597,7 @@ public class JSONFormatter {
     case FIELD_NAME:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:
@@ -604,6 +613,7 @@ public class JSONFormatter {
     case ObJECT_START:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:
@@ -619,6 +629,7 @@ public class JSONFormatter {
     case FIELD_NAME:
     case SCALER_FOUND:
     case LIST_FOUND:
+    case LIST_ENDS:
     case OBJECT_ENDS:
       return true;
       default:

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a881e9cb/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/json/PdxListHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/json/PdxListHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/json/PdxListHelper.java
index 7700b30..d51ceed 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/json/PdxListHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/pdx/internal/json/PdxListHelper.java
@@ -153,7 +153,7 @@ public class PdxListHelper {
       logger.trace("addListField");
     }
     PdxListHelper tmp = new PdxListHelper(this, "no-name");
-    list.add(tmp);
+    list.add(tmp.getList());
     return tmp;
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a881e9cb/geode-core/src/test/resources/com/gemstone/gemfire/pdx/jsonStrings/jsonListInsideList.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/pdx/jsonStrings/jsonListInsideList.txt b/geode-core/src/test/resources/com/gemstone/gemfire/pdx/jsonStrings/jsonListInsideList.txt
new file mode 100755
index 0000000..9a04081
--- /dev/null
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/pdx/jsonStrings/jsonListInsideList.txt
@@ -0,0 +1,48 @@
+{
+  "photos": [
+    [
+      {
+        "url": "image url",
+        "dimensions": "192x144"
+      },
+      {
+        "url": "image url",
+        "dimensions": "original"
+      },
+      {
+        "url": "image url",
+        "dimensions": "128x96"
+      },
+      {
+        "url": "image url",
+        "dimensions": "64x48"
+      },
+      {
+        "url": "image url",
+        "dimensions": "400x300"
+      }
+    ],
+    [
+      {
+        "url": "image url",
+        "dimensions": "192x144"
+      },
+      {
+        "url": "image url",
+        "dimensions": "original"
+      },
+      {
+        "url": "image url",
+        "dimensions": "128x96"
+      },
+      {
+        "url": "image url",
+        "dimensions": "64x48"
+      },
+      {
+        "url": "image url",
+        "dimensions": "400x300"
+      }
+    ]
+  ]
+}
\ No newline at end of file


[18/49] incubator-geode git commit: Revert "GEODE-1376: Cleaned up server port to be '0'."

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
index 692ff19..2e80ebf 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@ -19,6 +19,7 @@ package com.gemstone.gemfire.rest.internal.web.controllers;
 import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.internal.LocatorTestBase;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -30,10 +31,7 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.management.ManagementException;
 import com.gemstone.gemfire.management.ManagementTestBase;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.*;
 import com.gemstone.gemfire.util.test.TestUtil;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -49,12 +47,13 @@ import javax.net.ssl.SSLContext;
 import java.io.*;
 import java.net.BindException;
 import java.security.KeyStore;
-import java.util.Date;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
 /**
+ * 
  * @since 8.0
  */
 public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
@@ -64,13 +63,13 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
   private ManagementTestBase helper;
 
   private final String PEOPLE_REGION_NAME = "People";
-
+  
   private File jks;
 
   public RestAPIsWithSSLDUnitTest(String name) {
     super(name);
     this.helper = new ManagementTestBase(name);
-    this.jks = findTrustedJKS();
+    this.jks  = findTrustedJKS();
 
   }
 
@@ -86,22 +85,32 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
   }
 
   private File findTrustedJKS() {
-    if (jks == null) {
+    if(jks == null){
       jks = new File(TestUtil.getResourcePath(RestAPIsWithSSLDUnitTest.class, "/ssl/trusted.keystore"));
     }
     return jks;
   }
 
+  public String startBridgeServerWithRestServiceOnInVM(final VM vm, final String locators, final String[] regions,
+      final Properties sslProperties, final boolean clusterLevel) {
+
+    final String hostName = vm.getHost().getHostName();
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    vm.invoke("startBridge", () -> startBridgeServer(hostName,serverPort,locators,regions,sslProperties,clusterLevel));
+    return "https://" + hostName + ":" + serverPort + "/gemfire-api/v1";
+
+  }
+
   @SuppressWarnings("deprecation")
-  protected int startBridgeServer(String hostName, int restServicePort, final String locators, final String[] regions,
+  protected int startBridgeServer(String hostName, int restServicerPort, final String locators, final String[] regions,
       final Properties sslProperties, boolean clusterLevel) {
 
     Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
     props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
     props.setProperty(DistributionConfig.START_DEV_REST_API_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_BIND_ADDRESS_NAME, hostName);
-    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicePort));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(restServicerPort));
 
     System.setProperty("javax.net.debug", "ssl,handshake");
     configureSSL(props, sslProperties, clusterLevel);
@@ -109,8 +118,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     DistributedSystem ds = getSystem(props);
     Cache cache = CacheFactory.create(ds);
     ((GemFireCacheImpl) cache).setReadSerialized(true);
-
     AttributesFactory factory = new AttributesFactory();
+
     factory.setEnableBridgeConflation(true);
     factory.setDataPolicy(DataPolicy.REPLICATE);
     RegionAttributes attrs = factory.create();
@@ -119,45 +128,81 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     }
 
     CacheServer server = cache.addCacheServer();
-    server.setPort(0);
+    final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    server.setPort(serverPort);
     try {
       server.start();
     } catch (IOException e) {
       e.printStackTrace();
     }
     remoteObjects.put(CACHE_KEY, cache);
-    return new Integer(server.getPort());
+    return new Integer(serverPort);
   }
 
   public void doPutsInClientCache() {
-    ClientCache clientCache = ClientCacheFactory.getAnyInstance();
-    assertNotNull(clientCache);
-    Region<String, Object> region = clientCache.getRegion(PEOPLE_REGION_NAME);
+    ClientCache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+    Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME);
 
     // put person object
-    region.put("1", new Person(101L, "Mithali", "Dorai", "Raj", new Date(), Gender.FEMALE));
-    region.put("2", new Person(102L, "Sachin", "Ramesh", "Tendulkar", new Date(), Gender.MALE));
-    region.put("3", new Person(103L, "Saurabh", "Baburav", "Ganguly", new Date(), Gender.MALE));
-    region.put("4", new Person(104L, "Rahul", "subrymanyam", "Dravid", new Date(), Gender.MALE));
-    region.put("5", new Person(105L, "Jhulan", "Chidambaram", "Goswami", new Date(), Gender.FEMALE));
+    final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982,
+        Calendar.DECEMBER, 4), Gender.FEMALE);
+    final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975,
+        Calendar.DECEMBER, 14), Gender.MALE);
+    final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972,
+        Calendar.AUGUST, 29), Gender.MALE);
+    final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979,
+        Calendar.MARCH, 17), Gender.MALE);
+    final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983,
+        Calendar.NOVEMBER, 25), Gender.FEMALE);
+
+    region.put("1", person1);
+    region.put("2", person2);
+    region.put("3", person3);
+    region.put("4", person4);
+    region.put("5", person5);
+
+    final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi",
+        DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE);
+    final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945,
+        Calendar.DECEMBER, 24), Gender.MALE);
+    final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920,
+        Calendar.AUGUST, 9), Gender.MALE);
+    final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH,
+        27), Gender.FEMALE);
+    final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973,
+        Calendar.APRIL, 15), Gender.FEMALE);
+
+    final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923,
+        Calendar.APRIL, 25), Gender.MALE);
+    final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910,
+        Calendar.JANUARY, 01), Gender.MALE);
+    final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943,
+        Calendar.AUGUST, 10), Gender.FEMALE);
+    final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER,
+        27), Gender.MALE);
+    final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER,
+        21), Gender.MALE);
+    final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927,
+        Calendar.FEBRUARY, 15), Gender.FEMALE);
 
     Map<String, Object> userMap = new HashMap<String, Object>();
-    userMap.put("6", new Person(101L, "Rahul", "Rajiv", "Gndhi", new Date(), Gender.MALE));
-    userMap.put("7", new Person(102L, "Narendra", "Damodar", "Modi", new Date(), Gender.MALE));
-    userMap.put("8", new Person(103L, "Atal", "Bihari", "Vajpayee", new Date(), Gender.MALE));
-    userMap.put("9", new Person(104L, "Soniya", "Rajiv", "Gandhi", new Date(), Gender.FEMALE));
-    userMap.put("10", new Person(104L, "Priyanka", "Robert", "Gandhi", new Date(), Gender.FEMALE));
-    userMap.put("11", new Person(104L, "Murali", "Manohar", "Joshi", new Date(), Gender.MALE));
-    userMap.put("12", new Person(104L, "Lalkrishna", "Parmhansh", "Advani", new Date(), Gender.MALE));
-    userMap.put("13", new Person(104L, "Shushma", "kumari", "Swaraj", new Date(), Gender.FEMALE));
-    userMap.put("14", new Person(104L, "Arun", "raman", "jetly", new Date(), Gender.MALE));
-    userMap.put("15", new Person(104L, "Amit", "kumar", "shah", new Date(), Gender.MALE));
-    userMap.put("16", new Person(104L, "Shila", "kumari", "Dixit", new Date(), Gender.FEMALE));
+    userMap.put("6", person6);
+    userMap.put("7", person7);
+    userMap.put("8", person8);
+    userMap.put("9", person9);
+    userMap.put("10", person10);
+    userMap.put("11", person11);
+    userMap.put("12", person12);
+    userMap.put("13", person13);
+    userMap.put("14", person14);
+    userMap.put("15", person15);
+    userMap.put("16", person16);
 
     region.putAll(userMap);
 
-    if (clientCache != null)
-      clientCache.getLogger().info("Gemfire Cache Client: Puts successfully done");
+    if (cache != null)
+      cache.getLogger().info("Gemfire Cache Client: Puts successfully done");
 
   }
 
@@ -172,30 +217,24 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     // start locator
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
-    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
+    startLocatorInVM(locator, locatorPort, "");
 
     // find locators
     String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
 
     // start manager (peer cache)
-    manager.invoke("StartManager", () -> startManager(locators, new String[] { REGION_NAME }, sslProperties));
+    startManagerInVM(manager, locators, new String[] { REGION_NAME }, sslProperties);
 
     // start startBridgeServer With RestService enabled
-    String restEndpoint = server.invoke("startBridgeServerWithRestServiceOnInVM", () -> {
-      final String hostName = server.getHost().getHostName();
-      final int restServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
-      startBridgeServer(hostName, restServicePort, locators, new String[] { REGION_NAME }, sslProperties, clusterLevel);
-      return "https://" + hostName + ":" + restServicePort + "/gemfire-api/v1";
-    });
+    String restEndpoint = startBridgeServerWithRestServiceOnInVM(server, locators, new String[] { REGION_NAME },
+        sslProperties, clusterLevel);
 
     // create a client cache
-    client.invoke("Create ClientCache", () -> new ClientCacheFactory()
-        .setPdxReadSerialized(true)
-        .addPoolLocator(NetworkUtils.getServerHostName(locator.getHost()), locatorPort).create());
+    createClientCacheInVM(client, NetworkUtils.getServerHostName(locator.getHost()), locatorPort);
 
     // create region in Manager, peer cache and Client cache nodes
-    manager.invoke("createRegionInManager", () -> createRegionInCache());
-    server.invoke("createRegionInPeerServer", () -> createRegionInCache());
+    manager.invoke("createRegionInManager",() -> createRegionInManager());
+    server.invoke("createRegionInPeerServer", () -> createRegionInPeerServer());
     client.invoke("createRegionInClientCache", () -> createRegionInClientCache());
 
     // do some person puts from clientcache
@@ -221,114 +260,191 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     helper.closeCache(client);
   }
 
-  private void sslPropertyConverter(Properties properties, Properties newProperties, String propertyName, String newPropertyName) {
-    String property = properties.getProperty(propertyName);
-    if (property != null) {
-      newProperties.setProperty((newPropertyName != null ? newPropertyName : propertyName), property);
+  private void createClientCacheInVM(VM vm, final String host, final int port) throws Exception {
+    SerializableRunnable connect = new SerializableRunnable("Start Cache client") {
+      public void run() {
+        // Connect using the GemFire locator and create a Caching_Proxy cache
+        ClientCache clientCache = new ClientCacheFactory().setPdxReadSerialized(true).addPoolLocator(host, port).create();
+        clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+      }
+    };
+
+    if (vm == null) {
+      connect.run();
+    } else {
+      vm.invoke(connect);
     }
   }
 
   private void configureSSL(Properties props, Properties sslProperties, boolean clusterLevel) {
 
-    if (clusterLevel) {
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, DistributionConfig.CLUSTER_SSL_ENABLED_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, DistributionConfig.CLUSTER_SSL_KEYSTORE_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,
-          DistributionConfig.CLUSTER_SSL_KEYSTORE_PASSWORD_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, DistributionConfig.CLUSTER_SSL_KEYSTORE_TYPE_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, DistributionConfig.CLUSTER_SSL_PROTOCOLS_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
-          DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, DistributionConfig.CLUSTER_SSL_TRUSTSTORE_NAME);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
-          DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME);
-    } else {
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, null);
-      sslPropertyConverter(sslProperties, props, DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, null);
+    if(clusterLevel){
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_ENABLED_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_KEYSTORE_TYPE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_PROTOCOLS_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_REQUIRE_AUTHENTICATION_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.CLUSTER_SSL_TRUSTSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
+      }
+
+    }else{
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME));
+      }
+      if (sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME) != null) {
+        props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,
+            sslProperties.getProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME));
+      }
+
     }
+    
+   
   }
 
-  private void startManager(final String locators, final String[] regions, final Properties sslProperties) throws IOException {
-
+  private int startManagerInVM(VM vm, final String locators, final String[] regions, final Properties sslProperties) {
+    
     IgnoredException.addIgnoredException("java.net.BindException");
     IgnoredException.addIgnoredException("java.rmi.server.ExportException");
     IgnoredException.addIgnoredException("com.gemstone.gemfire.management.ManagementException");
-
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
-    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-    props.setProperty("jmx-manager", "true");
-    props.setProperty("jmx-manager-start", "true");
-
-    Cache cache = null;
-    configureSSL(props, sslProperties, false);
-    while (true) {
-      try {
-        DistributedSystem ds = getSystem(props);
-        System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port", "7070")
-            + " and jmx-manager-port " + props.getProperty("jmx-manager-port", "1099"));
-        cache = CacheFactory.create(ds);
-        System.out.println("Successfully created cache.");
-        break;
-      } catch (ManagementException ex) {
-        if ((ex.getCause() instanceof BindException)
-            || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) {
-          //close cache and disconnect
-          GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance();
-          if (existingInstance != null) {
-            existingInstance.close();
+    
+    SerializableCallable connect = new SerializableCallable("Start Manager ") {
+      public Object call() throws IOException {
+        Properties props = new Properties();
+        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+        props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+        props.setProperty("jmx-manager", "true");
+        props.setProperty("jmx-manager-start", "true");
+
+        Cache cache = null;
+        while (true) {
+          try {
+            configureSSL(props, sslProperties, false);
+            DistributedSystem ds = getSystem(props);
+            System.out.println("Creating cache with http-service-port " + props.getProperty("http-service-port", "7070") 
+            + " and jmx-manager-port " + props.getProperty("jmx-manager-port", "1099"));            
+            cache = CacheFactory.create(ds);
+            System.out.println("Successfully created cache.");
+            break;
           }
-          InternalDistributedSystem ids = InternalDistributedSystem
-              .getConnectedInstance();
-          if (ids != null) {
-            ids.disconnect();
+          catch (ManagementException ex) {
+            if ((ex.getCause() instanceof BindException) 
+                || (ex.getCause() != null && ex.getCause().getCause() instanceof BindException)) {
+              //close cache and disconnect
+              GemFireCacheImpl existingInstance = GemFireCacheImpl.getInstance();
+              if (existingInstance != null) {
+                existingInstance.close();
+              }
+              InternalDistributedSystem ids = InternalDistributedSystem
+                  .getConnectedInstance();
+              if (ids != null) {
+                ids.disconnect();
+              }
+              //try a different port
+              int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
+              int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort();
+              props.setProperty("http-service-port", Integer.toString(httpServicePort));
+              props.setProperty("jmx-manager-port", Integer.toString(jmxManagerPort));
+              System.out.println("Try a different http-service-port " + httpServicePort);
+              System.out.println("Try a different jmx-manager-port " + jmxManagerPort);
+            }
+            else {
+              throw ex;
+            }
           }
-          //try a different port
-          int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
-          int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort();
-          props.setProperty("http-service-port", Integer.toString(httpServicePort));
-          props.setProperty("jmx-manager-port", Integer.toString(jmxManagerPort));
-          System.out.println("Try a different http-service-port " + httpServicePort);
-          System.out.println("Try a different jmx-manager-port " + jmxManagerPort);
-        } else {
-          throw ex;
+        } 
+        AttributesFactory factory = new AttributesFactory();
+
+        factory.setEnableBridgeConflation(true);
+        factory.setDataPolicy(DataPolicy.REPLICATE);
+        RegionAttributes attrs = factory.create();
+        for (int i = 0; i < regions.length; i++) {
+          cache.createRegion(regions[i], attrs);
         }
-      }
-    }
-    AttributesFactory factory = new AttributesFactory();
+        CacheServer server = cache.addCacheServer();
+        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
+        server.setPort(serverPort);
+        server.start();
 
-    factory.setEnableBridgeConflation(true);
-    factory.setDataPolicy(DataPolicy.REPLICATE);
-    RegionAttributes attrs = factory.create();
-    for (int i = 0; i < regions.length; i++) {
-      cache.createRegion(regions[i], attrs);
-    }
-    CacheServer server = cache.addCacheServer();
-    server.setPort(0);
-    server.start();
+        return new Integer(serverPort);
+      }
+    };
+    Integer port = (Integer) vm.invoke(connect);
+    return port.intValue();
   }
 
   private void createRegionInClientCache() {
-    ClientCache clientCache = ClientCacheFactory.getAnyInstance();
-    assertNotNull(clientCache);
-    clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(PEOPLE_REGION_NAME);
-    clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+    ClientCache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+    ClientRegionFactory<String, Object> crf = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
+    crf.create(PEOPLE_REGION_NAME);
   }
 
-  private void createRegionInCache() {
+  private void createRegionInManager() {
     Cache cache = GemFireCacheImpl.getInstance();
     assertNotNull(cache);
-    RegionFactory<String, Object> regionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE);
-    regionFactory.create(PEOPLE_REGION_NAME);
+    RegionFactory<String, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
+    rf.create(PEOPLE_REGION_NAME);
   }
 
-  private CloseableHttpClient getSSLBasedHTTPClient() throws Exception {
+  private void createRegionInPeerServer() {
+    Cache cache = GemFireCacheImpl.getInstance();
+    assertNotNull(cache);
+    RegionFactory<String, Object> rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
+    rf.create(PEOPLE_REGION_NAME);
+  }
+  
+  private CloseableHttpClient getSSLBasedHTTPClient(String algo) throws Exception {
+    
     File jks = findTrustedJKS();
 
     KeyStore clientKeys = KeyStore.getInstance("JKS");
@@ -338,7 +454,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     SSLContext sslcontext = SSLContexts.custom()
         .loadTrustMaterial(clientKeys, new TrustSelfSignedStrategy())
         .loadKeyMaterial(clientKeys, "password".toCharArray())
-        .build();
+    .build();
 
     // Host checking is disabled here , as tests might run on multiple hosts and
     // host entries can not be assumed
@@ -350,7 +466,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     return httpclient;
   }
 
-  private void validateConnection(String restEndpoint) {
+  private void validateConnection(String restEndpoint, String algo) {
 
     try {
       // 1. Get on key="1" and validate result.
@@ -359,7 +475,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
         get.addHeader("Content-Type", "application/json");
         get.addHeader("Accept", "application/json");
 
-        CloseableHttpClient httpclient = getSSLBasedHTTPClient();
+       
+        CloseableHttpClient httpclient = getSSLBasedHTTPClient(algo);
         CloseableHttpResponse response = httpclient.execute(get);
 
         HttpEntity entity = response.getEntity();
@@ -384,7 +501,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
       throw new RuntimeException("unexpected exception", e);
     }
   }
-
+  
   // Actual Tests starts here.
 
   public void testSimpleSSL() throws Exception {
@@ -394,80 +511,90 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
-    validateConnection(startInfraWithSSL(props, false));
+    String restEndpoint = startInfraWithSSL(props,false);
+    validateConnection(restEndpoint, "SSL");
   }
-
+  
   public void testSSLWithoutKeyStoreType() throws Exception {
 
+   
+
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+  
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "SSL");
 
-    validateConnection(startInfraWithSSL(props, false));
 
   }
-
+  
   public void testSSLWithSSLProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
-
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "SSL");
 
   }
-
+  
   public void testSSLWithTLSProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLS");
-
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLS");
 
   }
-
+  
   public void testSSLWithTLSv11Protocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.1");
-
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLSv1.1");
 
   }
-
+  
   public void testSSLWithTLSv12Protocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
-
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLSv1.2");
 
   }
-
+  
   public void testWithMultipleProtocol() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL,TLSv1.2");
-
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLSv1.2");
 
   }
-
+  
   public void testSSLWithCipherSuite() throws Exception {
 
     System.setProperty("javax.net.debug", "ssl");
@@ -475,51 +602,57 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
-
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
     SSLContext ssl = SSLContext.getInstance("TLSv1.2");
-
+    
     ssl.init(null, null, new java.security.SecureRandom());
     String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
-
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0]);
-
-    validateConnection(startInfraWithSSL(props, false));
+    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]);
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLSv1.2");
 
   }
-
+  
   public void testSSLWithMultipleCipherSuite() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
-
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
     SSLContext ssl = SSLContext.getInstance("TLSv1.2");
-
+    
     ssl.init(null, null, new java.security.SecureRandom());
     String[] cipherSuites = ssl.getSocketFactory().getSupportedCipherSuites();
-
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME, cipherSuites[0] + "," + cipherSuites[1]);
-
-    validateConnection(startInfraWithSSL(props, false));
+    
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_CIPHERS_NAME,cipherSuites[0]+","+cipherSuites[1]);
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "TLSv1.2");
 
   }
-
+  
+  
   public void testMutualAuthentication() throws Exception {
 
     Properties props = new Properties();
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_ENABLED_NAME, "true");
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
     props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME,"true");
 
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_NAME,jks.getCanonicalPath());
 
-    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
-    validateConnection(startInfraWithSSL(props, false));
+    props.setProperty(DistributionConfig.HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME,"password");
+    
+    String restEndpoint = startInfraWithSSL(props, false);
+    validateConnection(restEndpoint, "SSL");
   }
 
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
index ad578c5..cfcff5e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
+import java.io.Serializable;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Assert;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.NoAvailableLocatorsException;
@@ -28,23 +37,22 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.management.membership.ClientMembership;
 import com.gemstone.gemfire.management.membership.ClientMembershipEvent;
 import com.gemstone.gemfire.management.membership.ClientMembershipListenerAdapter;
-import com.gemstone.gemfire.test.dunit.*;
-import org.junit.Assert;
-
-import java.io.Serializable;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
 
 /**
  * Tests cases that are particular for the auto connection source
- * - dynamically discovering servers, locators, handling
+ * - dynamically discovering servers, locators, handling 
  * locator disappearance, etc.
+ *
  */
 public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
-
+  
   protected static final Object BRIDGE_LISTENER = "BRIDGE_LISTENER";
   private static final long MAX_WAIT = 60000;
 
@@ -56,85 +64,84 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   public AutoConnectionSourceDUnitTest(String name) {
     super(name);
   }
-
+  
   public void testDiscoverBridgeServers() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-
-    String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
+    startLocatorInVM(vm0, locatorPort, "");
+    
+    String locators = NetworkUtils.getServerHostName(vm0.getHost())+ "[" + locatorPort + "]";
+    
+    startBridgeServerInVM(vm1, null, locators);
 
-    vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
 
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-
+    
     Assert.assertEquals("value", getInVM(vm1, "key"));
   }
 
   public void testNoLocators() {
-
+    
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
-
+    
     try {
-      vm0.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost())
-          , AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET)));
+      startBridgeClientInVM(vm0, null, NetworkUtils.getServerHostName(vm0.getHost()), AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
       putInVM(vm0, "key", "value");
       fail("Client cache should not have been able to start");
-    } catch (Exception e) {
+    } catch(Exception e) {
       //expected an exception
     }
   }
-
+  
   public void testNoBridgeServer() {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-    try {
-      vm1.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
+    startLocatorInVM(vm0, locatorPort, "");
+    try { 
+      startBridgeClientInVM(vm1, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
       putInVM(vm0, "key", "value");
       fail("Client cache should not have been able to start");
-    } catch (Exception e) {
+    } catch(Exception e) {
       //expected an exception
     }
   }
-
-  public void testDynamicallyFindBridgeServer() throws Exception {
+  
+  public void testDynamicallyFindBridgeServer() throws Exception  {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-
+    startLocatorInVM(vm0, locatorPort, "");
+    
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-
-    vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
-
+    
+    startBridgeServerInVM(vm1, null, locators);
+    
+    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-
-    vm3.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
+    
+    startBridgeServerInVM(vm3, null, locators);
+    
     stopBridgeMemberVM(vm1);
-
+    
     putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
-
+    
     Assert.assertEquals("value2", getInVM(vm3, "key2"));
   }
-
+  
   public void testDynamicallyFindLocators() throws Exception {
     try {
       final Host host = Host.getHost(0);
@@ -143,60 +150,59 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       VM vm1 = host.getVM(1);
       VM vm2 = host.getVM(2);
       VM vm3 = host.getVM(3);
-
+      
       int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
-
+      
       final int locatorPort0 = ports[0];
       final int locatorPort1 = ports[1];
       final int locatorPort3 = ports[2];
-      String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3 });
-      vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort0, locators));
-      vm1.invoke("Start Locator", () -> startLocator(vm1.getHost(), locatorPort1, locators));
-
-      vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0));
-
-      InetSocketAddress locatorToWaitFor = new InetSocketAddress(hostName, locatorPort1);
+      String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3});
+      startLocatorInVM(vm0, locatorPort0, locators);
+      
+      startLocatorInVM(vm1, locatorPort1, locators);
+      startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0);
+      
+      InetSocketAddress locatorToWaitFor= new InetSocketAddress(hostName, locatorPort1);
       waitForLocatorDiscovery(vm2, locatorToWaitFor);
-
-      vm0.invoke("Stop Locator", () -> stopLocator());
-      vm0.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
+      
+      stopLocatorInVM(vm0);
+      startBridgeServerInVM(vm0, null, locators);
+      
       putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
       Assert.assertEquals("value", getInVM(vm0, "key"));
-
-      vm3.invoke("Start Locator", () -> startLocator(vm3.getHost(), locatorPort3, locators));
+      
+      startLocatorInVM(vm3, locatorPort3, locators);
       stopBridgeMemberVM(vm0);
-      locatorToWaitFor = new InetSocketAddress(hostName, locatorPort3);
+      locatorToWaitFor= new InetSocketAddress(hostName, locatorPort3);
       waitForLocatorDiscovery(vm2, locatorToWaitFor);
-      vm1.invoke("Stop Locator", () -> stopLocator());
-      vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+      stopLocatorInVM(vm1);
+      startBridgeServerInVM(vm1, null, locators);
       putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
       Assert.assertEquals("value2", getInVM(vm1, "key2"));
-    } catch (Exception ec) {
-      if (ec.getCause() != null && (ec.getCause().getCause() instanceof BindException))
+    }catch(Exception ec) {
+      if(ec.getCause() != null && (ec.getCause().getCause() instanceof BindException))
         return;//BindException let it pass
       throw ec;
     }
   }
-
-  public void testEmbeddedLocator() throws Exception {
+  
+  public void testEmbeddedLocator() throws Exception  {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-
+    
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-
-    vm0.invoke("Start BridgeServer", () -> startBridgeServerWithEmbeddedLocator(null, locators, new String[] { REGION_NAME }
-        , CacheServer.DEFAULT_LOAD_PROBE));
-
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
-
+    
+    startBridgeServerWithEmbeddedLocator(vm0, null, locators, new String[] {REGION_NAME}, CacheServer.DEFAULT_LOAD_PROBE);
+    
+    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    
     putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-
+    
     Assert.assertEquals("value", getInVM(vm2, "key"));
   }
 
@@ -205,7 +211,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws InterruptedException {
         MyLocatorCallback callback = (MyLocatorCallback) remoteObjects.get(CALLBACK_KEY);
-
+        
         boolean discovered = callback.waitForDiscovery(locatorToWaitFor, MAX_WAIT);
         Assert.assertTrue("Waited " + MAX_WAIT + " for " + locatorToWaitFor
             + " to be discovered on client. List is now: "
@@ -214,89 +220,85 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   public void testServerGroups() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-
+    startLocatorInVM(vm0, locatorPort, "");
+    
     String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
+    
+    startBridgeServerInVM(vm1, new String[] {"group1", "group2"} , locators, new String[] {"A", "B"});
+    startBridgeServerInVM(vm2, new String[] {"group2", "group3"}, locators, new String[] {"B", "C"});
 
-    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1", "group2" }, locators, new String[] { "A", "B" }));
-    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group2", "group3" }, locators, new String[] { "B", "C" }));
-
-    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group1", NetworkUtils.getServerHostName(vm0.getHost())
-        , locatorPort, new String[] { "A", "B", "C" }));
+    
+    startBridgeClientInVM(vm3, "group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
     putAndWaitForSuccess(vm3, "A", "key", "value");
     Assert.assertEquals("value", getInVM(vm1, "A", "key"));
     try {
       putInVM(vm3, "C", "key2", "value2");
       fail("Should not have been able to find Region C on the server");
-    } catch (Exception expected) {
-    }
-
+    } catch(Exception expected) {}
+    
     stopBridgeMemberVM(vm3);
-
-    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group3", NetworkUtils.getServerHostName(vm0.getHost()),
-        locatorPort, new String[] { "A", "B", "C" }));
+    
+    startBridgeClientInVM(vm3, "group3", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
     try {
       putInVM(vm3, "A", "key3", "value");
       fail("Should not have been able to find Region A on the server");
-    } catch (Exception expected) {
-    }
+    } catch(Exception expected) {}
     putInVM(vm3, "C", "key4", "value");
     Assert.assertEquals("value", getInVM(vm2, "C", "key4"));
-
+    
     stopBridgeMemberVM(vm3);
-
-    vm3.invoke("StartBridgeClient", () -> startBridgeClient("group2", NetworkUtils.getServerHostName(vm0.getHost()),
-        locatorPort, new String[] { "A", "B", "C" }));
+    
+    startBridgeClientInVM(vm3, "group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort, new String [] {"A", "B", "C"});
     putInVM(vm3, "B", "key5", "value");
     Assert.assertEquals("value", getInVM(vm1, "B", "key5"));
     Assert.assertEquals("value", getInVM(vm2, "B", "key5"));
-
+    
     stopBridgeMemberVM(vm1);
     putInVM(vm3, "B", "key6", "value");
     Assert.assertEquals("value", getInVM(vm2, "B", "key6"));
-    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1", "group2" }, locators, new String[] { "A", "B" }));
+    startBridgeServerInVM(vm1, new String[] {"group1", "group2"} , locators, new String[] {"A", "B"});
     stopBridgeMemberVM(vm2);
-
+    
     putInVM(vm3, "B", "key7", "value");
     Assert.assertEquals("value", getInVM(vm1, "B", "key7"));
   }
-
+  
   public void testTwoServersInSameVM() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-    //    VM vm3 = host.getVM(3);
-
+//    VM vm3 = host.getVM(3);
+    
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-
-    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
-
+    
+    startLocatorInVM(vm0, locatorPort, "");
+    
     final String locators = NetworkUtils.getServerHostName(vm0.getHost()) + "[" + locatorPort + "]";
-
-    final int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "group1" }, locators));
-    final int serverPort2 = vm1.invoke("Start CacheServer", () -> addCacheServer(new String[] { "group2" }));
-
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient("group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
-
-    checkEndpoints(vm2, new int[] { serverPort2 });
-
+    
+    final int serverPort1 =startBridgeServerInVM(vm1, new String[] {"group1"}, locators);
+    final int serverPort2 =addCacheServerInVM(vm1, new String[] {"group2"});
+    
+    startBridgeClientInVM(vm2, "group2", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    
+    checkEndpoints(vm2, new int[] {serverPort2});
+    
     stopBridgeMemberVM(vm2);
 
-    vm2.invoke("StartBridgeClient", () -> startBridgeClient("group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort));
-
-    checkEndpoints(vm2, new int[] { serverPort1 });
+    startBridgeClientInVM(vm2, "group1", NetworkUtils.getServerHostName(vm0.getHost()), locatorPort);
+    
+    checkEndpoints(vm2, new int[] {serverPort1});
   }
-
+  
   public void testClientMembershipListener() throws Exception {
     final Host host = Host.getHost(0);
     VM locatorVM = host.getVM(0);
@@ -304,20 +306,19 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     VM bridge2VM = host.getVM(2);
     VM clientVM = host.getVM(3);
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    locatorVM.invoke("Start Locator", () -> startLocator(locatorVM.getHost(), locatorPort, ""));
-
+    startLocatorInVM(locatorVM, locatorPort, "");
     String locators = NetworkUtils.getServerHostName(locatorVM.getHost()) + "[" + locatorPort + "]";
 
     //start a bridge server with a listener
     addBridgeListener(bridge1VM);
-    int serverPort1 = bridge1VM.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+    int serverPort1 = startBridgeServerInVM(bridge1VM, null, locators);
 
     //start a bridge client with a listener
     addBridgeListener(clientVM);
-    clientVM.invoke("StartBridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(locatorVM.getHost()), locatorPort));
+    startBridgeClientInVM(clientVM, null, NetworkUtils.getServerHostName(locatorVM.getHost()), locatorPort);
     // wait for client to connect
-    checkEndpoints(clientVM, new int[] { serverPort1 });
-
+    checkEndpoints(clientVM, new int[] {serverPort1});
+    
     //make sure the client and bridge server both noticed each other
     waitForJoin(bridge1VM);
     MyListener serverListener = getBridgeListener(bridge1VM);
@@ -325,48 +326,48 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(1, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
-
+    
     waitForJoin(clientVM);
-    MyListener clientListener = getBridgeListener(clientVM);
+    MyListener clientListener= getBridgeListener(clientVM);
     Assert.assertEquals(0, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(1, clientListener.getJoins());
     resetBridgeListener(clientVM);
-
-    checkEndpoints(clientVM, new int[] { serverPort1 });
+    
+    checkEndpoints(clientVM, new int[] {serverPort1});
 
     //start another bridge server and make sure it is detected by the client
-    int serverPort2 = bridge2VM.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
-
-    checkEndpoints(clientVM, new int[] { serverPort1, serverPort2 });
+    int serverPort2 = startBridgeServerInVM(bridge2VM, null, locators);
+    
+    checkEndpoints(clientVM, new int[] {serverPort1, serverPort2});
     serverListener = getBridgeListener(bridge1VM);
     Assert.assertEquals(0, serverListener.getCrashes());
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(0, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
     waitForJoin(clientVM);
-    clientListener = getBridgeListener(clientVM);
+    clientListener= getBridgeListener(clientVM);
     Assert.assertEquals(0, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(1, clientListener.getJoins());
     resetBridgeListener(clientVM);
-
+    
     //stop the second bridge server and make sure it is detected by the client
     stopBridgeMemberVM(bridge2VM);
-
-    checkEndpoints(clientVM, new int[] { serverPort1 });
+    
+    checkEndpoints(clientVM, new int[] {serverPort1});
     serverListener = getBridgeListener(bridge1VM);
     Assert.assertEquals(0, serverListener.getCrashes());
     Assert.assertEquals(0, serverListener.getDepartures());
     Assert.assertEquals(0, serverListener.getJoins());
     resetBridgeListener(bridge1VM);
     waitForCrash(clientVM);
-    clientListener = getBridgeListener(clientVM);
+    clientListener= getBridgeListener(clientVM);
     Assert.assertEquals(1, clientListener.getCrashes());
     Assert.assertEquals(0, clientListener.getDepartures());
     Assert.assertEquals(0, clientListener.getJoins());
     resetBridgeListener(clientVM);
-
+    
     //stop the client and make sure the bridge server notices
     stopBridgeMemberVM(clientVM);
     waitForDeparture(bridge1VM);
@@ -379,7 +380,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   protected Object getInVM(VM vm, final Serializable key) {
     return getInVM(vm, REGION_NAME, key);
   }
-
+  
   protected Object getInVM(VM vm, final String regionName, final Serializable key) {
     return vm.invoke(new SerializableCallable("Get in VM") {
       public Object call() throws Exception {
@@ -389,22 +390,23 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
-  protected void putAndWaitForSuccess(VM vm, final String regionName, final Serializable key, final Serializable value) throws InterruptedException {
+  
+  protected void putAndWaitForSuccess(VM vm,  final String regionName, final Serializable key, final Serializable value) throws InterruptedException
+  {
     long endTime = System.currentTimeMillis() + MAX_WAIT;
     long remaining = MAX_WAIT;
     int i = 0;
-    while (true) {
+    while(true) {
       try {
         System.err.println("Attempt: " + (i++));
         putInVM(vm, regionName, key, value);
         break;
       } catch (NoAvailableLocatorsException | com.gemstone.gemfire.test.dunit.RMIException e) {
-        if (!(e instanceof NoAvailableLocatorsException)
+        if( !(e instanceof NoAvailableLocatorsException)
             && !(e.getCause() instanceof NoAvailableServersException)) {
           throw e;
         }
-        if (remaining <= 0) {
+        if(remaining <= 0) {
           throw e;
         }
         Wait.pause(100);
@@ -416,8 +418,10 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   protected void putInVM(VM vm, final Serializable key, final Serializable value) {
     putInVM(vm, REGION_NAME, key, value);
   }
-
-  protected void putInVM(VM vm, final String regionName, final Serializable key, final Serializable value) {
+  
+  
+  
+  protected void putInVM(VM vm,  final String regionName, final Serializable key, final Serializable value) {
     vm.invoke(new SerializableCallable("Put in VM") {
       public Object call() throws Exception {
         Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
@@ -426,12 +430,11 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   /**
    * Assert that there is one endpoint with the given host in port
    * on the client vm.
-   *
-   * @param vm            - the vm the client is running in
+   * @param vm - the vm the client is running in
    * @param expectedPorts - The server ports we expect the client to be connected to.
    */
   protected void checkEndpoints(VM vm, final int[] expectedPorts) {
@@ -442,14 +445,14 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
         List/*<ServerLocation>*/ endpoints;
         HashSet actualEndpointPorts;
         HashSet expectedEndpointPorts = new HashSet();
-        for (int i = 0; i < expectedPorts.length; i++) {
+        for(int i = 0; i < expectedPorts.length; i++) {
           expectedEndpointPorts.add(new Integer(expectedPorts[i]));
         }
         do {
           endpoints = pool.getCurrentServers();
           actualEndpointPorts = new HashSet();
-          for (Iterator itr = endpoints.iterator(); itr.hasNext(); ) {
-            ServerLocation sl = (ServerLocation) itr.next();
+          for(Iterator itr = endpoints.iterator(); itr.hasNext();) {
+            ServerLocation sl = (ServerLocation)itr.next();
             actualEndpointPorts.add(new Integer(sl.getPort()));
           }
           if (expectedEndpointPorts.size() == actualEndpointPorts.size()) {
@@ -457,12 +460,12 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
           } else {
             Wait.pause(100);
           }
-        } while (retryCount-- > 0);
+        } while(retryCount-- > 0);
         Assert.assertEquals(expectedEndpointPorts, actualEndpointPorts);
       }
     });
   }
-
+  
   protected void addBridgeListener(VM vm) {
     vm.invoke(new SerializableRunnable("Add membership listener") {
       public void run() {
@@ -472,7 +475,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   protected void resetBridgeListener(VM vm) {
     vm.invoke(new SerializableRunnable("Add membership listener") {
       public void run() {
@@ -481,7 +484,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   private MyListener getBridgeListener(VM vm) {
     return (MyListener) vm.invoke(new SerializableCallable("Add membership listener") {
       public Object call() {
@@ -489,17 +492,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   private void waitForJoin(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized (listener) {
+        synchronized(listener) {
           long end = System.currentTimeMillis() + 10000;
           while (listener.joins == 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if (remaining < 0) {
+              if(remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -511,17 +514,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   private void waitForCrash(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized (listener) {
+        synchronized(listener) {
           long end = System.currentTimeMillis() + 10000;
-          while (listener.crashes == 0) {
+          while (listener.crashes== 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if (remaining < 0) {
+              if(remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -533,17 +536,17 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   private void waitForDeparture(VM vm) {
     vm.invoke(new SerializableRunnable() {
       public void run() {
         MyListener listener = (MyListener) remoteObjects.get(BRIDGE_LISTENER);
-        synchronized (listener) {
+        synchronized(listener) {
           long end = System.currentTimeMillis() + 10000;
           while (listener.departures == 0) {
             try {
               long remaining = end - System.currentTimeMillis();
-              if (remaining < 0) {
+              if(remaining < 0) {
                 break;
               }
               listener.wait(remaining);
@@ -555,11 +558,11 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       }
     });
   }
-
+  
   public static class MyListener extends ClientMembershipListenerAdapter implements Serializable {
     protected int crashes = 0;
     protected int joins = 0;
-    protected int departures = 0;
+    protected int departures= 0;
 
     @Override
     public synchronized void memberCrashed(ClientMembershipEvent event) {
@@ -593,7 +596,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
       return joins;
     }
 
-    public synchronized int getDepartures() {
+    public synchronized int  getDepartures() {
       return departures;
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1a0748b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
index 667af89..8deedc1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
@@ -144,22 +144,27 @@ public class AutoConnectionSourceImplJUnitTest {
   
   @Test
   public void testNoServers() throws Exception {
+    
     startFakeLocator();
     handler.nextConnectionResponse = new ClientConnectionResponse(null);
+    
     assertEquals(null, source.findServer(null));
   }
   
   @Test
   public void testDiscoverServers() throws Exception {
     startFakeLocator();
+    
     ServerLocation loc1 = new ServerLocation("localhost", 4423);
     handler.nextConnectionResponse = new ClientConnectionResponse(loc1);
+    
     assertEquals(loc1, source.findServer(null));
   }
   
   @Test
   public void testDiscoverLocators() throws Exception {
     startFakeLocator();
+    
     int secondPort = AvailablePortHelper.getRandomAvailableTCPPort();
     TcpServer server2 = new TcpServer(secondPort, InetAddress.getLocalHost(), null, null, handler, new FakeHelper(), Thread.currentThread().getThreadGroup(), "tcp server");
     server2.start();


[32/49] incubator-geode git commit: GEODE-1351: add waitUntilFlush() into luceneIndexImpl

Posted by kl...@apache.org.
GEODE-1351: add waitUntilFlush() into luceneIndexImpl

This function is very useful in test and demo.
It will wait for the AEQ size to be 0

Also added junit test and integration tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/34d37919
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/34d37919
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/34d37919

Branch: refs/heads/feature/GEODE-835-test
Commit: 34d379196c3bf2129a391ce63a9890daa3d75b7b
Parents: e1cbc9b
Author: zhouxh <gz...@pivotal.io>
Authored: Sun May 15 21:36:34 2016 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Mon May 16 11:42:05 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/lucene/LuceneIndex.java       |  5 ++
 .../lucene/internal/LuceneEventListener.java    | 11 +++
 .../cache/lucene/internal/LuceneIndexImpl.java  | 43 +++++++++--
 .../internal/xml/LuceneIndexCreation.java       |  4 +
 .../gemfire/cache/lucene/LuceneQueriesBase.java | 69 ++++++++++++++++-
 .../internal/LuceneIndexImplJUnitTest.java      | 78 ++++++++++++++++++++
 6 files changed, 202 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
index 743045b..be329f7 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java
@@ -56,4 +56,9 @@ public interface LuceneIndex {
    */
   public Map<String, Analyzer> getFieldAnalyzers();
   
+  /* 
+   * wait until the current entries in cache are indexed
+   */
+  public void waitUntilFlushed(int maxWait);
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
index 9fdfd43..2dae4ee 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneEventListener.java
@@ -35,6 +35,8 @@ import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
 import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
 import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
 import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy.TestHook;
 import com.gemstone.gemfire.internal.logging.LogService;
 
 /**
@@ -70,6 +72,10 @@ public class LuceneEventListener implements AsyncEventListener {
         IndexRepository repository = repositoryManager.getRepository(region, key, callbackArgument);
 
         Operation op = event.getOperation();
+        
+        if (testHook != null) {
+          testHook.doTestHook("FOUND_AND_BEFORE_PROCESSING_A_EVENT");
+        }
 
         if (op.isCreate()) {
           repository.create(key, event.getDeserializedValue());
@@ -96,4 +102,9 @@ public class LuceneEventListener implements AsyncEventListener {
       DefaultQuery.setPdxReadSerialized(false);
     }
   }
+  
+  public interface TestHook {
+    public void doTestHook(String spot);
+  }
+  public static TestHook testHook;
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
index 0b5f8fa..981d9e4 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImpl.java
@@ -21,23 +21,26 @@ package com.gemstone.gemfire.cache.lucene.internal;
 
 import java.util.Collections;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
 import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
 import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
 import com.gemstone.gemfire.cache.lucene.internal.xml.LuceneIndexCreation;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 
 public abstract class LuceneIndexImpl implements InternalLuceneIndex {
@@ -77,7 +80,33 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
   protected void setSearchableFields(String[] fields) {
     searchableFieldNames = fields;
   }
-  
+
+  /*
+   *  For test and demo purpose. To use it, the data region should stop feeding
+   *  A more advanced version is under-development
+   */
+  @Override
+  public void waitUntilFlushed(int maxWait) {
+    String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
+    AsyncEventQueue queue = (AsyncEventQueue)cache.getAsyncEventQueue(aeqId);
+    if (queue != null) {
+      long start = System.nanoTime();
+      while (System.nanoTime() - start < TimeUnit.MILLISECONDS.toNanos(maxWait)) {
+        if (0 == queue.size()) {
+          logger.debug("waitUntilFlushed: Queue size is 0");
+          break;
+        } else {
+          try {
+            Thread.sleep(200);
+          } catch (InterruptedException e) {
+          }
+        }
+      }
+    } else { 
+      throw new IllegalArgumentException("The AEQ does not exist for the index "+indexName+" region "+regionPath);
+    }
+  }
+
   @Override
   public String[] getFieldNames() {
     return searchableFieldNames;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
index 86a10e4..b54f51b 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/xml/LuceneIndexCreation.java
@@ -114,4 +114,8 @@ public class LuceneIndexCreation implements LuceneIndex, Extension<Region<?, ?>>
   public void addFieldNames(String[] fieldNames) {
     this.fieldNames.addAll(Arrays.asList(fieldNames));
   }
+
+  @Override
+  public void waitUntilFlushed(int maxWait) {
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesBase.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesBase.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesBase.java
index c467a18..c7567f3 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesBase.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesBase.java
@@ -18,7 +18,7 @@
  */
 package com.gemstone.gemfire.cache.lucene;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -27,6 +27,12 @@ import java.util.Map;
 
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneEventListener;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
+import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
 import com.gemstone.gemfire.test.dunit.VM;
@@ -75,6 +81,67 @@ public abstract class LuceneQueriesBase extends JUnit4CacheTestCase {
     executeTextSearch(accessor);
   }
 
+  @Test
+  public void entriesFlushedToIndexAfterWaitForFlushCalled() {
+    SerializableRunnableIF createIndex = () -> {
+      LuceneService luceneService = LuceneServiceProvider.get(getCache());
+      luceneService.createIndex(INDEX_NAME, REGION_NAME, "text");
+    };
+    dataStore1.invoke(() -> initDataStore(createIndex));
+    dataStore2.invoke(() -> initDataStore(createIndex));
+    accessor.invoke(() -> initAccessor(createIndex));
+
+    try {
+      dataStore1.invoke(() -> setTestHook());
+      putDataInRegion(accessor);
+      waitForFlushBeforeExecuteTextSearch(accessor, 10);
+      executeTextSearch(accessor);
+    } finally {
+      dataStore1.invoke(() -> checkResultAndresetTestHook());
+    }
+  }
+
+  protected void waitForFlushBeforeExecuteTextSearch(VM vm, final int expectKeyNum) {
+    vm.invoke(() -> {
+      Cache cache = getCache();
+      Region<Object, Object> region = cache.getRegion(REGION_NAME);
+
+      LuceneService service = LuceneServiceProvider.get(cache);
+      LuceneIndexImpl index = (LuceneIndexImpl)service.getIndex(INDEX_NAME, REGION_NAME);
+      assertNotNull(index);
+      LuceneQuery<Integer, TestObject> query;
+
+      String aeqId = LuceneServiceImpl.getUniqueIndexName(INDEX_NAME, REGION_NAME);
+      AsyncEventQueue queue = cache.getAsyncEventQueue(aeqId);
+      assertNotNull(queue);
+      assertTrue(queue.size()>0);
+      index.waitUntilFlushed(30000);
+      return null;
+    });
+  }
+
+  public static void setTestHook() {
+    LuceneEventListener.testHook = new LuceneEventListener.TestHook() {
+
+      @Override
+      public void doTestHook(String spot) {
+        if (spot.equals("FOUND_AND_BEFORE_PROCESSING_A_EVENT")) {
+          try {
+            Thread.sleep(1000);
+            LogService.getLogger().debug("Waited in test hook");
+          }
+          catch (InterruptedException e) {
+          }
+        }
+      }
+    };
+  }
+  
+  public static void checkResultAndresetTestHook()
+  {
+    LuceneEventListener.testHook = null;
+  }
+
   protected void executeTextSearch(VM vm) {
     vm.invoke(() -> {
       Cache cache = getCache();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/34d37919/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImplJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImplJUnitTest.java
new file mode 100755
index 0000000..edecc66
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexImplJUnitTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.ExpectedException;
+import static org.mockito.Mockito.*;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.test.fake.Fakes;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class LuceneIndexImplJUnitTest {
+  public static final String REGION = "region";
+  public static final String INDEX = "index";
+  public static final int MAX_WAIT = 30000;
+  private Cache cache;
+  LuceneIndex index;
+
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
+  
+  @Before
+  public void createLuceneIndex() {
+    cache = Fakes.cache();
+    index = new LuceneIndexForPartitionedRegion(INDEX, REGION, cache);
+  }
+  
+  @Test
+  public void waitUnitFlushedWithMissingAEQThrowsIllegalArgument() throws Exception {
+    thrown.expect(IllegalArgumentException.class);
+    index.waitUntilFlushed(MAX_WAIT);
+  }
+  
+  @Test
+  public void waitUnitFlushedWaitsForFlush() throws Exception {
+    final String expectedIndexName = LuceneServiceImpl.getUniqueIndexName(INDEX, REGION);
+    final AsyncEventQueue queue = mock(AsyncEventQueue.class);
+    when(cache.getAsyncEventQueue(eq(expectedIndexName))).thenReturn(queue);
+    
+    AtomicInteger callCount = new AtomicInteger();
+    when(queue.size()).thenAnswer(invocation -> {
+      if (callCount.get() == 0) {
+        // when the waitUnitFlushed() called the 2nd time, queue.size() will return 0
+        callCount.incrementAndGet();
+        return 2;
+      } else {
+        // when the waitUnitFlushed() called the 2nd time, queue.size() will return 0
+        return 0;
+      }
+    });
+    index.waitUntilFlushed(MAX_WAIT);
+    verify(cache).getAsyncEventQueue(eq(expectedIndexName));
+  }
+
+}


[25/49] incubator-geode git commit: GEODE-430: Fixing races in UpdatePropagationDUnitTest

Posted by kl...@apache.org.
GEODE-430: Fixing races in UpdatePropagationDUnitTest

This test was failing with a couple of different race conditions

1) It was not waiting for updates to make it to the second client,
causing assertion failures. I added a wait.

2) It was occasionally using a connection that was previously made to
the server before it was killed, causing an unexpected socket closed. I
refactored the test to not use internal APIs to do the put, but instead
verify that the event was not sent to the client using a listener.

3) In the PR version of the test, the PR single hop code can return
different addresses for the server, resulting in the pool thinking it
has two different servers when it only has one. I changed the wait to
wait for a server with a given port to go away.

I also did some cleanup of the test - extended JUnit4CacheTestCase,
removed the waits, used awaitility, removed an almost duplicate disabled
test method and added the one extra assertion from that duplicate test
to the enabled test method.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/884cf13b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/884cf13b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/884cf13b

Branch: refs/heads/feature/GEODE-835-test
Commit: 884cf13b0ccace80d15ca11bcc3162f5169bdf73
Parents: c79b64f
Author: Dan Smith <up...@apache.org>
Authored: Wed May 11 13:04:57 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Fri May 13 15:41:56 2016 -0700

----------------------------------------------------------------------
 .../sockets/UpdatePropagationDUnitTest.java     | 489 +++++--------------
 .../sockets/UpdatePropagationPRDUnitTest.java   |   4 +-
 2 files changed, 136 insertions(+), 357 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/884cf13b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
index 69781c4..08d964a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
@@ -16,44 +16,50 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static junit.framework.TestCase.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
-import org.junit.Ignore;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.CacheWriterException;
 import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.client.internal.Connection;
+import com.gemstone.gemfire.cache.client.internal.EndpointManager;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
-import com.gemstone.gemfire.cache.client.internal.ServerRegionProxy;
 import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.ServerLocation;
 import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.internal.cache.EventID;
 import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.jayway.awaitility.Awaitility;
+import com.jayway.awaitility.core.ConditionTimeoutException;
 
 /**
  * Start client 1
@@ -71,7 +77,8 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
  * The key is to verify that the memberid being used by the client
  * to register with the server is the same across servers
  */
-public class UpdatePropagationDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
 
   VM server1 = null;
 
@@ -87,13 +94,6 @@ public class UpdatePropagationDUnitTest extends DistributedTestCase {
 
   private static final String REGION_NAME = "UpdatePropagationDUnitTest_region";
 
-  protected static Cache cache = null;
-  
-  /** constructor */
-  public UpdatePropagationDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -111,382 +111,169 @@ public class UpdatePropagationDUnitTest extends DistributedTestCase {
     //client 2 VM
     client2 = host.getVM(3);
     
-    PORT1 =  ((Integer)server1.invoke(() -> createServerCache())).intValue();
-    PORT2 =  ((Integer)server2.invoke(() -> createServerCache())).intValue();
+    PORT1 =  server1.invoke(() -> createServerCache());
+    PORT2 =  server2.invoke(() -> createServerCache());
 
     client1.invoke(() -> createClientCache(
-      NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1),new Integer(PORT2)));
+      NetworkUtils.getServerHostName(server1.getHost()), PORT1, PORT2));
     client2.invoke(() -> createClientCache(
-      NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1),new Integer(PORT2)));
+      NetworkUtils.getServerHostName(server1.getHost()), PORT1, PORT2));
     
     IgnoredException.addIgnoredException("java.net.SocketException");
     IgnoredException.addIgnoredException("Unexpected IOException");
   }
 
-  private void createCache(Properties props) throws Exception
-  {
-    DistributedSystem ds = getSystem(props);
-    cache = CacheFactory.create(ds);
-    assertNotNull(cache);
-  }
-
-  static private final String WAIT_PROPERTY =
-    "UpdatePropagationDUnitTest.maxWaitTime";
-  static private final int WAIT_DEFAULT = 60000;
-
-
-  /**
-   * This tests whether the updates are received by the sender or not if
-   * there is an Interest List failover
-   *
-   */
-  @Ignore("Bug 50405")
-  public void DISABLED_testVerifyUpdatesNotReceivedBySender()
-  {
-    final int maxWaitTime = Integer.getInteger(WAIT_PROPERTY, WAIT_DEFAULT).intValue();
-
-    //First create entries on both servers via the two client
-    client1.invoke(() -> createEntriesK1andK2());
-    client2.invoke(() -> createEntriesK1andK2());
-    client1.invoke(() -> registerKeysK1andK2());
-    client2.invoke(() -> registerKeysK1andK2());
-    //Induce fail over of InteretsList Endpoint to Server 2 by killing server1
-    
-    server1.invoke(() -> UpdatePropagationDUnitTest.killServer(new Integer(PORT1)));
-    //Wait for 10 seconds to allow fail over. This would mean that Interest
-    // has failed over to Server2.
-    client1.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
-      public void run2() throws CacheException
-      {
-        Region r = cache.getRegion(REGION_NAME);
-
-        try {
-          r.put("ping", "pong1"); // in the event there is no live server monitor thread
-        } catch (CacheWriterException itsOk) {}
-
-        String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() != 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
-      }
-    });
-
-    client2.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
-      public void run2() throws CacheException
-      {
-        Region r = cache.getRegion(REGION_NAME);
-
-        try {
-          r.put("ping", "pong3"); // in the event there is no live server monitor thread
-        } catch (CacheWriterException itsOk) {}
-
-        String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() != 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
-      }
-    });
-
-    //Start Server1 again so that both clients1 & Client 2 will establish connection to server1 too.
-    server1.invoke(() -> UpdatePropagationDUnitTest.startServer(new Integer(PORT1)));
-
-    client1.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
-      public void run2() throws CacheException
-      {
-        Region r = cache.getRegion(REGION_NAME);
-
-        try {
-          r.put("ping", "pong2"); // in the event there is no live server monitor thread
-        } catch (CacheWriterException itsOk) {}
-
-        String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() == 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
-      }
-    });
-
-    //Do a put on Server1 via Connection object from client1.
-    // Client1 should not receive updated value while client2 should receive
-    client1.invoke(() -> acquireConnectionsAndPutonK1andK2( NetworkUtils.getServerHostName(client1.getHost())));
-    //pause(5000);
-    //Check if both the puts ( on key1 & key2 ) have reached the servers
-    server1.invoke(() -> verifyUpdates());
-    server2.invoke(() -> verifyUpdates());
-    // verify no updates for update originator
-    client1.invoke(() -> verifyNoUpdates());
-
-  }
-
-
   /**
    * This tests whether the updates are received by other clients or not , if there are
    * situation of Interest List fail over
    */
-  @Category(FlakyTest.class) // GEODE-430: time sensitive, random ports, port reuse, thread sleeps (5 seconds), eats exceptions (fixed 1), async actions, waitForCriterion
-  public void testVerifyUpdatesReceivedByOtherClients() {
-    final int maxWaitTime = Integer.getInteger(WAIT_PROPERTY, WAIT_DEFAULT).intValue();
+  @Test
+  public void updatesAreProgegatedAfterFailover() {
     //  First create entries on both servers via the two client
     client1.invoke(() -> createEntriesK1andK2());
     client2.invoke(() -> createEntriesK1andK2());
     client1.invoke(() -> registerKeysK1andK2());
     client2.invoke(() -> registerKeysK1andK2());
     //Induce fail over of InteretsList Endpoint to Server 2 by killing server1
-    server1.invoke(() -> UpdatePropagationDUnitTest.killServer(new Integer(PORT1)));
+    server1.invoke(() -> killServer(new Integer(PORT1)));
     //Wait for 10 seconds to allow fail over. This would mean that Interstist has failed
     // over to Server2.
-    client1.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
-      public void run2() throws CacheException
-      {
-        Region r = cache.getRegion(REGION_NAME);
-
-        try {
-          r.put("ping", "pong3"); // in the event there is no live server monitor thread
-        } catch (CacheWriterException itsOk) {}
-
-        String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() != 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
-      }
-    });
-    client2.invoke(new CacheSerializableRunnable("Wait for server on port1 to be dead") {
+    final CacheSerializableRunnable waitToDetectDeadServer = new CacheSerializableRunnable("Wait for server on port1 to be dead") {
       public void run2() throws CacheException
       {
-        Region r = cache.getRegion(REGION_NAME);
-
-        try {
-          r.put("ping", "pong3"); // in the event there is no live server monitor thread
-        } catch (CacheWriterException itsOk) {}
+        Region r = getCache().getRegion(REGION_NAME);
 
         String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() != 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
+        final PoolImpl pool = (PoolImpl) PoolManager.find(poolName);
+        Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> !hasEndPointWithPort(pool, PORT1));
       }
-    });
+    };
+    client1.invoke(waitToDetectDeadServer);
+    client2.invoke(waitToDetectDeadServer);
 
     //Start Server1 again so that both clients1 & Client 2 will establish connection to server1 too.
-    server1.invoke(() -> UpdatePropagationDUnitTest.startServer(new Integer(PORT1)));
-
-    client1.invoke(new CacheSerializableRunnable("Wait for servers to be alive") {
-      public void run2() throws CacheException
-      {
-        Region r = cache.getRegion(REGION_NAME);
-        String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() == 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
-      }
-    });
+    server1.invoke(() -> startServer(new Integer(PORT1)));
 
-    client2.invoke(new CacheSerializableRunnable("Wait for servers to be alive") {
+    final CacheSerializableRunnable waitToDetectLiveServer = new CacheSerializableRunnable("Wait for servers to be alive") {
       public void run2() throws CacheException
       {
-        Region r = cache.getRegion(REGION_NAME);
+        Region r = getCache().getRegion(REGION_NAME);
         String poolName = r.getAttributes().getPoolName();
-        assertNotNull(poolName);
-        final PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-        assertNotNull(pool);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectedServerCount() == 2;
-          }
-          public String description() {
-            return null;
-          }
-        };
-        Wait.waitForCriterion(ev, maxWaitTime, 200, true);
+        final PoolImpl pool = (PoolImpl) PoolManager.find(poolName);
+        Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> hasEndPointWithPort(pool, PORT1));
       }
-    });
-    
-    Wait.pause(5000);
+    };
+    client1.invoke(waitToDetectLiveServer);
+    client2.invoke(waitToDetectLiveServer);
 
     //Do a put on Server1 via Connection object from client1.
     // Client1 should not receive updated value while client2 should receive
     client1.invoke(() -> acquireConnectionsAndPutonK1andK2( NetworkUtils.getServerHostName(client1.getHost())));
-    Wait.pause(5000);
     //Check if both the puts ( on key1 & key2 ) have reached the servers
     server1.invoke(() -> verifyUpdates());
     server2.invoke(() -> verifyUpdates());
     // verify updates to other client
     client2.invoke(() -> verifyUpdates());
+
+    // verify no updates for update originator
+    client1.invoke(() -> verifySenderUpdateCount());
+  }
+
+  /**
+   * Check to see if a client is connected to an endpoint with a specific port
+   */
+  private boolean hasEndPointWithPort(final PoolImpl pool, final int port) {
+    EndpointManager endpointManager = pool.getEndpointManager();
+    final Set<ServerLocation> servers = endpointManager
+      .getEndpointMap().keySet();
+    return servers.stream().anyMatch(location -> location.getPort() == port);
   }
 
   public void acquireConnectionsAndPutonK1andK2(String host)
   {
-    try {
-      Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
-      assertNotNull(r1);
-      String poolName = r1.getAttributes().getPoolName();
-      assertNotNull(poolName);
-      PoolImpl pool = (PoolImpl)PoolManager.find(poolName);
-      assertNotNull(pool);
-
-      Connection conn = pool.acquireConnection(new ServerLocation(host,PORT1));
-      assertNotNull(conn);
-      assertEquals(PORT1, conn.getServer().getPort());
-      ServerRegionProxy srp = new ServerRegionProxy(Region.SEPARATOR+ REGION_NAME, pool);
-      srp.putOnForTestsOnly(conn, "key1", "server-value1", new EventID(new byte[] {1},159632,1), null);
-      srp.putOnForTestsOnly(conn, "key2", "server-value2", new EventID(new byte[] {1},159632,2), null);
-    }
-    catch (Exception ex) {
-      Assert.fail("while setting acquireConnections", ex);
-    }
+    Region r1 = getCache().getRegion(Region.SEPARATOR + REGION_NAME);
+    r1.put("key1", "server-value1");
+    r1.put("key2", "server-value2");
   }
 
-  public static void killServer(Integer port )
+  public void killServer(Integer port )
   {
-    try {
-      Iterator iter = cache.getCacheServers().iterator();
-      if (iter.hasNext()) {
-        CacheServer server = (CacheServer)iter.next();
-        if(server.getPort() == port.intValue()){
-          server.stop();
-        }
-
+    Iterator iter = getCache().getCacheServers().iterator();
+    if (iter.hasNext()) {
+      CacheServer server = (CacheServer)iter.next();
+      if(server.getPort() == port.intValue()){
+        server.stop();
       }
-    }
-    catch (Exception ex) {
-      fail("while killing Server  " + ex);
+
     }
   }
 
-  public static void startServer(Integer port)
+  public void startServer(Integer port) throws IOException
   {
-    try {
-      CacheServer server1 = cache.addCacheServer();
-      server1.setPort(port.intValue());
-      server1.setNotifyBySubscription(true);
-      server1.start();
-    }
-    catch (Exception ex) {
-      fail("while killServer  " + ex);
-    }
+    CacheServer server1 = getCache().addCacheServer();
+    server1.setPort(port.intValue());
+    server1.setNotifyBySubscription(true);
+    server1.start();
   }
 
   /**
    * Creates entries on the server
    *
    */
-  public static void createEntriesK1andK2()
+  public void createEntriesK1andK2()
   {
-    try {
-      Region r1 = cache.getRegion(Region.SEPARATOR+REGION_NAME);
-      assertNotNull(r1);
-      if (!r1.containsKey("key1")) {
-        r1.put("key1", "key-1");
-      }
-      if (!r1.containsKey("key2")) {
-        r1.put("key2", "key-2");
-      }
-      assertEquals(r1.get("key1"), "key-1");
-      if (r1.getAttributes().getPartitionAttributes() == null) {
-        assertEquals(r1.getEntry("key1").getValue(), "key-1");
-        assertEquals(r1.getEntry("key2").getValue(), "key-2");
-      }
-      else {
-        assertEquals(r1.get("key1"), "key-1");
-        assertEquals(r1.get("key2"), "key-2");
-      }
+    Region r1 = getCache().getRegion(Region.SEPARATOR+REGION_NAME);
+    assertNotNull(r1);
+    if (!r1.containsKey("key1")) {
+      r1.put("key1", "key-1");
     }
-    catch (Exception ex) {
-      Assert.fail("failed while createEntriesK1andK2()", ex);
+    if (!r1.containsKey("key2")) {
+      r1.put("key2", "key-2");
+    }
+    assertEquals(r1.get("key1"), "key-1");
+    if (r1.getAttributes().getPartitionAttributes() == null) {
+      assertEquals(r1.getEntry("key1").getValue(), "key-1");
+      assertEquals(r1.getEntry("key2").getValue(), "key-2");
+    }
+    else {
+      assertEquals(r1.get("key1"), "key-1");
+      assertEquals(r1.get("key2"), "key-2");
     }
   }
 
-  public static void createClientCache(String host, Integer port1 , Integer port2 ) throws Exception
+  public void createClientCache(String host, Integer port1 , Integer port2 ) throws Exception
   {
-    int PORT1 = port1.intValue() ;
-    int PORT2 = port2.intValue();
-    Properties props = new Properties();
-    props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
-    props.setProperty(DistributionConfig.LOCATORS_NAME, "");
-    new UpdatePropagationDUnitTest("temp").createCache(props);
-    Pool p;
+    ClientCache cache;
     try {
       System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "true");
-      p = PoolManager.createFactory()
-        .addServer(host, PORT1)
-        .addServer(host, PORT2)
-        .setSubscriptionEnabled(true)
-        .setSubscriptionRedundancy(-1)
-        .setMinConnections(4)
-        .setSocketBufferSize(1000)
-        .setReadTimeout(2000)
-        // .setRetryInterval(250)
-        // .setRetryAttempts(2)
-        .create("UpdatePropagationDUnitTestPool");
+      int PORT1 = port1.intValue() ;
+      int PORT2 = port2.intValue();
+      Properties props = new Properties();
+      props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
+      props.setProperty(DistributionConfig.LOCATORS_NAME, "");
+      ClientCacheFactory cf = new ClientCacheFactory();
+      cf.addPoolServer(host, PORT1)
+      .addPoolServer(host, PORT2)
+      .setPoolSubscriptionEnabled(true)
+      .setPoolSubscriptionRedundancy(-1)
+      .setPoolMinConnections(4)
+      .setPoolSocketBufferSize(1000)
+      .setPoolReadTimeout(2000)
+      .setPoolPingInterval(300);
+       cache = getClientCache(cf);
     } finally {
       System.setProperty("gemfire.PoolImpl.DISABLE_RANDOM", "false");
       CacheServerTestUtil.enableShufflingOfEndpoints();
     }
-    AttributesFactory factory = new AttributesFactory();
-    factory.setScope(Scope.DISTRIBUTED_ACK);
-    factory.setPoolName(p.getName());
-    RegionAttributes attrs = factory.create();
-    cache.createRegion(REGION_NAME, attrs);
-
+    cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
+      .addCacheListener(new EventTrackingCacheListener())
+      .create(REGION_NAME);
   }
 
   public Integer createServerCache() throws Exception
   {
-    new UpdatePropagationDUnitTest("temp").createCache(new Properties());
-    RegionAttributes attrs = createCacheServerAttributes(); 
+    Cache cache = getCache();
+    RegionAttributes attrs = createCacheServerAttributes();
     cache.createRegion(REGION_NAME, attrs);
     CacheServer server = cache.addCacheServer();
     assertNotNull(server);
@@ -505,10 +292,10 @@ public class UpdatePropagationDUnitTest extends DistributedTestCase {
     return factory.create();
   }
 
-  public static void registerKeysK1andK2()
+  public void registerKeysK1andK2()
   {
     try {
-      Region r = cache.getRegion(Region.SEPARATOR+ REGION_NAME);
+      Region r = getCache().getRegion(Region.SEPARATOR+ REGION_NAME);
       assertNotNull(r);
       List list = new ArrayList();
       list.add("key1");
@@ -521,25 +308,22 @@ public class UpdatePropagationDUnitTest extends DistributedTestCase {
     }
   }
 
-  public static void verifyNoUpdates()
+  public void verifySenderUpdateCount()
   {
-    try {
-      Region r = cache.getRegion(Region.SEPARATOR+ REGION_NAME);
-      assertNotNull(r);
-      // verify no updates
-      assertEquals("key-1", r.getEntry("key1").getValue());
-      assertEquals("key-2", r.getEntry("key2").getValue());
-    }
-    catch (Exception ex) {
-      Assert.fail("failed while verifyNoUpdates()", ex);
-    }
+    Region r = getCache().getRegion(Region.SEPARATOR+ REGION_NAME);
+    EventTrackingCacheListener listener = (EventTrackingCacheListener) r.getAttributes().getCacheListeners()[0];
+
+    final List<EntryEvent> events = listener.receivedEvents;
+
+    //We only expect to see 1 create and 1 update from the original put
+    assertEquals("Expected only 2 events for key1", 2, events.stream().filter(event -> event.getKey().equals("key1")).count());
+    assertEquals("Expected only 2 events for key2", 2, events.stream().filter(event -> event.getKey().equals("key2")).count());
   }
 
-  public static void verifyUpdates()
+  public void verifyUpdates()
   {
-    try {
-      Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME);
-      assertNotNull(r);
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      Region r = getCache().getRegion(Region.SEPARATOR + REGION_NAME);
       // verify updates
       if (r.getAttributes().getPartitionAttributes() == null) {
         assertEquals("server-value2", r.getEntry("key2").getValue());
@@ -549,28 +333,25 @@ public class UpdatePropagationDUnitTest extends DistributedTestCase {
         assertEquals("server-value2", r.get("key2"));
         assertEquals("server-value1", r.get("key1"));
       }
+    });
+  }
+
+  private static class EventTrackingCacheListener extends CacheListenerAdapter {
+    List<EntryEvent> receivedEvents = new ArrayList<>();
+
+    @Override public void afterCreate(final EntryEvent event) {
+      receivedEvents.add(event);
     }
-    catch (Exception ex) {
-      Assert.fail("failed while region", ex);
+
+    @Override public void afterUpdate(final EntryEvent event) {
+      receivedEvents.add(event);
     }
-  }
 
-  public static void closeCache()
-  {
-    if (cache != null && !cache.isClosed()) {
-      cache.close();
-      cache.getDistributedSystem().disconnect();
+    @Override public void afterDestroy(final EntryEvent event) {
+      receivedEvents.add(event);
     }
-  }
 
-  @Override
-  public final void preTearDown() throws Exception {
-    //close client
-    client1.invoke(() -> closeCache());
-    client2.invoke(() -> closeCache());
-    //close server
-    server1.invoke(() -> closeCache());
-    server2.invoke(() -> closeCache());
+
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/884cf13b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
index 8edac45..589b455 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
@@ -24,9 +24,7 @@ import com.gemstone.gemfire.cache.*;
  */
 public class UpdatePropagationPRDUnitTest extends UpdatePropagationDUnitTest {
 
-  public UpdatePropagationPRDUnitTest(String name) {
-    super(name);
-  }
+  @Override
   protected RegionAttributes createCacheServerAttributes()
   {
     AttributesFactory factory = new AttributesFactory();


[30/49] incubator-geode git commit: GEODE-17: wording change

Posted by kl...@apache.org.
GEODE-17: wording change


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b6de5a39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b6de5a39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b6de5a39

Branch: refs/heads/feature/GEODE-835-test
Commit: b6de5a39ad78d74ef727bea5be76b6a12b69f237
Parents: 4428954
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Mon May 16 11:19:03 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon May 16 11:27:39 2016 -0700

----------------------------------------------------------------------
 .../gemfire/management/internal/cli/commands/ShellCommands.java  | 4 ++--
 .../gemfire/management/internal/cli/i18n/CliStrings.java         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6de5a39/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java
index a9712a1..baf3049 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/commands/ShellCommands.java
@@ -200,7 +200,7 @@ public class ShellCommands implements CommandMarker {
 
         if (userName != null && userName.length() > 0) {
           if (passwordToUse == null || passwordToUse.length() == 0) {
-            passwordToUse = gemfireShell.readWithMask("http password: ", '*');
+            passwordToUse = gemfireShell.readWithMask("password: ", '*');
           }
           if (passwordToUse == null || passwordToUse.length() == 0) {
             throw new IllegalArgumentException(CliStrings.CONNECT__MSG__JMX_PASSWORD_MUST_BE_SPECIFIED);
@@ -266,7 +266,7 @@ public class ShellCommands implements CommandMarker {
         // JMX Authentication Config
         if (userName != null && userName.length() > 0) {
           if (passwordToUse == null || passwordToUse.length() == 0) {
-            passwordToUse = gfshInstance.readWithMask("jmx password: ", '*');
+            passwordToUse = gfshInstance.readWithMask("password: ", '*');
           }
           if (passwordToUse == null || passwordToUse.length() == 0) {
               throw new IllegalArgumentException(CliStrings.CONNECT__MSG__JMX_PASSWORD_MUST_BE_SPECIFIED);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b6de5a39/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
index 9bb573b..28ba856 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/i18n/CliStrings.java
@@ -394,7 +394,7 @@ public class CliStrings {
   public static final String CONNECT__MSG__CONNECTING_TO_MANAGER_AT_0 = "Connecting to Manager at {0} ..";
   public static final String CONNECT__MSG__CONNECTING_TO_MANAGER_HTTP_SERVICE_AT_0 = "Connecting to Manager's HTTP service at {0} ..";
   public static final String CONNECT__MSG__LOCATOR_COULD_NOT_FIND_MANAGER = "Locator could not find a JMX Manager";
-  public static final String CONNECT__MSG__JMX_PASSWORD_MUST_BE_SPECIFIED = "jmx password must be specified.";
+  public static final String CONNECT__MSG__JMX_PASSWORD_MUST_BE_SPECIFIED = "password must be specified.";
   public static final String CONNECT__MSG__ALREADY_CONNECTED = "Already connected to: {0}";
   public static final String CONNECT__MSG__SUCCESS = "Successfully connected to: {0}";
   public static final String CONNECT__MSG__ERROR = "Could not connect to : {0}. {1}";


[03/49] incubator-geode git commit: GEODE-11: Integration test of lucene index with analyzers

Posted by kl...@apache.org.
GEODE-11: Integration test of lucene index with analyzers

Also moved the LuceneIndexCreationIngregrationTest to the public
package.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a83e428b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a83e428b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a83e428b

Branch: refs/heads/feature/GEODE-835-test
Commit: a83e428be67e5e9f17ffa90bc2e25e36656707f5
Parents: 43a038e
Author: Dan Smith <up...@apache.org>
Authored: Wed May 11 16:40:56 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu May 12 11:11:48 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/lucene/LuceneService.java     |   4 +-
 .../LuceneIndexForPartitionedRegion.java        |   4 +-
 .../LuceneIndexCreationIntegrationTest.java     | 122 +++++++++++++++++++
 .../cache/lucene/LuceneIntegrationTest.java     |  55 +++++++++
 .../lucene/LuceneQueriesIntegrationTest.java    |  21 +---
 .../LuceneIndexCreationIntegrationTest.java     |  74 -----------
 .../lucene/internal/LuceneIntegrationTest.java  |  47 -------
 7 files changed, 181 insertions(+), 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
index a42ab72..462aa7e 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java
@@ -80,10 +80,8 @@ public interface LuceneService {
    * @param indexName index name
    * @param regionPath region name
    * @param analyzerPerField analyzer per field map
-   * @deprecated TODO This feature is not yet implemented
    */
-  @Deprecated
-  public void createIndex(String indexName, String regionPath,  
+  public void createIndex(String indexName, String regionPath,
       Map<String, Analyzer> analyzerPerField);
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index 382f61c..dd9d384 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -138,7 +138,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
     return createRegion(fileRegionName, regionShortCut, this.regionPath, partitionAttributes);
   }
 
-  String createFileRegionName() {
+  public String createFileRegionName() {
     return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath)+".files";
   }
 
@@ -152,7 +152,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
     return createRegion(chunkRegionName, regionShortCut, fileRegionName, partitionAttributes);
   }
 
-  String createChunkRegionName() {
+  public String createChunkRegionName() {
     return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath) + ".chunks";
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
new file mode 100644
index 0000000..1dfaf51
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.gemstone.gemfire.cache.lucene;
+
+import static org.junit.Assert.*;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneIntegrationTest;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexForPartitionedRegion;
+import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.jayway.awaitility.Awaitility;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.core.KeywordTokenizer;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(IntegrationTest.class)
+public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
+  public static final String INDEX_NAME = "index";
+  public static final String REGION_NAME = "region";
+
+  @Test
+  public void shouldCreateIndexWriterWithAnalyzersWhenSettingPerFieldAnalyzers()
+    throws BucketNotFoundException, InterruptedException
+  {
+    Map<String, Analyzer> analyzers = new HashMap<>();
+
+    final RecordingAnalyzer field1Analyzer = new RecordingAnalyzer();
+    final RecordingAnalyzer field2Analyzer = new RecordingAnalyzer();
+    analyzers.put("field1", field1Analyzer);
+    analyzers.put("field2", field2Analyzer);
+    luceneService.createIndex(INDEX_NAME, REGION_NAME, analyzers);
+    Region region = createRegion();
+    final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
+    region.put("key1", new TestObject());
+
+    assertEquals(analyzers, index.getFieldAnalyzers());
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      assertEquals(Arrays.asList("field1"), field1Analyzer.analyzedfields);
+      assertEquals(Arrays.asList("field2"), field2Analyzer.analyzedfields);
+    });
+  }
+
+  @Test
+  public void verifyLuceneRegionInternal() {
+    createIndex("text");
+
+    // Create partitioned region
+    createRegion();
+
+    // Get index
+    LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
+
+    // Verify the meta regions exist and are internal
+    LocalRegion chunkRegion = (LocalRegion) cache.getRegion(index.createChunkRegionName());
+    assertTrue(chunkRegion.isInternalRegion());
+    LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
+    assertTrue(fileRegion.isInternalRegion());
+
+    // Verify the meta regions are not contained in the root regions
+    for (Region region : cache.rootRegions()) {
+      assertNotEquals(chunkRegion.getFullPath(), region.getFullPath());
+      assertNotEquals(fileRegion.getFullPath(), region.getFullPath());
+    }
+  }
+
+  private Region createRegion() {
+    return this.cache.createRegionFactory(RegionShortcut.PARTITION).create(REGION_NAME);
+  }
+
+  private void createIndex(String fieldName) {
+    LuceneServiceProvider.get(this.cache).createIndex(INDEX_NAME, REGION_NAME, fieldName);
+  }
+
+  private static class TestObject implements Serializable {
+
+    String field1 = "a b c d";
+    String field2 = "f g h";
+  }
+
+  private static class RecordingAnalyzer extends Analyzer {
+
+    private List<String> analyzedfields = new ArrayList<String>();
+
+    @Override protected TokenStreamComponents createComponents(final String fieldName) {
+      analyzedfields.add(fieldName);
+      return new TokenStreamComponents(new KeywordTokenizer());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
new file mode 100644
index 0000000..8c6f59e
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.gemstone.gemfire.cache.lucene;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+public class LuceneIntegrationTest {
+
+  protected Cache cache;
+  protected LuceneService luceneService;
+
+  @Rule
+  public TestName name = new TestName();
+
+  @After
+  public void tearDown() {
+    if(this.cache != null) {
+      this.cache.close();
+    }
+  }
+
+  @Before
+  public void createCache() {
+    CacheFactory cf = new CacheFactory();
+    cf.set("mcast-port", "0");
+    cf.set("locators", "");
+    this.cache = cf.create();
+    luceneService = LuceneServiceProvider.get(this.cache);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesIntegrationTest.java
index 9009e3d..2262339 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneQueriesIntegrationTest.java
@@ -19,17 +19,12 @@ package com.gemstone.gemfire.cache.lucene;
 import static org.hamcrest.Matchers.isA;
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.execute.Function;
 import com.gemstone.gemfire.cache.execute.FunctionException;
 import com.gemstone.gemfire.cache.query.QueryException;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -39,25 +34,11 @@ import org.junit.rules.ExpectedException;
  * This class contains tests of lucene queries that can fit
  */
 @Category(IntegrationTest.class)
-public class LuceneQueriesIntegrationTest {
+public class LuceneQueriesIntegrationTest extends LuceneIntegrationTest {
   @Rule
   public ExpectedException thrown = ExpectedException.none();
   private static final String INDEX_NAME = "index";
   protected static final String REGION_NAME = "index";
-  Cache cache;
-
-  @Before
-  public void createCache() {
-    cache = new CacheFactory()
-      .set("mcast-port", "0")
-      .set("locators", "")
-      .set("log-level", "warning").create();
-  }
-
-  @After
-  public void closeCache() {
-    cache.close();
-  }
 
   @Test()
   public void throwFunctionExceptionWhenGivenBadQuery() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationIntegrationTest.java
deleted file mode 100644
index e04d1c7..0000000
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationIntegrationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.gemstone.gemfire.cache.lucene.internal;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(IntegrationTest.class)
-public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
-
-  @Test
-  public void verifyLuceneRegionInternal() {
-    // Create cache
-    createCache();
-
-    // Create index
-    String indexName = "index";
-    String regionName = this.name.getMethodName();
-    createIndex(indexName, regionName, "text");
-
-    // Create partitioned region
-    createRegion(regionName);
-
-    // Get index
-    LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) LuceneServiceProvider.get(this.cache).getIndex(indexName, regionName);
-    assertNotNull(index);
-
-    // Verify the meta regions exist and are internal
-    LocalRegion chunkRegion = (LocalRegion) this.cache.getRegion(index.createChunkRegionName());
-    assertNotNull(chunkRegion);
-    assertTrue(chunkRegion.isInternalRegion());
-    LocalRegion fileRegion = (LocalRegion) this.cache.getRegion(index.createFileRegionName());
-    assertNotNull(fileRegion);
-    assertTrue(fileRegion.isInternalRegion());
-
-    // Verify the meta regions are not contained in the root regions
-    for (Region region : cache.rootRegions()) {
-      assertNotEquals(chunkRegion.getFullPath(), region.getFullPath());
-      assertNotEquals(fileRegion.getFullPath(), region.getFullPath());
-    }
-  }
-
-  private Region createRegion(String regionName) {
-    return this.cache.createRegionFactory(RegionShortcut.PARTITION).create(regionName);
-  }
-
-  private void createIndex(String indexName, String regionName, String fieldName) {
-    LuceneServiceProvider.get(this.cache).createIndex(indexName, regionName, fieldName);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a83e428b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIntegrationTest.java
deleted file mode 100644
index 4d94042..0000000
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIntegrationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.gemstone.gemfire.cache.lucene.internal;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-public class LuceneIntegrationTest {
-
-  protected Cache cache;
-
-  @Rule
-  public TestName name = new TestName();
-
-  @After
-  public void tearDown() {
-    if(this.cache != null) {
-      this.cache.close();
-    }
-  }
-
-  protected void createCache() {
-    CacheFactory cf = new CacheFactory();
-    cf.set("mcast-port", "0");
-    this.cache = cf.create();
-  }
-}


[04/49] incubator-geode git commit: GEODE-1146: Amending Testcase to use proper client caches rather than peer servers. Also amending JUnit4CacheTestCase.java to set "locators" and "mcast-port" to correct settings for clients.

Posted by kl...@apache.org.
GEODE-1146: Amending Testcase to use proper client caches rather than peer servers. Also amending JUnit4CacheTestCase.java to set "locators" and "mcast-port" to correct settings for clients.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2c2caae9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2c2caae9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2c2caae9

Branch: refs/heads/feature/GEODE-835-test
Commit: 2c2caae9db8d687107d5d15af44a5f0d14465b35
Parents: 665471a
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Fri May 13 04:32:15 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Fri May 13 04:37:13 2016 +1000

----------------------------------------------------------------------
 .../query/dunit/QueryUsingPoolDUnitTest.java    | 192 +++++++------------
 .../cache/internal/JUnit4CacheTestCase.java     |  17 +-
 2 files changed, 73 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2c2caae9/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
index a87c243..0e25d05 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
@@ -18,11 +18,11 @@ package com.gemstone.gemfire.cache.query.dunit;
 
 import cacheRunner.Portfolio;
 import cacheRunner.Position;
-import org.junit.experimental.categories.Category;
-
 import com.gemstone.gemfire.DataSerializable;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.query.*;
@@ -35,16 +35,11 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.dunit.*;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.jayway.awaitility.Awaitility;
+import org.junit.experimental.categories.Category;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -53,6 +48,7 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Tests remote (client/server) query execution.
@@ -114,29 +110,24 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
   public void createPool(final String poolName, final String[] servers, final int[] ports,
       final boolean subscriptionEnabled) {
     // Create Cache.
-    getCache();
+    getCache(true);
 
-    PoolFactory cpf = PoolManager.createFactory();
-    cpf.setSubscriptionEnabled(subscriptionEnabled);
+    PoolFactory poolFactory = PoolManager.createFactory();
+    poolFactory.setSubscriptionEnabled(subscriptionEnabled);
     for (int i = 0; i < servers.length; i++) {
-      LogWriterUtils.getLogWriter().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
-      cpf.addServer(servers[i], ports[i]);
+      LogService.getLogger().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
+      poolFactory.addServer(servers[i], ports[i]);
     }
-
-    cpf.create(poolName);
+    poolFactory.setMinConnections(1);
+    poolFactory.setMaxConnections(5);
+    poolFactory.setRetryAttempts(5);
+    poolFactory.create(poolName);
   }
 
   public void validateCompiledQuery(final long compiledQueryCount) {
-    long count = 0;
-    for (int i = 0; i < 100; i++) {
-      count = CacheClientNotifier.getInstance().getStats().getCompiledQueryCount();
-      if (count == compiledQueryCount) {
-        break;
-      } else {
-        Wait.pause(1 * 100);
-      }
-    }
-    assertEquals(compiledQueryCount, count);
+    Awaitility.await().pollInterval(100, TimeUnit.MILLISECONDS)
+        .pollDelay(100, TimeUnit.MILLISECONDS).timeout(60, TimeUnit.SECONDS)
+        .until(() -> CacheClientNotifier.getInstance().getStats().getCompiledQueryCount() == compiledQueryCount);
   }
 
   /**
@@ -160,7 +151,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, rootRegionName, factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -286,7 +277,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -413,7 +404,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -596,7 +587,6 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -800,7 +790,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
         for (int i = 0; i < queryString.length; i++) {
           try {
-            LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+            LogService.getLogger().info("### Executing Query :" + queryString[i]);
             Query query = qService.newQuery(queryString[i]);
             results = (SelectResults) query.execute(params[i]);
           } catch (Exception e) {
@@ -830,7 +820,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       for (int x = 0; x < useMaintainedCompiledQueries; x++) {
         for (int i = 0; i < queryString.length; i++) {
           try {
-            LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+            LogService.getLogger().info("### Executing Query :" + queryString[i]);
             Query query = qService.newQuery(queryString[i]);
             results = (SelectResults) query.execute(params[i]);
           } catch (Exception e) {
@@ -911,8 +901,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // Create client region
-    final int port0 = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
-    final int port1 = vm1.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
+    final int port0 = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
+    final int port1 = vm1.invoke("getCacheServerPort", () -> getCacheServerPort());
 
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
@@ -935,7 +925,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < queryString.length; j++) {
           for (int i = 0; i < queryString.length; i++) {
             try {
-              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+              LogService.getLogger().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               results = (SelectResults) query.execute(params[i]);
             } catch (Exception e) {
@@ -978,8 +968,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // recreate clients and execute queries.
-    vm2.invoke("createPool", () -> createPool(poolName, new String[] { host0,host0 }, new int[] { port1, port0 }, true));
-    vm3.invoke("createPool", () -> createPool(poolName, new String[] { host0,host0 }, new int[] { port0, port1 }, true));
+    vm2.invoke("createPool", () -> createPool(poolName, new String[] { host0, host0 }, new int[] { port1, port0 }, true));
+    vm3.invoke("createPool", () -> createPool(poolName, new String[] { host0, host0 }, new int[] { port0, port1 }, true));
 
     vm2.invoke(executeQueries);
     vm3.invoke(executeQueries);
@@ -1134,14 +1124,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     // Validate maintained compiled queries.
     vm0.invoke("validate Compiled query", () -> validateCompiledQuery(queryString.length));
 
-    // Let the compiled queries to be idle (not used).
-    Wait.pause(2 * 1000);
-
     // Validate maintained compiled queries.
     vm0.invoke("validate Compiled query", () -> validateCompiledQuery(0));
 
     // Close clients
-
     vm1.invoke("closeClient", () -> closeClient());
     vm2.invoke("closeClient", () -> closeClient());
 
@@ -1261,8 +1247,6 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
   @Category(FlakyTest.class) // GEODE-1146: time senstiive, thread sleeps, uses zero port for servers (good!), async actions, AsyncInvocation orphans
   public void testBindParamsWithMulitipleClients() throws CacheException {
 
-    final String name = this.getName();
-
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
@@ -1298,7 +1282,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     });
 
     // Create client region
-    final int port0 = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
+    final int port0 = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
 
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
@@ -1324,7 +1308,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < 5; j++) {
           for (int i = 0; i < 2; i++) {
             try {
-              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+              LogService.getLogger().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               rs[0][0] = (SelectResults) query.execute(params[i]);
               Query query2 = qService.newQuery(querys[i]);
@@ -1333,37 +1317,17 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
             } catch (Exception e) {
               Assert.fail("Failed executing " + queryString[i], e);
             }
-            LogWriterUtils.getLogWriter().info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+            LogService.getLogger().info("### Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
             compareQueryResultsWithoutAndWithIndexes(rs, 1);
-            LogWriterUtils.getLogWriter().info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
+            LogService.getLogger().info("### Done Comparing results for Query :" + ((i + 1) * (j + 1)) + " : " + queryString[i]);
           }
         }
       }
     };
 
-    vm1.invokeAsync(executeSameQueries);
-    vm2.invokeAsync(executeSameQueries);
-    vm3.invokeAsync(executeSameQueries);
-
-    // Wait till the query execution completes.
-    vm0.invoke("validate compiled query.", () -> {
-      long compiledQueryUsedCount = -1;
-      while (true) {
-        LogWriterUtils.getLogWriter().info("### CompiledQueryUsedCount :" + compiledQueryUsedCount);
-        if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
-          LogWriterUtils.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
-          break;
-        } else {
-          compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
-          try {
-            Thread.currentThread().sleep(3 * 1000);
-          } catch (Exception ex) {
-            break;
-          }
-        }
-      }
-      return 0;
-    });
+    vm1.invoke("executeSameQueries", () -> executeSameQueries);
+    vm2.invoke("executeSameQueries", () -> executeSameQueries);
+    vm3.invoke("executeSameQueries", () -> executeSameQueries);
 
     // Execute client queries and validate results.
     SerializableRunnable executeQueries = new CacheSerializableRunnable("Execute queries") {
@@ -1379,7 +1343,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         for (int j = 0; j < queryString.length; j++) {
           for (int i = 0; i < queryString.length; i++) {
             try {
-              LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+              LogService.getLogger().info("### Executing Query :" + queryString[i]);
               Query query = qService.newQuery(queryString[i]);
               rs[0][0] = (SelectResults) query.execute(params[i]);
               Query query2 = qService.newQuery(querys[i]);
@@ -1394,29 +1358,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       }
     };
 
-    vm1.invokeAsync("executeQueries", () -> executeQueries);
-    vm2.invokeAsync("executeQueries", () -> executeQueries);
-    vm3.invokeAsync("executeQueries", () -> executeQueries);
-
-    // Wait till the query execution completes.
-    vm0.invoke("validate compiled query.", () -> {
-      long compiledQueryUsedCount = -1;
-      while (true) {
-        LogWriterUtils.getLogWriter().info("### previous CompiledQueryUsedCount :" + compiledQueryUsedCount);
-        if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
-          LogWriterUtils.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
-          break;
-        } else {
-          compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
-          try {
-            Thread.currentThread().sleep(3 * 1000);
-          } catch (Exception ex) {
-            break;
-          }
-        }
-      }
-      return 0;
-    });
+    vm1.invoke("executeQueries", () -> executeQueries);
+    vm2.invoke("executeQueries", () -> executeQueries);
+    vm3.invoke("executeQueries", () -> executeQueries);
 
     vm1.invoke("closeClient", () -> closeClient());
     vm2.invoke("closeClient", () -> closeClient());
@@ -1448,7 +1392,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       factory.setScope(Scope.LOCAL);
       createRegion(name + "1", factory.create());
       createRegion(name + "2", factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1540,7 +1484,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1556,7 +1500,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       }
     });
 
-    final int port = vm0.invoke("getCacheServerPort", () -> QueryUsingPoolDUnitTest.getCacheServerPort());
+    final int port = vm0.invoke("getCacheServerPort", () -> getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(vm0.getHost());
 
     final String regionName = "/" + rootRegionName + "/" + name;
@@ -1663,8 +1607,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       Properties config = new Properties();
       config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
       getSystem(config);
-
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1684,7 +1627,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
         }
 
       });
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       for (int i = 0; i < numberOfEntries; i++) {
         region1.put("key-" + i, new TestObject(i, "ibm"));
         region2.put("key-" + i, new TestObject(i, "ibm"));
@@ -1750,7 +1693,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       AttributesFactory factory = new AttributesFactory();
       factory.setScope(Scope.LOCAL);
       createRegion(name, factory.create());
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1892,8 +1835,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       Properties config = new Properties();
       config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
       getSystem(config);
-
-      Wait.pause(1000);
+      //      Wait.pause(1000);
       try {
         startBridgeServer(0, false);
       } catch (Exception ex) {
@@ -1923,9 +1865,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
     // Execute client queries in VM1      
     vm1.invoke("Execute queries", () -> {
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.LOCAL);
-      final Region region1 = createRegion(name, factory.createRegionAttributes());
+      final Region region1 = ((ClientCache) getCache()).createClientRegionFactory(ClientRegionShortcut.LOCAL).create(name);
 
       String queryString = "select distinct * from " + regionName1 + " where ticker = $1";
       Object[] params = new Object[] { new String("ibm") };
@@ -2026,15 +1966,15 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       type1 = ((SelectResults) r[j][0]).getCollectionType().getElementType();
       type2 = ((SelectResults) r[j][1]).getCollectionType().getElementType();
       if ((type1.getClass().getName()).equals(type2.getClass().getName())) {
-        LogWriterUtils.getLogWriter().info("Both SelectResults are of the same Type i.e.--> "
+        LogService.getLogger().info("Both SelectResults are of the same Type i.e.--> "
             + ((SelectResults) r[j][0]).getCollectionType().getElementType());
       } else {
-        LogWriterUtils.getLogWriter().info("Classes are : " + type1.getClass().getName() + " "
+        LogService.getLogger().info("Classes are : " + type1.getClass().getName() + " "
             + type2.getClass().getName());
         fail("FAILED:Select result Type is different in both the cases");
       }
       if (((SelectResults) r[j][0]).size() == ((SelectResults) r[j][1]).size()) {
-        LogWriterUtils.getLogWriter().info("Both SelectResults are of Same Size i.e.  Size= "
+        LogService.getLogger().info("Both SelectResults are of Same Size i.e.  Size= "
             + ((SelectResults) r[j][1]).size());
       } else {
         fail("FAILED:SelectResults size is different in both the cases. Size1="
@@ -2044,7 +1984,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
       set2 = (((SelectResults) r[j][1]).asSet());
       set1 = (((SelectResults) r[j][0]).asSet());
 
-      LogWriterUtils.getLogWriter().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
+      LogService.getLogger().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
 
       //      boolean pass = true;
       itert1 = set1.iterator();
@@ -2054,10 +1994,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
         boolean exactMatch = false;
         while (itert2.hasNext()) {
-          LogWriterUtils.getLogWriter().info("### Comparing results..");
+          LogService.getLogger().info("### Comparing results..");
           Object p2 = itert2.next();
           if (p1 instanceof Struct) {
-            LogWriterUtils.getLogWriter().info("ITS a Set");
+            LogService.getLogger().info("ITS a Set");
             Object[] values1 = ((Struct) p1).getFieldValues();
             Object[] values2 = ((Struct) p2).getFieldValues();
             assertEquals(values1.length, values2.length);
@@ -2069,26 +2009,26 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
             }
             exactMatch = elementEqual;
           } else {
-            LogWriterUtils.getLogWriter().info("Not a Set p2:" + p2 + " p1: " + p1);
+            LogService.getLogger().info("Not a Set p2:" + p2 + " p1: " + p1);
             if (p2 instanceof TestObject) {
-              LogWriterUtils.getLogWriter().info("An instance of TestObject");
+              LogService.getLogger().info("An instance of TestObject");
               exactMatch = p2.equals(p1);
             } else {
-              LogWriterUtils.getLogWriter().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
+              LogService.getLogger().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
               exactMatch = p2.equals(p1);
             }
           }
           if (exactMatch) {
-            LogWriterUtils.getLogWriter().info("Exact MATCH");
+            LogService.getLogger().info("Exact MATCH");
             break;
           }
         }
         if (!exactMatch) {
-          LogWriterUtils.getLogWriter().info("NOT A MATCH");
+          LogService.getLogger().info("NOT A MATCH");
           fail("Atleast one element in the pair of SelectResults supposedly identical, is not equal ");
         }
       }
-      LogWriterUtils.getLogWriter().info("### Done Comparing results..");
+      LogService.getLogger().info("### Done Comparing results..");
     }
   }
 
@@ -2099,7 +2039,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
     createRegion(this.regionName, this.rootRegionName, factory.create());
-    Wait.pause(1000);
+    //    Wait.pause(1000);
     try {
       startBridgeServer(0, false);
     } catch (Exception ex) {
@@ -2118,9 +2058,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
     for (int i = 0; i < queryString.length; i++) {
       try {
-        LogWriterUtils.getLogWriter().info("### Executing Query :" + queryString[i]);
+        LogService.getLogger().info("### Executing Query :" + queryString[i]);
         Query query = qService.newQuery(queryString[i]);
-        SelectResults results = (SelectResults) query.execute(params[i]);
+        query.execute(params[i]);
       } catch (Exception e) {
         Assert.fail("Failed executing " + queryString[i], e);
       }
@@ -2154,13 +2094,13 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
 
   /* Close Client */
   public void closeClient() {
-    LogWriterUtils.getLogWriter().info("### Close Client. ###");
+    LogService.getLogger().info("### Close Client. ###");
     try {
       closeCache();
     } catch (Exception ex) {
-      LogWriterUtils.getLogWriter().info("### Failed to get close client. ###");
+      LogService.getLogger().info("### Failed to get close client. ###");
     }
-    Wait.pause(2 * 1000);
+    //    Wait.pause(2 * 1000);
   }
 
   private static int getCacheServerPort() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2c2caae9/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
index 6a719ab..fe63813 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -23,7 +23,9 @@ import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.TimeUnit;
 
+import com.jayway.awaitility.Awaitility;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
@@ -109,6 +111,8 @@ public class JUnit4CacheTestCase extends JUnit4DistributedTestCase implements Ca
         System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
         Cache newCache;
         if (client) {
+          System.setProperty("gemfire.locators", "");
+          System.setProperty("gemfire.mcast-port", "0");
           newCache = (Cache)new ClientCacheFactory(getSystem().getProperties()).create();
         } else {
           if(factory == null) {
@@ -240,16 +244,9 @@ public class JUnit4CacheTestCase extends JUnit4DistributedTestCase implements Ca
       final GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
       if (gemFireCache != null && !gemFireCache.isClosed()
               && gemFireCache.getCancelCriterion().cancelInProgress() != null) {
-        Wait.waitForCriterion(new WaitCriterion() { // TODO: replace with Awaitility
-          @Override
-          public boolean done() {
-            return gemFireCache.isClosed();
-          }
-          @Override
-          public String description() {
-            return "waiting for cache to close";
-          }
-        }, 30 * 1000, 300, true);
+        Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS)
+            .pollInterval(100,TimeUnit.MILLISECONDS).timeout(60,TimeUnit.SECONDS)
+            .until(() -> gemFireCache.isClosed());
       }
       if (cache == null || cache.isClosed()) {
         cache = null;


[48/49] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-835-test

Posted by kl...@apache.org.
Merge remote-tracking branch 'origin/develop' into feature/GEODE-835-test


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/45b42477
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/45b42477
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/45b42477

Branch: refs/heads/feature/GEODE-835-test
Commit: 45b42477805ac9f08deb33fda357e6f6a5fe7b1b
Parents: e388938 b3d9061
Author: Kirk Lund <kl...@apache.org>
Authored: Wed May 18 10:05:44 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed May 18 10:05:44 2016 -0700

----------------------------------------------------------------------
 extensions/geode-modules-assembly/build.gradle  |   53 +-
 .../release/conf/cache-client.xml               |   14 +-
 .../release/conf/cache-server.xml               |    6 +-
 .../release/scripts/cacheserver.bat             |  133 -
 .../release/scripts/cacheserver.sh              |   97 -
 .../release/scripts/gemfire.bat                 |   41 -
 .../release/scripts/gemfire.sh                  |   58 -
 .../release/scripts/setenv.properties           |    1 +
 .../release/session/bin/cacheserver.bat         |   56 -
 .../release/session/bin/cacheserver.sh          |   57 -
 .../release/session/bin/gemfire.bat             |   53 -
 .../release/session/bin/gemfire.sh              |   69 -
 .../release/session/bin/modify_war              |   91 +-
 .../release/session/bin/setenv.properties       |    6 -
 .../gemfire-cs-tomcat-7/context-fragment.xml    |   15 -
 .../tcserver/gemfire-cs-tomcat-7/modules.env    |    1 -
 .../gemfire-cs-tomcat-8/context-fragment.xml    |   15 -
 .../tcserver/gemfire-cs-tomcat-8/modules.env    |    1 -
 .../gemfire-cs/configuration-prompts.properties |   17 -
 .../tcserver/gemfire-cs/context-fragment.xml    |   13 -
 .../release/tcserver/gemfire-cs/modules.env     |    1 -
 .../tcserver/gemfire-cs/server-fragment.xml     |   12 -
 .../gemfire-p2p-tomcat-7/context-fragment.xml   |   15 -
 .../tcserver/gemfire-p2p-tomcat-7/modules.env   |    1 -
 .../gemfire-p2p-tomcat-8/context-fragment.xml   |   15 -
 .../tcserver/gemfire-p2p-tomcat-8/modules.env   |    1 -
 .../configuration-prompts.properties            |   19 -
 .../tcserver/gemfire-p2p/context-fragment.xml   |   13 -
 .../release/tcserver/gemfire-p2p/modules.env    |    1 -
 .../tcserver/gemfire-p2p/server-fragment.xml    |   14 -
 .../geode-cs-tomcat-7/context-fragment.xml      |   15 +
 .../geode-cs-tomcat-8/context-fragment.xml      |   15 +
 .../geode-cs/configuration-prompts.properties   |   17 +
 .../tcserver/geode-cs/context-fragment.xml      |   13 +
 .../tcserver/geode-cs/server-fragment.xml       |   12 +
 .../geode-p2p-tomcat-7/context-fragment.xml     |   15 +
 .../geode-p2p-tomcat-8/context-fragment.xml     |   15 +
 .../geode-p2p/configuration-prompts.properties  |   19 +
 .../tcserver/geode-p2p/context-fragment.xml     |   13 +
 .../tcserver/geode-p2p/server-fragment.xml      |   14 +
 extensions/geode-modules-session/build.gradle   |    2 +-
 .../junit/SeparateClassloaderTestRunner.java    |   56 -
 extensions/geode-modules-tomcat7/build.gradle   |    6 +
 .../gemstone/gemfire/modules/util/Banner.java   |   20 +-
 .../SharedConfigurationEndToEndDUnitTest.java   |   13 +-
 .../src/test/resources/expected_jars.txt        |    1 +
 geode-core/build.gradle                         |    2 +-
 .../cache/asyncqueue/AsyncEventQueue.java       |    9 +
 .../asyncqueue/AsyncEventQueueFactory.java      |   13 +
 .../internal/AsyncEventQueueFactoryImpl.java    |    8 +-
 .../internal/AsyncEventQueueImpl.java           |    9 +-
 .../client/internal/ClientMetadataService.java  |   31 +-
 .../cache/operations/OperationContext.java      |   10 +-
 .../gemfire/cache/wan/GatewaySender.java        |    2 +
 .../internal/AbstractDistributionConfig.java    |    2 +-
 .../internal/DistributionConfig.java            |   23 +-
 .../distributed/internal/InternalLocator.java   |    1 +
 .../distributed/internal/LocatorStats.java      |   31 -
 .../distributed/internal/ServerLocator.java     |   44 +-
 .../membership/gms/membership/GMSJoinLeave.java |    6 +-
 .../gemfire/internal/AbstractConfig.java        |    2 +-
 .../InsufficientDiskSpaceException.java         |   53 -
 .../internal/cache/BucketRegionQueue.java       |   10 +-
 .../gemfire/internal/cache/EntryEventImpl.java  |    2 +-
 .../gemfire/internal/cache/LocalRegion.java     |   52 +-
 .../gemstone/gemfire/internal/cache/Oplog.java  |    7 +-
 .../internal/cache/RemoteDestroyMessage.java    |    2 +-
 .../internal/cache/versions/VersionTag.java     |   83 +-
 .../cache/wan/AbstractGatewaySender.java        |  100 +-
 .../cache/wan/GatewaySenderAttributes.java      |    7 +
 .../cache/xmlcache/AsyncEventQueueCreation.java |   11 +
 .../internal/cache/xmlcache/CacheXml.java       |    1 +
 .../cache/xmlcache/CacheXmlGenerator.java       |    8 +
 .../internal/cache/xmlcache/CacheXmlParser.java |    7 +
 .../internal/security/GeodeSecurityUtil.java    |   41 +
 .../security/shiro/GeodePermissionResolver.java |   29 +
 .../internal/security/shiro/ShiroPrincipal.java |    2 +-
 .../gemfire/internal/util/BlobHelper.java       |   75 +-
 .../management/internal/ManagementAgent.java    |    7 +-
 .../internal/SystemManagementService.java       |   29 +-
 .../internal/cli/commands/QueueCommands.java    |   18 +-
 .../internal/cli/commands/ShellCommands.java    |    4 +-
 .../functions/AsyncEventQueueFunctionArgs.java  |  134 +
 .../CreateAsyncEventQueueFunction.java          |   54 +-
 .../internal/cli/i18n/CliStrings.java           |    4 +-
 .../security/ResourceOperationContext.java      |   10 +-
 .../controllers/QueueCommandsController.java    |    1 +
 .../com/gemstone/gemfire/pdx/JSONFormatter.java |   66 +-
 .../pdx/internal/json/PdxListHelper.java        |    2 +-
 .../geode.apache.org/schema/cache/cache-1.0.xsd |    1 +
 ...ventQueueEvictionAndExpirationJUnitTest.java |  346 ++
 .../cache30/CacheXmlGeode10DUnitTest.java       |   78 +
 ...tedAckOverflowRegionCCEOffHeapDUnitTest.java |    2 +-
 ...dAckPersistentRegionCCEOffHeapDUnitTest.java |    2 +-
 ...DistributedAckRegionCCEOffHeapDUnitTest.java |    2 +-
 .../DistributedAckRegionOffHeapDUnitTest.java   |    2 +-
 ...stributedNoAckRegionCCEOffHeapDUnitTest.java |    2 +-
 .../DistributedNoAckRegionOffHeapDUnitTest.java |    2 +-
 .../GlobalRegionCCEOffHeapDUnitTest.java        |    2 +-
 .../cache30/GlobalRegionOffHeapDUnitTest.java   |    2 +-
 .../OffHeapLRUEvictionControllerDUnitTest.java  |    2 +-
 .../PartitionedRegionOffHeapDUnitTest.java      |    2 +-
 .../gemfire/cache30/ReconnectDUnitTest.java     |   57 +-
 .../internal/ServerLocatorJUnitTest.java        |    0
 ...DistrbutedRegionProfileOffHeapDUnitTest.java |    2 +-
 .../cache/OffHeapEvictionDUnitTest.java         |    2 +-
 .../cache/OffHeapEvictionStatsDUnitTest.java    |    2 +-
 ...nedRegionLocalMaxMemoryOffHeapDUnitTest.java |    2 +-
 ...rtitionedRegionOffHeapEvictionDUnitTest.java |    2 +-
 .../PartitionedRegionSingleHopDUnitTest.java    |    8 +-
 ...ForceInvalidateOffHeapEvictionDUnitTest.java |    2 +-
 .../sockets/UpdatePropagationDUnitTest.java     |  489 +--
 .../sockets/UpdatePropagationPRDUnitTest.java   |    4 +-
 .../versions/AbstractVersionTagTestBase.java    |   92 +
 .../cache/versions/VMVersionTagTest.java        |   32 +
 ...ompressionCacheListenerOffHeapDUnitTest.java |    2 +-
 ...ressionRegionOperationsOffHeapDUnitTest.java |    2 +-
 .../offheap/OutOfOffHeapMemoryDUnitTest.java    |    2 +-
 .../gemfire/internal/util/BlobHelperTest.java   |  179 ++
 ...bHelperWithThreadContextClassLoaderTest.java |  306 ++
 .../gemfire/internal/util/SerializableImpl.java |   37 -
 .../util/SerializableImplWithValue.java         |   56 -
 .../gemfire/internal/util/Valuable.java         |    1 -
 .../cli/commands/CliCommandTestBase.java        |   51 +-
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  |  305 --
 .../cli/commands/HelpCommandsJUnitTest.java     |  130 +
 .../cli/commands/QueueCommandsDUnitTest.java    |    2 +
 .../SharedConfigurationCommandsDUnitTest.java   |    8 +-
 .../security/DataCommandsSecurityTest.java      |    4 +-
 .../GeodeSecurityUtilCustomRealmJUnitTest.java  |   18 +-
 .../GeodeSecurityUtilWithIniFileJUnitTest.java  |   15 +-
 .../security/GfshCommandsSecurityTest.java      |   11 +-
 .../ResourceOperationContextJUnitTest.java      |   11 +-
 .../internal/security/ShiroCacheStartRule.java  |    2 +-
 .../internal/security/TestCommand.java          |   16 +-
 .../test/dunit/standalone/DUnitLauncher.java    |   17 +-
 .../com/gemstone/gemfire/test/fake/Fakes.java   |   19 +
 .../sanctionedDataSerializables.txt             |    4 +-
 .../codeAnalysis/sanctionedSerializables.txt    |    2 +-
 .../cli/commands/golden-help-offline.properties | 2997 ++++++++++++++++++
 .../cli/commands/golden-help-online.properties  |  657 ++++
 .../pdx/jsonStrings/jsonListInsideList.txt      |   48 +
 .../src/test/resources/ssl/trusted.keystore     |  Bin 1078 -> 2241 bytes
 .../cache/ha/HADispatcherDUnitTest.java         |  608 ++--
 .../gemfire/test/junit/rules/DiskDirRule.java   |   54 +
 .../test/junit/runner/SuiteBlockRunner.java     |   46 +
 .../gemfire/test/junit/runner/SuiteRunner.java  |   53 +
 .../CategoryWithParameterizedRunner.java        |   44 +
 .../CategoryWithParameterizedRunnerFactory.java |   42 +
 .../junit/runners/ExposedGetAnnotations.java    |   23 +
 .../test/junit/rules/DiskDirRuleTest.java       |   49 +
 ...egoryWithParameterizedRunnerFactoryTest.java |  162 +
 .../gemfire/cache/lucene/LuceneIndex.java       |    7 +
 .../gemfire/cache/lucene/LuceneService.java     |    4 +-
 .../lucene/internal/LuceneEventListener.java    |   11 +
 .../LuceneIndexForPartitionedRegion.java        |   32 +-
 .../cache/lucene/internal/LuceneIndexImpl.java  |   42 +-
 .../lucene/internal/LuceneQueryFactoryImpl.java |    3 +
 .../internal/PartitionedRepositoryManager.java  |    1 +
 .../internal/xml/LuceneIndexCreation.java       |    5 +
 .../LuceneIndexCreationIntegrationTest.java     |  192 ++
 ...ceneIndexCreationOffHeapIntegrationTest.java |   72 +
 ...IndexCreationPersistenceIntegrationTest.java |  141 +
 .../cache/lucene/LuceneIntegrationTest.java     |   63 +
 .../gemfire/cache/lucene/LuceneQueriesBase.java |   69 +-
 .../lucene/LuceneQueriesIntegrationTest.java    |   21 +-
 .../LuceneIndexCreationIntegrationTest.java     |   74 -
 .../LuceneIndexForPartitionedRegionTest.java    |   58 +-
 .../internal/LuceneIndexImplJUnitTest.java      |   78 +
 .../LuceneIndexRecoveryHAIntegrationTest.java   |   14 +-
 .../lucene/internal/LuceneIntegrationTest.java  |   47 -
 .../LuceneQueryFactoryImplJUnitTest.java        |   21 +-
 .../cache/lucene/test/LuceneTestUtilities.java  |   64 +
 .../gemfire/cache/lucene/test/TestObject.java   |   27 +
 .../gemfire/cache/lucene/test/package-info.java |   23 +
 .../cache/wan/Simple2CacheServerDUnitTest.java  |   47 +-
 .../ClusterConfigurationDUnitTest.java          |   10 +-
 geode-web/build.gradle                          |   11 +
 .../cli/commands/CommandOverHttpDUnitTest.java  |   58 +
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  |  305 ++
 .../GfshCommandsOverHttpSecurityTest.java       |   29 +
 gradle/dependency-versions.properties           |    1 +
 gradle/ide.gradle                               |   15 +-
 gradle/rat.gradle                               |    1 +
 184 files changed, 7966 insertions(+), 2849 deletions(-)
----------------------------------------------------------------------



[43/49] incubator-geode git commit: GEODE-1392: add tests for BlobHelper

Posted by kl...@apache.org.
GEODE-1392: add tests for BlobHelper

* create BlobHelperTest with basic unit tests
* create BlobHelperWithThreadContextClassLoaderTest with TCCL related tests
* remove deadcode
* minor cleanup of format


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ec1415f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ec1415f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ec1415f4

Branch: refs/heads/feature/GEODE-835-test
Commit: ec1415f4ef6268c524a287a8a9cc19cd0fd9679c
Parents: 46056a6
Author: Kirk Lund <kl...@pivotal.io>
Authored: Tue May 17 09:38:43 2016 -0700
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Tue May 17 17:26:10 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/util/BlobHelper.java       |  75 ++---
 .../gemfire/internal/util/BlobHelperTest.java   | 179 +++++++++++
 ...bHelperWithThreadContextClassLoaderTest.java | 306 +++++++++++++++++++
 .../gemfire/internal/util/SerializableImpl.java |  37 ---
 .../util/SerializableImplWithValue.java         |  56 ----
 .../gemfire/internal/util/Valuable.java         |   1 -
 6 files changed, 509 insertions(+), 145 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/main/java/com/gemstone/gemfire/internal/util/BlobHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/util/BlobHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/util/BlobHelper.java
index 28252c3..45f9774 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/util/BlobHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/util/BlobHelper.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.util;
 
 import java.io.IOException;
@@ -26,19 +25,17 @@ import com.gemstone.gemfire.internal.ByteArrayDataInput;
 import com.gemstone.gemfire.internal.DSCODE;
 import com.gemstone.gemfire.internal.HeapDataOutputStream;
 import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.offheap.StoredObject;
 import com.gemstone.gemfire.internal.offheap.annotations.Unretained;
 import com.gemstone.gemfire.pdx.internal.PdxInputStream;
 
 /**
  * A "blob" is a serialized representation of an object into a byte[].
- * BlobHelper provides utility methods for
- * serializing and deserializing the object.
- * 
- * 
+ * BlobHelper provides utility methods for serializing and deserializing the
+ * object.
+ *
+ * TODO: compare performance with org.apache.commons.lang.SerializationUtils
  */
-
 public class BlobHelper {
 
   /**
@@ -50,12 +47,10 @@ public class BlobHelper {
   }
 
   /**
-   * A blob is a serialized Object.  This method serializes the
-   * object into a blob and returns the byte array that contains the blob.
+   * A blob is a serialized Object.  This method serializes the object into a
+   * blob and returns the byte array that contains the blob.
    */
-  public static byte[] serializeToBlob(Object obj, Version version)
-  throws IOException
-  {
+  public static byte[] serializeToBlob(Object obj, Version version) throws IOException {
     final long start = startSerialization();
     HeapDataOutputStream hdos = new HeapDataOutputStream(version);
     DataSerializer.writeObject(obj, hdos);
@@ -65,45 +60,32 @@ public class BlobHelper {
   }
 
   /**
-   * A blob is a serialized Object.  This method serializes the
-   * object into the given HeapDataOutputStream.
+   * A blob is a serialized Object.  This method serializes the object into
+   * the given HeapDataOutputStream.
    */
-  public static void serializeTo(Object obj, HeapDataOutputStream hdos)
-    throws IOException
-  {
+  public static void serializeTo(Object obj, HeapDataOutputStream hdos) throws IOException {
     final int startBytes = hdos.size();
     final long start = startSerialization();
     DataSerializer.writeObject(obj, hdos);
     endSerialization(start, hdos.size()-startBytes);
   }
-                                                                        
-
 
   /**
-   * A blob is a serialized Object.  This method 
-   * returns the deserialized object.
+   * A blob is a serialized Object.  This method returns the deserialized
+   * object.
    */
-  public static Object deserializeBlob(byte[] blob) throws IOException,
-      ClassNotFoundException {
+  public static Object deserializeBlob(byte[] blob) throws IOException, ClassNotFoundException {
     return deserializeBlob(blob, null, null);
   }
 
   /**
-   * A blob is a serialized Object.  This method 
-   * returns the deserialized object.
+   * A blob is a serialized Object.  This method returns the deserialized
+   * object.
    */
-  public static Object deserializeBlob(byte[] blob, Version version,
-      ByteArrayDataInput in) throws IOException, ClassNotFoundException {
+  public static Object deserializeBlob(byte[] blob, Version version, ByteArrayDataInput in) throws IOException, ClassNotFoundException {
     Object result;
     final long start = startDeserialization();
-    /*
-    final StaticSystemCallbacks sysCb;
-    if (version != null && (sysCb = GemFireCacheImpl.FactoryStatics
-        .systemCallbacks) != null) {
-      // may need to change serialized shape for SQLFire
-      result = sysCb.fromVersion(blob, true, version, in);
-    }
-    else*/ if (blob.length > 0 && blob[0] == DSCODE.PDX) {
+    if (blob.length > 0 && blob[0] == DSCODE.PDX) {
       // If the first byte of blob indicates a pdx then wrap
       // blob in a PdxInputStream instead.
       // This will prevent us from making a copy of the byte[]
@@ -121,24 +103,13 @@ public class BlobHelper {
       result = DataSerializer.readObject(in);
     }
     endDeserialization(start, blob.length);
-    // this causes a small performance drop in d-no-ack performance tests
-//    if (dis.available() != 0) {
-//      LogWriterI18n lw = InternalDistributedSystem.getLoggerI18n();
-//      if (lw != null && lw.warningEnabled()) {
-//        lw.warning(
-//            LocalizedStrings.BlobHelper_DESERIALIZATION_OF_A_0_DID_NOT_READ_1_BYTES_THIS_INDICATES_A_LOGIC_ERROR_IN_THE_SERIALIZATION_CODE_FOR_THIS_CLASS,
-//            new Object[] {((result!=null) ? result.getClass().getName() : "NULL"), Integer.valueOf(dis.available())});   
-//            
-//      }
-//    }
     return result;
   }
 
   /**
-   * A blob is a serialized Object.  This method 
-   * returns the deserialized object.
-   * If a PdxInstance is returned then it will refer to Chunk's off-heap memory
-   * with an unretained reference.
+   * A blob is a serialized Object.  This method returns the deserialized
+   * object. If a PdxInstance is returned then it will refer to Chunk's
+   * off-heap memory with an unretained reference.
    */
   public static @Unretained Object deserializeOffHeapBlob(StoredObject blob) throws IOException, ClassNotFoundException {
     Object result;
@@ -152,8 +123,10 @@ public class BlobHelper {
     return result;
   }
 
-  public static Object deserializeBuffer(ByteArrayDataInput in, int numBytes)
-      throws IOException, ClassNotFoundException {
+  /**
+   * Unused
+   */
+  public static Object deserializeBuffer(ByteArrayDataInput in, int numBytes) throws IOException, ClassNotFoundException {
     final long start = startDeserialization();
     Object result = DataSerializer.readObject(in);
     endDeserialization(start, numBytes);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperTest.java
new file mode 100644
index 0000000..8603c31
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperTest.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.util;
+
+import static com.gemstone.gemfire.internal.util.BlobHelper.*;
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.EOFException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.internal.ByteArrayDataInput;
+import com.gemstone.gemfire.internal.HeapDataOutputStream;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.offheap.StoredObject;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit Tests for {@link BlobHelper}.
+ *
+ * TODO: add coverage for additional methods:
+ * <li>{@link BlobHelper#deserializeBlob(byte[], Version, ByteArrayDataInput)}
+ * <li>{@link BlobHelper#deserializeBuffer(ByteArrayDataInput, int)}
+ * <li>{@link BlobHelper#deserializeOffHeapBlob(StoredObject)}
+ * <li>{@link BlobHelper#serializeToBlob(Object, Version)}
+ */
+@Category(UnitTest.class)
+public class BlobHelperTest {
+
+  private static final int HDOS_ALLOC_SIZE = 32;
+
+  private static final String CLASS_NOT_FOUND_MESSAGE = "ClassNotFoundSerialization.readObject fake exception";
+
+  private Map<Object, Object> mapWithTwoEntries;
+
+  private byte[] bytesOfClassNotFoundSerialization;
+  private byte[] bytesOfMap;
+  private byte[] bytesOfNull;
+  private byte[] zeroBytes;
+
+  @Before
+  public void setUp() throws Exception {
+    this.mapWithTwoEntries = new HashMap<>();
+    this.mapWithTwoEntries.put("FOO", "foo");
+    this.mapWithTwoEntries.put("BAR", 7);
+
+    HeapDataOutputStream hdos = createHeapDataOutputStream();
+    DataSerializer.writeObject(new ClassNotFoundSerialization(), hdos);
+    this.bytesOfClassNotFoundSerialization = hdos.toByteArray();
+
+    hdos = createHeapDataOutputStream();
+    DataSerializer.writeObject(this.mapWithTwoEntries, hdos);
+    this.bytesOfMap = hdos.toByteArray();
+
+    this.bytesOfNull = serializeToBlob(null);
+
+    this.zeroBytes = new byte[0];
+  }
+
+  @Test
+  public void deserializeBlobOfClassNotFoundSerializationThrowsEOFException() throws Exception {
+    assertThatThrownBy(() -> deserializeBlob(this.bytesOfClassNotFoundSerialization)).isExactlyInstanceOf(ClassNotFoundException.class);
+  }
+
+  @Test
+  public void deserializeBlobOfMapReturnsCopyOfMap() throws Exception {
+    final Object object = deserializeBlob(this.bytesOfMap);
+
+    assertThat(object).isNotNull();
+    assertThat(object).isExactlyInstanceOf(HashMap.class);
+    assertThat(object).isNotSameAs(this.mapWithTwoEntries);
+    assertThat(object).isEqualTo(this.mapWithTwoEntries);
+  }
+
+  @Test
+  public void deserializeBlobOfNullReturnsNull() throws Exception {
+    assertThat(deserializeBlob(this.bytesOfNull)).isNull();
+  }
+
+  @Test
+  public void deserializeBlobOfZeroBytesThrowsEOFException() throws Exception {
+    assertThatThrownBy(() -> deserializeBlob(this.zeroBytes)).isExactlyInstanceOf(EOFException.class);
+  }
+
+  @Test
+  public void deserializeBlobWithNullThrowsNullPointerException() throws Exception {
+    assertThatThrownBy(() -> deserializeBlob(null)).isExactlyInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void serializeMapToStreamWritesMapAsBytes() throws Exception {
+    HeapDataOutputStream hdos = createHeapDataOutputStream();
+
+    serializeTo(this.mapWithTwoEntries, hdos);
+
+    assertThat(hdos.toByteArray()).isNotNull().isEqualTo(bytesOfMap);
+  }
+
+  @Test
+  public void serializeNullToStreamWritesNullAsBytes() throws Exception {
+    HeapDataOutputStream hdos = createHeapDataOutputStream();
+
+    serializeTo(null, hdos);
+
+    assertThat(hdos.toByteArray()).isNotNull().isEqualTo(this.bytesOfNull);
+  }
+
+  @Test
+  public void serializeToBlobMapReturnsBytesOfMap() throws Exception {
+    byte[] bytes = serializeToBlob(this.mapWithTwoEntries);
+
+    assertThat(bytes).isNotNull().isEqualTo(this.bytesOfMap);
+  }
+
+  @Test
+  public void serializeToBlobUnserializableThrowsNotSerializableException() throws Exception {
+    assertThatThrownBy(() -> serializeToBlob(new Object()))
+      .isExactlyInstanceOf(NotSerializableException.class)
+      .hasMessage(Object.class.getName());
+  }
+
+  @Test
+  public void serializeToBlobWithNullReturnsBytesOfNull() throws Exception {
+    byte[] bytes = serializeToBlob(null);
+
+    assertThat(bytes).isNotNull().isEqualTo(this.bytesOfNull);
+  }
+
+  @Test
+  public void serializeToNullNullThrowsNullPointerException() throws Exception {
+    assertThatThrownBy(() -> serializeTo(null, null)).isExactlyInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void serializeToNullStreamThrowsNullPointerException() throws Exception {
+    assertThatThrownBy(() -> serializeTo(this.mapWithTwoEntries, null)).isExactlyInstanceOf(NullPointerException.class);
+  }
+
+  @Test
+  public void serializeUnserializableToStreamThrowsNotSerializableException() throws Exception {
+    HeapDataOutputStream hdos = createHeapDataOutputStream();
+
+    assertThatThrownBy(() -> serializeTo(new Object(), hdos))
+      .isExactlyInstanceOf(NotSerializableException.class)
+      .hasMessage(Object.class.getName());
+  }
+
+  private HeapDataOutputStream createHeapDataOutputStream() {
+    return new HeapDataOutputStream(HDOS_ALLOC_SIZE, null, true);
+  }
+
+  private static class ClassNotFoundSerialization implements Serializable {
+    private void readObject(final ObjectInputStream in) throws ClassNotFoundException    {
+      throw new ClassNotFoundException(CLASS_NOT_FOUND_MESSAGE);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperWithThreadContextClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperWithThreadContextClassLoaderTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperWithThreadContextClassLoaderTest.java
new file mode 100644
index 0000000..6dfcadd
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/BlobHelperWithThreadContextClassLoaderTest.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.util;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.Field;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.generic.ClassGen;
+import org.apache.bcel.generic.ConstantPoolGen;
+import org.apache.bcel.generic.FieldGen;
+import org.apache.bcel.generic.InstructionFactory;
+import org.apache.bcel.generic.InstructionHandle;
+import org.apache.bcel.generic.InstructionList;
+import org.apache.bcel.generic.MethodGen;
+import org.apache.bcel.generic.Type;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Unit tests for {@link BlobHelper} with Thread Context ClassLoader.
+ *
+ * @since 2.0.2
+ */
+@Category(UnitTest.class)
+public class BlobHelperWithThreadContextClassLoaderTest {
+
+  private static final String CLASS_NAME_SERIALIZABLE_IMPL = "com.gemstone.gemfire.internal.util.SerializableImpl";
+  private static final String CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE = "com.gemstone.gemfire.internal.util.SerializableImplWithValue";
+  private static final String VALUE = "value";
+  private static final String SET_VALUE = "setValue";
+  private static final String GET_VALUE = "getValue";
+
+  private ClassLoader oldCCL;
+
+  @Before
+  public void setUp() throws MalformedURLException {
+    this.oldCCL = Thread.currentThread().getContextClassLoader();
+    Thread.currentThread().setContextClassLoader(new GeneratingClassLoader(this.oldCCL));
+  }
+
+  @After
+  public void tearDown() {
+    Thread.currentThread().setContextClassLoader(this.oldCCL);
+  }
+
+  @Test
+  public void tcclLoadsSerializableImpl() throws Exception {
+    Class loadedClass = Class.forName(CLASS_NAME_SERIALIZABLE_IMPL, true, Thread.currentThread().getContextClassLoader());
+    assertThat(loadedClass).isNotNull();
+    assertThat(loadedClass.getName()).isEqualTo(CLASS_NAME_SERIALIZABLE_IMPL);
+
+    Object instance = loadedClass.newInstance();
+    assertThat(instance).isNotNull();
+    assertThat(Serializable.class.isInstance(loadedClass));
+    assertThat(loadedClass.getInterfaces()).contains(Serializable.class);
+  }
+
+  @Test
+  public void tcclLoadsSerializableImplWithValue() throws Exception {
+    Class loadedClass = Class.forName(CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, true, Thread.currentThread().getContextClassLoader());
+    assertThat(loadedClass).isNotNull();
+    assertThat(loadedClass.getName()).isEqualTo(CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE);
+
+    Object instance = loadedClass.newInstance();
+    assertThat(instance).isNotNull();
+
+    assertThat(loadedClass.getSuperclass().getName()).isEqualTo(CLASS_NAME_SERIALIZABLE_IMPL);
+    assertThat(Serializable.class.isInstance(loadedClass));
+
+    assertThat(Valuable.class.isInstance(loadedClass));
+    assertThat(loadedClass.getInterfaces()).contains(Valuable.class);
+
+    Method setter = loadedClass.getMethod("setValue", Object.class);
+    assertThat(setter).isNotNull();
+  }
+
+  /**
+   * Tests serializing an object loaded with the current context class
+   * loader (whose parent is the loader that loads GemFire and test
+   * classes).
+   */
+  @Test
+  public void handlesClassFromOtherClassLoader() throws Exception {
+    Class loadedClass = Class.forName(CLASS_NAME_SERIALIZABLE_IMPL, true, Thread.currentThread().getContextClassLoader());
+
+    Object instance = loadedClass.newInstance();
+    byte[] bytes = BlobHelper.serializeToBlob(instance);
+
+    Object object = BlobHelper.deserializeBlob(bytes);
+
+    assertThat(object).isNotNull();
+    assertThat(object.getClass().getName()).isEqualTo(CLASS_NAME_SERIALIZABLE_IMPL);
+    assertThat(Serializable.class.isInstance(object));
+
+    Class deserializedClass = object.getClass();
+    assertThat(deserializedClass.getInterfaces()).contains(Serializable.class);
+  }
+
+  /**
+   * Tests that the deserialized object has the correct state
+   */
+  @Test
+  public void handlesObjectWithStateFromOtherClassLoader() throws Exception {
+    Class loadedClass = Class.forName(CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, true, Thread.currentThread().getContextClassLoader());
+
+    Constructor ctor = loadedClass.getConstructor(new Class[] {Object.class});
+    Valuable instance = (Valuable) ctor.newInstance(new Object[] {123});
+    assertThat(instance.getValue()).isEqualTo(123);
+
+    byte[] bytes = BlobHelper.serializeToBlob(instance);
+
+    Valuable object = (Valuable) BlobHelper.deserializeBlob(bytes);
+    assertThat(object.getValue()).isEqualTo(instance.getValue());
+  }
+
+  /**
+   * Custom class loader which uses BCEL to dynamically generate SerializableImpl or SerializableImplWithValue.
+   */
+  private static class GeneratingClassLoader extends ClassLoader {
+
+    private static final String GENERATED = "<generated>";
+
+    private final Map<String, Class<?>> classDefinitions;
+
+    public GeneratingClassLoader(ClassLoader parent) {
+      super(parent);
+      this.classDefinitions = new HashMap<>();
+    }
+
+    public GeneratingClassLoader() {
+      this(null); // no parent
+    }
+
+    @Override
+    protected Class<?> findClass(String name) throws ClassNotFoundException {
+      Class<?> definedClass = null;
+      synchronized (this.classDefinitions) {
+        definedClass = getClass(name);
+        if (definedClass == null) {
+          definedClass = generate(name);
+          this.classDefinitions.put(name, definedClass);
+        }
+      }
+      return definedClass;
+    }
+
+    @Override
+    protected URL findResource(String name) {
+      return null;
+    }
+
+    @Override
+    protected Enumeration<URL> findResources(String name) throws IOException {
+      return null;
+    }
+
+    private Class<?> generate(String name) throws ClassNotFoundException {
+      if (CLASS_NAME_SERIALIZABLE_IMPL.equals(name)) {
+        return generateSerializableImpl();
+      } else if (CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE.equals(name)) {
+        return generateSerializableImplWithValue();
+      } else {
+        return null;
+        //throw new Error("Unable to generate " + name);
+      }
+    }
+
+    /**
+     * <pre>
+     * public class SerializableImpl implements Serializable {
+     *
+     *   public SerializableImpl() {
+     *   }
+     *
+     * }
+     * </pre>
+     */
+    private Class<?> generateSerializableImpl() throws ClassNotFoundException {
+      ClassGen cg = new ClassGen(CLASS_NAME_SERIALIZABLE_IMPL, Object.class.getName(), GENERATED, Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] {Serializable.class.getName()});
+      cg.addEmptyConstructor(Constants.ACC_PUBLIC);
+      JavaClass jClazz = cg.getJavaClass();
+      byte[] bytes = jClazz.getBytes();
+      return defineClass(jClazz.getClassName(), bytes, 0, bytes.length);
+    }
+
+    /**
+     * <pre>
+     * public class SerializableImplWithValue extends SerializableImpl implements Valuable {
+     *
+     *   private Object value;
+     *
+     *   public SerializableImplWithValue() {
+     *   }
+     *
+     *   public SerializableImplWithValue(Object value) {
+     *     this.value = value;
+     *   }
+     *
+     *   public Object getValue() {
+     *     return this.value;
+     *   }
+     *
+     *   public void setValue(Object value) {
+     *     this.value = value;
+     *   }
+     * }
+     * </pre>
+     *
+     * @see Valuable
+     */
+    private Class<?> generateSerializableImplWithValue() throws ClassNotFoundException {
+      ClassGen cg = new ClassGen(CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, CLASS_NAME_SERIALIZABLE_IMPL, GENERATED, Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] {Valuable.class.getName()});
+      ConstantPoolGen cp = cg.getConstantPool();
+      InstructionFactory fac = new InstructionFactory(cg, cp);
+
+      // field
+      FieldGen fg = new FieldGen(Constants.ACC_PRIVATE, Type.OBJECT, VALUE, cp);
+      Field field = fg.getField();
+      cg.addField(field);
+
+      // empty constructor
+      cg.addEmptyConstructor(Constants.ACC_PUBLIC);
+
+      // constructor with arg
+      InstructionList ctor = new InstructionList();
+      MethodGen ctorMethod = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[] { Type.OBJECT }, new String[] { "arg0" }, "<init>", "com.gemstone.gemfire.internal.util.bcel.SerializableImplWithValue", ctor, cp);
+      ctorMethod.setMaxStack(2);
+
+      InstructionHandle ctor_ih_0 = ctor.append(fac.createLoad(Type.OBJECT, 0));
+      ctor.append(fac.createInvoke(CLASS_NAME_SERIALIZABLE_IMPL, "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+      InstructionHandle ctor_ih_4 = ctor.append(fac.createLoad(Type.OBJECT, 0));
+      ctor.append(fac.createLoad(Type.OBJECT, 1));
+      ctor.append(fac.createFieldAccess(CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, "value", Type.OBJECT, Constants.PUTFIELD));
+      InstructionHandle ctor_ih_9 = ctor.append(fac.createReturn(Type.VOID));
+
+      cg.addMethod(ctorMethod.getMethod());
+      ctor.dispose();
+
+      // getter
+      InstructionList getter = new InstructionList();
+      MethodGen getterMethod = new MethodGen(Constants.ACC_PUBLIC, Type.OBJECT, null, null, GET_VALUE, CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, getter, cp);
+      getterMethod.setMaxStack(1);
+
+      InstructionHandle getter_ih_0 = getter.append(fac.createLoad(Type.OBJECT, 0));
+      InstructionHandle getter_ih_1 = getter.append(fac.createGetField(cg.getClassName(), field.getName(), Type.getType(field.getSignature())));
+      InstructionHandle getter_ih_4 = getter.append(fac.createReturn(Type.OBJECT));
+
+      cg.addMethod(getterMethod.getMethod());
+      getter.dispose();
+
+      // setter
+      InstructionList setter = new InstructionList();
+      MethodGen setterMethod = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[] {Type.OBJECT}, new String[] {field.getName()}, SET_VALUE, CLASS_NAME_SERIALIZABLE_IMPL_WITH_VALUE, setter, cp);
+      setterMethod.setMaxStack(2);
+
+      InstructionHandle setter_ih_0 = setter.append(fac.createLoad(Type.OBJECT, 0));
+      InstructionHandle setter_ih_1 = setter.append(fac.createLoad(Type.OBJECT, 1));
+      InstructionHandle setter_ih_2 = setter.append(fac.createPutField(cg.getClassName(), field.getName(), Type.getType(field.getSignature())));
+      InstructionHandle setter_ih_0_ih_5 = setter.append(fac.createReturn(Type.VOID));
+
+      cg.addMethod(setterMethod.getMethod());
+      setter.dispose();
+
+      JavaClass jClazz = cg.getJavaClass();
+      byte[] bytes = jClazz.getBytes();
+      return defineClass(jClazz.getClassName(), bytes, 0, bytes.length);
+    }
+
+    private Class<?> getClass(String name) {
+      synchronized (this.classDefinitions) {
+        return this.classDefinitions.get(name);
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImpl.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImpl.java
deleted file mode 100644
index 44a8363..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.util;
-
-import java.io.*;
-
-/**
- * A {@link Serializable} class that is loaded by a class loader other
- * than the one that is used to load test classes.
- *
- *
- * @since 2.0.1
- */
-public class SerializableImpl implements Serializable {
-
-  /**
-   * Creates a new <code>SerializableImpl</code>
-   */
-  public SerializableImpl() {
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImplWithValue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImplWithValue.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImplWithValue.java
deleted file mode 100644
index 5727ff8..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/SerializableImplWithValue.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.util;
-
-//import java.io.*;
-
-/**
- * A {@link SerializableImpl} that implements an interface and has
- * some object state.
- *
- *
- * @since 2.0.3
- */
-public class SerializableImplWithValue extends SerializableImpl 
-  implements Valuable {
-
-  /** This object's state */
-  private Object value;
-
-  /**
-   * Zero-argument constructor
-   */
-  public SerializableImplWithValue() {
-
-  }
-
-  /**
-   * Creates a new <code>SerializableImplWithValue</code> with a given
-   * value
-   */
-  public SerializableImplWithValue(Object value) {
-    this.value = value;
-  }
-
-  public Object getValue() {
-    return this.value;
-  }
-
-  public void setValue(Object value) {
-    this.value = value;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ec1415f4/geode-core/src/test/java/com/gemstone/gemfire/internal/util/Valuable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/Valuable.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/Valuable.java
index f58deb9..885b665 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/Valuable.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/Valuable.java
@@ -21,7 +21,6 @@ package com.gemstone.gemfire.internal.util;
  * value associated with them.  This interface is not considered to be
  * a "user class".
  *
- *
  * @since 2.0.3
  */
 public interface Valuable {


[22/49] incubator-geode git commit: GEODE-11: Adding tests of fixed partitions and persistent lucene indexes

Posted by kl...@apache.org.
GEODE-11: Adding tests of fixed partitions and persistent lucene indexes

In addition to the tests, I fixed some code to properly propagate the
disk synchronous flag to the index.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7908467a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7908467a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7908467a

Branch: refs/heads/feature/GEODE-835-test
Commit: 7908467a38932edcd781c6c276791e6371522269
Parents: d216e55
Author: Dan Smith <up...@apache.org>
Authored: Thu May 12 15:36:38 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Fri May 13 11:37:02 2016 -0700

----------------------------------------------------------------------
 .../com/gemstone/gemfire/test/fake/Fakes.java   |  19 +++
 .../gemfire/test/junit/rules/DiskDirRule.java   |  54 ++++++++
 .../test/junit/rules/DiskDirRuleTest.java       |  49 +++++++
 .../LuceneIndexForPartitionedRegion.java        |  28 ++--
 .../lucene/internal/LuceneQueryFactoryImpl.java |   3 +
 .../internal/PartitionedRepositoryManager.java  |   1 +
 .../LuceneIndexCreationIntegrationTest.java     | 131 +++++++++++++++++--
 .../cache/lucene/LuceneIntegrationTest.java     |  14 +-
 .../LuceneIndexForPartitionedRegionTest.java    |  58 ++++----
 .../LuceneQueryFactoryImplJUnitTest.java        |  21 ++-
 10 files changed, 312 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java b/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
index 99644b7..2a1fd8e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
@@ -23,6 +23,10 @@ import java.net.UnknownHostException;
 import org.junit.Assert;
 
 import com.gemstone.gemfire.CancelCriterion;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.distributed.internal.DSClock;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionManager;
@@ -96,6 +100,21 @@ public class Fakes {
     return cache().getDistributedSystem();
   }
 
+  /**
+   * A fake region, which contains a fake cache and some other
+   * fake attributes
+   */
+  public static Region region(String name, Cache cache) {
+    Region region = mock(Region.class);
+    RegionAttributes attributes = mock(RegionAttributes.class);
+    DataPolicy policy = mock(DataPolicy.class);
+    when(region.getAttributes()).thenReturn(attributes);
+    when(attributes.getDataPolicy()).thenReturn(policy);
+    when(region.getCache()).thenReturn(cache);
+    when(region.getRegionService()).thenReturn(cache);
+    return region;
+  }
+
   private Fakes() {
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/DiskDirRule.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/DiskDirRule.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/DiskDirRule.java
new file mode 100644
index 0000000..184619f
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/rules/DiskDirRule.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+
+import org.junit.rules.ExternalResource;
+
+public class DiskDirRule extends ExternalResource {
+  private File diskDir;
+
+  @Override protected void before() throws Throwable {
+    diskDir = new File(".", "DiskDirRule-" + System.nanoTime());
+  }
+
+  @Override protected void after() {
+    try {
+      Files.walk(diskDir.toPath()).forEach((path) -> {
+        try {
+          Files.delete(path);
+        }
+        catch (IOException e) {
+          //Ignore
+        }
+      });
+    } catch(IOException e) {
+      throw new RuntimeException("Could not delete disk dir: " + diskDir, e);
+    }
+    diskDir.delete();
+  }
+
+  public File get() {
+    diskDir.mkdirs();
+    return diskDir;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/DiskDirRuleTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/DiskDirRuleTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/DiskDirRuleTest.java
new file mode 100644
index 0000000..8c322a4
--- /dev/null
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/rules/DiskDirRuleTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.rules;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Arrays;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DiskDirRuleTest {
+  @Test
+  public void shouldDeleteDirInAfter() throws Throwable {
+    DiskDirRule diskDirRule = new DiskDirRule();
+    diskDirRule.before();
+    final File dir = diskDirRule.get();
+    assertTrue(dir.exists());
+    final File file1 = new File(dir, "file1");
+    final File subdir = new File(dir, "subdir");
+    final File file2 = new File(dir, "file2");
+    subdir.mkdir();
+    Files.write(file1.toPath(), Arrays.asList("abc"));
+    Files.write(file2.toPath(), Arrays.asList("stuff"));
+    diskDirRule.after();
+    assertFalse(dir.exists());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index dd9d384..d22ca4a 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -29,7 +29,6 @@ import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
 import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import com.gemstone.gemfire.cache.lucene.internal.filesystem.ChunkKey;
 import com.gemstone.gemfire.cache.lucene.internal.filesystem.File;
 import com.gemstone.gemfire.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
@@ -88,46 +87,37 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
       repositoryManager = new PartitionedRepositoryManager(dataRegion, (PartitionedRegion)fileRegion, (PartitionedRegion)chunkRegion, mapper, analyzer);
       
       // create AEQ, AEQ listener and specify the listener to repositoryManager
-      if (withPersistence) {
-        createAEQWithPersistence();
-      }
-      else {
-        createAEQ();
-      }
+      createAEQ(dataRegion);
 
       addExtension(dataRegion);
       hasInitialized = true;
     }
   }
 
-  private AsyncEventQueueFactoryImpl createAEQFactory() {
+  private AsyncEventQueueFactoryImpl createAEQFactory(final Region dataRegion) {
     AsyncEventQueueFactoryImpl factory = (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory();
     factory.setParallel(true); // parallel AEQ for PR
     factory.setMaximumQueueMemory(1000);
     factory.setDispatcherThreads(1);
     factory.setIsMetaQueue(true);
+    if(dataRegion.getAttributes().getDataPolicy().withPersistence()) {
+      factory.setPersistent(true);
+    }
+    factory.setDiskSynchronous(dataRegion.getAttributes().isDiskSynchronous());
     return factory;
   }
 
-  AsyncEventQueue createAEQWithPersistence() {
-    AsyncEventQueueFactoryImpl factory = createAEQFactory();
-    factory.setPersistent(true);
-    return createAEQ(factory);
-  }
-
-  AsyncEventQueue createAEQ() {
-    return createAEQ(createAEQFactory());
+  AsyncEventQueue createAEQ(Region dataRegion) {
+    return createAEQ(createAEQFactory(dataRegion));
   }
 
   private AsyncEventQueue createAEQ(AsyncEventQueueFactoryImpl factory) {
     LuceneEventListener listener = new LuceneEventListener(repositoryManager);
     String aeqId = LuceneServiceImpl.getUniqueIndexName(getName(), regionPath);
-    AsyncEventQueueImpl aeq = (AsyncEventQueueImpl)cache.getAsyncEventQueue(aeqId);
     AsyncEventQueue indexQueue = factory.create(aeqId, listener);
     return indexQueue;
   }
 
-
   boolean fileRegionExists(String fileRegionName) {
     return cache.<String, File> getRegion(fileRegionName) != null;
   }
@@ -156,7 +146,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
     return LuceneServiceImpl.getUniqueIndexName(indexName, regionPath) + ".chunks";
   }
 
-  private PartitionAttributesFactory configureLuceneRegionAttributesFactory(PartitionAttributesFactory attributesFactory, PartitionAttributes dataRegionAttributes) {
+  private PartitionAttributesFactory configureLuceneRegionAttributesFactory(PartitionAttributesFactory attributesFactory, PartitionAttributes<?,?> dataRegionAttributes) {
     attributesFactory.setTotalNumBuckets(dataRegionAttributes.getTotalNumBuckets());
     attributesFactory.setRedundantCopies(dataRegionAttributes.getRedundantCopies());
     return attributesFactory;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
index c6087ea..385b226 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImpl.java
@@ -54,6 +54,9 @@ public class LuceneQueryFactoryImpl implements LuceneQueryFactory {
   
   public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider) {
     Region<K, V> region = cache.getRegion(regionName);
+    if(region == null) {
+      throw new IllegalArgumentException("Region not found: " + regionName);
+    }
     LuceneQueryImpl<K, V> luceneQuery = new LuceneQueryImpl<K, V>(indexName, region, provider, projectionFields, limit, pageSize);
     return luceneQuery;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
index 07050e2..57b8862 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 
 import com.gemstone.gemfire.InternalGemFireError;
 import com.gemstone.gemfire.cache.Region;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index 2d16e32..6429143 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -29,23 +29,26 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
-import java.util.function.Function;
 
 import com.gemstone.gemfire.cache.EvictionAttributes;
 import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.FixedPartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.lucene.LuceneIndex;
-import com.gemstone.gemfire.cache.lucene.LuceneIntegrationTest;
-import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexForPartitionedRegion;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
 import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import com.jayway.awaitility.Awaitility;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordTokenizer;
+import org.apache.lucene.queryparser.classic.ParseException;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -122,6 +125,18 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
   }
 
   @Test
+  public void shouldNotUseOffHeapForInternalRegionsWhenUserRegionHasOffHeap() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setOffHeap(true)
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      assertEquals(false, region.getOffHeap());
+    });
+  }
+
+  @Test
   public void shouldNotUseOverflowForInternalRegionsWhenUserRegionHasOverflow() {
     createIndex("text");
     cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).create(REGION_NAME);
@@ -131,18 +146,112 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
   }
 
   @Test
-  public void shouldCreateInternalRegionsForIndex() {
+  public void shouldUseDiskSynchronousWhenUserRegionHasDiskSynchronous() {
+    createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .setDiskSynchronous(true)
+      .create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertTrue(region.getDataPolicy().withPersistence());
+      assertTrue(region.isDiskSynchronous());
+    });
+    AsyncEventQueue queue = getIndexQueue();
+    assertEquals(true, queue.isDiskSynchronous());
+    assertEquals(true, queue.isPersistent());
+  }
+
+  @Test
+  public void shouldUseDiskSyncFalseOnQueueWhenUserRegionHasDiskSynchronousFalse() {
     createIndex("text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .setDiskSynchronous(false)
+      .create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertTrue(region.getDataPolicy().withPersistence());
+      assertTrue(region.isDiskSynchronous());
+    });
+    AsyncEventQueue queue = getIndexQueue();
+    assertEquals(false, queue.isDiskSynchronous());
+    assertEquals(true, queue.isPersistent());
+  }
+
+  @Test
+  public void shouldRecoverPersistentIndexWhenDataStillInQueue() throws ParseException, InterruptedException {
+    createIndex("field1", "field2");
+    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    //Pause the sender so that the entry stays in the queue
+    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue();
+    queue.getSender().pause();
+
+    dataRegion.put("A", new TestObject());
+    cache.close();
+    createCache();
+    createIndex("field1", "field2");
+    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
+      .create(INDEX_NAME, REGION_NAME,
+        "field1:world");
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      assertEquals(1, query.search().size());
+    });
+  }
+
+  @Test
+  public void shouldRecoverPersistentIndexWhenDataIsWrittenToIndex() throws ParseException, InterruptedException {
+    createIndex("field1", "field2");
+    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    dataRegion.put("A", new TestObject());
+    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue();
+
+    //Wait until the queue has drained
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> assertEquals(0, queue.size()));
+    cache.close();
+    createCache();
+    createIndex("text");
+    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
+      .create(INDEX_NAME, REGION_NAME,
+      "field1:world");
+    assertEquals(1, query.search().size());
+  }
+
+  @Test
+  public void shouldCreateInternalRegionsForIndex() {
+    createIndex("field1", "field2");
 
     // Create partitioned region
     createRegion();
 
     verifyInternalRegions(region -> {
       region.isInternalRegion();
+      assertNotNull(region.getAttributes().getPartitionAttributes().getColocatedWith());
       cache.rootRegions().contains(region);
     });
   }
 
+  @Test
+  public void shouldUseFixedPartitionsForInternalRegions() {
+    createIndex("text");
+
+    PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory<>();
+    final FixedPartitionAttributes fixedAttributes = FixedPartitionAttributes.createFixedPartition("A", true, 1);
+    partitionAttributesFactory.addFixedPartitionAttributes(fixedAttributes);
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setPartitionAttributes(partitionAttributesFactory.create())
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      //Fixed partitioned regions don't allow you to specify the partitions on the colocated region
+      assertNull(region.getAttributes().getPartitionAttributes().getFixedPartitionAttributes());
+      assertTrue(((PartitionedRegion) region).isFixedPartitionedRegion());
+    });
+  }
+
+
   private void verifyInternalRegions(Consumer<LocalRegion> verify) {
     // Get index
     LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
@@ -152,21 +261,25 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
     LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
     verify.accept(chunkRegion);
     verify.accept(fileRegion);
+  }
 
+  private AsyncEventQueue getIndexQueue() {
+    String aeqId = LuceneServiceImpl.getUniqueIndexName(INDEX_NAME, REGION_NAME);
+    return cache.getAsyncEventQueue(aeqId);
   }
 
   private Region createRegion() {
     return this.cache.createRegionFactory(RegionShortcut.PARTITION).create(REGION_NAME);
   }
 
-  private void createIndex(String fieldName) {
-    LuceneServiceProvider.get(this.cache).createIndex(INDEX_NAME, REGION_NAME, fieldName);
+  private void createIndex(String ... fieldNames) {
+    LuceneServiceProvider.get(this.cache).createIndex(INDEX_NAME, REGION_NAME, fieldNames);
   }
 
   private static class TestObject implements Serializable {
 
-    String field1 = "a b c d";
-    String field2 = "f g h";
+    String field1 = "hello world";
+    String field2 = "this is a field";
   }
 
   private static class RecordingAnalyzer extends Analyzer {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
index 8c6f59e..67775d2 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
@@ -19,10 +19,15 @@
 
 package com.gemstone.gemfire.cache.lucene;
 
+import java.io.File;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.lucene.LuceneService;
 import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.offheap.MemoryAllocatorImpl;
+import com.gemstone.gemfire.test.junit.rules.DiskDirRule;
 
 import org.junit.After;
 import org.junit.Before;
@@ -33,15 +38,15 @@ public class LuceneIntegrationTest {
 
   protected Cache cache;
   protected LuceneService luceneService;
-
   @Rule
-  public TestName name = new TestName();
+  public DiskDirRule diskDirRule = new DiskDirRule();
 
   @After
   public void tearDown() {
     if(this.cache != null) {
       this.cache.close();
     }
+    MemoryAllocatorImpl.freeOffHeapMemory();
   }
 
   @Before
@@ -49,7 +54,12 @@ public class LuceneIntegrationTest {
     CacheFactory cf = new CacheFactory();
     cf.set("mcast-port", "0");
     cf.set("locators", "");
+    cf.set("off-heap-memory-size", "100m");
     this.cache = cf.create();
+    cache.createDiskStoreFactory()
+      .setDiskDirs(new File[] {diskDirRule.get()})
+      .setMaxOplogSize(1)
+      .create(GemFireCacheImpl.getDefaultDiskStoreName());
     luceneService = LuceneServiceProvider.get(this.cache);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
index 984b221..e35de5e 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
@@ -32,6 +32,7 @@ import com.gemstone.gemfire.cache.DataPolicy;
 import com.gemstone.gemfire.cache.ExpirationAttributes;
 import com.gemstone.gemfire.cache.MembershipAttributes;
 import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
@@ -120,12 +121,16 @@ public class LuceneIndexForPartitionedRegionTest {
     String name = "indexName";
     String regionPath = "regionName";
     Cache cache = Fakes.cache();
+    final Region region =Fakes.region(regionPath, cache);
+    RegionAttributes attributes  = region.getAttributes();
+    when(attributes.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_PARTITION);
     AsyncEventQueueFactoryImpl aeqFactory = mock(AsyncEventQueueFactoryImpl.class);
     when(cache.createAsyncEventQueueFactory()).thenReturn(aeqFactory);
 
     LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
-    index.createAEQWithPersistence();
+    index.createAEQ(region);
 
+    verify(aeqFactory).setPersistent(eq(true));
     verify(aeqFactory).create(any(), any());
   }
 
@@ -134,21 +139,23 @@ public class LuceneIndexForPartitionedRegionTest {
     String name = "indexName";
     String regionPath = "regionName";
     Cache cache = Fakes.cache();
+    final Region region =Fakes.region(regionPath, cache);
     AsyncEventQueueFactoryImpl aeqFactory = mock(AsyncEventQueueFactoryImpl.class);
     when(cache.createAsyncEventQueueFactory()).thenReturn(aeqFactory);
 
     LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
-    index.createAEQ();
+    index.createAEQ(region);
 
+    verify(aeqFactory, never()).setPersistent(eq(true));
     verify(aeqFactory).create(any(), any());
   }
 
-  private void initializeScenario(final boolean withPersistence, final String regionPath, final Cache cache) {
+  private Region initializeScenario(final boolean withPersistence, final String regionPath, final Cache cache) {
     int defaultLocalMemory = 100;
-    initializeScenario(withPersistence, regionPath, cache, defaultLocalMemory);
+    return initializeScenario(withPersistence, regionPath, cache, defaultLocalMemory);
   }
 
-  private void initializeScenario(final boolean withPersistence, final String regionPath, final Cache cache, int localMaxMemory) {
+  private Region initializeScenario(final boolean withPersistence, final String regionPath, final Cache cache, int localMaxMemory) {
     PartitionedRegion region = mock(PartitionedRegion.class);
     RegionAttributes regionAttributes = mock(RegionAttributes.class);
     PartitionAttributes partitionAttributes = mock(PartitionAttributes.class);
@@ -162,6 +169,8 @@ public class LuceneIndexForPartitionedRegionTest {
     when(partitionAttributes.getTotalNumBuckets()).thenReturn(113);
     when(dataPolicy.withPersistence()).thenReturn(withPersistence);
     when(region.getExtensionPoint()).thenReturn(extensionPoint);
+
+    return region;
   }
 
   private PartitionAttributes initializeAttributes(final Cache cache) {
@@ -192,41 +201,22 @@ public class LuceneIndexForPartitionedRegionTest {
   }
 
   @Test
-  public void initializeWithPersistenceShouldCreateAEQWithPersistence() {
-    boolean withPersistence = true;
-    String name = "indexName";
-    String regionPath = "regionName";
-    Cache cache = Fakes.cache();
-    initializeScenario(withPersistence, regionPath, cache);
-
-    LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
-    index.setSearchableFields(new String[]{"field"});
-    LuceneIndexForPartitionedRegion spy = spy(index);
-    doReturn(null).when(spy).createFileRegion(any(), any(), any());
-    doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQWithPersistence();
-    spy.initialize();
-
-    verify(spy).createAEQWithPersistence();
-  }
-
-  @Test
   public void initializeWithoutPersistenceShouldCreateAEQ() {
     boolean withPersistence = false;
     String name = "indexName";
     String regionPath = "regionName";
     Cache cache = Fakes.cache();
-    initializeScenario(withPersistence, regionPath, cache);
+    Region region = initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     index.setSearchableFields(new String[]{"field"});
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQ();
+    doReturn(null).when(spy).createAEQ(eq(region));
     spy.initialize();
 
-    verify(spy).createAEQ();
+    verify(spy).createAEQ(eq(region));
   }
 
   @Test
@@ -235,14 +225,14 @@ public class LuceneIndexForPartitionedRegionTest {
     String name = "indexName";
     String regionPath = "regionName";
     Cache cache = Fakes.cache();
-    initializeScenario(withPersistence, regionPath, cache);
+    Region region = initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     index.setSearchableFields(new String[]{"field"});
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQ();
+    doReturn(null).when(spy).createAEQ(eq(region));
     spy.initialize();
 
     verify(spy).createChunkRegion(eq(RegionShortcut.PARTITION), eq(index.createFileRegionName()), any(), eq(index.createChunkRegionName()));
@@ -254,14 +244,14 @@ public class LuceneIndexForPartitionedRegionTest {
     String name = "indexName";
     String regionPath = "regionName";
     Cache cache = Fakes.cache();
-    initializeScenario(withPersistence, regionPath, cache);
+    Region region = initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index = new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     index.setSearchableFields(new String[]{"field"});
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQ();
+    doReturn(null).when(spy).createAEQ(eq(region));
     spy.initialize();
 
     verify(spy).createFileRegion(eq(RegionShortcut.PARTITION), eq(index.createFileRegionName()), any());
@@ -309,7 +299,7 @@ public class LuceneIndexForPartitionedRegionTest {
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQWithPersistence();
+    doReturn(null).when(spy).createAEQ(any());
     spy.initialize();
 
     verify(spy).createChunkRegion(eq(RegionShortcut.PARTITION_PERSISTENT), eq(index.createFileRegionName()), any(), eq(index.createChunkRegionName()));
@@ -328,7 +318,7 @@ public class LuceneIndexForPartitionedRegionTest {
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQWithPersistence();
+    doReturn(null).when(spy).createAEQ(any());
     spy.initialize();
 
     verify(spy).createFileRegion(eq(RegionShortcut.PARTITION_PERSISTENT), eq(index.createFileRegionName()), any());
@@ -347,7 +337,7 @@ public class LuceneIndexForPartitionedRegionTest {
     LuceneIndexForPartitionedRegion spy = spy(index);
     doReturn(null).when(spy).createFileRegion(any(), any(), any());
     doReturn(null).when(spy).createChunkRegion(any(), any(), any(), any());
-    doReturn(null).when(spy).createAEQWithPersistence();
+    doReturn(null).when(spy).createAEQ(any());
     spy.initialize();
     spy.initialize();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7908467a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
index 0614e62..975b92f 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
@@ -19,21 +19,30 @@
 package com.gemstone.gemfire.cache.lucene.internal;
 
 import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
 
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 
 import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.lucene.LuceneQuery;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class LuceneQueryFactoryImplJUnitTest {
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
 
   @Test
-  public void test() {
-    Cache cache = Mockito.mock(Cache.class);
+  public void shouldCreateQueryWithCorrectAttributes() {
+    Cache cache = mock(Cache.class);
+    Region region = mock(Region.class);
+    when(cache.getRegion(any())).thenReturn(region);
     LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache);
     f.setPageSize(5);
     f.setResultLimit(25);
@@ -47,4 +56,12 @@ public class LuceneQueryFactoryImplJUnitTest {
     Mockito.verify(cache).getRegion(Mockito.eq("region"));
   }
 
+  @Test
+  public void shouldThrowIllegalArgumentWhenRegionIsMissing() {
+    Cache cache = mock(Cache.class);
+    LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache);
+    thrown.expect(IllegalArgumentException.class);
+    LuceneQuery<Object, Object> query = f.create("index", "region", new StringQueryProvider("test"));
+  }
+
 }


[06/49] incubator-geode git commit: GEODE-1376: Cleaned up server port to be '0'. Cleaned up some legacy code and replaced with cleaner Lambda invocation. Replaced waitOnCriterion with Awaitility.

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
index 9ef87d2..176fbea 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
@@ -16,17 +16,6 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.Assert;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest;
@@ -50,24 +39,31 @@ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
 import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.jayway.awaitility.Awaitility;
+import org.junit.Assert;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 /**
  *
  */
 public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
-  
+
   /**
    * The number of connections that we can be off by in the balancing tests
    * We need this little fudge factor, because the locator can receive an update
    * from the bridge server after it has made incremented its counter for a client
    * connection, but the client hasn't connected yet. This wipes out the estimation
    * on the locator.  This means that we may be slighly off in our balance.
-   * 
+   * <p>
    * TODO grid fix this hole in the locator.
    */
   private static final int ALLOWABLE_ERROR_IN_COUNT = 1;
@@ -78,149 +74,144 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
   }
 
   /**
-   * Test the locator discovers a bridge server and is initialized with 
+   * Test the locator discovers a bridge server and is initialized with
    * the correct load for that bridge server.
    */
   public void testDiscovery() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
-//    vm0.invoke(new SerializableRunnable() {
-//      public void run() {
-//        System.setProperty("gemfire.DistributionAdvisor.VERBOSE", "true");
-//      }
-//    });
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
-    
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
+
     String locators = getLocatorString(host, locatorPort);
-    
-    int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
-    
+
+    int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+
     ServerLoad expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(vm0
         .getHost()), serverPort);
     Map expected = new HashMap();
     expected.put(expectedLocation, expectedLoad);
-    
-    checkLocatorLoad(vm0, expected);
-    
-    int serverPort2 = startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
-    
+
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
+    int serverPort2 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+
     ServerLocation expectedLocation2 = new ServerLocation(NetworkUtils.getServerHostName(vm0
         .getHost()), serverPort2);
-    
+
     expected.put(expectedLocation2, expectedLoad);
-    checkLocatorLoad(vm0, expected);
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
   }
-  
+
   /**
    * Test that the locator will properly estimate the load for servers when
-   * it receives connection requests. 
+   * it receives connection requests.
    */
-  public void testEstimation() throws UnknownHostException, IOException, ClassNotFoundException {
+  public void testEstimation() throws IOException, ClassNotFoundException {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
     String locators = getLocatorString(host, locatorPort);
-    
-    int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
-    
-    ServerLoad expectedLoad = new ServerLoad(2/800f, 1 / 800.0f, 0f, 1f);
+
+    int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+
+    ServerLoad expectedLoad = new ServerLoad(2 / 800f, 1 / 800.0f, 0f, 1f);
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort);
     Map expected = new HashMap();
     expected.put(expectedLocation, expectedLoad);
-    
+
     ClientConnectionResponse response;
     response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress
-        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new ClientConnectionRequest(Collections.EMPTY_SET, null), 10000);
     Assert.assertEquals(expectedLocation, response.getServer());
-    
+
     response = (ClientConnectionResponse) TcpClient.requestToServer(InetAddress
-        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new ClientConnectionRequest(Collections.EMPTY_SET, null), 10000, true);
     Assert.assertEquals(expectedLocation, response.getServer());
-    
+
     //we expect that the connection load load will be 2 * the loadPerConnection
-    checkLocatorLoad(vm0, expected);
-    
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
     QueueConnectionResponse response2;
     response2 = (QueueConnectionResponse) TcpClient.requestToServer(InetAddress
-        .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
+            .getByName(NetworkUtils.getServerHostName(host)), locatorPort,
         new QueueConnectionRequest(null, 2,
             Collections.EMPTY_SET, null, false), 10000, true);
     Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());
-    
+
     response2 = (QueueConnectionResponse) TcpClient
         .requestToServer(InetAddress.getByName(NetworkUtils.getServerHostName(host)),
             locatorPort, new QueueConnectionRequest(null, 5, Collections.EMPTY_SET, null,
                 false), 10000, true);
-    
+
     Assert.assertEquals(Collections.singletonList(expectedLocation), response2.getServers());
 
     //we expect that the queue load will increase by 2
     expectedLoad.setSubscriptionConnectionLoad(2f);
-    checkLocatorLoad(vm0, expected);
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
   }
-  
+
   /**
    * Test to make sure the bridge servers communicate
    * their updated load to the controller when the load
    * on the bridge server changes.
-   * @throws Exception 
+   *
+   * @throws Exception
    */
   public void testLoadMessaging() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
     String locators = getLocatorString(host, locatorPort);
-    
-    final int serverPort = startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
-    
+
+    final int serverPort = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+
     //We expect 0 load
     Map expected = new HashMap();
     ServerLocation expectedLocation = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort);
     ServerLoad expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     expected.put(expectedLocation, expectedLoad);
-    checkLocatorLoad(vm0, expected);
-    
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addServer(NetworkUtils.getServerHostName(host), serverPort);
     pf.setMinConnections(8);
     pf.setMaxConnections(8);
     pf.setSubscriptionEnabled(true);
-    startBridgeClientInVM(vm2, pf.getPoolAttributes(), new String[] {REGION_NAME});
-    
+    vm2.invoke("StartBridgeClient", () -> startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME }));
+
     //We expect 8 client to server connections. The queue requires
     //an additional client to server connection, but that shouldn't show up here.
-    expectedLoad = new ServerLoad(8/800f, 1 / 800.0f, 1f, 1f);
+    expectedLoad = new ServerLoad(8 / 800f, 1 / 800.0f, 1f, 1f);
     expected.put(expectedLocation, expectedLoad);
-    
-    
-    checkLocatorLoad(vm0, expected);
-    
+
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
     stopBridgeMemberVM(vm2);
-    
+
     //Now we expect 0 load
     expectedLoad = new ServerLoad(0f, 1 / 800.0f, 0f, 1f);
     expected.put(expectedLocation, expectedLoad);
-    checkLocatorLoad(vm0, expected);
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
   }
-  
+
   /**
    * Test to make sure that the locator
    * balancing load between two servers.
-   * @throws Exception 
+   *
+   * @throws Exception
    */
   public void testBalancing() throws Exception {
     final Host host = Host.getHost(0);
@@ -228,87 +219,60 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
     String locators = getLocatorString(host, locatorPort);
-    
-    startBridgeServerInVM(vm1, new String[] {"a", "b"},  locators);
-    startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
-    
+
+    vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(80);
     pf.setMaxConnections(80);
     pf.setSubscriptionEnabled(false);
     pf.setIdleTimeout(-1);
-    startBridgeClientInVM(vm3, pf.getPoolAttributes(), new String[] {REGION_NAME});
-    
-    waitForPrefilledConnections(vm3, 80);
-    
-    checkConnectionCount(vm1, 40);
-    checkConnectionCount(vm2, 40);
+    vm3.invoke("StartBridgeClient", () -> startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME }));
+
+    vm3.invoke("waitForPrefilledConnections", () -> waitForPrefilledConnections(80));
+
+    vm1.invoke("check connection count", () -> checkConnectionCount(40));
+    vm2.invoke("check connection count", () -> checkConnectionCount(40));
   }
 
-  private void checkConnectionCount(VM vm, final int count) {
-    SerializableRunnableIF checkConnectionCount = new SerializableRunnable("checkConnectionCount") {
-      public void run() {
-        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-        final CacheServerImpl server = (CacheServerImpl)
-            cache.getCacheServers().get(0);
-        WaitCriterion wc = new WaitCriterion() {
-          String excuse;
-          public boolean done() {
-            int sz = server.getAcceptor().getStats()
-                .getCurrentClientConnections();
-            if (Math.abs(sz - count) <= ALLOWABLE_ERROR_IN_COUNT) {
-              return true;
-            }
-            excuse = "Found " + sz + " connections, expected " + count;
-            return false;
-          }
-          public String description() {
-            return excuse;
-          }
-        };
-        Wait.waitForCriterion(wc, 5 * 60 * 1000, 1000, true);
+  private void checkConnectionCount(final int count) {
+    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+    final CacheServerImpl server = (CacheServerImpl)
+        cache.getCacheServers().get(0);
+    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
+        .timeout(300, TimeUnit.SECONDS).until(() -> {
+      int sz = server.getAcceptor().getStats().getCurrentClientConnections();
+      if (Math.abs(sz - count) <= ALLOWABLE_ERROR_IN_COUNT) {
+        return true;
       }
-    };
-    
-    vm.invoke(checkConnectionCount);
+      System.out.println("Found " + sz + " connections, expected " + count);
+      return false;
+    });
   }
-  
-  private void waitForPrefilledConnections(VM vm, final int count) throws Exception {
-    waitForPrefilledConnections(vm, count, POOL_NAME);
+
+  private void waitForPrefilledConnections(final int count) throws Exception {
+    waitForPrefilledConnections(count, POOL_NAME);
   }
 
-  private void waitForPrefilledConnections(VM vm, final int count, final String poolName) throws Exception {
-    SerializableRunnable runnable = new SerializableRunnable("waitForPrefilledConnections") {
-      public void run() {
-        final PoolImpl pool = (PoolImpl) PoolManager.getAll().get(poolName);
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return pool.getConnectionCount() >= count; 
-          }
-          public String description() {
-            return "connection count never reached " + count;
-          }
-        };
-        Wait.waitForCriterion(ev, MAX_WAIT, 200, true);
-      }
-    };
-    if(vm == null) {
-      runnable.run();
-    } else {
-      vm.invoke(runnable);
-    }
+  private void waitForPrefilledConnections(final int count, final String poolName) throws Exception {
+    final PoolImpl pool = (PoolImpl) PoolManager.getAll().get(poolName);
+    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
+        .timeout(300, TimeUnit.SECONDS).until(() -> pool.getConnectionCount() >= count);
   }
-  
-  /** Test that the locator balances load between
+
+  /**
+   * Test that the locator balances load between
    * three servers with intersecting server groups.
    * Server:    1       2       3
    * Groups:    a       a,b     b
-   * @throws Exception 
+   *
+   * @throws Exception
    */
   public void testIntersectingServerGroups() throws Exception {
     final Host host = Host.getHost(0);
@@ -316,175 +280,158 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
     String locators = getLocatorString(host, locatorPort);
-    
-    int serverPort1 = startBridgeServerInVM(vm1, new String[] {"a"},  locators);
-    startBridgeServerInVM(vm2, new String[] {"a", "b"},  locators);
-    startBridgeServerInVM(vm3, new String[] {"b"},  locators);
-    
+
+    int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a" }, locators));
+    vm2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "a", "b" }, locators));
+    vm3.invoke("Start BridgeServer", () -> startBridgeServer(new String[] { "b" }, locators));
+
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(12);
     pf.setSubscriptionEnabled(false);
     pf.setServerGroup("a");
     pf.setIdleTimeout(-1);
-    startBridgeClientInVM(null, pf.getPoolAttributes(), new String[] {REGION_NAME});
-    waitForPrefilledConnections(null, 12);
-    
-    checkConnectionCount(vm1, 6);
-    checkConnectionCount(vm2, 6);
-    checkConnectionCount(vm3, 0);
-    
+    startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME });
+    waitForPrefilledConnections(12);
+
+    vm1.invoke("Check Connection Count", () -> checkConnectionCount(6));
+    vm2.invoke("Check Connection Count", () -> checkConnectionCount(6));
+    vm3.invoke("Check Connection Count", () -> checkConnectionCount(0));
+
     LogWriterUtils.getLogWriter().info("pool1 prefilled");
-    
+
     PoolFactoryImpl pf2 = (PoolFactoryImpl) PoolManager.createFactory();
     pf2.init(pf.getPoolAttributes());
     pf2.setServerGroup("b");
-    PoolImpl pool2= (PoolImpl) pf2.create("testPool2");
-    waitForPrefilledConnections(null, 12, "testPool2");
+    PoolImpl pool2 = (PoolImpl) pf2.create("testPool2");
+    waitForPrefilledConnections(12, "testPool2");
 
     // The load will not be perfect, because we created all of the connections
     //for group A first.
-    checkConnectionCount(vm1, 6);
-    checkConnectionCount(vm2, 9);
-    checkConnectionCount(vm3, 9);
-    
+    vm1.invoke("Check Connection Count", () -> checkConnectionCount(6));
+    vm2.invoke("Check Connection Count", () -> checkConnectionCount(9));
+    vm3.invoke("Check Connection Count", () -> checkConnectionCount(9));
+
     LogWriterUtils.getLogWriter().info("pool2 prefilled");
-    
+
     ServerLocation location1 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort1);
     PoolImpl pool1 = (PoolImpl) PoolManager.getAll().get(POOL_NAME);
     Assert.assertEquals("a", pool1.getServerGroup());
-    
+
     //Use up all of the pooled connections on pool1, and acquire 3 more
-    for(int i = 0; i < 15; i++) {
+    for (int i = 0; i < 15; i++) {
       pool1.acquireConnection();
     }
-    
+
     LogWriterUtils.getLogWriter().info("aquired 15 connections in pool1");
-    
+
     //now the load should be equal
-    checkConnectionCount(vm1, 9);
-    checkConnectionCount(vm2, 9);
-    checkConnectionCount(vm3, 9);
-    
+    vm1.invoke("Check Connection Count", () -> checkConnectionCount(9));
+    vm2.invoke("Check Connection Count", () -> checkConnectionCount(9));
+    vm3.invoke("Check Connection Count", () -> checkConnectionCount(9));
+
     //use up all of the pooled connections on pool2
-    for(int i = 0; i < 12; i++) {
+    for (int i = 0; i < 12; i++) {
       pool2.acquireConnection();
     }
-    
+
     LogWriterUtils.getLogWriter().info("aquired 12 connections in pool2");
-    
+
     //interleave creating connections in both pools
-    for(int i = 0; i < 6; i++) {
+    for (int i = 0; i < 6; i++) {
       pool1.acquireConnection();
       pool2.acquireConnection();
     }
-    
+
     LogWriterUtils.getLogWriter().info("interleaved 6 connections from pool1 with 6 connections from pool2");
-    
+
     //The load should still be balanced
-    checkConnectionCount(vm1, 13);
-    checkConnectionCount(vm2, 13);
-    checkConnectionCount(vm3, 13);
-    
+    vm1.invoke("Check Connection Count", () -> checkConnectionCount(13));
+    vm2.invoke("Check Connection Count", () -> checkConnectionCount(13));
+    vm3.invoke("Check Connection Count", () -> checkConnectionCount(13));
+
   }
-  
+
   public void testCustomLoadProbe() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
-//    VM vm3 = host.getVM(3);
-    
+    //    VM vm3 = host.getVM(3);
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(vm0, locatorPort, "");
+    vm0.invoke("Start Locator", () -> startLocator(vm0.getHost(), locatorPort, ""));
     String locators = getLocatorString(host, locatorPort);
-    
-    ServerLoad load1= new ServerLoad(.3f, .01f, .44f, 4564f);
-    ServerLoad load2= new ServerLoad(23.2f, 1.1f, 22.3f, .3f);
-    int serverPort1 = startBridgeServerInVM(vm1, null, locators, new String[] {REGION_NAME}, new MyLoadProbe(load1 ));
-    int serverPort2 = startBridgeServerInVM(vm2, null, locators, new String[] {REGION_NAME}, new MyLoadProbe(load2 ));
-    
+
+    final ServerLoad load1 = new ServerLoad(.3f, .01f, .44f, 4564f);
+    final ServerLoad load2 = new ServerLoad(23.2f, 1.1f, 22.3f, .3f);
+    int serverPort1 = vm1.invoke("Start BridgeServer", () -> startBridgeServer(null, locators, new String[] { REGION_NAME }, new MyLoadProbe(load1)));
+    int serverPort2 = vm2.invoke("Start BridgeServer", () -> startBridgeServer(null, locators, new String[] { REGION_NAME }, new MyLoadProbe(load2)));
+
     HashMap expected = new HashMap();
     ServerLocation l1 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort1);
     ServerLocation l2 = new ServerLocation(NetworkUtils.getServerHostName(host), serverPort2);
     expected.put(l1, load1);
     expected.put(l2, load2);
-    checkLocatorLoad(vm0, expected);
-    
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
     load1.setConnectionLoad(25f);
-    changeLoad(vm1, load1);
+    vm1.invoke("changeLoad", () -> changeLoad(load1));
     load2.setSubscriptionConnectionLoad(3.5f);
-    changeLoad(vm2, load2);
-    checkLocatorLoad(vm0, expected);
-    
-    load1 = new ServerLoad(1f, .1f, 0f, 1f);
-    load2 = new ServerLoad(2f, 5f, 0f, 2f);
-    expected.put(l1, load1);
-    expected.put(l2, load2);
-    changeLoad(vm1, load1);
-    changeLoad(vm2, load2);
-    checkLocatorLoad(vm0, expected);
-    
+    vm2.invoke("changeLoad", () -> changeLoad(load2));
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
+    final ServerLoad load1Updated = new ServerLoad(1f, .1f, 0f, 1f);
+    final ServerLoad load2Updated = new ServerLoad(2f, 5f, 0f, 2f);
+    expected.put(l1, load1Updated);
+    expected.put(l2, load2Updated);
+    vm1.invoke("changeLoad", () -> changeLoad(load1Updated));
+    vm2.invoke("changeLoad", () -> changeLoad(load2Updated));
+    vm0.invoke("check Locator Load", () -> checkLocatorLoad(expected));
+
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(NetworkUtils.getServerHostName(host), locatorPort);
     pf.setMinConnections(20);
     pf.setSubscriptionEnabled(true);
     pf.setIdleTimeout(-1);
-    startBridgeClientInVM(null, pf.getPoolAttributes(), new String[] {REGION_NAME});
-    waitForPrefilledConnections(null, 20);
-    
+    startBridgeClient(pf.getPoolAttributes(), new String[] { REGION_NAME });
+    waitForPrefilledConnections(20);
+
     //The first 10 connection should to go vm1, then 1 to vm2, then another 9 to vm1
     //because have unequal values for loadPerConnection
-    checkConnectionCount(vm1, 19);
-    checkConnectionCount(vm2, 1);
+    vm1.invoke("Check Connection Count", () -> checkConnectionCount(19));
+    vm2.invoke("Check Connection Count", () -> checkConnectionCount(1));
   }
-  
-  public void checkLocatorLoad(VM vm, final Map expected) {
-    vm.invoke(new SerializableRunnable() {
-      public void run() {
-        List locators = Locator.getLocators();
-        Assert.assertEquals(1, locators.size());
-        InternalLocator locator = (InternalLocator) locators.get(0);
-        final ServerLocator sl = locator.getServerLocatorAdvisee();
-        InternalLogWriter log = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out);
-        sl.getDistributionAdvisor().dumpProfiles("PROFILES= ");
-        WaitCriterion ev = new WaitCriterion() {
-          public boolean done() {
-            return expected.equals(sl.getLoadMap());
-          }
-          public String description() {
-            return "load map never became equal to " + expected;
-          }
-        };
-        Wait.waitForCriterion(ev, MAX_WAIT, 200, true);
-      }
-    });
+
+  public void checkLocatorLoad(final Map expected) {
+    List locators = Locator.getLocators();
+    Assert.assertEquals(1, locators.size());
+    InternalLocator locator = (InternalLocator) locators.get(0);
+    final ServerLocator sl = locator.getServerLocatorAdvisee();
+    InternalLogWriter log = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out);
+    sl.getDistributionAdvisor().dumpProfiles("PROFILES= ");
+    Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS)
+        .timeout(300, TimeUnit.SECONDS).until(() -> expected.equals(sl.getLoadMap()));
   }
-  
-  private void changeLoad(VM vm, final ServerLoad newLoad) {
-    vm.invoke(new SerializableRunnable() {
-
-      public void run() {
-        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-        CacheServer server = (CacheServer) cache.getCacheServers().get(0);
-        MyLoadProbe probe = (MyLoadProbe) server.getLoadProbe();
-        probe.setLoad(newLoad);
-      }
-      
-    });
+
+  private void changeLoad(final ServerLoad newLoad) {
+    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+    CacheServer server = cache.getCacheServers().get(0);
+    MyLoadProbe probe = (MyLoadProbe) server.getLoadProbe();
+    probe.setLoad(newLoad);
   }
-  
+
   private static class MyLoadProbe extends ServerLoadProbeAdapter implements Serializable {
     private ServerLoad load;
-    
+
     public MyLoadProbe(ServerLoad load) {
       this.load = load;
     }
-    
+
     public ServerLoad getLoad(ServerMetrics metrics) {
       float connectionLoad = load.getConnectionLoad()
           + metrics.getConnectionCount() * load.getLoadPerConnection();
@@ -493,7 +440,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
       return new ServerLoad(connectionLoad, load.getLoadPerConnection(),
           queueLoad, load.getLoadPerSubscriptionConnection());
     }
-    
+
     public void setLoad(ServerLoad load) {
       this.load = load;
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
index 2207e1d..af5ba9c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
@@ -16,52 +16,35 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.server.ServerLoadProbe;
 import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.server.ServerLoadProbe;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.Invoke;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.*;
 
 /**
  *
  */
-public abstract class LocatorTestBase  extends DistributedTestCase {
+public abstract class LocatorTestBase extends DistributedTestCase {
   protected static final String CACHE_KEY = "CACHE";
   protected static final String LOCATOR_KEY = "LOCATOR";
   protected static final String REGION_NAME = "A_REGION";
   protected static final String POOL_NAME = "daPool";
   protected static final Object CALLBACK_KEY = "callback";
-  /** A map for storing temporary objects in a remote VM so that they can be used
+  /**
+   * A map for storing temporary objects in a remote VM so that they can be used
    * between calls. Cleared after each test.
    */
   protected static final HashMap remoteObjects = new HashMap();
@@ -69,264 +52,211 @@ public abstract class LocatorTestBase  extends DistributedTestCase {
   public LocatorTestBase(String name) {
     super(name);
   }
-  
+
   @Override
   public final void preTearDown() throws Exception {
-    
+
     SerializableRunnable tearDown = new SerializableRunnable("tearDown") {
       public void run() {
         Locator locator = (Locator) remoteObjects.get(LOCATOR_KEY);
-        if(locator != null) {
+        if (locator != null) {
           try {
             locator.stop();
-          } catch(Exception e) {
+          } catch (Exception e) {
             //do nothing
           }
         }
-        
+
         Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-        if(cache != null) {
+        if (cache != null) {
           try {
             cache.close();
-          } catch(Exception e) {
+          } catch (Exception e) {
             //do nothing
           }
         }
         remoteObjects.clear();
-        
+
       }
     };
     //We seem to like leaving the DS open if we can for
     //speed, but lets at least destroy our cache and locator.
     Invoke.invokeInEveryVM(tearDown);
     tearDown.run();
-    
+
     postTearDownLocatorTestBase();
   }
-  
+
   protected void postTearDownLocatorTestBase() throws Exception {
   }
-  
-  protected void startLocatorInVM(final VM vm, final int locatorPort, final String otherLocators) {
-    vm.invoke(new SerializableRunnable("Create Locator") {
 
-      final String testName= getUniqueName();
-      public void run() {
-        disconnectFromDS();
-        Properties props = new Properties();
-        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-        props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
-        props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
-        props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
-        try {
-          File logFile = new File(testName + "-locator" + locatorPort
-              + ".log");
-          InetAddress bindAddr = null;
-          try {
-            bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vm.getHost()));
-          } catch (UnknownHostException uhe) {
-            Assert.fail("While resolving bind address ", uhe);
-          }
-          Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
-          remoteObjects.put(LOCATOR_KEY, locator);
-        } catch (IOException ex) {
-          Assert.fail("While starting locator on port " + locatorPort, ex);
-        }
-      }
-    });
+  protected void startLocator(final Host vmHost, final int locatorPort, final String otherLocators) {
+    disconnectFromDS();
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
+    props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+    props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+    File logFile = new File(getUniqueName() + "-locator" + locatorPort + ".log");
+    try {
+      InetAddress bindAddress = InetAddress.getByName(NetworkUtils.getServerHostName(vmHost));
+      Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddress, props);
+      remoteObjects.put(LOCATOR_KEY, locator);
+    } catch (UnknownHostException uhe) {
+      Assert.fail("While resolving bind address ", uhe);
+    } catch (IOException ex) {
+      Assert.fail("While starting locator on port " + locatorPort, ex);
+    }
   }
-  
-  
-  
-  protected void stopLocatorInVM(VM vm) {
-    vm.invoke(new SerializableRunnable("Stop Locator") {
-      public void run() {
-        Locator locator = (Locator) remoteObjects.remove(LOCATOR_KEY);
-        locator.stop();
-      }
-    });
+
+  protected void stopLocator() {
+    Locator locator = (Locator) remoteObjects.remove(LOCATOR_KEY);
+    locator.stop();
   }
-  
-  protected int startBridgeServerInVM(VM vm, String[] groups, String locators) {
-    return startBridgeServerInVM(vm, groups, locators, new String[] {REGION_NAME});
+
+  protected int startBridgeServer(String[] groups, String locators) throws IOException {
+    return startBridgeServer(groups, locators, new String[] { REGION_NAME });
   }
-  
-  protected int addCacheServerInVM(VM vm, final String[] groups) {
-    SerializableCallable connect =
-      new SerializableCallable("Add Bridge server") {
 
-      public Object call() throws Exception {
-        Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
-        CacheServer server = cache.addCacheServer();
-        final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-        server.setPort(serverPort);
-        server.setGroups(groups);
-        server.start();
-        return new Integer(serverPort);
-      }
-    };
-    Integer port = (Integer) vm.invoke(connect);
-    return port.intValue();
+  protected int addCacheServer(final String[] groups) throws IOException {
+    Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
+    CacheServer server = cache.addCacheServer();
+    server.setPort(0);
+    server.setGroups(groups);
+    server.start();
+    return new Integer(server.getPort());
   }
-  
-  protected int startBridgeServerInVM(VM vm, final String[] groups, final String locators, final String[] regions) {
-    return startBridgeServerInVM(vm, groups, locators, regions, CacheServer.DEFAULT_LOAD_PROBE);
+
+  protected int startBridgeServer(final String[] groups, final String locators, final String[] regions) throws IOException {
+    return startBridgeServer(groups, locators, regions, CacheServer.DEFAULT_LOAD_PROBE);
   }
-  
-  protected int startBridgeServerInVM(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
-    SerializableCallable connect =
-      new SerializableCallable("Start bridge server") {
-          public Object call() throws IOException  {
-            Properties props = new Properties();
-            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-            props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-            DistributedSystem ds = getSystem(props);
-            Cache cache = CacheFactory.create(ds);
-            AttributesFactory factory = new AttributesFactory();
-            factory.setScope(Scope.DISTRIBUTED_ACK);
-            factory.setEnableBridgeConflation(true);
-            factory.setDataPolicy(DataPolicy.REPLICATE);
-            RegionAttributes attrs = factory.create();
-            for(int i = 0; i < regions.length; i++) {
-              cache.createRegion(regions[i], attrs);
-            }
-            CacheServer server = cache.addCacheServer();
-            final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-            server.setPort(serverPort);
-            server.setGroups(groups);
-            server.setLoadProbe(probe);
-            server.start();
-            
-            remoteObjects.put(CACHE_KEY, cache);
-            
-            return new Integer(serverPort);
-          }
-        };
-    Integer port = (Integer) vm.invoke(connect);
-    return port.intValue();
+
+  protected int startBridgeServer(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) throws IOException {
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.DISTRIBUTED_ACK);
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attributes = factory.create();
+    for (int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attributes);
+    }
+    CacheServer server = cache.addCacheServer();
+    server.setPort(0);
+    server.setGroups(groups);
+    server.setLoadProbe(probe);
+    server.start();
+
+    remoteObjects.put(CACHE_KEY, cache);
+
+    return new Integer(server.getPort());
   }
-  
-  protected int startBridgeServerWithEmbeddedLocator(VM vm, final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe) {
-    SerializableCallable connect =
-      new SerializableCallable("Start bridge server") {
-          public Object call() throws IOException  {
-            Properties props = new Properties();
-            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-            props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
-            props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
-            DistributedSystem ds = getSystem(props);
-            Cache cache = CacheFactory.create(ds);
-            AttributesFactory factory = new AttributesFactory();
-            factory.setScope(Scope.DISTRIBUTED_ACK);
-            factory.setEnableBridgeConflation(true);
-            factory.setDataPolicy(DataPolicy.REPLICATE);
-            RegionAttributes attrs = factory.create();
-            for(int i = 0; i < regions.length; i++) {
-              cache.createRegion(regions[i], attrs);
-            }
-            CacheServer server = cache.addCacheServer();
-            server.setGroups(groups);
-            server.setLoadProbe(probe);
-            final int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-            server.setPort(serverPort);
-            server.start();
-            
-            remoteObjects.put(CACHE_KEY, cache);
-            
-            return new Integer(serverPort);
-          }
-        };
-    Integer port = (Integer) vm.invoke(connect);
-    return port.intValue();
+
+  protected int startBridgeServerWithEmbeddedLocator(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe)
+      throws IOException {
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.START_LOCATOR_NAME, locators);
+    props.setProperty(DistributionConfig.LOCATORS_NAME, locators);
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.DISTRIBUTED_ACK);
+    factory.setEnableBridgeConflation(true);
+    factory.setDataPolicy(DataPolicy.REPLICATE);
+    RegionAttributes attrs = factory.create();
+    for (int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
+    }
+    CacheServer server = cache.addCacheServer();
+    server.setGroups(groups);
+    server.setLoadProbe(probe);
+    server.setPort(0);
+    server.start();
+
+    remoteObjects.put(CACHE_KEY, cache);
+
+    return new Integer(server.getPort());
   }
-  
-  protected void  startBridgeClientInVM(VM vm, final String group, final String host, final int port) throws Exception {
-    startBridgeClientInVM(vm, group, host, port, new String[] {REGION_NAME});
+
+  protected void startBridgeClient(final String group, final String host, final int port) throws Exception {
+    startBridgeClient(group, host, port, new String[] { REGION_NAME });
   }
-  
 
-  protected void startBridgeClientInVM(VM vm, final String group, final String host, final int port, final String[] regions) throws Exception {
+  protected void startBridgeClient(final String group, final String host, final int port, final String[] regions) throws Exception {
     PoolFactoryImpl pf = new PoolFactoryImpl(null);
     pf.addLocator(host, port)
-    .setServerGroup(group)
-    .setPingInterval(200)
-    .setSubscriptionEnabled(true)
-    .setSubscriptionRedundancy(-1);
-    startBridgeClientInVM(vm, pf.getPoolAttributes(), regions);
+        .setServerGroup(group)
+        .setPingInterval(200)
+        .setSubscriptionEnabled(true)
+        .setSubscriptionRedundancy(-1);
+    startBridgeClient(pf.getPoolAttributes(), regions);
   }
-  
-  protected void  startBridgeClientInVM(VM vm, final Pool pool, final String[] regions) throws Exception {
-    SerializableRunnable connect =
-      new SerializableRunnable("Start bridge client") {
-          public void run() {
-            Properties props = new Properties();
-            props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-            props.setProperty(DistributionConfig.LOCATORS_NAME, "");
-            DistributedSystem ds = getSystem(props);
-            Cache cache = CacheFactory.create(ds);
-            AttributesFactory factory = new AttributesFactory();
-            factory.setScope(Scope.LOCAL);
-//            factory.setEnableBridgeConflation(true);
-//            factory.setDataPolicy(DataPolicy.NORMAL);
-            factory.setPoolName(POOL_NAME);
-            PoolFactoryImpl pf= (PoolFactoryImpl) PoolManager.createFactory();
-            pf.init(pool);
-            LocatorDiscoveryCallback locatorCallback = new MyLocatorCallback();
-            remoteObjects.put(CALLBACK_KEY, locatorCallback);
-            pf.setLocatorDiscoveryCallback(locatorCallback);
-            pf.create(POOL_NAME);
-
-
-            RegionAttributes attrs = factory.create();
-            for(int i = 0; i < regions.length; i++) {
-              cache.createRegion(regions[i], attrs);
-            }
-            
-            remoteObjects.put(CACHE_KEY, cache);
-          }
-    };
-    
-    if(vm == null) {
-      connect.run();
-    } else {
-      vm.invoke(connect);
+
+  protected void startBridgeClient(final Pool pool, final String[] regions) throws Exception {
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, "");
+    DistributedSystem ds = getSystem(props);
+    Cache cache = CacheFactory.create(ds);
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.LOCAL);
+    //            factory.setEnableBridgeConflation(true);
+    //            factory.setDataPolicy(DataPolicy.NORMAL);
+    factory.setPoolName(POOL_NAME);
+    PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
+    pf.init(pool);
+    LocatorDiscoveryCallback locatorCallback = new MyLocatorCallback();
+    remoteObjects.put(CALLBACK_KEY, locatorCallback);
+    pf.setLocatorDiscoveryCallback(locatorCallback);
+    pf.create(POOL_NAME);
+
+    RegionAttributes attrs = factory.create();
+    for (int i = 0; i < regions.length; i++) {
+      cache.createRegion(regions[i], attrs);
     }
+
+    remoteObjects.put(CACHE_KEY, cache);
   }
-  
+
   protected void stopBridgeMemberVM(VM vm) {
-   vm.invoke(new SerializableRunnable("Stop bridge member") {
-    public void run() {
-      Cache cache = (Cache) remoteObjects.remove(CACHE_KEY);
-      cache.close();
-      disconnectFromDS();
-    }
-   });
+    vm.invoke(new SerializableRunnable("Stop bridge member") {
+      public void run() {
+        Cache cache = (Cache) remoteObjects.remove(CACHE_KEY);
+        cache.close();
+        disconnectFromDS();
+      }
+    });
   }
-  
+
   public String getLocatorString(Host host, int locatorPort) {
-    return getLocatorString(host, new int[] {locatorPort});
+    return getLocatorString(host, new int[] { locatorPort });
   }
-  
+
   public String getLocatorString(Host host, int[] locatorPorts) {
     StringBuffer str = new StringBuffer();
-    for(int i = 0; i < locatorPorts.length; i++) {
+    for (int i = 0; i < locatorPorts.length; i++) {
       str.append(NetworkUtils.getServerHostName(host))
           .append("[")
           .append(locatorPorts[i])
           .append("]");
-      if(i < locatorPorts.length - 1) {
+      if (i < locatorPorts.length - 1) {
         str.append(",");
       }
     }
-    
+
     return str.toString();
   }
-  
+
   protected static class MyLocatorCallback extends LocatorDiscoveryCallbackAdapter {
 
     private final Set discoveredLocators = new HashSet();
     private final Set removedLocators = new HashSet();
-    
+
     public synchronized void locatorsDiscovered(List locators) {
       discoveredLocators.addAll(locators);
       notifyAll();
@@ -336,29 +266,29 @@ public abstract class LocatorTestBase  extends DistributedTestCase {
       removedLocators.addAll(locators);
       notifyAll();
     }
-    
+
     public boolean waitForDiscovery(InetSocketAddress locator, long time) throws InterruptedException {
       return waitFor(discoveredLocators, locator, time);
     }
-    
+
     public boolean waitForRemove(InetSocketAddress locator, long time) throws InterruptedException {
       return waitFor(removedLocators, locator, time);
     }
-    
+
     private synchronized boolean waitFor(Set set, InetSocketAddress locator, long time) throws InterruptedException {
       long remaining = time;
       long endTime = System.currentTimeMillis() + time;
-      while(!set.contains(locator) && remaining >= 0) {
+      while (!set.contains(locator) && remaining >= 0) {
         wait(remaining);
-        remaining = endTime - System.currentTimeMillis(); 
+        remaining = endTime - System.currentTimeMillis();
       }
       return set.contains(locator);
     }
-    
+
     public synchronized Set getDiscovered() {
       return new HashSet(discoveredLocators);
     }
-    
+
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
index de43c29..0f08456 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug47667DUnitTest.java
@@ -56,11 +56,11 @@ public class Bug47667DUnitTest extends LocatorTestBase {
 
     final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     final String locatorHost = NetworkUtils.getServerHostName(host);
-    startLocatorInVM(locator, locatorPort, "");
+    locator.invoke("Start Locator",() ->startLocator(locator.getHost(), locatorPort, ""));
 
     String locString = getLocatorString(host, locatorPort);
-    startBridgeServerInVM(server1, new String[] {"R1"}, locString, new String[] {"R1"});
-    startBridgeServerInVM(server2, new String[] {"R2"}, locString, new String[] {"R2"});
+    server1.invoke("Start BridgeServer", () -> startBridgeServer(new String[] {"R1"}, locString, new String[] {"R1"}));
+    server2.invoke("Start BridgeServer", () -> startBridgeServer(new String[] {"R2"}, locString, new String[] {"R2"}));
 
     client.invoke(new SerializableCallable() {
       @Override
@@ -70,15 +70,15 @@ public class Bug47667DUnitTest extends LocatorTestBase {
         ClientCache cache = ccf.create();
         PoolManager.createFactory().addLocator(locatorHost, locatorPort).setServerGroup("R1").create("R1");
         PoolManager.createFactory().addLocator(locatorHost, locatorPort).setServerGroup("R2").create("R2");
-        Region r1 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R1").create("R1");
-        Region r2 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R2").create("R2");
-        CacheTransactionManager mgr = cache.getCacheTransactionManager();
-        mgr.begin();
-        r1.put(1, "value1");
-        mgr.commit();
-        mgr.begin();
-        r2.put(2, "value2");
-        mgr.commit();
+        Region region1 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R1").create("R1");
+        Region region2 = cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).setPoolName("R2").create("R2");
+        CacheTransactionManager transactionManager = cache.getCacheTransactionManager();
+        transactionManager.begin();
+        region1.put(1, "value1");
+        transactionManager.commit();
+        transactionManager.begin();
+        region2.put(2, "value2");
+        transactionManager.commit();
         return null;
       }
     });

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c33efb60/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
index d784397..167cc3a 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java
@@ -16,26 +16,9 @@
  */
 package com.gemstone.gemfire.management;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.Properties;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.client.internal.LocatorTestBase;
-import com.gemstone.gemfire.cache.query.IndexExistsException;
-import com.gemstone.gemfire.cache.query.IndexInvalidException;
-import com.gemstone.gemfire.cache.query.IndexNameConflictException;
-import com.gemstone.gemfire.cache.query.QueryService;
-import com.gemstone.gemfire.cache.query.RegionNotFoundException;
+import com.gemstone.gemfire.cache.query.*;
 import com.gemstone.gemfire.cache.query.cq.dunit.CqQueryDUnitTest;
 import com.gemstone.gemfire.cache.query.internal.cq.CqService;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -46,37 +29,34 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.management.internal.JmxManagerLocatorRequest;
-import com.gemstone.gemfire.management.internal.JmxManagerLocatorResponse;
 import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
 import com.gemstone.gemfire.management.internal.SystemManagementService;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.*;
+
+import javax.management.*;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collections;
+import java.util.Properties;
 
 /**
  * Cache Server related management test cases
- * 
- * 
  */
 public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   private static final long serialVersionUID = 1L;
-  
-  private static int CONNECT_LOCATOR_TIMEOUT_MS = 30000; 
+
+  private static int CONNECT_LOCATOR_TIMEOUT_MS = 30000;
 
   private ManagementTestBase helper;
 
   private static final String queryName = "testClientWithFeederAndCQ_0";
 
   private static final String indexName = "testIndex";
-  
+
   private static MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-  
 
   protected CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest(
       "CqDataDUnitTest");
@@ -84,7 +64,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
   public CacheServerManagementDUnitTest(String name) {
     super(name);
     this.helper = new ManagementTestBase(name);
-    
+
   }
 
   @Override
@@ -98,7 +78,6 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
   }
 
   /**
-   * 
    * @throws Exception
    */
   public void testCacheServerMBean() throws Exception {
@@ -112,12 +91,11 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     helper.startManagingNode(managingNode);
     //helper.createCache(server);
     int serverPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    cqDUnitTest.createServer(server,serverPort);
-    
-   
+    cqDUnitTest.createServer(server, serverPort);
+
     DistributedMember member = helper.getMember(server);
-    
-    verifyCacheServer(server,serverPort);
+
+    verifyCacheServer(server, serverPort);
 
     final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
@@ -145,10 +123,10 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     // Close.
 
     Wait.pause(2000);
-    checkNavigation(managingNode,member,serverPort);
-    verifyIndex(server,serverPort);
+    checkNavigation(managingNode, member, serverPort);
+    verifyIndex(server, serverPort);
     // This will test all CQs and will close the cq in its final step
-    verifyCacheServerRemote(managingNode, member,serverPort);
+    verifyCacheServerRemote(managingNode, member, serverPort);
 
     verifyClosedCQ(server);
 
@@ -162,30 +140,30 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Test for client server connection related management artifacts
-   * like notifications 
+   * like notifications
+   *
    * @throws Exception
    */
-  
+
   public void testCacheClient() throws Exception {
-    
+
     final Host host = Host.getHost(0);
     VM locator = host.getVM(0);
     VM server = host.getVM(1);
     VM client = host.getVM(2);
-    
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocatorInVM(locator, locatorPort, "");
-    
-    String locators = NetworkUtils.getServerHostName(locator.getHost())+ "[" + locatorPort + "]";
-    
-   
-    int serverPort = startBridgeServerInVM(server, null, locators);
-    
-    addClientNotifListener(server,serverPort);
+    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
+
+    String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
+
+    int serverPort = server.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
+
+    addClientNotifListener(server, serverPort);
 
     // Start a client and make sure that proper notification is received
-    startBridgeClientInVM(client, null, NetworkUtils.getServerHostName(locator.getHost()), locatorPort);
-    
+    client.invoke("Start BridgeClient", () -> startBridgeClient(null, NetworkUtils.getServerHostName(locator.getHost()), locatorPort));
+
     //stop the client and make sure the bridge server notifies
     stopBridgeMemberVM(client);
     helper.closeCache(locator);
@@ -193,13 +171,14 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     helper.closeCache(client);
 
   }
-  
+
   /**
    * Intention of this test is to check if a node becomes manager after all the nodes are alive
    * it should have all the information of all  the members.
-   * 
+   * <p>
    * Thats why used  service.getLocalManager().runManagementTaskAdhoc() to make node
    * ready for federation when manager node comes up
+   *
    * @throws Exception
    */
 
@@ -208,96 +187,72 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     final Host host = Host.getHost(0);
     VM locator = host.getVM(0);
     VM server = host.getVM(1);
-    
+
     //Step 1:
     final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    startLocator(locator, locatorPort, "");
+    locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
 
-    String locators = NetworkUtils.getServerHostName(locator.getHost())+ "[" + locatorPort + "]";
-    
-    //Step 2:
-    int serverPort = startBridgeServerInVM(server, null, locators);
-    
-    //Step 3:
-    server.invoke(new SerializableRunnable("Check Server") {
-
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        assertNotNull(cache);
-        SystemManagementService service = (SystemManagementService)ManagementService
-            .getExistingManagementService(cache);
-        assertNotNull(service);
-        assertFalse(service.isManager());
-        assertNotNull(service.getMemberMXBean());
-        service.getLocalManager().runManagementTaskAdhoc();
+    String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
 
+    //Step 2:
+    server.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
 
-      }
+    //Step 3:
+    server.invoke("Check Server", () -> {
+      Cache cache = GemFireCacheImpl.getInstance();
+      assertNotNull(cache);
+      SystemManagementService service = (SystemManagementService) ManagementService
+          .getExistingManagementService(cache);
+      assertNotNull(service);
+      assertFalse(service.isManager());
+      assertNotNull(service.getMemberMXBean());
+      service.getLocalManager().runManagementTaskAdhoc();
     });
-    
-  //Step 4:
-    JmxManagerLocatorResponse locRes = JmxManagerLocatorRequest.send(locator
-        .getHost().getHostName(), locatorPort, CONNECT_LOCATOR_TIMEOUT_MS, Collections.<String, String> emptyMap());
-    
-  //Step 5:
-    locator.invoke(new SerializableRunnable("Check locator") {
 
-      public void run() {
-        Cache cache = GemFireCacheImpl.getInstance();
-        assertNotNull(cache);
-        ManagementService service = ManagementService
-            .getExistingManagementService(cache);
-        assertNotNull(service);
-        assertTrue(service.isManager());
-        LocatorMXBean bean = service.getLocalLocatorMXBean();
-        assertEquals(locatorPort, bean.getPort());
-        DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
-        ObjectName[] names = dsBean.listMemberObjectNames();
-       
-        assertEquals(2,dsBean.listMemberObjectNames().length);
-
-      }
+    //Step 4:
+    JmxManagerLocatorRequest.send(locator
+        .getHost().getHostName(), locatorPort, CONNECT_LOCATOR_TIMEOUT_MS, Collections.<String, String>emptyMap());
+
+    //Step 5:
+    locator.invoke("Check locator", () -> {
+      Cache cache = GemFireCacheImpl.getInstance();
+      assertNotNull(cache);
+      ManagementService service = ManagementService
+          .getExistingManagementService(cache);
+      assertNotNull(service);
+      assertTrue(service.isManager());
+      LocatorMXBean bean = service.getLocalLocatorMXBean();
+      assertEquals(locatorPort, bean.getPort());
+      DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
+
+      assertEquals(2, dsBean.listMemberObjectNames().length);
     });
-    
-
 
     helper.closeCache(locator);
     helper.closeCache(server);
-    
- 
+
   }
-  
-  
-  protected void startLocator(final VM vm, final int locatorPort, final String otherLocators) {
-    vm.invoke(new SerializableRunnable("Create Locator") {
 
-      final String testName= getUniqueName();
-      public void run() {
-        disconnectFromDS();
-        Properties props = new Properties();
-        props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
-        props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
-        props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
-        props.setProperty(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME, "0");
-        props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
-        try {
-          File logFile = new File(testName + "-locator" + locatorPort
-              + ".log");
-          InetAddress bindAddr = null;
-          try {
-            bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vm.getHost()));
-          } catch (UnknownHostException uhe) {
-            Assert.fail("While resolving bind address ", uhe);
-          }
-          Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
-          remoteObjects.put(LOCATOR_KEY, locator);
-        } catch (IOException ex) {
-          Assert.fail("While starting locator on port " + locatorPort, ex);
-        }
-      }
-    });
+  protected void startLocator(Host vmHost, final int locatorPort, final String otherLocators) {
+    disconnectFromDS();
+    Properties props = new Properties();
+    props.setProperty(DistributionConfig.MCAST_PORT_NAME, String.valueOf(0));
+    props.setProperty(DistributionConfig.LOCATORS_NAME, otherLocators);
+    props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
+    props.setProperty(DistributionConfig.JMX_MANAGER_HTTP_PORT_NAME, "0");
+    props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
+    File logFile = new File(getUniqueName() + "-locator" + locatorPort + ".log");
+    try {
+      InetAddress bindAddr = InetAddress.getByName(NetworkUtils.getServerHostName(vmHost));
+      Locator locator = Locator.startLocatorAndDS(locatorPort, logFile, bindAddr, props);
+      remoteObjects.put(LOCATOR_KEY, locator);
+    } catch (UnknownHostException uhe) {
+      Assert.fail("While resolving bind address ", uhe);
+    } catch (IOException ex) {
+      Assert.fail("While starting locator on port " + locatorPort, ex);
+    }
   }
-  
+
   protected void checkNavigation(final VM vm,
       final DistributedMember cacheServerMember, final int serverPort) {
     SerializableRunnable checkNavigation = new SerializableRunnable(
@@ -327,14 +282,14 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     };
     vm.invoke(checkNavigation);
   }
-  
+
   /**
    * Verify the Cache Server details
-   * 
+   *
    * @param vm
    */
   @SuppressWarnings("serial")
-  protected void addClientNotifListener(final VM vm , final int serverPort) throws Exception {
+  protected void addClientNotifListener(final VM vm, final int serverPort) throws Exception {
     SerializableRunnable addClientNotifListener = new SerializableRunnable(
         "Add Client Notif Listener") {
       public void run() {
@@ -359,18 +314,19 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
         TestCacheServerNotif nt = new TestCacheServerNotif();
         try {
           mbeanServer.addNotificationListener(MBeanJMXAdapter
-              .getClientServiceMBeanName(serverPort,cache.getDistributedSystem().getMemberId()), nt, null, null);
+              .getClientServiceMBeanName(serverPort, cache.getDistributedSystem().getMemberId()), nt, null, null);
         } catch (InstanceNotFoundException e) {
           fail("Failed With Exception " + e);
         }
-        
+
       }
     };
     vm.invoke(addClientNotifListener);
   }
+
   /**
    * Verify the closed CQ which is closed from Managing Node
-   * 
+   *
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -405,7 +361,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
           bean.removeIndex(indexName);
         } catch (Exception e) {
           fail("Failed With Exception " + e);
-        
+
         }
         assertEquals(bean.getIndexCount(), 0);
 
@@ -416,7 +372,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Verify the closed CQ which is closed from Managing Node
-   * 
+   *
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -434,11 +390,9 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     vm.invoke(verifyClosedCQ);
   }
 
- 
-
   /**
    * Verify the Cache Server details
-   * 
+   *
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -496,7 +450,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
 
   /**
    * Verify the Cache Server details
-   * 
+   *
    * @param vm
    */
   @SuppressWarnings("serial")
@@ -522,14 +476,14 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
           LogWriterUtils.getLogWriter().info(
               "<ExpectedString> Active Query Count  "
                   + bean.getActiveCQCount() + "</ExpectedString> ");
-          
+
           LogWriterUtils.getLogWriter().info(
               "<ExpectedString> Registered Query Count  "
                   + bean.getRegisteredCQCount() + "</ExpectedString> ");
 
-          assertTrue(bean.showAllClientStats()[0].getClientCQCount() == 1); 
-          int numQueues = bean.getNumSubscriptions(); 
-          assertEquals(numQueues, 1); 
+          assertTrue(bean.showAllClientStats()[0].getClientCQCount() == 1);
+          int numQueues = bean.getNumSubscriptions();
+          assertEquals(numQueues, 1);
           // test for client connection Count
           
           /* @TODO */
@@ -552,11 +506,9 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
     };
     vm.invoke(verifyCacheServerRemote);
   }
-  
+
   /**
    * Notification handler
-   * 
-   * 
    */
   private static class TestCacheServerNotif implements
       NotificationListener {


[38/49] incubator-geode git commit: GEODE-1405: Fixing shouldRecoverPersistentIndexWhenDataStillInQueue

Posted by kl...@apache.org.
GEODE-1405: Fixing shouldRecoverPersistentIndexWhenDataStillInQueue

The changes in 3e8a610e99bc005bcc56c378e3d1e2274a3d468c broke this test.
It just needs to wait for the flush *after* the data region is created.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/09b3c036
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/09b3c036
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/09b3c036

Branch: refs/heads/feature/GEODE-835-test
Commit: 09b3c036e083080306e164a56f6a63f408b40e71
Parents: 3e181e8
Author: Dan Smith <up...@apache.org>
Authored: Tue May 17 11:43:53 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Tue May 17 11:43:53 2016 -0700

----------------------------------------------------------------------
 .../gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/09b3c036/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index fe754a4..ef7f808 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -185,9 +185,9 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
     cache.close();
     createCache();
     createIndex("field1", "field2");
-    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
     dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
       .create(REGION_NAME);
+    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
     LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
       .create(INDEX_NAME, REGION_NAME,
         "field1:world");


[10/49] incubator-geode git commit: GEODE-1350: Provide local fix for Category and Parameterized test issue

Posted by kl...@apache.org.
GEODE-1350: Provide local fix for Category and Parameterized test issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/973c86c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/973c86c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/973c86c7

Branch: refs/heads/feature/GEODE-835-test
Commit: 973c86c7a2706f1737c39ffc4fa2feaf0fc08801
Parents: 819bf65
Author: Jens Deppe <jd...@pivotal.io>
Authored: Wed May 11 08:05:33 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Fri May 13 07:54:30 2016 -0700

----------------------------------------------------------------------
 .../CategoryWithParameterizedRunner.java        |  44 +++++
 .../CategoryWithParameterizedRunnerFactory.java |  42 +++++
 .../junit/runners/ExposedGetAnnotations.java    |  23 +++
 ...egoryWithParameterizedRunnerFactoryTest.java | 161 +++++++++++++++++++
 4 files changed, 270 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/973c86c7/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunner.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunner.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunner.java
new file mode 100644
index 0000000..c96951b
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunner.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.runners;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
+import org.junit.runners.parameterized.TestWithParameters;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CategoryWithParameterizedRunner extends BlockJUnit4ClassRunnerWithParameters implements ExposedGetAnnotations {
+  public CategoryWithParameterizedRunner(TestWithParameters test) throws InitializationError {
+    super(test);
+  }
+
+  @Override
+  public Annotation[] getRunnerAnnotations() {
+    Annotation[] allAnnotations = getTestClass().getAnnotations();
+    List<Annotation> annotationsWithoutRunWith = new ArrayList<>();
+    for (Annotation annotation: allAnnotations) {
+      if (!annotation.annotationType().equals(RunWith.class)) {
+        annotationsWithoutRunWith.add(annotation);
+      }
+    }
+    return annotationsWithoutRunWith.toArray(new Annotation[0]);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/973c86c7/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactory.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactory.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactory.java
new file mode 100644
index 0000000..84882f0
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.runners;
+
+import org.junit.runner.RunWith;
+import org.junit.runner.Runner;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
+import org.junit.runners.parameterized.ParametersRunnerFactory;
+import org.junit.runners.parameterized.TestWithParameters;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class provides an early fix for JUnit issue <a href="https://github.com/junit-team/junit4/issues/751>751</a>.
+ *
+ * Once JUnit 4.13 is released, this class can be removed.
+ *
+ * See also <a href="https://issues.apache.org/jira/browse/GEODE-1350">GEODE-1350</a>
+ */
+public class CategoryWithParameterizedRunnerFactory implements ParametersRunnerFactory {
+  @Override
+  public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError {
+    return new CategoryWithParameterizedRunner(test);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/973c86c7/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/ExposedGetAnnotations.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/ExposedGetAnnotations.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/ExposedGetAnnotations.java
new file mode 100644
index 0000000..f5906f2
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runners/ExposedGetAnnotations.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.runners;
+
+import java.lang.annotation.Annotation;
+
+public interface ExposedGetAnnotations {
+  Annotation[] getRunnerAnnotations();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/973c86c7/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
new file mode 100644
index 0000000..63a579b
--- /dev/null
+++ b/geode-junit/src/test/java/com/gemstone/gemfire/test/junit/runners/CategoryWithParameterizedRunnerFactoryTest.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.junit.runners;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.RunWith;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runners.Parameterized;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
+import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParametersFactory;
+import org.junit.runners.parameterized.TestWithParameters;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class CategoryWithParameterizedRunnerFactoryTest {
+
+  /**
+   * So much hacking in order to expose JUnit internals. I have no words...
+   */
+  public static class ExposedBlockJUnit4ClassRunnerWithParameters extends BlockJUnit4ClassRunnerWithParameters implements ExposedGetAnnotations {
+    public ExposedBlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError {
+      super(test);
+    }
+
+    @Override
+    public Annotation[] getRunnerAnnotations() {
+      return super.getRunnerAnnotations();
+    }
+  }
+
+  public static class ExposedBlockJUnit4ClassRunnerWithParametersFactory extends
+      BlockJUnit4ClassRunnerWithParametersFactory {
+    public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError {
+      return new ExposedBlockJUnit4ClassRunnerWithParameters(test);
+    }
+  }
+
+  public static class ExposedParameterized extends Parameterized {
+    public ExposedParameterized(Class<?> klass) throws Throwable {
+      super(klass);
+    }
+
+    @Override
+    protected List<Runner> getChildren() {
+      return super.getChildren();
+    }
+  }
+
+  @Category(UnitTest.class)
+  @RunWith(ExposedParameterized.class)
+  @Parameterized.UseParametersRunnerFactory(ExposedBlockJUnit4ClassRunnerWithParametersFactory.class)
+  public static class BrokenCategoryClass {
+    @Parameterized.Parameters
+    public static Iterable<String> getParams() {
+      return Arrays.asList("one", "two");
+    }
+
+    @Parameterized.Parameter
+    public String value;
+
+    @Test
+    public void insanity() {
+      assertTrue(true);
+    }
+  }
+
+  @Category(UnitTest.class)
+  @RunWith(ExposedParameterized.class)
+  @Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
+  public static class WorkingCategoryClass {
+    @Parameterized.Parameters
+    public static Iterable<String> getParams() {
+      return Arrays.asList("one", "two");
+    }
+
+    @Parameterized.Parameter
+    public String value;
+
+    @Test
+    public void insanity() {
+      assertTrue(true);
+    }
+  }
+
+  @Test
+  public void testBrokenCategoryAndParameterized() {
+    Request request = Request.aClass(BrokenCategoryClass.class);
+    ExposedParameterized runner = (ExposedParameterized) request.getRunner();
+    request = request.filterWith(new CategoryFilter((ExposedBlockJUnit4ClassRunnerWithParameters) runner.getChildren().get(0)));
+    Result result = new JUnitCore().run(request);
+    assertEquals("Yeah!! This might actually mean we've upgraded to JUnit 4.13. Hurry up already and delete this hack.", 1, result.getRunCount());
+  }
+
+  @Test
+  public void testWorkingCategoryAndParameterized() {
+    Request request = Request.aClass(WorkingCategoryClass.class);
+    ExposedParameterized runner = (ExposedParameterized) request.getRunner();
+    request = request.filterWith(new CategoryFilter((ExposedGetAnnotations) runner.getChildren().get(0)));
+    Result result = new JUnitCore().run(request);
+    assertEquals(2, result.getRunCount());
+  }
+
+  public static class CategoryFilter extends Filter {
+
+    private ExposedGetAnnotations runner;
+
+    public CategoryFilter(ExposedGetAnnotations runner) {
+      this.runner = runner;
+    }
+
+    @Override
+    public boolean shouldRun(Description description) {
+      if (description.getChildren().size() == 0) {
+        return true;
+      }
+
+      List<Annotation> runnerAnnotations = new ArrayList<>();
+      Collections.addAll(runnerAnnotations, runner.getRunnerAnnotations());
+      for (Annotation a : description.getAnnotations()) {
+        if (runnerAnnotations.contains(a)) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    @Override
+    public String describe() {
+      return CategoryFilter.class.getSimpleName();
+    }
+  }
+}


[39/49] incubator-geode git commit: GEODE-11: Split out lucene tests of persistence and off heap

Posted by kl...@apache.org.
GEODE-11: Split out lucene tests of persistence and off heap

Persistence and offheap require some special before and after code to
create and clean up the resources. Splitting these to separate
integration tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8024f33d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8024f33d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8024f33d

Branch: refs/heads/feature/GEODE-835-test
Commit: 8024f33d5687ebbbfda7a0e20375620ff58015d9
Parents: 09b3c03
Author: Dan Smith <up...@apache.org>
Authored: Fri May 13 09:51:43 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Tue May 17 12:11:40 2016 -0700

----------------------------------------------------------------------
 .../LuceneIndexCreationIntegrationTest.java     | 159 ++++---------------
 ...ceneIndexCreationOffHeapIntegrationTest.java |  72 +++++++++
 ...IndexCreationPersistenceIntegrationTest.java | 141 ++++++++++++++++
 .../cache/lucene/LuceneIntegrationTest.java     |  20 ++-
 .../cache/lucene/test/LuceneTestUtilities.java  |  64 ++++++++
 .../gemfire/cache/lucene/test/TestObject.java   |  27 ++++
 .../gemfire/cache/lucene/test/package-info.java |  23 +++
 7 files changed, 365 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index ef7f808..4c28938 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -19,9 +19,9 @@
 
 package com.gemstone.gemfire.cache.lucene;
 
+import static com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities.*;
 import static org.junit.Assert.*;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -36,10 +36,8 @@ import com.gemstone.gemfire.cache.FixedPartitionAttributes;
 import com.gemstone.gemfire.cache.PartitionAttributesFactory;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
-import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexForPartitionedRegion;
-import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities;
+import com.gemstone.gemfire.cache.lucene.test.TestObject;
 import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
@@ -47,14 +45,26 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordTokenizer;
-import org.apache.lucene.queryparser.classic.ParseException;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-
+import org.junit.runner.RunWith;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+/**
+ * Tests of creating lucene indexes on regions. All tests of index creation
+ * use cases should be in classes starting with LuceneIndexCreation*. Most
+ * tests belong in this class, except for:
+ * <ul>
+ * <li> Tests that use persistence are in {@link LuceneIndexCreationPersistenceIntegrationTest}  </li>
+ * <li> Tests that use offheap are in {@link LuceneIndexCreationOffHeapIntegrationTest}  </li>
+ * </ul>
+ */
 @Category(IntegrationTest.class)
+@RunWith(JUnitParamsRunner.class)
 public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
-  public static final String INDEX_NAME = "index";
-  public static final String REGION_NAME = "region";
+
 
   @Test
   public void shouldCreateIndexWriterWithAnalyzersWhenSettingPerFieldAnalyzers()
@@ -70,18 +80,22 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
     Region region = createRegion();
     final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
     region.put("key1", new TestObject());
-    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
+    verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
     assertEquals(analyzers, index.getFieldAnalyzers());
     assertEquals(Arrays.asList("field1"), field1Analyzer.analyzedfields);
     assertEquals(Arrays.asList("field2"), field2Analyzer.analyzedfields);
   }
 
   @Test
-  public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy() {
+  @Parameters({"0", "1", "2"})
+  public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy(int redundancy) {
     createIndex("text");
-    cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).create(REGION_NAME);
+    PartitionAttributesFactory paf = new PartitionAttributesFactory();
+    paf.setRedundantCopies(redundancy);
+
+    cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).setPartitionAttributes(paf.create()).create(REGION_NAME);
     verifyInternalRegions(region -> {
-      assertEquals(1, region.getAttributes().getPartitionAttributes().getRedundantCopies());
+      assertEquals(redundancy, region.getAttributes().getPartitionAttributes().getRedundantCopies());
     });
   }
 
@@ -122,103 +136,6 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
   }
 
   @Test
-  public void shouldNotUseOffHeapForInternalRegionsWhenUserRegionHasOffHeap() {
-    createIndex("text");
-    cache.createRegionFactory(RegionShortcut.PARTITION)
-      .setOffHeap(true)
-      .create(REGION_NAME);
-
-    verifyInternalRegions(region -> {
-      assertEquals(false, region.getOffHeap());
-    });
-  }
-
-  @Test
-  public void shouldNotUseOverflowForInternalRegionsWhenUserRegionHasOverflow() {
-    createIndex("text");
-    cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).create(REGION_NAME);
-    verifyInternalRegions(region -> {
-      assertTrue(region.getAttributes().getEvictionAttributes().getAction().isNone());
-    });
-  }
-
-  @Test
-  public void shouldUseDiskSynchronousWhenUserRegionHasDiskSynchronous() {
-    createIndex("text");
-    cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .setDiskSynchronous(true)
-      .create(REGION_NAME);
-    verifyInternalRegions(region -> {
-      assertTrue(region.getDataPolicy().withPersistence());
-      assertTrue(region.isDiskSynchronous());
-    });
-    AsyncEventQueue queue = getIndexQueue();
-    assertEquals(true, queue.isDiskSynchronous());
-    assertEquals(true, queue.isPersistent());
-  }
-
-  @Test
-  public void shouldUseDiskSyncFalseOnQueueWhenUserRegionHasDiskSynchronousFalse() {
-    createIndex("text");
-    cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .setDiskSynchronous(false)
-      .create(REGION_NAME);
-    verifyInternalRegions(region -> {
-      assertTrue(region.getDataPolicy().withPersistence());
-      assertTrue(region.isDiskSynchronous());
-    });
-    AsyncEventQueue queue = getIndexQueue();
-    assertEquals(false, queue.isDiskSynchronous());
-    assertEquals(true, queue.isPersistent());
-  }
-
-  @Test
-  public void shouldRecoverPersistentIndexWhenDataStillInQueue() throws ParseException, InterruptedException {
-    createIndex("field1", "field2");
-    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .create(REGION_NAME);
-    //Pause the sender so that the entry stays in the queue
-    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue();
-    queue.getSender().pause();
-
-    dataRegion.put("A", new TestObject());
-    cache.close();
-    createCache();
-    createIndex("field1", "field2");
-    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .create(REGION_NAME);
-    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
-    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
-      .create(INDEX_NAME, REGION_NAME,
-        "field1:world");
-    assertEquals(1, query.search().size());
-  }
-
-  private void verifyIndexFinishFlushing(String indexName, String regionName) {
-    LuceneIndex index = luceneService.getIndex(indexName, regionName);
-    boolean flushed = index.waitUntilFlushed(60000);
-    assertTrue(flushed);
-  }
-  
-  @Test
-  public void shouldRecoverPersistentIndexWhenDataIsWrittenToIndex() throws ParseException, InterruptedException {
-    createIndex("field1", "field2");
-    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .create(REGION_NAME);
-    dataRegion.put("A", new TestObject());
-    verifyIndexFinishFlushing(INDEX_NAME, REGION_NAME);
-    cache.close();
-    createCache();
-    createIndex("text");
-    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
-      .create(REGION_NAME);
-    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
-      .create(INDEX_NAME, REGION_NAME,
-      "field1:world");
-    assertEquals(1, query.search().size());
-  }
-
-  @Test
   public void shouldCreateInternalRegionsForIndex() {
     createIndex("field1", "field2");
 
@@ -252,19 +169,7 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
 
 
   private void verifyInternalRegions(Consumer<LocalRegion> verify) {
-    // Get index
-    LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
-
-    // Verify the meta regions exist and are internal
-    LocalRegion chunkRegion = (LocalRegion) cache.getRegion(index.createChunkRegionName());
-    LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
-    verify.accept(chunkRegion);
-    verify.accept(fileRegion);
-  }
-
-  private AsyncEventQueue getIndexQueue() {
-    String aeqId = LuceneServiceImpl.getUniqueIndexName(INDEX_NAME, REGION_NAME);
-    return cache.getAsyncEventQueue(aeqId);
+    LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
   }
 
   private Region createRegion() {
@@ -272,13 +177,7 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
   }
 
   private void createIndex(String ... fieldNames) {
-    LuceneServiceProvider.get(this.cache).createIndex(INDEX_NAME, REGION_NAME, fieldNames);
-  }
-
-  private static class TestObject implements Serializable {
-
-    String field1 = "hello world";
-    String field2 = "this is a field";
+    LuceneTestUtilities.createIndex(cache, fieldNames);
   }
 
   private static class RecordingAnalyzer extends Analyzer {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationOffHeapIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationOffHeapIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationOffHeapIntegrationTest.java
new file mode 100644
index 0000000..8f10c26
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationOffHeapIntegrationTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.gemstone.gemfire.cache.lucene;
+
+import static com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities.*;
+import static org.junit.Assert.assertEquals;
+
+import java.util.function.Consumer;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.offheap.MemoryAllocatorImpl;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * Tests of lucene index creation that use off heap memory
+ */
+@Category(IntegrationTest.class)
+public class LuceneIndexCreationOffHeapIntegrationTest extends LuceneIntegrationTest {
+
+  @Override
+  public void closeCache() {
+    super.closeCache();
+    MemoryAllocatorImpl.freeOffHeapMemory();
+  }
+
+  @Override
+  protected CacheFactory getCacheFactory() {
+    CacheFactory factory = super.getCacheFactory();
+    factory.set("off-heap-memory-size", "100m");
+    return factory;
+  }
+
+  @Test
+  public void shouldNotUseOffHeapForInternalRegionsWhenUserRegionHasOffHeap() {
+    createIndex(cache, "text");
+    cache.createRegionFactory(RegionShortcut.PARTITION)
+      .setOffHeap(true)
+      .create(REGION_NAME);
+
+    verifyInternalRegions(region -> {
+      assertEquals(false, region.getOffHeap());
+    });
+  }
+
+  private void verifyInternalRegions(Consumer<LocalRegion> verify) {
+    LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
new file mode 100644
index 0000000..23983cb
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.gemstone.gemfire.cache.lucene;
+
+import static com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import com.gemstone.gemfire.cache.lucene.test.LuceneTestUtilities;
+import com.gemstone.gemfire.cache.lucene.test.TestObject;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.rules.DiskDirRule;
+import com.jayway.awaitility.Awaitility;
+
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+/**
+ * Tests of lucene index creation that use persistence
+ */
+@Category(IntegrationTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegrationTest {
+
+  @Rule
+  public DiskDirRule diskDirRule = new DiskDirRule();
+
+  public static final String INDEX_NAME = "index";
+  public static final String REGION_NAME = "region";
+
+  @Override
+  public void createCache() {
+    super.createCache();
+    cache.createDiskStoreFactory()
+      .setDiskDirs(new File[] {diskDirRule.get()})
+      .setMaxOplogSize(1)
+      .create(GemFireCacheImpl.getDefaultDiskStoreName());
+  }
+
+  @Test
+  public void shouldNotUseOverflowForInternalRegionsWhenUserRegionHasOverflow() {
+    createIndex(cache, "text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertTrue(region.getAttributes().getEvictionAttributes().getAction().isNone());
+    });
+  }
+
+  @Test
+  @Parameters({"true", "false"})
+  public void shouldUseDiskSynchronousWhenUserRegionHasDiskSynchronous(boolean synchronous) {
+    createIndex(cache, "text");
+    cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .setDiskSynchronous(synchronous)
+      .create(REGION_NAME);
+    verifyInternalRegions(region -> {
+      assertTrue(region.getDataPolicy().withPersistence());
+      //Underlying region should always be synchronous
+      assertTrue(region.isDiskSynchronous());
+    });
+    AsyncEventQueue queue = getIndexQueue(cache);
+    assertEquals(synchronous, queue.isDiskSynchronous());
+    assertEquals(true, queue.isPersistent());
+  }
+
+  @Test
+  public void shouldRecoverPersistentIndexWhenDataStillInQueue() throws ParseException, InterruptedException {
+    createIndex(cache, "field1", "field2");
+    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    //Pause the sender so that the entry stays in the queue
+    final AsyncEventQueueImpl queue = (AsyncEventQueueImpl) getIndexQueue(cache);
+    queue.getSender().pause();
+
+    dataRegion.put("A", new TestObject());
+    cache.close();
+    createCache();
+    createIndex(cache, "field1", "field2");
+    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
+    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
+      .create(INDEX_NAME, REGION_NAME,
+        "field1:world");
+    assertEquals(1, query.search().size());
+  }
+
+  @Test
+  public void shouldRecoverPersistentIndexWhenDataIsWrittenToIndex() throws ParseException, InterruptedException {
+    createIndex(cache, "field1", "field2");
+    Region dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    dataRegion.put("A", new TestObject());
+    verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
+    cache.close();
+    createCache();
+    createIndex(cache, "field1", "field2");
+    dataRegion = cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT)
+      .create(REGION_NAME);
+    LuceneQuery<Object, Object> query = luceneService.createLuceneQueryFactory()
+      .create(INDEX_NAME, REGION_NAME,
+      "field1:world");
+    assertEquals(1, query.search().size());
+  }
+
+  private void verifyInternalRegions(Consumer<LocalRegion> verify) {
+    LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
index 67775d2..c302460 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIntegrationTest.java
@@ -38,28 +38,26 @@ public class LuceneIntegrationTest {
 
   protected Cache cache;
   protected LuceneService luceneService;
-  @Rule
-  public DiskDirRule diskDirRule = new DiskDirRule();
 
   @After
-  public void tearDown() {
+  public void closeCache() {
     if(this.cache != null) {
       this.cache.close();
     }
-    MemoryAllocatorImpl.freeOffHeapMemory();
   }
 
   @Before
   public void createCache() {
+    CacheFactory cf = getCacheFactory();
+    this.cache = cf.create();
+
+    luceneService = LuceneServiceProvider.get(this.cache);
+  }
+
+  protected CacheFactory getCacheFactory() {
     CacheFactory cf = new CacheFactory();
     cf.set("mcast-port", "0");
     cf.set("locators", "");
-    cf.set("off-heap-memory-size", "100m");
-    this.cache = cf.create();
-    cache.createDiskStoreFactory()
-      .setDiskDirs(new File[] {diskDirRule.get()})
-      .setMaxOplogSize(1)
-      .create(GemFireCacheImpl.getDefaultDiskStoreName());
-    luceneService = LuceneServiceProvider.get(this.cache);
+    return cf;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/LuceneTestUtilities.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/LuceneTestUtilities.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/LuceneTestUtilities.java
new file mode 100644
index 0000000..61355c4
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/LuceneTestUtilities.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.function.Consumer;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.LuceneServiceProvider;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexForPartitionedRegion;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+
+public class LuceneTestUtilities {
+  public static final String INDEX_NAME = "index";
+  public static final String REGION_NAME = "region";
+
+  public static void verifyInternalRegions(LuceneService luceneService, Cache cache, Consumer<LocalRegion> verify) {
+    // Get index
+    LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
+
+    // Verify the meta regions exist and are internal
+    LocalRegion chunkRegion = (LocalRegion) cache.getRegion(index.createChunkRegionName());
+    LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
+    verify.accept(chunkRegion);
+    verify.accept(fileRegion);
+  }
+
+  public static AsyncEventQueue getIndexQueue(Cache cache) {
+    String aeqId = LuceneServiceImpl.getUniqueIndexName(INDEX_NAME, REGION_NAME);
+    return cache.getAsyncEventQueue(aeqId);
+  }
+
+  public static void createIndex(Cache cache, String... fieldNames) {
+    LuceneServiceProvider.get(cache).createIndex(INDEX_NAME, REGION_NAME, fieldNames);
+  }
+
+  public static void verifyIndexFinishFlushing(Cache cache, String indexName, String regionName) {
+    LuceneService luceneService = LuceneServiceProvider.get(cache);
+    LuceneIndex index = luceneService.getIndex(indexName, regionName);
+    boolean flushed = index.waitUntilFlushed(60000);
+    assertTrue(flushed);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/TestObject.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/TestObject.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/TestObject.java
new file mode 100644
index 0000000..3287b9f
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/TestObject.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.test;
+
+import java.io.Serializable;
+
+public class TestObject implements Serializable {
+
+  String field1 = "hello world";
+  String field2 = "this is a field";
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8024f33d/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/package-info.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/package-info.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/package-info.java
new file mode 100644
index 0000000..6345804
--- /dev/null
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/test/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Utility classes for testing the lucene functionality.
+ */
+
+package com.gemstone.gemfire.cache.lucene.test;
\ No newline at end of file


[26/49] incubator-geode git commit: GEODE-1390: Disabling broken test

Posted by kl...@apache.org.
GEODE-1390: Disabling broken test


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/08ef0c1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/08ef0c1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/08ef0c1e

Branch: refs/heads/feature/GEODE-835-test
Commit: 08ef0c1ee442d33e2da872a4a5e4bdb120d25817
Parents: 884cf13
Author: Jens Deppe <jd...@pivotal.io>
Authored: Sat May 14 15:14:12 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Sat May 14 15:14:12 2016 -0700

----------------------------------------------------------------------
 .../cli/commands/HelpCommandsJUnitTest.java       | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/08ef0c1e/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
index 7cbe85a..1d81d2e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsJUnitTest.java
@@ -25,7 +25,9 @@ import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.shell.GfshConfig;
 import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -41,8 +43,10 @@ public class HelpCommandsJUnitTest extends JUnit4DistributedTestCase {
 
   private int jmxPort;
 
+  private Gfsh gfsh;
+
   @Before
-  public void setup() {
+  public void setup() throws Exception {
     jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
     Properties localProps = new Properties();
@@ -51,15 +55,22 @@ public class HelpCommandsJUnitTest extends JUnit4DistributedTestCase {
     localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
     getSystem(localProps);
 
+    gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
   }
 
+  @After
+  public void teardown() {
+    disconnectAllFromDS();
+
+    gfsh.executeCommand("disconnect");
+  }
+
+  @Ignore("Disconnect command doesn't appear to be working")
   @Test
   public void testOfflineHelp() throws Exception {
     Properties helpProps = new Properties();
     helpProps.load(HelpCommandsJUnitTest.class.getResourceAsStream("golden-help-offline.properties"));
 
-    Gfsh gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
-
     CommandManager cm = CommandManager.getInstance();
     for (Map.Entry<String, CommandTarget> e : cm.getCommands().entrySet()) {
       // Mock commands may have been produced in the VM by other tests
@@ -88,7 +99,6 @@ public class HelpCommandsJUnitTest extends JUnit4DistributedTestCase {
     Properties helpProps = new Properties();
     helpProps.load(HelpCommandsJUnitTest.class.getResourceAsStream("golden-help-online.properties"));
 
-    Gfsh gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
     gfsh.executeCommand("connect --jmx-manager=localhost[" + jmxPort + "]");
 
     CommandManager cm = CommandManager.getInstance();


[24/49] incubator-geode git commit: GEODE-17: make sure commands tests are run in useHttp mode.

Posted by kl...@apache.org.
GEODE-17: make sure commands tests are run in useHttp mode.

* added the CommandOverHttpDUnitTest in geode-web
* added GfshCommandsOverHttpSecurityTest in geode-web
* move ConnectCommandWithHttpAndSSLDUnitTest to geode-web
* make sure ConnectCommandWithHttpAndSSLDUnitTest is running with the correct connection method
* updated the trusted.keystore with the supported algorithm
* create a SuiteRunner so that we can run tests in a suite yet have them report to its own xml


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c79b64ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c79b64ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c79b64ff

Branch: refs/heads/feature/GEODE-835-test
Commit: c79b64ff41f278ecffe0408cc4478bb6d19d3518
Parents: 97d6172
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue May 10 13:03:41 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 13 14:08:42 2016 -0700

----------------------------------------------------------------------
 .../SharedConfigurationEndToEndDUnitTest.java   |  12 +-
 .../internal/security/shiro/ShiroPrincipal.java |   2 +-
 .../cli/commands/CliCommandTestBase.java        |  47 +--
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  | 305 -------------------
 .../SharedConfigurationCommandsDUnitTest.java   |   8 +-
 .../security/GfshCommandsSecurityTest.java      |   9 +-
 .../src/test/resources/ssl/trusted.keystore     | Bin 1078 -> 2241 bytes
 .../test/junit/runner/SuiteBlockRunner.java     |  46 +++
 .../gemfire/test/junit/runner/SuiteRunner.java  |  53 ++++
 .../ClusterConfigurationDUnitTest.java          |  10 +-
 geode-web/build.gradle                          |  11 +
 .../cli/commands/CommandOverHttpDUnitTest.java  |  58 ++++
 .../ConnectCommandWithHttpAndSSLDUnitTest.java  | 305 +++++++++++++++++++
 .../GfshCommandsOverHttpSecurityTest.java       |  29 ++
 14 files changed, 528 insertions(+), 367 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
index caee9ea..a6221e9 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java
@@ -36,10 +36,6 @@ import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
 
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.RegionShortcut;
@@ -61,6 +57,10 @@ import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 @Category(DistributedTest.class)
 public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
 
@@ -116,7 +116,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
   public void testStartServerAndExecuteCommands() throws Exception {
     final HeadlessGfsh gfsh = new HeadlessGfsh("gfsh2", 300, this.gfshDir);
     assertNotNull(gfsh);
-    shellConnect(jmxHost, jmxPort, httpPort, gfsh);
+    connect(jmxHost, jmxPort, httpPort, gfsh);
 
     serverNames.addAll(startServers(gfsh, locatorString, 2, "Server", 1));
     doCreateCommands();
@@ -380,7 +380,7 @@ public class SharedConfigurationEndToEndDUnitTest extends CliCommandTestBase {
     int jmxPort = (Integer)result[2];
     int httpPort = (Integer)result[3];
 
-    shellConnect(jmxHost, jmxPort, httpPort, gfsh);
+    connect(jmxHost, jmxPort, httpPort, gfsh);
 
     // Create a cache in VM 1
     VM dataMember = getHost(0).getVM(1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/ShiroPrincipal.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/ShiroPrincipal.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/ShiroPrincipal.java
index 8413ebb..621eb87 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/ShiroPrincipal.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/ShiroPrincipal.java
@@ -30,7 +30,7 @@ public class ShiroPrincipal implements Principal {
 
   @Override
   public String getName() {
-    return subject.toString();
+    return subject.getPrincipal().toString();
   }
 
   public Subject getSubject(){

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 4b25165..a0966f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -39,7 +39,6 @@ import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
@@ -57,11 +56,8 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
 
   private transient HeadlessGfsh shell;
 
-  protected boolean useHttpOnConnect = false;
-  protected boolean enableAuth = false;
-  protected String jsonAuthorization = "cacheServer.json";
-  protected String username = "super-user";
-  protected String password = "1234567";
+  public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
+  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
 
   private transient int httpPort;
   private transient int jmxPort;
@@ -107,12 +103,12 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
   @SuppressWarnings("serial")
   protected HeadlessGfsh setUpJmxManagerOnVm0ThenConnect(final Properties props) {
     setUpJMXManagerOnVM(0, props);
-    shellConnect();
+    connect(this.jmxHost, this.jmxPort, this.httpPort, getDefaultShell());
     return shell;
   }
 
   protected void setUpJMXManagerOnVM(int vm, final Properties props) {
-    Object[] result = (Object[]) Host.getHost(0).getVM(vm).invoke("setUpJmxManagerOnVm0ThenConnect", () -> {
+    Object[] result = (Object[]) Host.getHost(0).getVM(vm).invoke("setUpJmxManagerOnVm"+vm, () -> {
       final Object[] results = new Object[3];
       final Properties localProps = (props != null ? props : new Properties());
 
@@ -138,14 +134,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
       localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
       localProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
 
-      if (enableAuth) {
-        localProps.put(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME,
-          JSONAuthorization.class.getName() + ".create");
-        localProps.put(DistributionConfig.SECURITY_CLIENT_ACCESSOR_NAME, JSONAuthorization.class.getName() + ".create");
-
-        JSONAuthorization.setUpWithJsonFile(jsonAuthorization);
-      }
-
       getSystem(localProps);
       verifyManagementServiceStarted(getCache());
 
@@ -214,33 +202,9 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     }
   }
 
-  /**
-   * Connect a shell to the JMX server at the given host and port
-   *
-   *
-   * @param host    Host of the JMX server
-   * @param jmxPort Port of the JMX server
-   * @param shell   Shell to connect
-   */
-  protected void shellConnect(final String host, final int jmxPort, final int httpPort, HeadlessGfsh shell) {
-    assertTrue(host != null);
-    assertTrue(shell != null);
-
-    connect(host, jmxPort, httpPort, shell);
-  }
-
-  protected CommandResult shellConnect(){
-    return connect(this.jmxHost, this.jmxPort, this.httpPort, getDefaultShell());
-  }
-
-  protected CommandResult connect(final String host, final int jmxPort, final int httpPort, HeadlessGfsh shell){
+  protected void connect(final String host, final int jmxPort, final int httpPort, HeadlessGfsh shell){
     final CommandStringBuilder command = new CommandStringBuilder(CliStrings.CONNECT);
 
-    if(enableAuth) {
-      command.addOption(CliStrings.CONNECT__USERNAME, username);
-      command.addOption(CliStrings.CONNECT__PASSWORD, password);
-    }
-
     String endpoint;
     if (useHttpOnConnect) {
       endpoint = "http://" + host + ":" + httpPort + "/gemfire/v1";
@@ -261,7 +225,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
 
     info("Successfully connected to managing node using " + (useHttpOnConnect ? "HTTP" : "JMX"));
     assertEquals(true, shell.isConnectedAndReady());
-    return result;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
deleted file mode 100644
index 2e0897d..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.management.internal.cli.commands;
-
-import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
-import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.util.test.TestUtil.*;
-
-import java.io.File;
-import java.util.Properties;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
-import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-
-/**
- * @since  8.1
- */
-@Category({ DistributedTest.class, SecurityTest.class })
-public class ConnectCommandWithHttpAndSSLDUnitTest extends CliCommandTestBase {
-
-  private static final ThreadLocal<Properties> sslInfoHolder = new ThreadLocal<>();
-
-  private File jks;
-
-  // TODO: should this test use @RunWith(Parameterized.class)?
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    this.jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
-  }
-  
-  @Override
-  protected final void preTearDownCliCommandTestBase() throws Exception {
-    destroyDefaultSetup();
-  }
-  
-  @Override
-  public final void postTearDownCacheTestCase() throws Exception {
-    sslInfoHolder.set(null);
-  }
-
-  @Test
-  public void testMutualAuthentication() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
-    localProps.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__KEY_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__KEY_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "SSL");
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSimpleSSL() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithoutKeyStoreType() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-  
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithSSLProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSv11Protocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testSSLWithTLSv12Protocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Test
-  public void testWithMultipleProtocol() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Ignore("disabled for unknown reason")
-  @Test
-  public void testSSLWithCipherSuite() throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
-
-    //Its bad to hard code here. But using SocketFactory.getDefaultCiphers() somehow is not working with the option 
-    //"https.cipherSuites" which is required to restrict cipher suite with HttpsURLConnection
-    //Keeping the below code for further investigation on different Java versions ( 7 & 8) @TODO
-    
-   /*SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
-    
-    sslContext.init(null, null, new java.security.SecureRandom());
-    String[] cipherSuites = sslContext.getSocketFactory().getSupportedCipherSuites();*/
-    
-    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
-
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Ignore("disabled for unknown reason")
-  @Test
-  public void testSSLWithMultipleCipherSuite() throws Exception {
-    System.setProperty("javax.net.debug", "ssl,handshake,failure");
-    
-    Properties localProps = new Properties();
-    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
-    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
-    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
-    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_EMPTY_RENEGOTIATION_INFO_SCSV");
-    
-    Properties clientProps = new Properties();
-    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
-    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
-    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
-    
-    sslInfoHolder.set(clientProps);
-    setUpJmxManagerOnVm0ThenConnect(localProps);
-  }
-
-  @Override
-  protected void shellConnect(final String host, final int jmxPort, final int httpPort, final HeadlessGfsh shell) {
-    assertNotNull(host);
-    assertNotNull(shell);
-
-    final CommandStringBuilder command = new CommandStringBuilder(CONNECT);
-    String endpoint;
-
-    // This is for testing purpose only. If we remove this piece of code we will
-    // get a java.security.cert.CertificateException
-    // as matching hostname can not be obtained in all test environment.
-    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
-      @Override
-      public boolean verify(String string, SSLSession ssls) {
-        return true;
-      }
-    });
-    
-    endpoint = "https://" + host + ":" + httpPort + "/gemfire/v1";
-    
-    command.addOption(CONNECT__USE_HTTP, Boolean.TRUE.toString());
-    command.addOption(CONNECT__URL, endpoint);
-    command.addOption(CONNECT__USE_SSL,Boolean.TRUE.toString());
-
-    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE) != null){
-      command.addOption(CONNECT__KEY_STORE, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD) != null){
-      command.addOption(CONNECT__KEY_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE) != null){
-      command.addOption(CONNECT__TRUST_STORE, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD) != null){
-      command.addOption(CONNECT__TRUST_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS) != null){
-      command.addOption(CONNECT__SSL_PROTOCOLS, sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS));
-    }
-    if(sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS) != null){
-      command.addOption(CONNECT__SSL_CIPHERS, sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS));
-    }
-
-    CommandResult result = executeCommand(shell, command.toString());
-
-    if (!shell.isConnectedAndReady()) {
-      fail("Connect command failed to connect to manager " + endpoint + " result=" + commandResultToString(result));
-    }
-
-    info("Successfully connected to managing node using HTTPS");
-    assertEquals(true, shell.isConnectedAndReady());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
index 781ed98..334d2e1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/SharedConfigurationCommandsDUnitTest.java
@@ -31,9 +31,6 @@ import java.io.IOException;
 import java.util.Properties;
 import java.util.Set;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.DistributedMember;
@@ -54,6 +51,9 @@ import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 /**
  * DUnit test to test export and import of shared configuration.
  */
@@ -167,7 +167,7 @@ public class SharedConfigurationCommandsDUnitTest extends CliCommandTestBase {
     });
 
     HeadlessGfsh gfsh = getDefaultShell();
-    shellConnect(locator1JmxHost, locator1JmxPort, locator1HttpPort, gfsh);
+    connect(locator1JmxHost, locator1JmxPort, locator1HttpPort, gfsh);
 
     // Create a cache in VM 1
     VM dataMember = getHost(0).getVM(1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
index d96c96c..8eaaf6a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
@@ -39,9 +39,9 @@ import org.junit.experimental.categories.Category;
 
 @Category(IntegrationTest.class)
 public class GfshCommandsSecurityTest {
-  private static int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-  private static int jmxPort = ports[0];
-  private static int httpPort = ports[1];
+  protected static int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+  protected static int jmxPort = ports[0];
+  protected static int httpPort = ports[1];
 
   private HeadlessGfsh gfsh = null;
 
@@ -50,12 +50,13 @@ public class GfshCommandsSecurityTest {
       jmxPort, httpPort, "cacheServer.json");
 
   @Rule
-  public GfshShellConnectionRule gfshConnection = null;
+  public GfshShellConnectionRule gfshConnection;
 
   public GfshCommandsSecurityTest(){
     gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, false);
   }
 
+
   @Before
   public void before(){
     gfsh = gfshConnection.getGfsh();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-core/src/test/resources/ssl/trusted.keystore
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/ssl/trusted.keystore b/geode-core/src/test/resources/ssl/trusted.keystore
old mode 100755
new mode 100644
index 6057e3c..bd75039
Binary files a/geode-core/src/test/resources/ssl/trusted.keystore and b/geode-core/src/test/resources/ssl/trusted.keystore differ

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteBlockRunner.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteBlockRunner.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteBlockRunner.java
new file mode 100644
index 0000000..60fed84
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteBlockRunner.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.test.junit.runner;
+
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * used by SuiteRunner to override the test method name
+ */
+public class SuiteBlockRunner extends BlockJUnit4ClassRunner {
+
+  private Class<?> suiteClass;
+
+  /**
+   * Creates a BlockJUnit4ClassRunner to run {@code klass}
+   * @param klass
+   * @throws InitializationError if the test class is malformed.
+   */
+  public SuiteBlockRunner(final Class parentClass,  final Class<?> klass) throws InitializationError {
+    super(klass);
+    this.suiteClass = parentClass;
+  }
+
+  @Override
+  protected String testName(FrameworkMethod method) {
+    return method.getName()+"@"+ suiteClass.getName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteRunner.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteRunner.java b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteRunner.java
new file mode 100644
index 0000000..2a860c0
--- /dev/null
+++ b/geode-junit/src/main/java/com/gemstone/gemfire/test/junit/runner/SuiteRunner.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.test.junit.runner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.runner.Runner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+/**
+ * SuiteRunner is like Junit Suite, it's used in conjunction with <code>SuiteClass({xx.class, yy.class})</code>
+ * It's different from Suite in two ways:
+ * 1. it should only contain contain Junit4 test classes
+ * 2. the test method names inside each test class are appended with the suiteClass name so that the result will show up different
+ * as when you run these tests alone.
+ */
+public class SuiteRunner extends Suite {
+
+  public SuiteRunner(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
+    super(klass, getRunners(klass));
+  }
+
+  private static List<Runner> getRunners(final Class<?> klass) throws InitializationError{
+    SuiteClasses annotation = klass.getAnnotation(SuiteClasses.class);
+    if (annotation == null) {
+      throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation", klass.getName()));
+    }
+    Class<?>[] childClasses = annotation.value();
+    List<Runner> runners = new ArrayList<>();
+    for(Class childClass:childClasses){
+      runners.add(new SuiteBlockRunner(klass, childClass));
+    }
+    return runners;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
index 62bb793..d8692ce 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/configuration/ClusterConfigurationDUnitTest.java
@@ -40,10 +40,6 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
@@ -80,6 +76,10 @@ import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 @Category(DistributedTest.class)
 public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
 
@@ -663,7 +663,7 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
     int jmxPort = (Integer)result[2];
     int httpPort = (Integer)result[3];
     
-    shellConnect(jmxHost, jmxPort, httpPort, gfsh);
+    connect(jmxHost, jmxPort, httpPort, gfsh);
 
     final String dataMemberWorkingDir = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + dataMember;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-web/build.gradle
----------------------------------------------------------------------
diff --git a/geode-web/build.gradle b/geode-web/build.gradle
index 5bd1d89..228751b 100755
--- a/geode-web/build.gradle
+++ b/geode-web/build.gradle
@@ -52,6 +52,9 @@ dependencies {
   testCompile project(':geode-junit')
   testRuntime project(':geode-common')
   testRuntime project(':geode-core')
+  testCompile files(project(':geode-core').sourceSets.test.output)
+
+  testRuntime files(war.destinationDir)
 }
 
 //Remove the gradle output directories from the eclipse classpath. These
@@ -69,6 +72,14 @@ idea.module.iml {
   }
 }
 
+distributedTest {
+  dependsOn ':geode-core:webJar', 'war'
+}
+
+integrationTest {
+  dependsOn ':geode-core:webJar', 'war'
+}
+
 war {
   classpath configurations.runtime 
   classpath project(':geode-core').webJar.archivePath

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
new file mode 100644
index 0000000..9687eb7
--- /dev/null
+++ b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.management.internal.cli.commands;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.runner.SuiteRunner;
+
+import org.junit.ClassRule;
+import org.junit.contrib.java.lang.system.ProvideSystemProperty;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@Category(DistributedTest.class)
+@RunWith(SuiteRunner.class)
+@Suite.SuiteClasses({
+  ConfigCommandsDUnitTest.class,
+  DeployCommandsDUnitTest.class,
+  DiskStoreCommandsDUnitTest.class,
+  FunctionCommandsDUnitTest.class,
+  GemfireDataCommandsDUnitTest.class,
+  GetCommandOnRegionWithCacheLoaderDuringCacheMissDUnitTest.class,
+  IndexCommandsDUnitTest.class,
+  ListAndDescribeDiskStoreCommandsDUnitTest.class,
+  ListIndexCommandDUnitTest.class,
+  MemberCommandsDUnitTest.class,
+  MiscellaneousCommandsDUnitTest.class,
+  MiscellaneousCommandsExportLogsPart1DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart2DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart3DUnitTest.class,
+  MiscellaneousCommandsExportLogsPart4DUnitTest.class,
+  QueueCommandsDUnitTest.class,
+  SharedConfigurationCommandsDUnitTest.class,
+  ShellCommandsDUnitTest.class,
+  ShowDeadlockDUnitTest.class,
+  ShowMetricsDUnitTest.class,
+  ShowStackTraceDUnitTest.class,
+  UserCommandsDUnitTest.class
+})
+public class CommandOverHttpDUnitTest {
+  @ClassRule
+  public static ProvideSystemProperty provideSystemProperty = new ProvideSystemProperty(CliCommandTestBase.USE_HTTP_SYSTEM_PROPERTY, "true");
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
new file mode 100644
index 0000000..a8f209b
--- /dev/null
+++ b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ConnectCommandWithHttpAndSSLDUnitTest.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management.internal.cli.commands;
+
+import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
+import static com.gemstone.gemfire.management.internal.cli.i18n.CliStrings.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.util.test.TestUtil.*;
+
+import java.io.File;
+import java.util.Properties;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
+import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
+import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/**
+ * @since  8.1
+ */
+@Category({ DistributedTest.class, SecurityTest.class })
+public class ConnectCommandWithHttpAndSSLDUnitTest extends CliCommandTestBase {
+
+  private static final ThreadLocal<Properties> sslInfoHolder = new ThreadLocal<>();
+
+  private File jks;
+
+  // TODO: should this test use @RunWith(Parameterized.class)?
+
+  @Override
+  public final void postSetUpCliCommandTestBase() throws Exception {
+    this.jks = new File(getResourcePath(getClass(), "/ssl/trusted.keystore"));
+  }
+  
+  @Override
+  protected final void preTearDownCliCommandTestBase() throws Exception {
+    destroyDefaultSetup();
+  }
+  
+  @Override
+  public final void postTearDownCacheTestCase() throws Exception {
+    sslInfoHolder.set(null);
+  }
+
+  @Test
+  public void testMutualAuthentication() throws Exception {
+    Properties serverProps = new Properties();
+    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
+    serverProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "SSL");
+    serverProps.setProperty(HTTP_SERVICE_SSL_REQUIRE_AUTHENTICATION_NAME, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_NAME, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD_NAME, "password");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__KEY_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__KEY_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "SSL");
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(serverProps);
+  }
+
+  @Test
+  public void testSimpleSSL() throws Exception {
+    Properties serverProps = new Properties();
+    serverProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    serverProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_TYPE_NAME, "JKS");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(serverProps);
+  }
+
+  @Test
+  public void testSSLWithoutKeyStoreType() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+  
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithSSLProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLS");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSv11Protocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.1");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testSSLWithTLSv12Protocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Test
+  public void testWithMultipleProtocol() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"SSL,TLSv1.2");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Ignore("disabled for unknown reason")
+  @Test
+  public void testSSLWithCipherSuite() throws Exception {
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME, "TLSv1.2");
+
+    //Its bad to hard code here. But using SocketFactory.getDefaultCiphers() somehow is not working with the option 
+    //"https.cipherSuites" which is required to restrict cipher suite with HttpsURLConnection
+    //Keeping the below code for further investigation on different Java versions ( 7 & 8) @TODO
+    
+   /*SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
+    
+    sslContext.init(null, null, new java.security.SecureRandom());
+    String[] cipherSuites = sslContext.getSocketFactory().getSupportedCipherSuites();*/
+    
+    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_CIPHERS, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Ignore("disabled for unknown reason")
+  @Test
+  public void testSSLWithMultipleCipherSuite() throws Exception {
+    System.setProperty("javax.net.debug", "ssl,handshake,failure");
+    
+    Properties localProps = new Properties();
+    localProps.setProperty(HTTP_SERVICE_SSL_ENABLED_NAME, "true");
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_NAME, jks.getCanonicalPath());
+    localProps.setProperty(HTTP_SERVICE_SSL_KEYSTORE_PASSWORD_NAME, "password");
+    localProps.setProperty(HTTP_SERVICE_SSL_PROTOCOLS_NAME,"TLSv1.2");
+    localProps.setProperty(HTTP_SERVICE_SSL_CIPHERS_NAME,"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_EMPTY_RENEGOTIATION_INFO_SCSV");
+    
+    Properties clientProps = new Properties();
+    clientProps.setProperty(CONNECT__TRUST_STORE, jks.getCanonicalPath());
+    clientProps.setProperty(CONNECT__TRUST_STORE_PASSWORD, "password");
+    clientProps.setProperty(CONNECT__SSL_PROTOCOLS, "TLSv1.2");
+    
+    sslInfoHolder.set(clientProps);
+    setUpJmxManagerOnVm0ThenConnect(localProps);
+  }
+
+  @Override
+  protected void connect(final String host, final int jmxPort, final int httpPort, final HeadlessGfsh shell) {
+    assertNotNull(host);
+    assertNotNull(shell);
+
+    final CommandStringBuilder command = new CommandStringBuilder(CONNECT);
+    String endpoint;
+
+    // This is for testing purpose only. If we remove this piece of code we will
+    // get a java.security.cert.CertificateException
+    // as matching hostname can not be obtained in all test environment.
+    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
+      @Override
+      public boolean verify(String string, SSLSession ssls) {
+        return true;
+      }
+    });
+    
+    endpoint = "https://" + host + ":" + httpPort + "/gemfire/v1";
+    
+    command.addOption(CONNECT__USE_HTTP, Boolean.TRUE.toString());
+    command.addOption(CONNECT__URL, endpoint);
+    command.addOption(CONNECT__USE_SSL,Boolean.TRUE.toString());
+
+    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE) != null){
+      command.addOption(CONNECT__KEY_STORE, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD) != null){
+      command.addOption(CONNECT__KEY_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__KEY_STORE_PASSWORD));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE) != null){
+      command.addOption(CONNECT__TRUST_STORE, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD) != null){
+      command.addOption(CONNECT__TRUST_STORE_PASSWORD, sslInfoHolder.get().getProperty(CONNECT__TRUST_STORE_PASSWORD));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS) != null){
+      command.addOption(CONNECT__SSL_PROTOCOLS, sslInfoHolder.get().getProperty(CONNECT__SSL_PROTOCOLS));
+    }
+    if(sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS) != null){
+      command.addOption(CONNECT__SSL_CIPHERS, sslInfoHolder.get().getProperty(CONNECT__SSL_CIPHERS));
+    }
+
+    CommandResult result = executeCommand(shell, command.toString());
+
+    if (!shell.isConnectedAndReady()) {
+      fail("Connect command failed to connect to manager " + endpoint + " result=" + commandResultToString(result));
+    }
+
+    info("Successfully connected to managing node using HTTPS");
+    assertEquals(true, shell.isConnectedAndReady());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c79b64ff/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
new file mode 100644
index 0000000..af0cfad
--- /dev/null
+++ b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsOverHttpSecurityTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.management.internal.security;
+
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+import org.junit.experimental.categories.Category;
+
+@Category(IntegrationTest.class)
+public class GfshCommandsOverHttpSecurityTest extends GfshCommandsSecurityTest {
+  public GfshCommandsOverHttpSecurityTest(){
+    gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, true);
+  }
+}