You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/04/21 23:41:57 UTC

[01/51] [abbrv] geode git commit: GEODE-2777 Update docs to be for Geode version 1.2 [Forced Update!]

Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2097 578580afc -> ead905cfe (forced update)


http://git-wip-us.apache.org/repos/asf/geode/blob/15250979/geode-book/redirects.rb
----------------------------------------------------------------------
diff --git a/geode-book/redirects.rb b/geode-book/redirects.rb
index 52eb357..1329716 100644
--- a/geode-book/redirects.rb
+++ b/geode-book/redirects.rb
@@ -15,5 +15,6 @@
 
 r301 %r{/releases/latest/javadoc/(.*)}, 'http://geode.apache.org/releases/latest/javadoc/$1'
 r302 '/index-10.html', 'http://geode.apache.org/docs/guide/10/about_geode.html'
-rewrite '/', '/docs/guide/11/about_geode.html'
-rewrite '/index.html', '/docs/guide/11/about_geode.html'
+r302 '/index-11.html', 'http://geode.apache.org/docs/guide/11/about_geode.html'
+rewrite '/', '/docs/guide/12/about_geode.html'
+rewrite '/index.html', '/docs/guide/12/about_geode.html'


[47/51] [abbrv] geode git commit: GEODE-2632: refactor code to use InternalCache instead of GemFireCacheImpl

Posted by ds...@apache.org.
GEODE-2632: refactor code to use InternalCache instead of GemFireCacheImpl

* minor cleanup also


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

Branch: refs/heads/feature/GEODE-2097
Commit: 363e50d213d763f4cca6e0744b206941a4f2d52c
Parents: 0862174
Author: Kirk Lund <kl...@apache.org>
Authored: Wed Apr 19 14:41:42 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Apr 21 13:45:22 2017 -0700

----------------------------------------------------------------------
 .../query/internal/cq/CqServiceProvider.java    |  22 +-
 .../query/internal/cq/spi/CqServiceFactory.java |   8 +-
 .../cache/query/internal/cq/ClientCQImpl.java   |  95 +--
 .../cache/query/internal/cq/CqQueryImpl.java    |  91 ++-
 .../query/internal/cq/CqServiceFactoryImpl.java |  17 +-
 .../cache/query/internal/cq/CqServiceImpl.java  | 673 ++++---------------
 .../internal/cq/CqServiceStatisticsImpl.java    |  21 +-
 .../query/internal/cq/CqServiceVsdStats.java    |  73 +-
 .../cache/query/internal/cq/ServerCQImpl.java   | 121 +---
 .../cache/tier/sockets/command/ExecuteCQ.java   |   4 +-
 .../cache/tier/sockets/command/ExecuteCQ61.java |   4 +-
 .../tier/sockets/command/GetDurableCQs.java     |   4 +-
 .../cache/query/cq/dunit/CqStatsDUnitTest.java  |  44 +-
 .../cq/dunit/CqStatsUsingPoolDUnitTest.java     |  47 +-
 .../TopEntriesFunctionCollector.java            |  22 +-
 .../LuceneQueryFunctionJUnitTest.java           |  54 +-
 .../TopEntriesCollectorJUnitTest.java           |  23 +-
 .../TopEntriesFunctionCollectorJUnitTest.java   |  48 +-
 .../distributed/TopEntriesJUnitTest.java        |  44 +-
 .../cache/lucene/test/LuceneTestUtilities.java  |  16 +
 20 files changed, 442 insertions(+), 989 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceProvider.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceProvider.java
index cded9c3..90fbf4b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceProvider.java
@@ -16,7 +16,7 @@ package org.apache.geode.cache.query.internal.cq;
 
 import org.apache.geode.cache.query.internal.cq.spi.CqServiceFactory;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 
 import java.io.DataInput;
 import java.io.IOException;
@@ -26,17 +26,19 @@ import java.util.ServiceLoader;
 public class CqServiceProvider {
 
   private static final CqServiceFactory factory;
-  // System property to maintain the CQ event references for optimizing the updates.
-  // This will allows to run the CQ query only once during update events.
+
+  /**
+   * System property to maintain the CQ event references for optimizing the updates. This will allow
+   * running the CQ query only once during update events.
+   */
   public static boolean MAINTAIN_KEYS = Boolean
-      .valueOf(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "cq.MAINTAIN_KEYS", "true"))
-      .booleanValue();
+      .valueOf(System.getProperty(DistributionConfig.GEMFIRE_PREFIX + "cq.MAINTAIN_KEYS", "true"));
+
   /**
    * A debug flag used for testing vMotion during CQ registration
    */
   public static boolean VMOTION_DURING_CQ_REGISTRATION_FLAG = false;
 
-
   static {
     ServiceLoader<CqServiceFactory> loader = ServiceLoader.load(CqServiceFactory.class);
     Iterator<CqServiceFactory> itr = loader.iterator();
@@ -48,8 +50,7 @@ public class CqServiceProvider {
     }
   }
 
-  public static CqService create(GemFireCacheImpl cache) {
-
+  public static CqService create(InternalCache cache) {
     if (factory == null) {
       return new MissingCqService();
     }
@@ -63,10 +64,7 @@ public class CqServiceProvider {
     } else {
       return factory.readCqQuery(in);
     }
-
   }
 
-  private CqServiceProvider() {
-
-  }
+  private CqServiceProvider() {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/spi/CqServiceFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/spi/CqServiceFactory.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/spi/CqServiceFactory.java
index 68ebbd5..2b8a47e 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/spi/CqServiceFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/cq/spi/CqServiceFactory.java
@@ -19,16 +19,16 @@ import java.io.IOException;
 
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.ServerCQ;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 
 public interface CqServiceFactory {
 
-  public void initialize();
+  void initialize();
 
   /**
    * Create a new CqService for the given cache
    */
-  public CqService create(GemFireCacheImpl cache);
+  CqService create(InternalCache cache);
 
-  public ServerCQ readCqQuery(DataInput in) throws ClassNotFoundException, IOException;
+  ServerCQ readCqQuery(DataInput in) throws ClassNotFoundException, IOException;
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ClientCQImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ClientCQImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ClientCQImpl.java
index 00a0aa5..111bf84 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ClientCQImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ClientCQImpl.java
@@ -35,7 +35,7 @@ import org.apache.geode.cache.query.CqResults;
 import org.apache.geode.cache.query.CqStatusListener;
 import org.apache.geode.cache.query.RegionNotFoundException;
 import org.apache.geode.cache.query.internal.CqStateImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
@@ -57,7 +57,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
    */
   private volatile ConcurrentLinkedQueue<CqEventImpl> queuedEvents = null;
 
-  public final Object queuedEventsSynchObject = new Object();
+  final Object queuedEventsSynchObject = new Object();
 
   private boolean connected = false;
 
@@ -73,22 +73,15 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
     return this.cqName;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#getCQProxy()
-   */
-  public ServerCQProxyImpl getCQProxy() {
+  ServerCQProxyImpl getCQProxy() {
     return this.cqProxy;
   }
 
   /**
    * Initializes the connection using the pool from the client region. Also sets the cqBaseRegion
    * value of this CQ.
-   * 
-   * @throws CqException
    */
-  public void initConnectionProxy() throws CqException, RegionNotFoundException {
+  private void initConnectionProxy() throws CqException, RegionNotFoundException {
     cqBaseRegion = (LocalRegion) cqService.getCache().getRegion(regionName);
     // Check if the region exists on the local cache.
     // In the current implementation of 5.1 the Server Connection is (ConnectionProxyImpl)
@@ -113,17 +106,9 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
       throw new CqException(
           "Unable to get the connection pool. The Region does not have a pool configured.");
     }
-
-    // if (proxy == null) {
-    // throw new
-    // CqException(LocalizedStrings.CqQueryImpl_UNABLE_TO_GET_THE_CONNECTIONPROXY_THE_REGION_MAY_NOT_HAVE_A_BRIDGEWRITER_OR_BRIDGECLIENT_INSTALLED_ON_IT.toLocalizedString());
-    // } else if(!proxy.getEstablishCallbackConnection()){
-    // throw new
-    // CqException(LocalizedStrings.CqQueryImpl_THE_ESTABLISHCALLBACKCONNECTION_ON_BRIDGEWRITER_CLIENT_INSTALLED_ON_REGION_0_IS_SET_TO_FALSE
-    // .toLocalizedString(regionName));
-    // }
   }
 
+  @Override
   public void close() throws CqClosedException, CqException {
     this.close(true);
   }
@@ -182,15 +167,15 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
       if (cqProxy == null || !sendRequestToServer || isClosed) {
         // Stat update.
         if (stateBeforeClosing == CqStateImpl.RUNNING) {
-          cqService.stats.decCqsActive();
+          cqService.stats().decCqsActive();
         } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-          cqService.stats.decCqsStopped();
+          cqService.stats().decCqsStopped();
         }
 
         // Set the state to close, and update stats
         this.cqState.setState(CqStateImpl.CLOSED);
-        cqService.stats.incCqsClosed();
-        cqService.stats.decCqsOnClient();
+        cqService.stats().incCqsClosed();
+        cqService.stats().decCqsOnClient();
         if (this.stats != null)
           this.stats.close();
       } else {
@@ -201,7 +186,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
         if (exception != null) {
           throw new CqException(
               LocalizedStrings.CqQueryImpl_FAILED_TO_CLOSE_THE_CQ_CQNAME_0_ERROR_FROM_LAST_ENDPOINT_1
-                  .toLocalizedString(new Object[] {this.cqName, exception.getLocalizedMessage()}),
+                  .toLocalizedString(this.cqName, exception.getLocalizedMessage()),
               exception.getCause());
         } else {
           throw new CqException(
@@ -261,31 +246,28 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
 
   /**
    * Clears the resource used by CQ.
-   * 
-   * @throws CqException
    */
+  @Override
   protected void cleanup() throws CqException {
     this.cqService.removeFromBaseRegionToCqNameMap(this.regionName, this.getServerCqName());
   }
 
+  @Override
   public CqAttributes getCqAttributes() {
     return cqAttributes;
   }
 
-
-
   /**
    * @return Returns the cqListeners.
    */
   public CqListener[] getCqListeners() {
-
     return cqAttributes.getCqListeners();
   }
 
-
   /**
    * Start or resume executing the query.
    */
+  @Override
   public void execute() throws CqClosedException, RegionNotFoundException, CqException {
     executeCqOnRedundantsAndPrimary(false);
   }
@@ -293,7 +275,8 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
   /**
    * Start or resume executing the query. Gets or updates the CQ results and returns them.
    */
-  public CqResults executeWithInitialResults()
+  @Override
+  public <E> CqResults<E> executeWithInitialResults()
       throws CqClosedException, RegionNotFoundException, CqException {
 
     synchronized (queuedEventsSynchObject) {
@@ -320,16 +303,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
     CqResults initialResults;
     try {
       initialResults = (CqResults) executeCqOnRedundantsAndPrimary(true);
-    } catch (CqClosedException e) {
-      queuedEvents = null;
-      throw e;
-    } catch (RegionNotFoundException e) {
-      queuedEvents = null;
-      throw e;
-    } catch (CqException e) {
-      queuedEvents = null;
-      throw e;
-    } catch (RuntimeException e) {
+    } catch (RegionNotFoundException | CqException | RuntimeException e) {
       queuedEvents = null;
       throw e;
     }
@@ -343,6 +317,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
         if (!this.queuedEvents.isEmpty()) {
           try {
             Runnable r = new Runnable() {
+              @Override
               public void run() {
                 Object[] eventArray = null;
                 if (CqQueryImpl.testHook != null) {
@@ -395,7 +370,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
    * @param executeWithInitialResults boolean
    * @return Object SelectResults in case of executeWithInitialResults
    */
-  public Object executeCqOnRedundantsAndPrimary(boolean executeWithInitialResults)
+  private Object executeCqOnRedundantsAndPrimary(boolean executeWithInitialResults)
       throws CqClosedException, RegionNotFoundException, CqException {
 
     Object initialResults = null;
@@ -461,8 +436,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
           } else {
             String errMsg =
                 LocalizedStrings.CqQueryImpl_FAILED_TO_EXECUTE_THE_CQ_CQNAME_0_QUERY_STRING_IS_1_ERROR_FROM_LAST_SERVER_2
-                    .toLocalizedString(
-                        new Object[] {this.cqName, this.queryString, ex.getLocalizedMessage()});
+                    .toLocalizedString(this.cqName, this.queryString, ex.getLocalizedMessage());
             if (logger.isDebugEnabled()) {
               logger.debug(errMsg, ex);
             }
@@ -498,8 +472,8 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
       }
     }
     // Update CQ-base region for book keeping.
-    this.cqService.stats.incCqsActive();
-    this.cqService.stats.decCqsStopped();
+    this.cqService.stats().incCqsActive();
+    this.cqService.stats().decCqsStopped();
     return initialResults;
   }
 
@@ -509,23 +483,22 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
    * @return true if shutdown in progress else false.
    */
   private boolean shutdownInProgress() {
-    GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+    InternalCache cache = cqService.getInternalCache();
     if (cache == null || cache.isClosed()) {
       return true; // bail, things are shutting down
     }
 
-
     String reason = cqProxy.getPool().getCancelCriterion().cancelInProgress();
     if (reason != null) {
       return true;
     }
     return false;
-
   }
 
   /**
    * Stop or pause executing the query.
    */
+  @Override
   public void stop() throws CqClosedException, CqException {
     boolean isStopped = false;
     synchronized (this.cqState) {
@@ -558,8 +531,8 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
       if (cqProxy == null || isStopped) {
         // Change state and stats on the client side
         this.cqState.setState(CqStateImpl.STOPPED);
-        this.cqService.stats.incCqsStopped();
-        this.cqService.stats.decCqsActive();
+        this.cqService.stats().incCqsStopped();
+        this.cqService.stats().decCqsActive();
         if (logger.isDebugEnabled()) {
           logger.debug("Successfully stopped the CQ. {}", cqName);
         }
@@ -568,7 +541,7 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
         if (exception != null) {
           throw new CqException(
               LocalizedStrings.CqQueryImpl_FAILED_TO_STOP_THE_CQ_CQNAME_0_ERROR_FROM_LAST_SERVER_1
-                  .toLocalizedString(new Object[] {this.cqName, exception.getLocalizedMessage()}),
+                  .toLocalizedString(this.cqName, exception.getLocalizedMessage()),
               exception.getCause());
         } else {
           throw new CqException(
@@ -579,24 +552,15 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
     }
   }
 
+  @Override
   public CqAttributesMutator getCqAttributesMutator() {
     return (CqAttributesMutator) this.cqAttributes;
   }
 
-
-  public ConcurrentLinkedQueue<CqEventImpl> getQueuedEvents() {
+  ConcurrentLinkedQueue<CqEventImpl> getQueuedEvents() {
     return this.queuedEvents;
   }
 
-
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqQuery2#setProxyCache(org.apache.geode.cache.
-   * client.internal.ProxyCache)
-   */
   @Override
   public void setProxyCache(ProxyCache proxyCache) {
     this.proxyCache = proxyCache;
@@ -612,7 +576,6 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
 
   @Override
   public void createOn(Connection conn, boolean isDurable) {
-
     byte regionDataPolicyOrdinal = getCqBaseRegion() == null ? (byte) 0
         : getCqBaseRegion().getAttributes().getDataPolicy().ordinal;
 
@@ -620,6 +583,4 @@ public class ClientCQImpl extends CqQueryImpl implements ClientCQ {
     this.cqProxy.createOn(getName(), conn, getQueryString(), state, isDurable,
         regionDataPolicyOrdinal);
   }
-
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
index 22b4137..07e3171 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqQueryImpl.java
@@ -21,11 +21,9 @@ import java.util.Set;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.StatisticsFactory;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.query.CqClosedException;
 import org.apache.geode.cache.query.CqEvent;
 import org.apache.geode.cache.query.CqException;
-import org.apache.geode.cache.query.CqExistsException;
 import org.apache.geode.cache.query.CqState;
 import org.apache.geode.cache.query.CqStatistics;
 import org.apache.geode.cache.query.Query;
@@ -38,7 +36,7 @@ import org.apache.geode.cache.query.internal.CqStateImpl;
 import org.apache.geode.cache.query.internal.DefaultQuery;
 import org.apache.geode.cache.query.internal.ExecutionContext;
 import org.apache.geode.cache.query.internal.QueryExecutionContext;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.InternalLogWriter;
@@ -58,13 +56,13 @@ public abstract class CqQueryImpl implements InternalCqQuery {
 
   protected String queryString;
 
-  protected static final Object TOKEN = new Object();
+  static final Object TOKEN = new Object();
 
-  protected LocalRegion cqBaseRegion;
+  LocalRegion cqBaseRegion;
 
   protected Query query = null;
 
-  protected InternalLogWriter securityLogWriter;
+  InternalLogWriter securityLogWriter;
 
   protected CqServiceImpl cqService;
 
@@ -72,14 +70,14 @@ public abstract class CqQueryImpl implements InternalCqQuery {
 
   protected boolean isDurable = false;
 
-  // Stats counters
-  protected CqStatisticsImpl cqStats;
+  /** Stats counters */
+  private CqStatisticsImpl cqStats;
 
   protected CqQueryVsdStats stats;
 
   protected final CqStateImpl cqState = new CqStateImpl();
 
-  protected ExecutionContext queryExecutionContext = null;
+  private ExecutionContext queryExecutionContext = null;
 
   public static TestHook testHook = null;
 
@@ -100,6 +98,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
   /**
    * returns CQ name
    */
+  @Override
   public String getName() {
     return this.cqName;
   }
@@ -109,6 +108,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
     this.cqName = cqName;
   }
 
+  @Override
   public void setCqService(CqService cqService) {
     this.cqService = (CqServiceImpl) cqService;
   }
@@ -121,25 +121,24 @@ public abstract class CqQueryImpl implements InternalCqQuery {
     return this.regionName;
   }
 
-  public void updateCqCreateStats() {
+  void updateCqCreateStats() {
     // Initialize the VSD statistics
     StatisticsFactory factory = cqService.getCache().getDistributedSystem();
     this.stats = new CqQueryVsdStats(factory, getServerCqName());
     this.cqStats = new CqStatisticsImpl(this);
 
     // Update statistics with CQ creation.
-    this.cqService.stats.incCqsStopped();
-    this.cqService.stats.incCqsCreated();
-    this.cqService.stats.incCqsOnClient();
+    this.cqService.stats().incCqsStopped();
+    this.cqService.stats().incCqsCreated();
+    this.cqService.stats().incCqsOnClient();
   }
 
   /**
    * Validates the CQ. Checks for cq constraints. Also sets the base region name.
    */
-  public void validateCq() {
-    Cache cache = cqService.getCache();
-    DefaultQuery locQuery =
-        (DefaultQuery) ((GemFireCacheImpl) cache).getLocalQueryService().newQuery(this.queryString);
+  void validateCq() {
+    InternalCache cache = cqService.getInternalCache();
+    DefaultQuery locQuery = (DefaultQuery) cache.getLocalQueryService().newQuery(this.queryString);
     this.query = locQuery;
     // assert locQuery != null;
 
@@ -221,10 +220,8 @@ public abstract class CqQueryImpl implements InternalCqQuery {
 
   /**
    * Removes the CQ from CQ repository.
-   * 
-   * @throws CqException
    */
-  protected void removeFromCqMap() throws CqException {
+  void removeFromCqMap() throws CqException {
     try {
       cqService.removeCq(this.getServerCqName());
     } catch (Exception ex) {
@@ -243,6 +240,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
   /**
    * Returns the QueryString of this CQ.
    */
+  @Override
   public String getQueryString() {
     return queryString;
   }
@@ -252,23 +250,16 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @return the Query for the query string
    */
+  @Override
   public Query getQuery() {
     return query;
   }
 
-
-  /**
-   * @see org.apache.geode.cache.query.CqQuery#getStatistics()
-   */
+  @Override
   public CqStatistics getStatistics() {
     return cqStats;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#getCqBaseRegion()
-   */
   @Override
   public LocalRegion getCqBaseRegion() {
     return this.cqBaseRegion;
@@ -279,11 +270,12 @@ public abstract class CqQueryImpl implements InternalCqQuery {
   /**
    * @return Returns the Region name on which this cq is created.
    */
-  public String getBaseRegionName() {
+  String getBaseRegionName() {
 
     return this.regionName;
   }
 
+  @Override
   public abstract String getServerCqName();
 
   /**
@@ -291,15 +283,11 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @return STOPPED RUNNING or CLOSED
    */
+  @Override
   public CqState getState() {
     return this.cqState;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#setCqState(int)
-   */
   @Override
   public void setCqState(int state) {
     if (this.isClosed()) {
@@ -309,18 +297,13 @@ public abstract class CqQueryImpl implements InternalCqQuery {
 
     synchronized (cqState) {
       if (state == CqStateImpl.RUNNING) {
-        if (this.isRunning()) {
-          // throw new
-          // IllegalStateException(LocalizedStrings.CqQueryImpl_CQ_IS_NOT_IN_RUNNING_STATE_STOP_CQ_DOES_NOT_APPLY_CQNAME_0
-          // .toLocalizedString(this.cqName));
-        }
         this.cqState.setState(CqStateImpl.RUNNING);
-        this.cqService.stats.incCqsActive();
-        this.cqService.stats.decCqsStopped();
+        this.cqService.stats().incCqsActive();
+        this.cqService.stats().decCqsStopped();
       } else if (state == CqStateImpl.STOPPED) {
         this.cqState.setState(CqStateImpl.STOPPED);
-        this.cqService.stats.incCqsStopped();
-        this.cqService.stats.decCqsActive();
+        this.cqService.stats().incCqsStopped();
+        this.cqService.stats().decCqsActive();
       } else if (state == CqStateImpl.CLOSING) {
         this.cqState.setState(state);
       }
@@ -332,7 +315,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @param cqEvent object
    */
-  public void updateStats(CqEvent cqEvent) {
+  void updateStats(CqEvent cqEvent) {
     this.stats.updateStats(cqEvent); // Stats for VSD
   }
 
@@ -341,15 +324,17 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @return true if running, false otherwise
    */
+  @Override
   public boolean isRunning() {
     return this.cqState.isRunning();
   }
 
   /**
-   * Return true if the CQ is in Sstopped state
+   * Return true if the CQ is in stopped state
    * 
    * @return true if stopped, false otherwise
    */
+  @Override
   public boolean isStopped() {
     return this.cqState.isStopped();
   }
@@ -359,6 +344,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @return true if closed, false otherwise
    */
+  @Override
   public boolean isClosed() {
     return this.cqState.isClosed();
   }
@@ -377,6 +363,7 @@ public abstract class CqQueryImpl implements InternalCqQuery {
    * 
    * @return true if durable, false otherwise
    */
+  @Override
   public boolean isDurable() {
     return this.isDurable;
   }
@@ -391,22 +378,22 @@ public abstract class CqQueryImpl implements InternalCqQuery {
     return stats;
   }
 
-  public ExecutionContext getQueryExecutionContext() {
+  ExecutionContext getQueryExecutionContext() {
     return queryExecutionContext;
   }
 
-  public void setQueryExecutionContext(ExecutionContext queryExecutionContext) {
+  private void setQueryExecutionContext(ExecutionContext queryExecutionContext) {
     this.queryExecutionContext = queryExecutionContext;
   }
 
   /** Test Hook */
   public interface TestHook {
-    public void pauseUntilReady();
+    void pauseUntilReady();
 
-    public void ready();
+    void ready();
 
-    public int numQueuedEvents();
+    int numQueuedEvents();
 
-    public void setEventCount(int count);
+    void setEventCount(int count);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceFactoryImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceFactoryImpl.java
index db90632..9cc2eea 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceFactoryImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceFactoryImpl.java
@@ -22,7 +22,7 @@ import java.util.Map;
 
 import org.apache.geode.cache.query.internal.cq.spi.CqServiceFactory;
 import org.apache.geode.internal.Version;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.cache.tier.sockets.CommandInitializer;
@@ -36,14 +36,13 @@ import org.apache.geode.internal.cache.tier.sockets.command.StopCQ;
 
 public class CqServiceFactoryImpl implements CqServiceFactory {
 
+  @Override
   public void initialize() {
-    {
-      Map<Version, Command> versions = new HashMap<Version, Command>();
-      versions.put(Version.GFE_57, ExecuteCQ.getCommand());
-      versions.put(Version.GFE_61, ExecuteCQ61.getCommand());
-      CommandInitializer.registerCommand(MessageType.EXECUTECQ_MSG_TYPE, versions);
-      CommandInitializer.registerCommand(MessageType.EXECUTECQ_WITH_IR_MSG_TYPE, versions);
-    }
+    Map<Version, Command> versions = new HashMap<>();
+    versions.put(Version.GFE_57, ExecuteCQ.getCommand());
+    versions.put(Version.GFE_61, ExecuteCQ61.getCommand());
+    CommandInitializer.registerCommand(MessageType.EXECUTECQ_MSG_TYPE, versions);
+    CommandInitializer.registerCommand(MessageType.EXECUTECQ_WITH_IR_MSG_TYPE, versions);
 
     CommandInitializer.registerCommand(MessageType.GETCQSTATS_MSG_TYPE,
         Collections.singletonMap(Version.GFE_57, GetCQStats.getCommand()));
@@ -58,7 +57,7 @@ public class CqServiceFactoryImpl implements CqServiceFactory {
   }
 
   @Override
-  public CqService create(GemFireCacheImpl cache) {
+  public CqService create(InternalCache cache) {
     return new CqServiceImpl(cache);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
index f1ca832..570c06c 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java
@@ -14,19 +14,63 @@
  */
 package org.apache.geode.cache.query.internal.cq;
 
+import java.util.ArrayList;
+import java.util.Collection;
+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.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.InvalidDeltaException;
 import org.apache.geode.StatisticsFactory;
 import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheEvent;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.EntryEvent;
+import org.apache.geode.cache.Operation;
+import org.apache.geode.cache.RegionEvent;
+import org.apache.geode.cache.TimeoutException;
 import org.apache.geode.cache.client.Pool;
-import org.apache.geode.cache.client.internal.*;
-import org.apache.geode.cache.query.*;
-import org.apache.geode.cache.query.internal.*;
+import org.apache.geode.cache.client.internal.GetEventValueOp;
+import org.apache.geode.cache.client.internal.InternalPool;
+import org.apache.geode.cache.client.internal.QueueManager;
+import org.apache.geode.cache.client.internal.ServerCQProxyImpl;
+import org.apache.geode.cache.client.internal.UserAttributes;
+import org.apache.geode.cache.query.CqAttributes;
+import org.apache.geode.cache.query.CqClosedException;
+import org.apache.geode.cache.query.CqException;
+import org.apache.geode.cache.query.CqExistsException;
+import org.apache.geode.cache.query.CqListener;
+import org.apache.geode.cache.query.CqQuery;
+import org.apache.geode.cache.query.CqServiceStatistics;
+import org.apache.geode.cache.query.CqStatusListener;
+import org.apache.geode.cache.query.QueryException;
+import org.apache.geode.cache.query.QueryInvalidException;
+import org.apache.geode.cache.query.RegionNotFoundException;
+import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.cache.query.internal.CompiledSelect;
+import org.apache.geode.cache.query.internal.CqQueryVsdStats;
+import org.apache.geode.cache.query.internal.CqStateImpl;
+import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.cache.query.internal.ExecutionContext;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.i18n.StringId;
 import org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile;
-import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.EntryEventImpl;
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.FilterProfile;
+import org.apache.geode.internal.cache.FilterRoutingInfo;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.tier.MessageType;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
@@ -35,57 +79,43 @@ import org.apache.geode.internal.cache.tier.sockets.Part;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
 /**
- * @since GemFire 5.5
- *
- *        Implements the CqService functionality.
- * 
- */
-/**
+ * Implements the CqService functionality.
  *
+ * @since GemFire 5.5
  */
 public final class CqServiceImpl implements CqService {
   private static final Logger logger = LogService.getLogger();
 
-  private static final Integer MESSAGE_TYPE_LOCAL_CREATE =
-      Integer.valueOf(MessageType.LOCAL_CREATE);
-  private static final Integer MESSAGE_TYPE_LOCAL_UPDATE =
-      Integer.valueOf(MessageType.LOCAL_UPDATE);
-  private static final Integer MESSAGE_TYPE_LOCAL_DESTROY =
-      Integer.valueOf(MessageType.LOCAL_DESTROY);
-  private static final Integer MESSAGE_TYPE_EXCEPTION = Integer.valueOf(MessageType.EXCEPTION);
+  private static final Integer MESSAGE_TYPE_LOCAL_CREATE = MessageType.LOCAL_CREATE;
+  private static final Integer MESSAGE_TYPE_LOCAL_UPDATE = MessageType.LOCAL_UPDATE;
+  private static final Integer MESSAGE_TYPE_LOCAL_DESTROY = MessageType.LOCAL_DESTROY;
+  private static final Integer MESSAGE_TYPE_EXCEPTION = MessageType.EXCEPTION;
 
   /**
    * System property to evaluate the query even though the initial results are not required when cq
    * is executed using the execute() method.
    */
-  public static boolean EXECUTE_QUERY_DURING_INIT = Boolean
-      .valueOf(System
-          .getProperty(DistributionConfig.GEMFIRE_PREFIX + "cq.EXECUTE_QUERY_DURING_INIT", "true"))
-      .booleanValue();
+  public static boolean EXECUTE_QUERY_DURING_INIT = Boolean.valueOf(System
+      .getProperty(DistributionConfig.GEMFIRE_PREFIX + "cq.EXECUTE_QUERY_DURING_INIT", "true"));
 
   private static final String CQ_NAME_PREFIX = "GfCq";
 
-  private final Cache cache;
+  private final InternalCache cache;
 
   /**
    * Manages cq pools to determine if a status of connect or disconnect needs to be sent out
    */
-  private final HashMap<String, Boolean> cqPoolsConnected = new HashMap<String, Boolean>();
-
+  private final HashMap<String, Boolean> cqPoolsConnected = new HashMap<>();
 
   /**
    * Manages CQ objects. uses serverCqName as key and CqQueryImpl as value
    * 
-   * @guarded.By cqQueryMapLock
+   * GuardedBy cqQueryMapLock
    */
-  private volatile HashMap<String, CqQueryImpl> cqQueryMap = new HashMap<String, CqQueryImpl>();
+  private volatile HashMap<String, CqQueryImpl> cqQueryMap = new HashMap<>();
+
   private final Object cqQueryMapLock = new Object();
 
   private volatile boolean isRunning = false;
@@ -93,36 +123,21 @@ public final class CqServiceImpl implements CqService {
   /**
    * Used by client when multiuser-authentication is true.
    */
-  private final HashMap<String, UserAttributes> cqNameToUserAttributesMap =
-      new HashMap<String, UserAttributes>();
-
-  // private boolean isServer = true;
-
-  /*
-   * // Map to manage CQ to satisfied CQ events (keys) for optimizing updates. private final HashMap
-   * cqToCqEventKeysMap = CqService.MAINTAIN_KEYS ? new HashMap() : null;
-   */
+  private final HashMap<String, UserAttributes> cqNameToUserAttributesMap = new HashMap<>();
 
   // Map to manage the similar CQs (having same query - performance optimization).
   // With query as key and Set of CQs as values.
   private final ConcurrentHashMap matchingCqMap;
 
   // CQ Service statistics
-  public final CqServiceStatisticsImpl cqServiceStats;
-  public final CqServiceVsdStats stats;
+  private final CqServiceStatisticsImpl cqServiceStats;
+  private final CqServiceVsdStats stats;
 
   // CQ identifier, also used in auto generated CQ names
   private volatile long cqId = 1;
 
-  /**
-   * Used to synchronize access to CQs in the repository
-   */
-  final Object cqSync = new Object();
-
   /* This is to manage region to CQs map, client side book keeping. */
-  private HashMap<String, ArrayList<String>> baseRegionToCqNameMap =
-      new HashMap<String, ArrayList<String>>();
-
+  private HashMap<String, ArrayList<String>> baseRegionToCqNameMap = new HashMap<>();
 
   /**
    * Access and modification to the contents of this map do not necessarily need to be lock
@@ -135,33 +150,24 @@ public final class CqServiceImpl implements CqService {
 
   /**
    * Constructor.
-   * 
-   * @param c The cache used for the service
+   *
+   * @param cache The cache used for the service
    */
-  public CqServiceImpl(final Cache c) {
-    if (c == null) {
+  public CqServiceImpl(final InternalCache cache) {
+    if (cache == null) {
       throw new IllegalStateException(LocalizedStrings.CqService_CACHE_IS_NULL.toLocalizedString());
     }
-    GemFireCacheImpl gfc = (GemFireCacheImpl) c;
-    gfc.getCancelCriterion().checkCancelInProgress(null);
-
-    this.cache = gfc;
+    cache.getCancelCriterion().checkCancelInProgress(null);
 
+    this.cache = cache;
 
     // Initialize the Map which maintains the matching cqs.
     this.matchingCqMap = new ConcurrentHashMap<String, HashSet<String>>();
 
     // Initialize the VSD statistics
-    StatisticsFactory factory = cache.getDistributedSystem();
+    StatisticsFactory factory = this.cache.getDistributedSystem();
     this.stats = new CqServiceVsdStats(factory);
     this.cqServiceStats = new CqServiceStatisticsImpl(this);
-
-    // final LoggingThreadGroup group =
-    // LoggingThreadGroup.createThreadGroup("CqExecutor Threads", logger);
-
-    // if (this.cache.getCacheServers().isEmpty()) {
-    // isServer = false;
-    // }
   }
 
   /**
@@ -171,13 +177,14 @@ public final class CqServiceImpl implements CqService {
     return this.cache;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#newCq(java.lang.String,
-   * java.lang.String, org.apache.geode.cache.query.CqAttributes,
-   * org.apache.geode.cache.client.internal.ServerCQProxy, boolean)
-   */
+  public InternalCache getInternalCache() {
+    return this.cache;
+  }
+
+  public CqServiceVsdStats stats() {
+    return this.stats;
+  }
+
   @Override
   public synchronized ClientCQ newCq(String cqName, String queryString, CqAttributes cqAttributes,
       InternalPool pool, boolean isDurable)
@@ -242,22 +249,15 @@ public final class CqServiceImpl implements CqService {
     return cQuery;
   }
 
-
   /**
    * Executes the given CqQuery, if the CqQuery for that name is not there it registers the one and
    * executes. This is called on the Server.
    * 
-   * @param cqName
-   * @param queryString
-   * @param cqState
-   * @param clientProxyId
-   * @param ccn
    * @param manageEmptyRegions whether to update the 6.1 emptyRegions map held in the CCN
    * @param regionDataPolicy the data policy of the region associated with the query. This is only
    *        needed if manageEmptyRegions is true.
    * @param emptyRegionsMap map of empty regions.
    * @throws IllegalStateException if this is called at client side.
-   * @throws CqException
    */
   @Override
   public synchronized ServerCQ executeCq(String cqName, String queryString, int cqState,
@@ -271,7 +271,7 @@ public final class CqServiceImpl implements CqService {
     }
 
     String serverCqName = constructServerCqName(cqName, clientProxyId);
-    ServerCQImpl cQuery = null;
+    ServerCQImpl cQuery;
 
     // If this CQ is not yet registered in Server, register CQ.
     if (!isCqExists(serverCqName)) {
@@ -292,7 +292,6 @@ public final class CqServiceImpl implements CqService {
         logger.info(LocalizedMessage.create(
             LocalizedStrings.CqService_EXCEPTION_WHILE_REGISTERING_CQ_ON_SERVER_CQNAME___0,
             cQuery.getName()));
-        cQuery = null;
         throw cqe;
       }
 
@@ -308,6 +307,7 @@ public final class CqServiceImpl implements CqService {
     return cQuery;
   }
 
+  @Override
   public void resumeCQ(int cqState, ServerCQ cQuery) {
     // Initialize the state of CQ.
     if (((CqStateImpl) cQuery.getState()).getState() != cqState) {
@@ -324,25 +324,10 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-  /*
-   * public void addToCqEventKeysMap(CqQuery cq){ if (cqToCqEventKeysMap != null) { synchronized
-   * (cqToCqEventKeysMap){ String serverCqName = ((CqQueryImpl)cq).getServerCqName(); if
-   * (!cqToCqEventKeysMap.containsKey(serverCqName)){ cqToCqEventKeysMap.put(serverCqName, new
-   * HashSet()); if (_logger.isDebugEnabled()) {
-   * _logger.debug("CQ Event key maintenance for CQ, CqName: " + serverCqName + " is Enabled." +
-   * " key maintenance map size is: " + cqToCqEventKeysMap.size()); } } } // synchronized } }
-   */
-
-  public boolean hasCq() {
-    HashMap<String, CqQueryImpl> cqMap = cqQueryMap;
-    return (cqMap.size() > 0);
-  }
-
-
   /**
    * Adds the given CQ and cqQuery object into the CQ map.
    */
-  public void addToCqMap(CqQueryImpl cq) throws CqExistsException, CqException {
+  void addToCqMap(CqQueryImpl cq) throws CqExistsException, CqException {
     // On server side cqName will be server side cqName.
     String sCqName = cq.getServerCqName();
     if (logger.isDebugEnabled()) {
@@ -355,7 +340,7 @@ public final class CqServiceImpl implements CqService {
               .toLocalizedString(sCqName));
     }
     synchronized (cqQueryMapLock) {
-      HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<String, CqQueryImpl>(cqQueryMap);
+      HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<>(cqQueryMap);
       try {
         tmpCqQueryMap.put(sCqName, cq);
       } catch (Exception ex) {
@@ -377,66 +362,34 @@ public final class CqServiceImpl implements CqService {
   /**
    * Removes given CQ from the cqMap..
    */
-  public void removeCq(String cqName) {
+  void removeCq(String cqName) {
     // On server side cqName will be server side cqName.
     synchronized (cqQueryMapLock) {
-      HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<String, CqQueryImpl>(cqQueryMap);
+      HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<>(cqQueryMap);
       tmpCqQueryMap.remove(cqName);
       this.cqNameToUserAttributesMap.remove(cqName);
       cqQueryMap = tmpCqQueryMap;
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#getClientCqFromServer(org.apache.geode.
-   * internal.cache.tier.sockets.ClientProxyMembershipID, java.lang.String)
-   */
   @Override
   public CqQuery getClientCqFromServer(ClientProxyMembershipID clientProxyId, String clientCqName) {
     // On server side cqName will be server side cqName.
     HashMap<String, CqQueryImpl> cqMap = cqQueryMap;
-    return (CqQuery) cqMap.get(this.constructServerCqName(clientCqName, clientProxyId));
+    return cqMap.get(this.constructServerCqName(clientCqName, clientProxyId));
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#getCq(java.lang.String)
-   */
   @Override
   public InternalCqQuery getCq(String cqName) {
     // On server side cqName will be server side cqName.
-    return (InternalCqQuery) cqQueryMap.get(cqName);
+    return cqQueryMap.get(cqName);
   }
 
-  /**
-   * Clears the CQ Query Map.
-   */
-  public void clearCqQueryMap() {
-    // On server side cqName will be server side cqName.
-    synchronized (cqQueryMapLock) {
-      cqQueryMap = new HashMap<String, CqQueryImpl>();
-    }
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#getAllCqs()
-   */
   @Override
   public Collection<? extends InternalCqQuery> getAllCqs() {
     return cqQueryMap.values();
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#getAllCqs(java.lang.String)
-   */
   @Override
   public Collection<? extends InternalCqQuery> getAllCqs(final String regionName)
       throws CqException {
@@ -445,7 +398,7 @@ public final class CqServiceImpl implements CqService {
           LocalizedStrings.CqService_NULL_ARGUMENT_0.toLocalizedString("regionName"));
     }
 
-    String[] cqNames = null;
+    String[] cqNames;
 
     synchronized (this.baseRegionToCqNameMap) {
       ArrayList<String> cqs = this.baseRegionToCqNameMap.get(regionName);
@@ -456,7 +409,7 @@ public final class CqServiceImpl implements CqService {
       cqs.toArray(cqNames);
     }
 
-    ArrayList<InternalCqQuery> cQueryList = new ArrayList<InternalCqQuery>();
+    ArrayList<InternalCqQuery> cQueryList = new ArrayList<>();
     for (int cqCnt = 0; cqCnt < cqNames.length; cqCnt++) {
       InternalCqQuery cq = getCq(cqNames[cqCnt]);
       if (cq != null) {
@@ -467,34 +420,16 @@ public final class CqServiceImpl implements CqService {
     return cQueryList;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#executeAllClientCqs()
-   */
   @Override
   public synchronized void executeAllClientCqs() throws CqException {
     executeCqs(this.getAllCqs());
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#executeAllRegionCqs(java.lang.String)
-   */
   @Override
   public synchronized void executeAllRegionCqs(final String regionName) throws CqException {
     executeCqs(getAllCqs(regionName));
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#executeCqs(org.apache.geode.cache.query
-   * .CqQuery[])
-   */
   @Override
   public synchronized void executeCqs(Collection<? extends InternalCqQuery> cqs)
       throws CqException {
@@ -503,53 +438,31 @@ public final class CqServiceImpl implements CqService {
     }
     String cqName = null;
     for (InternalCqQuery internalCq : cqs) {
-      CqQuery cq = (CqQuery) internalCq;
+      CqQuery cq = internalCq;
       if (!cq.isClosed() && cq.isStopped()) {
         try {
           cqName = cq.getName();
           cq.execute();
-        } catch (QueryException qe) {
-          if (logger.isDebugEnabled()) {
-            logger.debug("Failed to execute the CQ, CqName : {} Error : {}", cqName,
-                qe.getMessage());
-          }
-        } catch (CqClosedException cce) {
+        } catch (QueryException | CqClosedException e) {
           if (logger.isDebugEnabled()) {
             logger.debug("Failed to execute the CQ, CqName : {} Error : {}", cqName,
-                cce.getMessage());
+                e.getMessage());
           }
         }
       }
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#stopAllClientCqs()
-   */
   @Override
   public synchronized void stopAllClientCqs() throws CqException {
     stopCqs(this.getAllCqs());
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#stopAllRegionCqs(java.lang.String)
-   */
   @Override
   public synchronized void stopAllRegionCqs(final String regionName) throws CqException {
     stopCqs(this.getAllCqs(regionName));
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#stopCqs(org.apache.geode.cache.query.
-   * CqQuery[])
-   */
   @Override
   public synchronized void stopCqs(Collection<? extends InternalCqQuery> cqs) throws CqException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -567,29 +480,20 @@ public final class CqServiceImpl implements CqService {
 
     String cqName = null;
     for (InternalCqQuery internalCqQuery : cqs) {
-      CqQuery cq = (CqQuery) internalCqQuery;
+      CqQuery cq = internalCqQuery;
       if (!cq.isClosed() && cq.isRunning()) {
         try {
           cqName = cq.getName();
           cq.stop();
-        } catch (QueryException qe) {
-          if (isDebugEnabled) {
-            logger.debug("Failed to stop the CQ, CqName : {} Error : {}", cqName, qe.getMessage());
-          }
-        } catch (CqClosedException cce) {
+        } catch (QueryException | CqClosedException e) {
           if (isDebugEnabled) {
-            logger.debug("Failed to stop the CQ, CqName : {} Error : {}", cqName, cce.getMessage());
+            logger.debug("Failed to stop the CQ, CqName : {} Error : {}", cqName, e.getMessage());
           }
         }
       }
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#closeCqs(java.lang.String)
-   */
   @Override
   public void closeCqs(final String regionName) throws CqException {
     Collection<? extends InternalCqQuery> cqs = this.getAllCqs(regionName);
@@ -603,8 +507,8 @@ public final class CqServiceImpl implements CqService {
             // invoked on the server
             cq.close(false);
           } else {
-            // @todo grid: if regionName has a pool check its keepAlive
-            boolean keepAlive = ((GemFireCacheImpl) this.cache).keepDurableSubscriptionsAlive();
+            // TODO: grid: if regionName has a pool check its keepAlive
+            boolean keepAlive = this.cache.keepDurableSubscriptionsAlive();
             if (cq.isDurable() && keepAlive) {
               logger.warn(LocalizedMessage.create(
                   LocalizedStrings.CqService_NOT_SENDING_CQ_CLOSE_TO_THE_SERVER_AS_IT_IS_A_DURABLE_CQ));
@@ -614,14 +518,9 @@ public final class CqServiceImpl implements CqService {
             }
           }
 
-        } catch (QueryException qe) {
+        } catch (QueryException | CqClosedException e) {
           if (logger.isDebugEnabled()) {
-            logger.debug("Failed to close the CQ, CqName : {} Error : {}", cqName, qe.getMessage());
-          }
-        } catch (CqClosedException cce) {
-          if (logger.isDebugEnabled()) {
-            logger.debug("Failed to close the CQ, CqName : {} Error : {}", cqName,
-                cce.getMessage());
+            logger.debug("Failed to close the CQ, CqName : {} Error : {}", cqName, e.getMessage());
           }
         }
       }
@@ -630,10 +529,6 @@ public final class CqServiceImpl implements CqService {
 
   /**
    * Called directly on server side.
-   * 
-   * @param cqName
-   * @param clientId
-   * @throws CqException
    */
   @Override
   public void stopCq(String cqName, ClientProxyMembershipID clientId) throws CqException {
@@ -650,8 +545,6 @@ public final class CqServiceImpl implements CqService {
     try {
       HashMap<String, CqQueryImpl> cqMap = cqQueryMap;
       if (!cqMap.containsKey(serverCqName)) {
-        // throw new
-        // CqException(LocalizedStrings.CqService_CQ_NOT_FOUND_FAILED_TO_STOP_THE_SPECIFIED_CQ_0.toLocalizedString(serverCqName));
         /*
          * gregp 052808: We should silently fail here instead of throwing error. This is to deal
          * with races in recovery
@@ -689,15 +582,8 @@ public final class CqServiceImpl implements CqService {
     }
     // Send stop message to peers.
     cQuery.getCqBaseRegion().getFilterProfile().stopCq(cQuery);
-
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#closeCq(java.lang.String,
-   * org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID)
-   */
   @Override
   public void closeCq(String cqName, ClientProxyMembershipID clientProxyId) throws CqException {
     String serverCqName = cqName;
@@ -713,9 +599,6 @@ public final class CqServiceImpl implements CqService {
     try {
       HashMap<String, CqQueryImpl> cqMap = cqQueryMap;
       if (!cqMap.containsKey(serverCqName)) {
-        // throw new
-        // CqException(LocalizedStrings.CqService_CQ_NOT_FOUND_FAILED_TO_CLOSE_THE_SPECIFIED_CQ_0
-        // .toLocalizedString(serverCqName));
         /*
          * gregp 052808: We should silently fail here instead of throwing error. This is to deal
          * with races in recovery
@@ -791,12 +674,6 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#closeAllCqs(boolean)
-   */
   @Override
   public void closeAllCqs(boolean clientInitiated) {
     closeAllCqs(clientInitiated, getAllCqs());
@@ -807,21 +684,13 @@ public final class CqServiceImpl implements CqService {
    * CqQuerys created by other VMs are unaffected.
    */
   private void closeAllCqs(boolean clientInitiated, Collection<? extends InternalCqQuery> cqs) {
-    closeAllCqs(clientInitiated, cqs,
-        ((GemFireCacheImpl) this.cache).keepDurableSubscriptionsAlive());
+    closeAllCqs(clientInitiated, cqs, this.cache.keepDurableSubscriptionsAlive());
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#closeAllCqs(boolean,
-   * org.apache.geode.cache.query.CqQuery[], boolean)
-   */
   @Override
   public void closeAllCqs(boolean clientInitiated, Collection<? extends InternalCqQuery> cqs,
       boolean keepAlive) {
 
-    // CqQuery[] cqs = getAllCqs();
     if (cqs != null) {
       String cqName = null;
       if (logger.isDebugEnabled()) {
@@ -830,7 +699,6 @@ public final class CqServiceImpl implements CqService {
       for (InternalCqQuery cQuery : cqs) {
         try {
           cqName = cQuery.getName();
-          // boolean keepAlive = ((GemFireCache)this.cache).keepDurableSubscriptionsAlive();
 
           if (isServer()) {
             cQuery.close(false);
@@ -847,47 +715,26 @@ public final class CqServiceImpl implements CqService {
               }
             }
           }
-        } catch (QueryException cqe) {
+        } catch (QueryException | CqClosedException e) {
           if (!isRunning()) {
             // Not cache shutdown
             logger
                 .warn(LocalizedMessage.create(LocalizedStrings.CqService_FAILED_TO_CLOSE_CQ__0___1,
-                    new Object[] {cqName, cqe.getMessage()}));
+                    new Object[] {cqName, e.getMessage()}));
           }
           if (logger.isDebugEnabled()) {
-            logger.debug(cqe.getMessage(), cqe);
-          }
-        } catch (CqClosedException cqe) {
-          if (!isRunning()) {
-            // Not cache shutdown
-            logger
-                .warn(LocalizedMessage.create(LocalizedStrings.CqService_FAILED_TO_CLOSE_CQ__0___1,
-                    new Object[] {cqName, cqe.getMessage()}));
-          }
-          if (logger.isDebugEnabled()) {
-            logger.debug(cqe.getMessage(), cqe);
+            logger.debug(e.getMessage(), e);
           }
         }
       }
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#getCqStatistics()
-   */
   @Override
   public CqServiceStatistics getCqStatistics() {
     return cqServiceStats;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#closeClientCqs(org.apache.geode.
-   * internal.cache.tier.sockets.ClientProxyMembershipID)
-   */
   @Override
   public void closeClientCqs(ClientProxyMembershipID clientProxyId) throws CqException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -899,30 +746,19 @@ public final class CqServiceImpl implements CqService {
       CqQueryImpl cQuery = (CqQueryImpl) cq;
       try {
         cQuery.close(false);
-      } catch (QueryException qe) {
+      } catch (QueryException | CqClosedException e) {
         if (isDebugEnabled) {
           logger.debug("Failed to close the CQ, CqName : {} Error : {}", cQuery.getName(),
-              qe.getMessage());
-        }
-      } catch (CqClosedException cce) {
-        if (isDebugEnabled) {
-          logger.debug("Failed to close the CQ, CqName : {} Error : {}", cQuery.getName(),
-              cce.getMessage());
+              e.getMessage());
         }
       }
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqService#getAllClientCqs(org.apache.geode.
-   * internal.cache.tier.sockets.ClientProxyMembershipID)
-   */
   @Override
   public List<ServerCQ> getAllClientCqs(ClientProxyMembershipID clientProxyId) {
     Collection<? extends InternalCqQuery> cqs = getAllCqs();
-    ArrayList<ServerCQ> clientCqs = new ArrayList<ServerCQ>();
+    ArrayList<ServerCQ> clientCqs = new ArrayList<>();
 
     for (InternalCqQuery cq : cqs) {
       ServerCQImpl cQuery = (ServerCQImpl) cq;
@@ -934,23 +770,16 @@ public final class CqServiceImpl implements CqService {
     return clientCqs;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#getAllDurableClientCqs(org.apache.geode
-   * .internal.cache.tier.sockets.ClientProxyMembershipID)
-   */
   @Override
   public List<String> getAllDurableClientCqs(ClientProxyMembershipID clientProxyId)
       throws CqException {
     if (clientProxyId == null) {
       throw new CqException(
           LocalizedStrings.CqService_UNABLE_TO_RETRIEVE_DURABLE_CQS_FOR_CLIENT_PROXY_ID
-              .toLocalizedString(clientProxyId));
+              .toLocalizedString(null));
     }
     List<ServerCQ> cqs = getAllClientCqs(clientProxyId);
-    ArrayList<String> durableClientCqs = new ArrayList<String>();
+    ArrayList<String> durableClientCqs = new ArrayList<>();
 
     for (ServerCQ cq : cqs) {
       ServerCQImpl cQuery = (ServerCQImpl) cq;
@@ -966,9 +795,6 @@ public final class CqServiceImpl implements CqService {
 
   /**
    * Server side method. Closes non-durable CQs for the given client proxy id.
-   * 
-   * @param clientProxyId
-   * @throws CqException
    */
   @Override
   public void closeNonDurableClientCqs(ClientProxyMembershipID clientProxyId) throws CqException {
@@ -983,15 +809,10 @@ public final class CqServiceImpl implements CqService {
         if (!cQuery.isDurable()) {
           cQuery.close(false);
         }
-      } catch (QueryException qe) {
-        if (isDebugEnabled) {
-          logger.debug("Failed to close the CQ, CqName : {} Error : {}", cQuery.getName(),
-              qe.getMessage());
-        }
-      } catch (CqClosedException cce) {
+      } catch (QueryException | CqClosedException e) {
         if (isDebugEnabled) {
           logger.debug("Failed to close the CQ, CqName : {} Error : {}", cQuery.getName(),
-              cce.getMessage());
+              e.getMessage());
         }
       }
     }
@@ -1028,6 +849,7 @@ public final class CqServiceImpl implements CqService {
     return this.isRunning;
   }
 
+  @Override
   public void start() {
     this.isRunning = true;
   }
@@ -1035,9 +857,10 @@ public final class CqServiceImpl implements CqService {
   /**
    * @return Returns the serverCqName.
    */
+  @Override
   public String constructServerCqName(String cqName, ClientProxyMembershipID clientProxyId) {
-    ConcurrentHashMap<ClientProxyMembershipID, String> cache = serverCqNameCache
-        .computeIfAbsent(cqName, key -> new ConcurrentHashMap<ClientProxyMembershipID, String>());
+    ConcurrentHashMap<ClientProxyMembershipID, String> cache =
+        serverCqNameCache.computeIfAbsent(cqName, key -> new ConcurrentHashMap<>());
 
     String cName = cache.get(clientProxyId);
     if (null == cName) {
@@ -1065,7 +888,7 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-  /*
+  /**
    * Checks if CQ with the given name already exists.
    * 
    * @param cqName name of the CQ.
@@ -1073,17 +896,15 @@ public final class CqServiceImpl implements CqService {
    * @return true if exists else false.
    */
   private synchronized boolean isCqExists(String cqName) {
-    boolean status = false;
     HashMap<String, CqQueryImpl> cqMap = cqQueryMap;
-    status = cqMap.containsKey(cqName);
-    return status;
+    return cqMap.containsKey(cqName);
   }
 
-  /*
+  /**
    * Generates a name for CQ. Checks if CQ with that name already exists if so generates a new
    * cqName.
    */
-  public synchronized String generateCqName() {
+  private synchronized String generateCqName() {
     while (true) {
       String cqName = CQ_NAME_PREFIX + (cqId++);
       if (!isCqExists(cqName)) {
@@ -1092,18 +913,9 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#dispatchCqListeners(java.util.HashMap,
-   * int, java.lang.Object, java.lang.Object, byte[],
-   * org.apache.geode.cache.client.internal.QueueManager, org.apache.geode.internal.cache.EventID)
-   */
   @Override
   public void dispatchCqListeners(HashMap<String, Integer> cqs, int messageType, Object key,
       Object value, byte[] delta, QueueManager qManager, EventID eventId) {
-    ClientCQImpl cQuery = null;
     Object[] fullValue = new Object[1];
     Iterator<Map.Entry<String, Integer>> iter = cqs.entrySet().iterator();
     String cqName = null;
@@ -1112,7 +924,7 @@ public final class CqServiceImpl implements CqService {
       try {
         Map.Entry<String, Integer> entry = iter.next();
         cqName = entry.getKey();
-        cQuery = (ClientCQImpl) this.getCq(cqName);
+        ClientCQImpl cQuery = (ClientCQImpl) this.getCq(cqName);
 
         if (cQuery == null || (!cQuery.isRunning() && cQuery.getQueuedEvents() == null)) {
           if (isDebugEnabled) {
@@ -1122,7 +934,7 @@ public final class CqServiceImpl implements CqService {
           continue;
         }
 
-        Integer cqOp = (Integer) entry.getValue();
+        Integer cqOp = entry.getValue();
 
         // If Region destroy event, close the cq.
         if (cqOp.intValue() == MessageType.DESTROY_REGION) {
@@ -1136,8 +948,7 @@ public final class CqServiceImpl implements CqService {
         }
 
         // Construct CqEvent.
-        CqEventImpl cqEvent = null;
-        cqEvent = new CqEventImpl(cQuery, getOperation(messageType), getOperation(cqOp.intValue()),
+        CqEventImpl cqEvent = new CqEventImpl(cQuery, getOperation(messageType), getOperation(cqOp),
             key, value, delta, qManager, eventId);
 
         // Update statistics
@@ -1181,11 +992,11 @@ public final class CqServiceImpl implements CqService {
     } // iteration.
   }
 
-  public void invokeListeners(String cqName, ClientCQImpl cQuery, CqEventImpl cqEvent) {
+  void invokeListeners(String cqName, ClientCQImpl cQuery, CqEventImpl cqEvent) {
     invokeListeners(cqName, cQuery, cqEvent, null);
   }
 
-  public void invokeListeners(String cqName, ClientCQImpl cQuery, CqEventImpl cqEvent,
+  private void invokeListeners(String cqName, ClientCQImpl cQuery, CqEventImpl cqEvent,
       Object[] fullValue) {
     if (!cQuery.isRunning() || cQuery.getCqAttributes() == null) {
       return;
@@ -1217,8 +1028,8 @@ public final class CqServiceImpl implements CqService {
             }
             Part result = (Part) GetEventValueOp
                 .executeOnPrimary(cqEvent.getQueueManager().getPool(), cqEvent.getEventID(), null);
-            Object newVal = null;
-            if (result == null || (newVal = result.getObject()) == null) {
+            Object newVal = result.getObject();
+            if (result == null || newVal == null) {
               if (!cache.getCancelCriterion().isCancelInProgress()) {
                 Exception ex =
                     new Exception("Failed to retrieve full value from server for eventID "
@@ -1231,7 +1042,7 @@ public final class CqServiceImpl implements CqService {
                 }
               }
             } else {
-              ((GemFireCacheImpl) this.cache).getCachePerfStats().incDeltaFullValuesRequested();
+              this.cache.getCachePerfStats().incDeltaFullValuesRequested();
               cqEvent = new CqEventImpl(cQuery, cqEvent.getBaseOperation(),
                   cqEvent.getQueryOperation(), cqEvent.getKey(), newVal, cqEvent.getDeltaValue(),
                   cqEvent.getQueueManager(), cqEvent.getEventID());
@@ -1278,7 +1089,7 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-  public void invokeCqConnectedListeners(String cqName, ClientCQImpl cQuery, boolean connected) {
+  private void invokeCqConnectedListeners(String cqName, ClientCQImpl cQuery, boolean connected) {
     if (!cQuery.isRunning() || cQuery.getCqAttributes() == null) {
       return;
     }
@@ -1335,12 +1146,8 @@ public final class CqServiceImpl implements CqService {
     }
   }
 
-
   /**
    * Returns the Operation for the given EnumListenerEvent type.
-   * 
-   * @param eventType
-   * @return Operation
    */
   private Operation getOperation(int eventType) {
     Operation op = null;
@@ -1372,15 +1179,6 @@ public final class CqServiceImpl implements CqService {
     return op;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqService#processEvents(org.apache.geode.cache.
-   * CacheEvent, org.apache.geode.distributed.internal.DistributionAdvisor.Profile,
-   * org.apache.geode.distributed.internal.DistributionAdvisor.Profile[],
-   * org.apache.geode.internal.cache.FilterRoutingInfo)
-   */
   @Override
   public void processEvents(CacheEvent event, Profile localProfile, Profile[] profiles,
       FilterRoutingInfo frInfo) throws CqException {
@@ -1421,7 +1219,7 @@ public final class CqServiceImpl implements CqService {
         continue;
       }
       Map cqs = pf.getCqMap();
-      HashMap<Long, Integer> cqInfo = new HashMap<Long, Integer>();
+      HashMap<Long, Integer> cqInfo = new HashMap<>();
       Iterator cqIter = cqs.entrySet().iterator();
       while (cqIter.hasNext()) {
         Map.Entry cqEntry = (Map.Entry) cqIter.next();
@@ -1454,10 +1252,10 @@ public final class CqServiceImpl implements CqService {
   private void processEntryEvent(CacheEvent event, Profile localProfile, Profile[] profiles,
       FilterRoutingInfo frInfo) throws CqException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
-    HashSet<Object> cqUnfilteredEventsSet_newValue = new HashSet<Object>();
-    HashSet<Object> cqUnfilteredEventsSet_oldValue = new HashSet<Object>();
-    boolean b_cqResults_newValue = false;
-    boolean b_cqResults_oldValue = false;
+    HashSet<Object> cqUnfilteredEventsSet_newValue = new HashSet<>();
+    HashSet<Object> cqUnfilteredEventsSet_oldValue = new HashSet<>();
+    boolean b_cqResults_newValue;
+    boolean b_cqResults_oldValue;
     boolean queryOldValue;
     EntryEvent entryEvent = (EntryEvent) event;
     Object eventKey = entryEvent.getKey();
@@ -1472,8 +1270,8 @@ public final class CqServiceImpl implements CqService {
         || event.getOperation().isDestroy() || event.getOperation().isInvalidate()
         || (event.getOperation().isCreate() && isDupEvent));
 
-    HashMap<String, Integer> matchedCqs = new HashMap<String, Integer>();
-    long executionStartTime = 0;
+    HashMap<String, Integer> matchedCqs = new HashMap<>();
+    long executionStartTime;
     for (int i = -1; i < profiles.length; i++) {
       CacheProfile cf;
       if (i < 0) {
@@ -1498,7 +1296,6 @@ public final class CqServiceImpl implements CqService {
         continue;
       }
 
-
       // Get new value. If its not retrieved.
       if (cqUnfilteredEventsSet_newValue.isEmpty()
           && (event.getOperation().isCreate() || event.getOperation().isUpdate())) {
@@ -1509,7 +1306,7 @@ public final class CqServiceImpl implements CqService {
         }
       }
 
-      HashMap<Long, Integer> cqInfo = new HashMap<Long, Integer>();
+      HashMap<Long, Integer> cqInfo = new HashMap<>();
       Iterator cqIter = cqs.entrySet().iterator();
 
       while (cqIter.hasNext()) {
@@ -1546,7 +1343,6 @@ public final class CqServiceImpl implements CqService {
           }
         } else {
           boolean error = false;
-          // synchronized (cQuery)
           {
             try {
               synchronized (cQuery) {
@@ -1644,7 +1440,7 @@ public final class CqServiceImpl implements CqService {
                 cQuery.markAsDestroyedInCqResultKeys(eventKey);
               }
             }
-          } // end synchronized(cQuery)
+          }
 
           // Get the matching CQs if any.
           // synchronized (this.matchingCqMap){
@@ -1663,7 +1459,6 @@ public final class CqServiceImpl implements CqService {
               }
             }
           }
-          // }
         }
 
         if (cqEvent != null && cQuery.isRunning()) {
@@ -1694,153 +1489,35 @@ public final class CqServiceImpl implements CqService {
     } // iteration over Profiles.
   }
 
-
-  /*
-   * public void processEvents (EnumListenerEvent operation, CacheEvent event, ClientUpdateMessage
-   * clientMessage, CM<ClientProxyMembershipID, CM<CqQuery, Boolean>> clientIds) throws CqException
-   * {
-   * 
-   * //Is this a region event or an entry event if (event instanceof RegionEvent){
-   * processRegionEvent(operation, event, clientMessage, clientIds); } else { processEntryEvent
-   * (operation, event, clientMessage, clientIds); }
-   * 
-   * }
-   * 
-   * private void processRegionEvent(EnumListenerEvent operation, CacheEvent event,
-   * ClientUpdateMessage clientMessage, CM<ClientProxyMembershipID, CM<CqQuery, Boolean>> clientIds)
-   * throws CqException {
-   * 
-   * if (logger.isDebugEnabled()) { logger.debug("Processing region event for region " +
-   * ((LocalRegion)(event.getRegion())).getName()); } HashMap filteredCqs = new HashMap(); Integer
-   * cqRegionEvent = generateCqRegionEvent(operation); Iterator it =
-   * clientIds.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry)it.next();
-   * ClientProxyMembershipID clientId = (ClientProxyMembershipID)me.getKey(); CM cqsToBooleans =
-   * (CM)me.getValue(); if (cqsToBooleans == null) { continue; } Set<CqQuery> cqs =
-   * cqsToBooleans.keySet(); if (cqs.isEmpty()) { continue; } filteredCqs.clear(); Iterator cqIt =
-   * cqs.iterator(); while (cqIt.hasNext()) { CqQueryImpl cQuery = (CqQueryImpl)cqIt.next(); if
-   * (operation == EnumListenerEvent.AFTER_REGION_DESTROY) { try { if (logger.isDebugEnabled()){
-   * logger.debug("Closing CQ on region destroy event. CqName :" + cQuery.getName()); }
-   * cQuery.close(false); } catch (Exception ex) {
-   * logger.debug("Failed to Close CQ on region destroy. CqName :" + cQuery.getName(), ex); }
-   * 
-   * } filteredCqs.put(cQuery.cqName, cqRegionEvent);
-   * cQuery.getVsdStats().updateStats(cqRegionEvent);
-   * 
-   * } if (!filteredCqs.isEmpty()){ ((ClientUpdateMessageImpl)clientMessage).addClientCqs( clientId,
-   * filteredCqs); }
-   * 
-   * }
-   * 
-   * }
-   * 
-   * private void processEntryEvent(EnumListenerEvent operation, CacheEvent event,
-   * ClientUpdateMessage clientMessage, CM<ClientProxyMembershipID, CM<CqQuery, Boolean>> clientIds)
-   * throws CqException { HashSet cqUnfilteredEventsSet_newValue = new HashSet(); HashSet
-   * cqUnfilteredEventsSet_oldValue = new HashSet(); boolean b_cqResults_newValue = false; boolean
-   * b_cqResults_oldValue = false; EntryEvent entryEvent = (EntryEvent)event; Object eventKey =
-   * entryEvent.getKey(); if (operation == EnumListenerEvent.AFTER_CREATE || operation ==
-   * EnumListenerEvent.AFTER_UPDATE) { if (entryEvent.getNewValue() != null) { //We have a new value
-   * to run the query on cqUnfilteredEventsSet_newValue.clear();
-   * cqUnfilteredEventsSet_newValue.add(entryEvent.getNewValue()); } }
-   * 
-   * HashMap matchedCqs = new HashMap(); long executionStartTime = 0; Iterator it =
-   * clientIds.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry)it.next();
-   * ClientProxyMembershipID clientId = (ClientProxyMembershipID)me.getKey(); if
-   * (logger.isDebugEnabled()) { logger.debug("Processing event for CQ filter, ClientId : " +
-   * clientId); } CM cqsToBooleans = (CM)me.getValue(); if (cqsToBooleans == null) { continue; }
-   * Set<CqQuery> cqs = cqsToBooleans.keySet(); if (cqs.isEmpty()) { continue; } HashMap filteredCqs
-   * = new HashMap(); Iterator cqIt = cqs.iterator(); while (cqIt.hasNext()) { CqQueryImpl cQuery =
-   * (CqQueryImpl)cqIt.next(); b_cqResults_newValue = false; b_cqResults_oldValue = false; if
-   * (cQuery == null || !(cQuery.isRunning())){ continue; } String cqName =
-   * cQuery.getServerCqName(); Integer cqEvent = null; if (matchedCqs.containsKey(cqName)) { if
-   * (logger.isDebugEnabled()){ logger.
-   * debug("Similar cq/query is already processed, getting the cq event-type from the matched cq.");
-   * } cqEvent = (Integer)matchedCqs.get(cqName); } else { boolean error = false; boolean
-   * hasSeenEvent = false; HashSet cqEventKeys = null; synchronized (cQuery) { try { // Apply query
-   * on new value. if (!cqUnfilteredEventsSet_newValue.isEmpty()) { executionStartTime =
-   * this.stats.startCqQueryExecution(); b_cqResults_newValue = evaluateQuery(cQuery, new Object[]
-   * {cqUnfilteredEventsSet_newValue}); this.stats.endCqQueryExecution(executionStartTime); } //
-   * Check if old value is cached, if not apply query on old value. if (cqToCqEventKeysMap != null)
-   * { synchronized (cqToCqEventKeysMap) { if ((cqEventKeys =
-   * (HashSet)cqToCqEventKeysMap.get(cqName)) != null) { hasSeenEvent =
-   * cqEventKeys.contains(eventKey); } } } if (!hasSeenEvent) { // get the oldValue. // In case of
-   * Update, destroy and invalidate. if (operation == EnumListenerEvent.AFTER_UPDATE || operation ==
-   * EnumListenerEvent.AFTER_DESTROY || operation == EnumListenerEvent.AFTER_INVALIDATE) { if
-   * (entryEvent.getOldValue() != null) { cqUnfilteredEventsSet_oldValue.clear();
-   * cqUnfilteredEventsSet_oldValue.add(entryEvent.getOldValue()); // Apply query on old value.
-   * executionStartTime = this.stats.startCqQueryExecution(); b_cqResults_oldValue =
-   * evaluateQuery(cQuery, new Object[] {cqUnfilteredEventsSet_oldValue});
-   * this.stats.endCqQueryExecution(executionStartTime); } } } } catch (Exception ex) { //Any
-   * exception in running the query // should be caught here and buried //because this code is
-   * running inline with the //message processing code and we don't want to //kill that thread error
-   * = true; logger.info( LocalizedStrings.
-   * CqService_ERROR_WHILE_PROCESSING_CQ_ON_THE_EVENT_KEY_0_CQNAME_1_CLIENTID_2_ERROR_3, new
-   * Object[] { ((EntryEvent)event).getKey(), cQuery.getName(), clientId,
-   * ex.getLocalizedMessage()}); }
-   * 
-   * if (error) { cqEvent = Integer.valueOf(MessageType.EXCEPTION); } else { if
-   * (b_cqResults_newValue) { if (hasSeenEvent || b_cqResults_oldValue) { cqEvent =
-   * Integer.valueOf(MessageType.LOCAL_UPDATE); } else { cqEvent =
-   * Integer.valueOf(MessageType.LOCAL_CREATE); } // If its create and caching is enabled, cache the
-   * key for this CQ. if (!hasSeenEvent && cqEventKeys != null) { cqEventKeys.add(eventKey); } }
-   * else if (hasSeenEvent || (b_cqResults_oldValue)) { // Base invalidate operation is treated as
-   * destroy. // When the invalidate comes through, the entry will no longer satisfy // the query
-   * and will need to be deleted. cqEvent = Integer.valueOf(MessageType.LOCAL_DESTROY); // If
-   * caching is enabled, remove this event's key from the cache. if (hasSeenEvent && cqEventKeys !=
-   * null) { cqEventKeys.remove(eventKey); } } }
-   * 
-   * } //end synchronized(cQuery)
-   * 
-   * // Get the matching CQs if any. synchronized (this.matchingCqMap){ String query =
-   * cQuery.getQueryString(); ArrayList matchingCqs = (ArrayList)matchingCqMap.get(query); if
-   * (matchingCqs != null) { Iterator iter = matchingCqs.iterator(); while (iter.hasNext()) { String
-   * matchingCqName = (String)iter.next(); if (!matchingCqName.equals(cqName)){
-   * matchedCqs.put(matchingCqName, cqEvent); } } } }
-   * 
-   * }
-   * 
-   * if (cqEvent != null){ if (logger.isDebugEnabled()) {
-   * logger.debug("Event is added for the CQ, CqName (clientside): " + cQuery.cqName +
-   * " With CQ Op : " + cqEvent + " for Client : " + clientId); } filteredCqs.put(cQuery.cqName,
-   * cqEvent); cQuery.getVsdStats().updateStats(cqEvent); }
-   * 
-   * } // iteration over cqsToBooleans.keySet() if (!filteredCqs.isEmpty()){
-   * logger.debug("Adding event map for client : "+clientId +
-   * " with event map size : "+filteredCqs.size());
-   * ((ClientUpdateMessageImpl)clientMessage).addClientCqs(clientId, filteredCqs); } } // iteration
-   * over clientIds.entrySet() }
-   */
-
   private Integer generateCqRegionEvent(CacheEvent event) {
     Integer cqEvent = null;
     if (event.getOperation().isRegionDestroy()) {
-      cqEvent = Integer.valueOf(MessageType.DESTROY_REGION);
+      cqEvent = MessageType.DESTROY_REGION;
     } else if (event.getOperation().isRegionInvalidate()) {
-      cqEvent = Integer.valueOf(MessageType.INVALIDATE_REGION);
+      cqEvent = MessageType.INVALIDATE_REGION;
     } else if (event.getOperation().isClear()) {
-      cqEvent = Integer.valueOf(MessageType.CLEAR_REGION);
+      cqEvent = MessageType.CLEAR_REGION;
     }
     return cqEvent;
   }
 
-
   /**
    * Manages the CQs created for the base region. This is managed here, instead of on the base
    * region; since the cq could be created on the base region, before base region is created (using
    * newCq()).
    */
-  public void addToBaseRegionToCqNameMap(String regionName, String cqName) {
+  private void addToBaseRegionToCqNameMap(String regionName, String cqName) {
     synchronized (this.baseRegionToCqNameMap) {
       ArrayList<String> cqs = this.baseRegionToCqNameMap.get(regionName);
       if (cqs == null) {
-        cqs = new ArrayList<String>();
+        cqs = new ArrayList<>();
       }
       cqs.add(cqName);
       this.baseRegionToCqNameMap.put(regionName, cqs);
     }
   }
 
-  public void removeFromBaseRegionToCqNameMap(String regionName, String cqName) {
+  void removeFromBaseRegionToCqNameMap(String regionName, String cqName) {
     synchronized (this.baseRegionToCqNameMap) {
       ArrayList<String> cqs = this.baseRegionToCqNameMap.get(regionName);
       if (cqs != null) {
@@ -1864,37 +1541,12 @@ public final class CqServiceImpl implements CqService {
   }
 
   /**
-   * Removes this CQ from CQ event Cache map. This disables the caching events for this CQ.
-   * 
-   * @param cqName
-   */
-  /*
-   * synchronized public void removeCQFromCaching(String cqName){ if (cqToCqEventKeysMap != null) {
-   * // Take a lock on CqQuery object. In processEvents the maps are // handled under CqQuery
-   * object. if (cqToCqEventKeysMap != null){ synchronized (cqToCqEventKeysMap) {
-   * cqToCqEventKeysMap.remove(cqName); } } } }
-   */
-
-  /**
-   * Returns the CQ event cache map.
-   * 
-   * @return HashMap cqToCqEventKeysMap
-   * 
-   *         Caller must synchronize on the returned value in order to inspect.
-   */
-  /*
-   * public HashMap getCqToCqEventKeysMap(){ return cqToCqEventKeysMap; }
-   */
-
-  /**
    * Adds the query from the given CQ to the matched CQ map.
-   * 
-   * @param cq
    */
-  public void addToMatchingCqMap(CqQueryImpl cq) {
+  void addToMatchingCqMap(CqQueryImpl cq) {
     synchronized (this.matchingCqMap) {
       String cqQuery = cq.getQueryString();
-      Set<String> matchingCQs = null;
+      Set<String> matchingCQs;
       if (!matchingCqMap.containsKey(cqQuery)) {
         matchingCQs = Collections.newSetFromMap(new ConcurrentHashMap());
         matchingCqMap.put(cqQuery, matchingCQs);
@@ -1912,10 +1564,8 @@ public final class CqServiceImpl implements CqService {
 
   /**
    * Removes the query from the given CQ from the matched CQ map.
-   * 
-   * @param cq
    */
-  public void removeFromMatchingCqMap(CqQueryImpl cq) {
+  private void removeFromMatchingCqMap(CqQueryImpl cq) {
     synchronized (this.matchingCqMap) {
       String cqQuery = cq.getQueryString();
       if (matchingCqMap.containsKey(cqQuery)) {
@@ -1947,10 +1597,6 @@ public final class CqServiceImpl implements CqService {
    * Applies the query on the event. This method takes care of the performance related changed done
    * to improve the CQ-query performance. When CQ-query is executed first time, it saves the query
    * related information in the execution context and uses that info in later executions.
-   * 
-   * @param cQuery
-   * @param event
-   * @return boolean
    */
   private boolean evaluateQuery(CqQueryImpl cQuery, Object[] event) throws Exception {
     ExecutionContext execContext = cQuery.getQueryExecutionContext();
@@ -1983,19 +1629,6 @@ public final class CqServiceImpl implements CqService {
     return this.cqNameToUserAttributesMap.get(cqName);
   }
 
-  // public static void memberLeft(String poolName) {
-  // if (cqServiceSingleton != null && !cqServiceSingleton.isServer()) {
-  // cqServiceSingleton.sendMemberDisconnectedMessageToCqs(poolName);
-  // }
-  // }
-  //
-  // public static void memberCrashed(String poolName) {
-  // if (cqServiceSingleton != null && !cqServiceSingleton.isServer()) {
-  // cqServiceSingleton.sendMemberDisconnectedMessageToCqs(poolName);
-  // }
-  // }
-  //
-
   @Override
   public void cqsDisconnected(Pool pool) {
     invokeCqsConnected(pool, false);
@@ -2014,7 +1647,7 @@ public final class CqServiceImpl implements CqService {
     // Check to see if we are already connected/disconnected.
     // If state has not changed, do not invoke another connected/disconnected
     synchronized (cqPoolsConnected) {
-      // don't repeatily send same connect/disconnect message to cq's on repeated fails of
+      // don't repeatedly send same connect/disconnect message to cq's on repeated fails of
       // RedundancySatisfier
       if (cqPoolsConnected.containsKey(poolName) && connected == cqPoolsConnected.get(poolName)) {
         return;
@@ -2059,13 +1692,6 @@ public final class CqServiceImpl implements CqService {
           SystemFailure.checkFailure();
           logger.warn(LocalizedMessage
               .create(LocalizedStrings.CqService_ERROR_SENDING_CQ_CONNECTION_STATUS, cqName), t);
-
-          if (t instanceof VirtualMachineError) {
-            logger.warn(LocalizedMessage.create(
-                LocalizedStrings.CqService_VIRTUALMACHINEERROR_PROCESSING_CQLISTENER_FOR_CQ_0,
-                cqName), t);
-            return;
-          }
         }
       }
     }
@@ -2075,7 +1701,4 @@ public final class CqServiceImpl implements CqService {
   public List<String> getAllDurableCqsFromServer(InternalPool pool) {
     return new ServerCQProxyImpl(pool).getAllDurableCqsFromServer();
   }
-
-
 }
-

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceStatisticsImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceStatisticsImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceStatisticsImpl.java
index ba71143..a675162 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceStatisticsImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceStatisticsImpl.java
@@ -14,11 +14,9 @@
  */
 package org.apache.geode.cache.query.internal.cq;
 
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.query.CqServiceStatistics;
 import org.apache.geode.cache.query.CqQuery;
 import org.apache.geode.cache.query.internal.DefaultQueryService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 
 /**
  * Provides statistical information about CqService.
@@ -26,24 +24,22 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
  * @since GemFire 5.5
  */
 public class CqServiceStatisticsImpl implements CqServiceStatistics {
+
   private CqServiceImpl cqService;
-  // private long activeCqs;
-  // private long stoppedCqs;
-  // private long closedCqs;
-  // private long createdCqs;
 
   /**
    * Constructor for CqStatisticsImpl
    * 
    * @param cqs - CqService
    */
-  public CqServiceStatisticsImpl(CqServiceImpl cqs) {
+  CqServiceStatisticsImpl(CqServiceImpl cqs) {
     cqService = cqs;
   }
 
   /**
    * Returns the number of CQs currently executing
    */
+  @Override
   public long numCqsActive() {
     return this.cqService.getCqServiceVsdStats().getNumCqsActive();
   }
@@ -53,6 +49,7 @@ public class CqServiceStatisticsImpl implements CqServiceStatistics {
    * 
    * @return long number of cqs created.
    */
+  @Override
   public long numCqsCreated() {
     return this.cqService.getCqServiceVsdStats().getNumCqsCreated();
   }
@@ -60,6 +57,7 @@ public class CqServiceStatisticsImpl implements CqServiceStatistics {
   /**
    * Returns number of Cqs that are closed.
    */
+  @Override
   public long numCqsClosed() {
     return this.cqService.getCqServiceVsdStats().getNumCqsClosed();
   }
@@ -67,6 +65,7 @@ public class CqServiceStatisticsImpl implements CqServiceStatistics {
   /**
    * Returns number of Cqs that are stopped.
    */
+  @Override
   public long numCqsStopped() {
     return this.cqService.getCqServiceVsdStats().getNumCqsStopped();
   }
@@ -74,20 +73,18 @@ public class CqServiceStatisticsImpl implements CqServiceStatistics {
   /**
    * Returns number of CQs created from the client.
    */
+  @Override
   public long numCqsOnClient() {
     return this.cqService.getCqServiceVsdStats().getNumCqsOnClient();
   }
 
   /**
    * Returns the number of CQs (active + suspended) on the given region.
-   * 
-   * @param regionName
    */
+  @Override
   public long numCqsOnRegion(String regionName) {
-
     DefaultQueryService queryService =
-        (DefaultQueryService) ((GemFireCacheImpl) CacheFactory.getAnyInstance())
-            .getLocalQueryService();
+        (DefaultQueryService) cqService.getInternalCache().getLocalQueryService();
     try {
       CqQuery[] cqs = queryService.getCqs(regionName);
 


[22/51] [abbrv] geode git commit: GEODE-2290: Limit scanning of deployed jars

Posted by ds...@apache.org.
GEODE-2290: Limit scanning of deployed jars

 - Uses fast-classpath-scanner to scan jars for classes containing Functions without eagerly loading all classes in the jar.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 6f7f943998153de1f00b1446eb80fa6d304ac40f
Parents: 8f9624d
Author: Jared Stewart <js...@pivotal.io>
Authored: Wed Apr 12 10:53:13 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Sun Apr 16 09:10:02 2017 -0700

----------------------------------------------------------------------
 geode-assembly/build.gradle                     |   1 +
 .../src/test/resources/expected_jars.txt        |   1 +
 geode-core/build.gradle                         |  15 +-
 .../org/apache/geode/internal/DeployedJar.java  |  97 +++---
 .../org/apache/geode/internal/JarDeployer.java  |   7 +-
 .../ClassPathLoaderIntegrationTest.java         |   4 -
 .../geode/internal/DeployedJarJUnitTest.java    | 310 ++++++-------------
 .../internal/JarDeployerIntegrationTest.java    |  18 +-
 .../cache/IncrementalBackupDUnitTest.java       |   6 +-
 .../geode/management/DeployJarTestSuite.java    |   3 +
 .../DeployCommandRedeployDUnitTest.java         |  95 +++---
 .../cli/commands/DeployCommandsDUnitTest.java   |  40 +--
 .../configuration/ClusterConfigBaseTest.java    | 127 --------
 .../ClusterConfigDeployJarDUnitTest.java        |  10 +-
 .../ClusterConfigImportDUnitTest.java           |   3 +-
 .../ClusterConfigStartMemberDUnitTest.java      |   3 +-
 .../configuration/ClusterConfigTestBase.java    | 128 ++++++++
 .../dunit/rules/LocatorServerStartupRule.java   |  12 +
 ...oyCommandRedeployDUnitTest_FunctionATemplate |  30 ++
 ...oyCommandRedeployDUnitTest_FunctionBTemplate |  26 ++
 gradle/dependency-versions.properties           |   1 +
 21 files changed, 439 insertions(+), 498 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index 304a1c4..a4f0c69 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -139,6 +139,7 @@ def cp = {
         it.contains('commons-io') ||
         it.contains('commons-lang') ||
         it.contains('commons-logging') ||
+        it.contains('fast-classpath-scanner') ||
         it.contains('fastutil') ||
         it.contains('jackson-annotations') ||
         it.contains('jackson-core') ||

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/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 b7d1dc2..6260167 100644
--- a/geode-assembly/src/test/resources/expected_jars.txt
+++ b/geode-assembly/src/test/resources/expected_jars.txt
@@ -10,6 +10,7 @@ commons-io
 commons-lang
 commons-logging
 commons-modeler
+fast-classpath-scanner
 fastutil
 findbugs-annotations
 gfsh-dependencies.jar

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 757599a..f07444a 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -32,7 +32,7 @@ configurations {
 
 dependencies {
    // Source Dependencies
-  // External 
+  // 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:' + project.'jgroups.version'
@@ -104,17 +104,22 @@ dependencies {
   }
   compile ('org.iq80.snappy:snappy:' + project.'snappy-java.version') {
     ext.optional = true
-  } 
+  }
 
   compile 'org.apache.shiro:shiro-core:' + project.'shiro.version'
   // This is only added since shiro is using an old version of beanutils and we want
   // to use a standard version. Once shiro deps are updated, remove this explicit dependency
   // in favor of a transitive dependency on beanutils.
   compile 'commons-beanutils:commons-beanutils:' + project.'commons-beanutils.version'
-  
+
+  // https://mvnrepository.com/artifact/io.github.lukehutch/fast-classpath-scanner
+    compile 'io.github.lukehutch:fast-classpath-scanner:' + project.'fast-classpath-scanner.version'
+
+
+
   compile project(':geode-common')
   compile project(':geode-json')
-  
+
   jcaCompile sourceSets.main.output
 
   testCompile project(':geode-junit')
@@ -181,7 +186,7 @@ jar {
 
   from sourceSets.main.output
   from sourceSets.jca.output
-  
+
   exclude 'org/apache/geode/management/internal/web/**'
   exclude 'org/apache/geode/internal/i18n/StringIdResourceBundle_ja.txt'
   exclude 'org/apache/geode/admin/doc-files/ds4_0.dtd'

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
index 8adec1f..f96863f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
@@ -14,6 +14,9 @@
  */
 package org.apache.geode.internal;
 
+import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
+import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -25,7 +28,7 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
 import java.net.URL;
-import java.nio.channels.FileLock;
+import java.net.URLClassLoader;
 import java.nio.file.Files;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -37,7 +40,6 @@ import java.util.Properties;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 
-import org.apache.geode.cache.Cache;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.CacheClosedException;
@@ -48,7 +50,6 @@ import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.pdx.internal.TypeRegistry;
-import sun.nio.ch.ChannelInputStream;
 
 /**
  * ClassLoader for a single JAR file.
@@ -103,7 +104,7 @@ public class DeployedJar {
           + ", was modified prior to obtaining a lock: " + jarName);
     }
 
-    if (!isValidJarContent(getJarContent())) {
+    if (!hasValidJarContent(getJarContent())) {
       throw new IllegalArgumentException(
           "File does not contain valid JAR content: " + versionedJarFile.getAbsolutePath());
     }
@@ -147,23 +148,10 @@ public class DeployedJar {
    * @param jarBytes Bytes of data to be validated.
    * @return True if the data has JAR content, false otherwise
    */
-  public static boolean isValidJarContent(final byte[] jarBytes) {
+  public static boolean hasValidJarContent(final byte[] jarBytes) {
     return hasValidJarContent(new ByteArrayInputStream(jarBytes));
   }
 
-  /**
-   * Peek into the JAR data and make sure that it is valid JAR content.
-   * 
-   * @param jarFile File whose contents should be validated.
-   * @return True if the data has JAR content, false otherwise
-   */
-  public static boolean hasValidJarContent(final File jarFile) {
-    try {
-      return hasValidJarContent(new FileInputStream(jarFile));
-    } catch (IOException ioex) {
-      return false;
-    }
-  }
 
   /**
    * Scan the JAR file and attempt to load all classes and register any function classes found.
@@ -184,37 +172,42 @@ public class DeployedJar {
 
     JarInputStream jarInputStream = null;
     try {
+      List<String> functionClasses = findFunctionsInThisJar();
+
       jarInputStream = new JarInputStream(byteArrayInputStream);
       JarEntry jarEntry = jarInputStream.getNextJarEntry();
 
       while (jarEntry != null) {
         if (jarEntry.getName().endsWith(".class")) {
-          if (isDebugEnabled) {
-            logger.debug("Attempting to load class: {}, from JAR file: {}", jarEntry.getName(),
-                this.file.getAbsolutePath());
-          }
-
           final String className = jarEntry.getName().replaceAll("/", "\\.").substring(0,
               (jarEntry.getName().length() - 6));
-          try {
-            Class<?> clazz = ClassPathLoader.getLatest().forName(className);
-            Collection<Function> registerableFunctions = getRegisterableFunctionsFromClass(clazz);
-            for (Function function : registerableFunctions) {
-              FunctionService.registerFunction(function);
-              if (isDebugEnabled) {
-                logger.debug("Registering function class: {}, from JAR file: {}", className,
-                    this.file.getAbsolutePath());
+
+          if (functionClasses.contains(className)) {
+            if (isDebugEnabled) {
+              logger.debug("Attempting to load class: {}, from JAR file: {}", jarEntry.getName(),
+                  this.file.getAbsolutePath());
+            }
+            try {
+              Class<?> clazz = ClassPathLoader.getLatest().forName(className);
+              Collection<Function> registerableFunctions = getRegisterableFunctionsFromClass(clazz);
+              for (Function function : registerableFunctions) {
+                FunctionService.registerFunction(function);
+                if (isDebugEnabled) {
+                  logger.debug("Registering function class: {}, from JAR file: {}", className,
+                      this.file.getAbsolutePath());
+                }
+                this.registeredFunctions.add(function);
               }
-              this.registeredFunctions.add(function);
+            } catch (ClassNotFoundException | NoClassDefFoundError cnfex) {
+              logger.error("Unable to load all classes from JAR file: {}",
+                  this.file.getAbsolutePath(), cnfex);
+              throw cnfex;
+            }
+          } else {
+            if (isDebugEnabled) {
+              logger.debug("No functions found in class: {}, from JAR file: {}", jarEntry.getName(),
+                  this.file.getAbsolutePath());
             }
-          } catch (ClassNotFoundException cnfex) {
-            logger.error("Unable to load all classes from JAR file: {}",
-                this.file.getAbsolutePath(), cnfex);
-            throw cnfex;
-          } catch (NoClassDefFoundError ncdfex) {
-            logger.error("Unable to load all classes from JAR file: {}",
-                this.file.getAbsolutePath(), ncdfex);
-            throw ncdfex;
           }
         }
         jarEntry = jarInputStream.getNextJarEntry();
@@ -327,6 +320,15 @@ public class DeployedJar {
     return registerableFunctions;
   }
 
+  private List<String> findFunctionsInThisJar() throws IOException {
+    URLClassLoader urlClassLoader =
+        new URLClassLoader(new URL[] {this.getFile().getCanonicalFile().toURL()});
+    FastClasspathScanner fastClasspathScanner = new FastClasspathScanner()
+        .removeTemporaryFilesAfterScan(true).overrideClassLoaders(urlClassLoader);
+    ScanResult scanResult = fastClasspathScanner.scan();
+    return scanResult.getNamesOfClassesImplementing(Function.class);
+  }
+
   private Function newFunction(final Class<Function> clazz, final boolean errorOnNoSuchMethod) {
     try {
       final Constructor<Function> constructor = clazz.getConstructor();
@@ -342,20 +344,11 @@ public class DeployedJar {
               clazz.getName());
         }
       }
-    } catch (SecurityException sex) {
-      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
-          sex);
-    } catch (IllegalAccessException iae) {
-      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
-          iae);
-    } catch (InvocationTargetException ite) {
+    } catch (Exception ex) {
       logger.error("Error when attempting constructor for function for class: {}", clazz.getName(),
-          ite);
-    } catch (InstantiationException ie) {
-      logger.error("Unable to instantiate function for class: {}", clazz.getName(), ie);
-    } catch (ExceptionInInitializerError eiiex) {
-      logger.error("Error during function initialization for class: {}", clazz.getName(), eiiex);
+          ex);
     }
+
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
index da4c136..a65cd0f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
@@ -26,7 +26,6 @@ import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Serializable;
@@ -35,7 +34,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -51,7 +49,6 @@ import java.util.stream.Stream;
 public class JarDeployer implements Serializable {
   private static final long serialVersionUID = 1L;
   private static final Logger logger = LogService.getLogger();
-  public static final String JAR_PREFIX = "";
   public static final String JAR_PREFIX_FOR_REGEX = "";
   private static final Lock lock = new ReentrantLock();
 
@@ -438,7 +435,7 @@ public class JarDeployer implements Serializable {
     Optional<File> latestValidDeployedJarOptional =
         Arrays.stream(jarFiles).filter(Objects::nonNull).filter(jarFile -> {
           try {
-            return DeployedJar.isValidJarContent(FileUtils.readFileToByteArray(jarFile));
+            return DeployedJar.hasValidJarContent(FileUtils.readFileToByteArray(jarFile));
           } catch (IOException e) {
             return false;
           }
@@ -501,7 +498,7 @@ public class JarDeployer implements Serializable {
     DeployedJar[] deployedJars = new DeployedJar[jarNames.length];
 
     for (int i = 0; i < jarNames.length; i++) {
-      if (!DeployedJar.isValidJarContent(jarBytes[i])) {
+      if (!DeployedJar.hasValidJarContent(jarBytes[i])) {
         throw new IllegalArgumentException(
             "File does not contain valid JAR content: " + jarNames[i]);
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
index 14108c7..c783318 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
@@ -66,7 +66,6 @@ public class ClassPathLoaderIntegrationTest {
 
   private File tempFile;
   private File tempFile2;
-  private File extLibsDir;
 
   @Rule
   public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
@@ -78,9 +77,6 @@ public class ClassPathLoaderIntegrationTest {
   public void setUp() throws Exception {
     System.setProperty(ClassPathLoader.EXCLUDE_TCCL_PROPERTY, "false");
 
-    extLibsDir = new File(this.temporaryFolder.getRoot(), "ext");
-    extLibsDir.mkdirs();
-
     this.tempFile = this.temporaryFolder.newFile("tempFile1.tmp");
     FileOutputStream fos = new FileOutputStream(this.tempFile);
     fos.write(new byte[TEMP_FILE_BYTES_COUNT]);

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
index 7216463..5e7c40f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
@@ -14,12 +14,9 @@
  */
 package org.apache.geode.internal;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
@@ -27,6 +24,7 @@ import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.internal.cache.execute.FunctionContextImpl;
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.awaitility.Awaitility;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -43,17 +41,12 @@ import java.io.OutputStream;
 import java.lang.management.ManagementFactory;
 import java.lang.management.ThreadInfo;
 import java.lang.management.ThreadMXBean;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Random;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
 
-/**
- * TODO: Need to fix this testDeclarableFunctionsWithParms and testClassOnClasspath on Windows:
- */
 @Category(IntegrationTest.class)
 public class DeployedJarJUnitTest {
   @Rule
@@ -62,13 +55,13 @@ public class DeployedJarJUnitTest {
   @Rule
   public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
 
-  private final ClassBuilder classBuilder = new ClassBuilder();
+  private ClassBuilder classBuilder;
 
   @Before
   public void setup() throws Exception {
     File workingDir = temporaryFolder.newFolder();
-
     ClassPathLoader.setLatestToDefault(workingDir);
+    classBuilder = new ClassBuilder();
   }
 
   @After
@@ -82,13 +75,14 @@ public class DeployedJarJUnitTest {
 
   @Test
   public void testIsValidJarContent() throws IOException {
-    assertTrue(
-        DeployedJar.isValidJarContent(this.classBuilder.createJarFromName("JarClassLoaderJUnitA")));
+    assertThat(
+        DeployedJar.hasValidJarContent(this.classBuilder.createJarFromName("JarClassLoaderJUnitA")))
+            .isTrue();
   }
 
   @Test
   public void testIsInvalidJarContent() {
-    assertFalse(DeployedJar.isValidJarContent("INVALID JAR CONTENT".getBytes()));
+    assertThat(DeployedJar.hasValidJarContent("INVALID JAR CONTENT".getBytes())).isFalse();
   }
 
   @Test
@@ -99,11 +93,7 @@ public class DeployedJarJUnitTest {
             "package com.jcljunit; public class JarClassLoaderJUnitA {}");
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
 
-    try {
-      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
+    ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA");
 
     // Update the JAR file and make sure the first class is no longer on the Classpath
     // and the second one is.
@@ -111,54 +101,36 @@ public class DeployedJarJUnitTest {
         "package com.jcljunit; public class JarClassLoaderJUnitB {}");
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
 
-    try {
-      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitB");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    try {
-      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA");
-      fail("Class should not be found on Classpath");
-    } catch (ClassNotFoundException expected) { // expected
-    }
-
+    ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitB");
+    assertThatThrownBy(
+        () -> ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA"))
+            .isInstanceOf(ClassNotFoundException.class);
   }
 
   @Test
   public void testFailingCompilation() throws Exception {
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {}");
-    String functionString = stringBuffer.toString();
-
-    try {
-      this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-      fail("This code should have failed to compile and thrown an exception");
-    } catch (Exception ex) {
-      // All good
-    }
+    String functionString = "import org.apache.geode.cache.Declarable;"
+        + "import org.apache.geode.cache.execute.Function;"
+        + "import org.apache.geode.cache.execute.FunctionContext;"
+        + "public class JarClassLoaderJUnitFunction implements Function {}";
+
+    assertThatThrownBy(() -> this.classBuilder
+        .createJarFromClassContent("JarClassLoaderJUnitFunction", functionString)).isNotNull();
   }
 
   @Test
-  public void testFunctions() throws IOException, ClassNotFoundException {
+  public void testFunctions() throws Exception {
     // Test creating a JAR file with a function
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {");
-    stringBuffer.append("public void init(Properties props) {}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"GOODv1\");}");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
+    String functionString =
+        "import java.util.Properties;" + "import org.apache.geode.cache.Declarable;"
+            + "import org.apache.geode.cache.execute.Function;"
+            + "import org.apache.geode.cache.execute.FunctionContext;"
+            + "public class JarClassLoaderJUnitFunction implements Function {"
+            + "public void init(Properties props) {}" + "public boolean hasResult() {return true;}"
+            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"GOODv1\");}"
+            + "public String getId() {return \"JarClassLoaderJUnitFunction\";}"
+            + "public boolean optimizeForWrite() {return false;}"
+            + "public boolean isHA() {return false;}}";
 
     byte[] jarBytes =
         this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
@@ -166,11 +138,11 @@ public class DeployedJarJUnitTest {
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
 
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
+    assertThat(function).isNotNull();
     TestResultSender resultSender = new TestResultSender();
     FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
     function.execute(functionContext);
-    assertEquals("GOODv1", (String) resultSender.getResults());
+    assertThat(resultSender.getResults()).isEqualTo("GOODv1");
 
     // Test updating the function with a new JAR file
     functionString = functionString.replace("v1", "v2");
@@ -179,11 +151,11 @@ public class DeployedJarJUnitTest {
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
 
     function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
+    assertThat(function).isNotNull();
     resultSender = new TestResultSender();
     functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
     function.execute(functionContext);
-    assertEquals("GOODv2", (String) resultSender.getResults());
+    assertThat(resultSender.getResults()).isEqualTo("GOODv2");
 
     // Test returning null for the Id
     String functionNullIdString =
@@ -192,88 +164,71 @@ public class DeployedJarJUnitTest {
         functionNullIdString);
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
 
-    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
+    assertThat(FunctionService.getFunction("JarClassLoaderJUnitFunction")).isNull();
 
     // Test removing the JAR
     ClassPathLoader.getLatest().getJarDeployer().undeploy("JarClassLoaderJUnit.jar");
-    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
+    assertThat(FunctionService.getFunction("JarClassLoaderJUnitFunction")).isNull();
   }
 
   /**
    * Ensure that abstract functions aren't added to the Function Service.
    */
   @Test
-  public void testAbstractFunction() throws IOException, ClassNotFoundException {
+  public void testAbstractFunction() throws Exception {
     // Add an abstract Function to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("public abstract class JarClassLoaderJUnitFunction implements Function {");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}}");
-    String functionString = stringBuffer.toString();
+    String functionString = "import org.apache.geode.cache.execute.Function;"
+        + "public abstract class JarClassLoaderJUnitFunction implements Function {"
+        + "public String getId() {return \"JarClassLoaderJUnitFunction\";}}";
 
     byte[] jarBytes =
         this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitFunction.jar",
         jarBytes);
 
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
+    ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
 
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNull(function);
+    assertThat(function).isNull();
   }
 
   @Test
   public void testDeclarableFunctionsWithNoCacheXml() throws Exception {
-
     final String jarName = "JarClassLoaderJUnitNoXml.jar";
 
     // Add a Declarable Function without parameters for the class to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer
-        .append("public class JarClassLoaderJUnitFunctionNoXml implements Function, Declarable {");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunctionNoXml\";}");
-    stringBuffer.append("public void init(Properties props) {}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"NOPARMSv1\");}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
+    String functionString =
+        "import java.util.Properties;" + "import org.apache.geode.cache.Declarable;"
+            + "import org.apache.geode.cache.execute.Function;"
+            + "import org.apache.geode.cache.execute.FunctionContext;"
+            + "public class JarClassLoaderJUnitFunctionNoXml implements Function, Declarable {"
+            + "public String getId() {return \"JarClassLoaderJUnitFunctionNoXml\";}"
+            + "public void init(Properties props) {}"
+            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"NOPARMSv1\");}"
+            + "public boolean hasResult() {return true;}"
+            + "public boolean optimizeForWrite() {return false;}"
+            + "public boolean isHA() {return false;}}";
 
     byte[] jarBytes = this.classBuilder
         .createJarFromClassContent("JarClassLoaderJUnitFunctionNoXml", functionString);
 
     ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, jarBytes);
 
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunctionNoXml");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
+    ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunctionNoXml");
 
     // Check to see if the function without parameters executes correctly
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunctionNoXml");
-    assertNotNull(function);
+    assertThat(function).isNotNull();
     TestResultSender resultSender = new TestResultSender();
     function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("NOPARMSv1", (String) resultSender.getResults());
+    assertThat((String) resultSender.getResults()).isEqualTo("NOPARMSv1");
   }
 
   @Test
-  public void testDependencyBetweenJars() throws IOException, ClassNotFoundException {
+  public void testDependencyBetweenJars() throws Exception {
     final File parentJarFile = temporaryFolder.newFile("JarClassLoaderJUnitParent.jar");
     final File usesJarFile = temporaryFolder.newFile("JarClassLoaderJUnitUses.jar");
 
-    JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
-
     // Write out a JAR files.
     StringBuffer stringBuffer = new StringBuffer();
     stringBuffer.append("package jcljunit.parent;");
@@ -319,17 +274,15 @@ public class DeployedJarJUnitTest {
     jarBytes = functionClassBuilder.createJarFromClassContent(
         "jcljunit/function/JarClassLoaderJUnitFunction", stringBuffer.toString());
 
-
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitFunction.jar",
         jarBytes);
 
-
     Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
+    assertThat(function).isNotNull();
     TestResultSender resultSender = new TestResultSender();
     FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
     function.execute(functionContext);
-    assertEquals("PARENT:USES", (String) resultSender.getResults());
+    assertThat((String) resultSender.getResults()).isEqualTo("PARENT:USES");
   }
 
   @Test
@@ -342,39 +295,26 @@ public class DeployedJarJUnitTest {
         jarBytes);
 
     InputStream inputStream = ClassPathLoader.getLatest().getResourceAsStream(fileName);
-    assertNotNull(inputStream);
+    assertThat(inputStream).isNotNull();
 
     final byte[] fileBytes = new byte[fileContent.length()];
     inputStream.read(fileBytes);
     inputStream.close();
-    assertTrue(fileContent.equals(new String(fileBytes)));
+    assertThat(fileContent).isEqualTo(new String(fileBytes));
   }
 
   @Test
-  public void testUpdateClassInJar() throws IOException, ClassNotFoundException {
+  public void testUpdateClassInJar() throws Exception {
     // First use of the JAR file
     byte[] jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitTestClass",
         "public class JarClassLoaderJUnitTestClass { public Integer getValue5() { return new Integer(5); } }");
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitUpdate.jar", jarBytes);
 
-    try {
-      Class<?> clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
-      Object object = clazz.newInstance();
-      Method getValue5Method = clazz.getMethod("getValue5", new Class[] {});
-      Integer value = (Integer) getValue5Method.invoke(object, new Object[] {});
-      assertEquals(value.intValue(), 5);
-
-    } catch (InvocationTargetException itex) {
-      fail("JAR file not correctly added to Classpath" + itex);
-    } catch (NoSuchMethodException nsmex) {
-      fail("JAR file not correctly added to Classpath" + nsmex);
-    } catch (InstantiationException iex) {
-      fail("JAR file not correctly added to Classpath" + iex);
-    } catch (IllegalAccessException iaex) {
-      fail("JAR file not correctly added to Classpath" + iaex);
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath" + cnfex);
-    }
+    Class<?> clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
+    Object object = clazz.newInstance();
+    Method getValue5Method = clazz.getMethod("getValue5");
+    Integer value = (Integer) getValue5Method.invoke(object);
+    assertThat(value).isEqualTo(5);
 
     // Now create an updated JAR file and make sure that the method from the new
     // class is available.
@@ -382,29 +322,15 @@ public class DeployedJarJUnitTest {
         "public class JarClassLoaderJUnitTestClass { public Integer getValue10() { return new Integer(10); } }");
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitUpdate.jar", jarBytes);
 
-
-    try {
-      Class<?> clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
-      Object object = clazz.newInstance();
-      Method getValue10Method = clazz.getMethod("getValue10", new Class[] {});
-      Integer value = (Integer) getValue10Method.invoke(object, new Object[] {});
-      assertEquals(value.intValue(), 10);
-
-    } catch (InvocationTargetException itex) {
-      fail("JAR file not correctly added to Classpath" + itex);
-    } catch (NoSuchMethodException nsmex) {
-      fail("JAR file not correctly added to Classpath" + nsmex);
-    } catch (InstantiationException iex) {
-      fail("JAR file not correctly added to Classpath" + iex);
-    } catch (IllegalAccessException iaex) {
-      fail("JAR file not correctly added to Classpath" + iaex);
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath" + cnfex);
-    }
+    clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
+    object = clazz.newInstance();
+    Method getValue10Method = clazz.getMethod("getValue10");
+    value = (Integer) getValue10Method.invoke(object);
+    assertThat(value).isEqualTo(10);
   }
 
   @Test
-  public void testMultiThread() throws IOException, ClassNotFoundException {
+  public void testMultiThreadingDoesNotCauseDeadlock() throws Exception {
     // Add two JARs to the classpath
     byte[] jarBytes = this.classBuilder.createJarFromName("JarClassLoaderJUnitA");
     ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitA.jar", jarBytes);
@@ -416,54 +342,32 @@ public class DeployedJarJUnitTest {
     String[] classNames = new String[] {"JarClassLoaderJUnitA", "com.jcljunit.JarClassLoaderJUnitB",
         "NON-EXISTENT CLASS"};
 
-    // Spawn some threads which try to instantiate these classes
     final int threadCount = 10;
-    final int numLoops = 1000;
-    final CyclicBarrier cyclicBarrier = new CyclicBarrier(threadCount + 1);
+    ExecutorService executorService = Executors.newFixedThreadPool(threadCount);
     for (int i = 0; i < threadCount; i++) {
-      new ForNameExerciser(cyclicBarrier, numLoops, classNames).start();
+      executorService.submit(new ForNameExerciser(classNames));
     }
 
-    // Wait for all of the threads to be ready
-    try {
-      cyclicBarrier.await();
-    } catch (InterruptedException iex) {
-      fail("Interrupted while waiting for barrier");
-    } catch (BrokenBarrierException bbex) {
-      fail("Broken barrier while waiting");
-    }
+    executorService.shutdown();
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(executorService::isTerminated);
 
-    // Loop while each thread tries N times to instantiate a non-existent class
-    for (int i = 0; i < numLoops; i++) {
-      try {
-        cyclicBarrier.await(5, TimeUnit.SECONDS);
-      } catch (InterruptedException iex) {
-        fail("Interrupted while waiting for barrier");
-      } catch (TimeoutException tex) {
-        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-        long[] threadIds = threadMXBean.findDeadlockedThreads();
-
-        if (threadIds != null) {
-          StringBuffer deadLockTrace = new StringBuffer();
-          for (long threadId : threadIds) {
-            ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId, 100);
-            deadLockTrace.append(threadInfo.getThreadName()).append("\n");
-            for (StackTraceElement stackTraceElem : threadInfo.getStackTrace()) {
-              deadLockTrace.append("\t").append(stackTraceElem).append("\n");
-            }
-          }
-
-          fail("Deadlock with trace:\n" + deadLockTrace.toString());
-        }
+    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+    long[] threadIds = threadMXBean.findDeadlockedThreads();
 
-        fail("Timeout while waiting for barrier - no deadlock detected");
-      } catch (BrokenBarrierException bbex) {
-        fail("Broken barrier while waiting");
+    if (threadIds != null) {
+      StringBuilder deadLockTrace = new StringBuilder();
+      for (long threadId : threadIds) {
+        ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId, 100);
+        deadLockTrace.append(threadInfo.getThreadName()).append("\n");
+        for (StackTraceElement stackTraceElem : threadInfo.getStackTrace()) {
+          deadLockTrace.append("\t").append(stackTraceElem).append("\n");
+        }
       }
+      System.out.println(deadLockTrace);
     }
+    assertThat(threadIds).isNull();
   }
 
-
   private void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws IOException {
     final OutputStream outStream = new FileOutputStream(jarFile);
     outStream.write(jarBytes);
@@ -497,40 +401,24 @@ public class DeployedJarJUnitTest {
 
   static final Random random = new Random();
 
-  private class ForNameExerciser extends Thread {
-    private final CyclicBarrier cyclicBarrier;
-    private final int numLoops;
+  private class ForNameExerciser implements Runnable {
+    private final int numLoops = 1000;
     private final String[] classNames;
 
-    ForNameExerciser(final CyclicBarrier cyclicBarrier, final int numLoops,
-        final String[] classNames) {
-      this.cyclicBarrier = cyclicBarrier;
-      this.numLoops = numLoops;
+    ForNameExerciser(final String[] classNames) {
       this.classNames = classNames;
     }
 
     @Override
     public void run() {
-      try {
-        this.cyclicBarrier.await();
-      } catch (InterruptedException iex) {
-        fail("Interrupted while waiting for latch");
-      } catch (BrokenBarrierException bbex) {
-        fail("Broken barrier while waiting");
-      }
       for (int i = 0; i < this.numLoops; i++) {
         try {
           // Random select a name from the list of class names and try to load it
           String className = this.classNames[random.nextInt(this.classNames.length)];
           ClassPathLoader.getLatest().forName(className);
         } catch (ClassNotFoundException expected) { // expected
-        }
-        try {
-          this.cyclicBarrier.await();
-        } catch (InterruptedException iex) {
-          fail("Interrupted while waiting for barrrier");
-        } catch (BrokenBarrierException bbex) {
-          fail("Broken barrier while waiting");
+        } catch (Exception e) {
+          throw new RuntimeException(e);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
index e9af0e7..b81e3e9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
@@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.awaitility.Awaitility;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -34,6 +35,7 @@ import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -94,8 +96,6 @@ public class JarDeployerIntegrationTest {
     alternateDir.delete();
 
     final JarDeployer jarDeployer = new JarDeployer(alternateDir);
-
-    final CyclicBarrier barrier = new CyclicBarrier(2);
     final byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDTID");
 
     // Test to verify that deployment fails if the directory doesn't exist.
@@ -106,16 +106,20 @@ public class JarDeployerIntegrationTest {
     // Test to verify that deployment succeeds if the directory doesn't
     // initially exist, but is then created while the JarDeployer is looping
     // looking for a valid directory.
-    Future<Boolean> done = Executors.newSingleThreadExecutor().submit(() -> {
+    final AtomicBoolean isDeployed = new AtomicBoolean(false);
+    final CyclicBarrier barrier = new CyclicBarrier(2);
+
+    Executors.newSingleThreadExecutor().submit(() -> {
       barrier.await();
       jarDeployer.deployWithoutRegistering("JarDeployerIntegrationTest.jar", jarBytes);
+      isDeployed.set(true);
       return true;
     });
 
     barrier.await();
-    Thread.sleep(500);
-    alternateDir.mkdir();
-    assertThat(done.get(2, TimeUnit.MINUTES)).isTrue();
+    alternateDir.mkdirs();
+    Awaitility.await().atMost(1, TimeUnit.MINUTES)
+        .until(() -> assertThat(isDeployed.get()).isTrue());
   }
 
   @Test
@@ -137,7 +141,7 @@ public class JarDeployerIntegrationTest {
   @Test
   public void testVersionNumberMatcher() throws IOException {
     int version =
-        jarDeployer.extractVersionFromFilename(temporaryFolder.newFile("MyJar.v1.jar").getName());
+        JarDeployer.extractVersionFromFilename(temporaryFolder.newFile("MyJar.v1.jar").getName());
 
     assertThat(version).isEqualTo(1);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
index dcbbeb0..0dbe75f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
@@ -1103,7 +1103,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
       }
     });
 
-    assert (deployedJarFile.exists());
+    assertTrue(deployedJarFile.exists());
     /*
      * Perform backup. Make sure it is successful.
      */
@@ -1138,7 +1138,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Cleanup "dummy" jar from file system.
      */
-    Pattern pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + jarName + ".*#\\d++$");
+    Pattern pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
     deleteMatching(new File("."), pattern);
 
     // Execute the restore
@@ -1179,7 +1179,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Cleanup "dummy" jar from file system.
      */
-    pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + jarName + ".*#\\d++$");
+    pattern = Pattern.compile("^" + jarName + ".*#\\d++$");
     deleteMatching(new File(vmDir), pattern);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
index ee46cbf..6dfab66 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
@@ -21,9 +21,12 @@ import org.apache.geode.internal.JarDeployerIntegrationTest;
 import org.apache.geode.management.internal.cli.commands.DeployCommandRedeployDUnitTest;
 import org.apache.geode.management.internal.cli.commands.DeployCommandsDUnitTest;
 import org.apache.geode.management.internal.configuration.ClusterConfigDeployJarDUnitTest;
+import org.junit.Ignore;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
+
+@Ignore
 @RunWith(Suite.class)
 @Suite.SuiteClasses({DeployedJarJUnitTest.class, DeployCommandsDUnitTest.class,
     JarDeployerIntegrationTest.class, ClassPathLoaderIntegrationTest.class,

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
index 8280f5d..7780c0e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.management.internal.cli.commands;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.geode.cache.execute.Execution;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.distributed.DistributedSystem;
@@ -23,10 +24,8 @@ import org.apache.geode.internal.ClassBuilder;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.Locator;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
-import org.apache.geode.test.dunit.rules.Server;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.junit.Before;
 import org.junit.Rule;
@@ -34,8 +33,8 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.Serializable;
+import java.net.URL;
 import java.util.List;
 
 @Category(DistributedTest.class)
@@ -43,15 +42,15 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
   private static final String VERSION1 = "Version1";
   private static final String VERSION2 = "Version2";
 
-  private static final String jarNameA = "DeployCommandRedeployDUnitTestA.jar";
-  private static final String functionA = "DeployCommandRedeployDUnitFunctionA";
+  private static final String JAR_NAME_A = "DeployCommandRedeployDUnitTestA.jar";
+  private static final String FUNCTION_A = "DeployCommandRedeployDUnitFunctionA";
   private File jarAVersion1;
   private File jarAVersion2;
 
-  private static final String jarNameB = "DeployCommandRedeployDUnitTestB.jar";
-  private static final String functionB = "DeployCommandRedeployDUnitFunctionB";
-  private static final String packageB = "jddunit.function";
-  private static final String fullyQualifiedFunctionB = packageB + "." + functionB;
+  private static final String JAR_NAME_B = "DeployCommandRedeployDUnitTestB.jar";
+  private static final String FUNCTION_B = "DeployCommandRedeployDUnitFunctionB";
+  private static final String PACKAGE_B = "jddunit.function";
+  private static final String FULLY_QUALIFIED_FUNCTION_B = PACKAGE_B + "." + FUNCTION_B;
   private File jarBVersion1;
   private File jarBVersion2;
 
@@ -59,7 +58,7 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
   private MemberVM server;
 
   @Rule
-  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule(true);
 
   @Rule
   public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
@@ -81,64 +80,60 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
   @Test
   public void redeployJarsWithNewVersionsOfFunctions() throws Exception {
     gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarAVersion1.getCanonicalPath());
-    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
-    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
-
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_A, FUNCTION_A));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_A, VERSION1));
 
     gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarBVersion1.getCanonicalPath());
-    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
-    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
-    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
-    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION1));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_A, FUNCTION_A));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_B, FULLY_QUALIFIED_FUNCTION_B));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_A, VERSION1));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_B, VERSION1));
 
     gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarBVersion2.getCanonicalPath());
-    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
-    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
-    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
-    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION2));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_A, FUNCTION_A));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_B, FULLY_QUALIFIED_FUNCTION_B));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_A, VERSION1));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_B, VERSION2));
 
     gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarAVersion2.getCanonicalPath());
-    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
-    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
-    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION2));
-    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION2));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_A, FUNCTION_A));
+    server.invoke(() -> assertThatCanLoad(JAR_NAME_B, FULLY_QUALIFIED_FUNCTION_B));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_A, VERSION2));
+    server.invoke(() -> assertThatFunctionHasVersion(FUNCTION_B, VERSION2));
   }
 
   // Note that jar A is a Declarable Function, while jar B is only a Function.
   // Also, the function for jar A resides in the default package, whereas jar B specifies a package.
   // This ensures that this test has identical coverage to some tests that it replaced.
   private File createJarWithFunctionA(String version) throws Exception {
-    String classContents =
-        "import java.util.Properties;" + "import org.apache.geode.cache.Declarable;"
-            + "import org.apache.geode.cache.execute.Function;"
-            + "import org.apache.geode.cache.execute.FunctionContext;" + "public class " + functionA
-            + " implements Function, Declarable {" + "public String getId() {return \"" + functionA
-            + "\";}" + "public void init(Properties props) {}"
-            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\""
-            + version + "\");}" + "public boolean hasResult() {return true;}"
-            + "public boolean optimizeForWrite() {return false;}"
-            + "public boolean isHA() {return false;}}";
-
-    File jar = new File(lsRule.getTempFolder().newFolder(jarNameA + version), this.jarNameA);
+    URL classTemplateUrl = DeployCommandRedeployDUnitTest.class
+        .getResource("DeployCommandRedeployDUnitTest_FunctionATemplate");
+    assertThat(classTemplateUrl).isNotNull();
+
+    String classContents = FileUtils.readFileToString(new File(classTemplateUrl.toURI()), "UTF-8");
+    classContents = classContents.replaceAll("FUNCTION_A", FUNCTION_A);
+    classContents = classContents.replaceAll("VERSION", version);
+
+    File jar = new File(lsRule.getTempFolder().newFolder(JAR_NAME_A + version), this.JAR_NAME_A);
     ClassBuilder functionClassBuilder = new ClassBuilder();
-    functionClassBuilder.writeJarFromContent(functionA, classContents, jar);
+    functionClassBuilder.writeJarFromContent(FUNCTION_A, classContents, jar);
 
     return jar;
   }
 
-  private File createJarWithFunctionB(String version) throws IOException {
-    String classContents =
-        "package " + packageB + ";" + "import org.apache.geode.cache.execute.Function;"
-            + "import org.apache.geode.cache.execute.FunctionContext;" + "public class " + functionB
-            + " implements Function {" + "public boolean hasResult() {return true;}"
-            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\""
-            + version + "\");}" + "public String getId() {return \"" + functionB + "\";}"
-            + "public boolean optimizeForWrite() {return false;}"
-            + "public boolean isHA() {return false;}}";
-
-    File jar = new File(lsRule.getTempFolder().newFolder(jarNameB + version), this.jarNameB);
+  private File createJarWithFunctionB(String version) throws Exception {
+    URL classTemplateUrl = DeployCommandRedeployDUnitTest.class
+        .getResource("DeployCommandRedeployDUnitTest_FunctionATemplate");
+    assertThat(classTemplateUrl).isNotNull();
+
+    String classContents = FileUtils.readFileToString(new File(classTemplateUrl.toURI()), "UTF-8");
+    classContents = classContents.replaceAll("PACKAGE_B", PACKAGE_B);
+    classContents = classContents.replaceAll("FUNCTION_B", FUNCTION_B);
+    classContents = classContents.replaceAll("VERSION", version);
+
+    File jar = new File(lsRule.getTempFolder().newFolder(JAR_NAME_B + version), this.JAR_NAME_B);
     ClassBuilder functionClassBuilder = new ClassBuilder();
-    functionClassBuilder.writeJarFromContent("jddunit/function/" + functionB, classContents, jar);
+    functionClassBuilder.writeJarFromContent("jddunit/function/" + FUNCTION_B, classContents, jar);
 
     return jar;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
index 6df2572..9ed5bed 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -15,6 +15,7 @@
 package org.apache.geode.management.internal.cli.commands;
 
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.test.dunit.Host.getHost;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertNotNull;
@@ -39,7 +40,7 @@ import java.util.Properties;
 
 /**
  * Unit tests for the DeployCommands class
- *
+ * 
  * @since GemFire 7.0
  */
 @SuppressWarnings("serial")
@@ -76,6 +77,9 @@ public class DeployCommandsDUnitTest implements Serializable {
 
   @Before
   public void setup() throws Exception {
+    getHost(0).getVM(1).bounce();
+    getHost(0).getVM(2).bounce();
+
     ClassBuilder classBuilder = new ClassBuilder();
     File jarsDir = lsRule.getTempFolder().newFolder();
     jar1 = new File(jarsDir, jarName1);
@@ -108,7 +112,7 @@ public class DeployCommandsDUnitTest implements Serializable {
     // Deploy a jar to a single group
     CommandResult cmdResult =
         gfshConnector.executeAndVerifyCommand("deploy --jar=" + jar2 + " --group=" + GROUP1);
-    String resultString = commandResultToString(cmdResult);
+    String resultString = gfshConnector.getGfshOutput();
 
     assertThat(resultString).contains(server1.getName());
     assertThat(resultString).doesNotContain(server2.getName());
@@ -121,9 +125,9 @@ public class DeployCommandsDUnitTest implements Serializable {
   @Test
   public void deployMultipleJarsToOneGroup() throws Exception {
     // Deploy of multiple JARs to a single group
-    CommandResult cmdResult = gfshConnector.executeAndVerifyCommand(
+    gfshConnector.executeAndVerifyCommand(
         "deploy --group=" + GROUP1 + " --dir=" + subdirWithJars3and4.getCanonicalPath());
-    String resultString = commandResultToString(cmdResult);
+    String resultString = gfshConnector.getGfshOutput();
 
     assertThat(resultString).describedAs(resultString).contains(server1.getName());
     assertThat(resultString).doesNotContain(server2.getName());
@@ -139,7 +143,6 @@ public class DeployCommandsDUnitTest implements Serializable {
       assertThatCannotLoad(jarName4, class4);
     });
 
-
     // Undeploy of multiple jars by specifying group
     gfshConnector.executeAndVerifyCommand("undeploy --group=" + GROUP1);
     server1.invoke(() -> {
@@ -155,9 +158,9 @@ public class DeployCommandsDUnitTest implements Serializable {
   @Test
   public void deployJarToAllServers() throws Exception {
     // Deploy a jar to all servers
-    CommandResult cmdResult = gfshConnector.executeAndVerifyCommand("deploy --jar=" + jar1);
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + jar1);
+    String resultString = gfshConnector.getGfshOutput();
 
-    String resultString = commandResultToString(cmdResult);
     assertThat(resultString).contains(server1.getName());
     assertThat(resultString).contains(server2.getName());
     assertThat(resultString).contains(jarName1);
@@ -242,16 +245,16 @@ public class DeployCommandsDUnitTest implements Serializable {
         "deploy jar --group=" + GROUP2 + " --jar=" + jar2.getCanonicalPath());
 
     // List for all members
-    CommandResult commandResult = gfshConnector.executeAndVerifyCommand("list deployed");
-    String resultString = commandResultToString(commandResult);
+    gfshConnector.executeAndVerifyCommand("list deployed");
+    String resultString = gfshConnector.getGfshOutput();
     assertThat(resultString).contains(server1.getName());
     assertThat(resultString).contains(server2.getName());
     assertThat(resultString).contains(jarName1);
     assertThat(resultString).contains(jarName2);
 
     // List for members in Group1
-    commandResult = gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP1);
-    resultString = commandResultToString(commandResult);
+    gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP1);
+    resultString = gfshConnector.getGfshOutput();
     assertThat(resultString).contains(server1.getName());
     assertThat(resultString).doesNotContain(server2.getName());
 
@@ -259,23 +262,12 @@ public class DeployCommandsDUnitTest implements Serializable {
     assertThat(resultString).doesNotContain(jarName2);
 
     // List for members in Group2
-    commandResult = gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP2);
-    resultString = commandResultToString(commandResult);
+    gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP2);
+    resultString = gfshConnector.getGfshOutput();
     assertThat(resultString).doesNotContain(server1.getName());
     assertThat(resultString).contains(server2.getName());
 
     assertThat(resultString).doesNotContain(jarName1);
     assertThat(resultString).contains(jarName2);
   }
-
-  protected static String commandResultToString(final CommandResult commandResult) {
-    assertNotNull(commandResult);
-    commandResult.resetToFirstLine();
-    StringBuilder buffer = new StringBuilder(commandResult.getHeader());
-    while (commandResult.hasNextLine()) {
-      buffer.append(commandResult.nextLine());
-    }
-    buffer.append(commandResult.getFooter());
-    return buffer.toString();
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigBaseTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigBaseTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigBaseTest.java
deleted file mode 100644
index cecc8cf..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigBaseTest.java
+++ /dev/null
@@ -1,127 +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 org.apache.geode.management.internal.configuration;
-
-import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
-import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.geode.internal.ClassBuilder;
-import org.apache.geode.management.internal.configuration.utils.ZipUtils;
-import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
-import org.junit.Before;
-import org.junit.Rule;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-public class ClusterConfigBaseTest {
-  public String clusterConfigZipPath;
-
-  public static final ConfigGroup CLUSTER = new ConfigGroup("cluster").regions("regionForCluster")
-      .jars("cluster.jar").maxLogFileSize("5000").configFiles("cluster.properties", "cluster.xml");
-  public static final ConfigGroup GROUP1 = new ConfigGroup("group1").regions("regionForGroup1")
-      .jars("group1.jar").maxLogFileSize("6000").configFiles("group1.properties", "group1.xml");
-  public static final ConfigGroup GROUP2 = new ConfigGroup("group2").regions("regionForGroup2")
-      .jars("group2.jar").maxLogFileSize("7000").configFiles("group2.properties", "group2.xml");
-
-  public static final ClusterConfig CONFIG_FROM_ZIP = new ClusterConfig(CLUSTER, GROUP1, GROUP2);
-
-  public static final ClusterConfig REPLICATED_CONFIG_FROM_ZIP = new ClusterConfig(
-      new ConfigGroup("cluster").maxLogFileSize("5000").jars("cluster.jar")
-          .regions("regionForCluster"),
-      new ConfigGroup("group1").maxLogFileSize("6000").jars("group1.jar")
-          .regions("regionForGroup1"),
-      new ConfigGroup("group2").maxLogFileSize("7000").jars("group2.jar")
-          .regions("regionForGroup2"));
-
-  @Rule
-  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
-
-  protected Properties locatorProps;
-  protected Properties serverProps;
-
-  @Before
-  public void before() throws Exception {
-    clusterConfigZipPath = buildClusterZipFile();
-    locatorProps = new Properties();
-    serverProps = new Properties();
-
-    // the following are default values, we don't need to set them. We do it for clarity purpose
-    locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-    serverProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-  }
-
-  private String buildClusterZipFile() throws Exception {
-    ClassBuilder classBuilder = new ClassBuilder();
-    File clusterConfigDir = this.lsRule.getTempFolder().newFolder("cluster_config");
-
-    File clusterDir = new File(clusterConfigDir, "cluster");
-    String clusterXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
-        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
-        + "<region name=\"regionForCluster\">\n"
-        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
-        + "  </region>\n" + "</cache>\n";
-    writeFile(clusterDir, "cluster.xml", clusterXml);
-    writeFile(clusterDir, "cluster.properties", "log-file-size-limit=5000");
-    createJarFileWithClass("Cluster", "cluster.jar", clusterDir);
-
-    File group1Dir = new File(clusterConfigDir, "group1");
-    String group1Xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
-        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
-        + "<region name=\"regionForGroup1\">\n"
-        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
-        + "  </region>\n" + "</cache>\n";
-    writeFile(group1Dir, "group1.xml", group1Xml);
-    writeFile(group1Dir, "group1.properties", "log-file-size-limit=6000");
-    createJarFileWithClass("Group1", "group1.jar", group1Dir);
-
-
-    File group2Dir = new File(clusterConfigDir, "group2");
-    String group2Xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
-        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
-        + "<region name=\"regionForGroup2\">\n"
-        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
-        + "  </region>\n" + "</cache>\n";
-    writeFile(group2Dir, "group2.xml", group2Xml);
-    writeFile(group2Dir, "group2.properties", "log-file-size-limit=7000");
-    createJarFileWithClass("Group2", "group2.jar", group2Dir);
-
-
-    File clusterConfigZip = new File(lsRule.getTempFolder().newFolder(), "cluster_config.zip");
-    ZipUtils.zipDirectory(clusterConfigDir.getCanonicalPath(), clusterConfigZip.getCanonicalPath());
-
-    FileUtils.deleteDirectory(clusterConfigDir);
-    return clusterConfigZip.getCanonicalPath();
-  }
-
-  private File writeFile(File dir, String fileName, String content) throws IOException {
-    dir.mkdirs();
-    File file = new File(dir, fileName);
-    FileUtils.writeStringToFile(file, content);
-
-    return file;
-  }
-
-  protected String createJarFileWithClass(String className, String jarName, File dir)
-      throws IOException {
-    File jarFile = new File(dir, jarName);
-    new ClassBuilder().writeJarFromName(className, jarFile);
-    return jarFile.getCanonicalPath();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
index 980f81f..3781c98 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
@@ -18,6 +18,7 @@ package org.apache.geode.management.internal.configuration;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.test.dunit.Host.getHost;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
@@ -29,7 +30,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category(DistributedTest.class)
-public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
+public class ClusterConfigDeployJarDUnitTest extends ClusterConfigTestBase {
   @Rule
   public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
 
@@ -37,7 +38,6 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
 
   @Before
   public void before() throws Exception {
-    super.before();
     clusterJar = createJarFileWithClass("Cluster", "cluster.jar", lsRule.getTempFolder().getRoot());
     group1Jar = createJarFileWithClass("Group1", "group1.jar", lsRule.getTempFolder().getRoot());
     group2Jar = createJarFileWithClass("Group2", "group2.jar", lsRule.getTempFolder().getRoot());
@@ -180,7 +180,6 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
     // test undeploy cluster
     gfshConnector.executeAndVerifyCommand("undeploy --jar=cluster.jar");
 
-
     cluster = cluster.removeJar("cluster.jar");
     server3Config.verify(locator);
     server1Config.verify(server1);
@@ -253,7 +252,6 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
     gfshConnector.executeAndVerifyCommand("undeploy --jar=cluster.jar");
     server3 = lsRule.startServerVM(3, serverProps, locator.getPort());
 
-
     cluster = cluster.removeJar("cluster.jar");
     server3Config.verify(locator);
     server1Config.verify(server1);
@@ -264,8 +262,8 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
 
     group1 = group1.removeJar("group1.jar");
     /*
-     * TODO: This is the current (weird) behavior If you started server4 with group1,group2 after
-     * this undeploy command, it would have group1.jar (brought from
+     * TODO: GEODE-2779 This is the current (weird) behavior If you started server4 with
+     * group1,group2 after this undeploy command, it would have group1.jar (brought from
      * cluster_config/group2/group1.jar on locator) whereas server3 (also in group1,group2) does not
      * have this jar.
      */

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
index 696d22c..521e084 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
@@ -42,7 +42,7 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
 @Category(DistributedTest.class)
-public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
+public class ClusterConfigImportDUnitTest extends ClusterConfigTestBase {
   @Rule
   public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
 
@@ -52,7 +52,6 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigBaseTest {
 
   @Before
   public void before() throws Exception {
-    super.before();
     locatorVM = lsRule.startLocatorVM(0, locatorProps);
     INITIAL_CONFIG.verify(locatorVM);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigStartMemberDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigStartMemberDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigStartMemberDUnitTest.java
index 652ec60..1cdda4c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigStartMemberDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigStartMemberDUnitTest.java
@@ -33,12 +33,11 @@ import java.io.File;
 import java.util.Properties;
 
 @Category(DistributedTest.class)
-public class ClusterConfigStartMemberDUnitTest extends ClusterConfigBaseTest {
+public class ClusterConfigStartMemberDUnitTest extends ClusterConfigTestBase {
   protected MemberVM locator;
 
   @Before
   public void before() throws Exception {
-    super.before();
     locator = startLocatorWithLoadCCFromDir();
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigTestBase.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigTestBase.java
new file mode 100644
index 0000000..c5aaa74
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigTestBase.java
@@ -0,0 +1,128 @@
+/*
+ * 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 org.apache.geode.management.internal.configuration;
+
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.test.dunit.Host.getHost;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.geode.internal.ClassBuilder;
+import org.apache.geode.management.internal.configuration.utils.ZipUtils;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.junit.Before;
+import org.junit.Rule;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+public abstract class ClusterConfigTestBase {
+  public String clusterConfigZipPath;
+
+  public static final ConfigGroup CLUSTER = new ConfigGroup("cluster").regions("regionForCluster")
+      .jars("cluster.jar").maxLogFileSize("5000").configFiles("cluster.properties", "cluster.xml");
+  public static final ConfigGroup GROUP1 = new ConfigGroup("group1").regions("regionForGroup1")
+      .jars("group1.jar").maxLogFileSize("6000").configFiles("group1.properties", "group1.xml");
+  public static final ConfigGroup GROUP2 = new ConfigGroup("group2").regions("regionForGroup2")
+      .jars("group2.jar").maxLogFileSize("7000").configFiles("group2.properties", "group2.xml");
+
+  public static final ClusterConfig CONFIG_FROM_ZIP = new ClusterConfig(CLUSTER, GROUP1, GROUP2);
+
+  public static final ClusterConfig REPLICATED_CONFIG_FROM_ZIP = new ClusterConfig(
+      new ConfigGroup("cluster").maxLogFileSize("5000").jars("cluster.jar")
+          .regions("regionForCluster"),
+      new ConfigGroup("group1").maxLogFileSize("6000").jars("group1.jar")
+          .regions("regionForGroup1"),
+      new ConfigGroup("group2").maxLogFileSize("7000").jars("group2.jar")
+          .regions("regionForGroup2"));
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule(true);
+
+  protected Properties locatorProps;
+  protected Properties serverProps;
+
+  @Before
+  public void beforeClusterConfigTestBase() throws Exception {
+    clusterConfigZipPath = buildClusterZipFile();
+    locatorProps = new Properties();
+    serverProps = new Properties();
+
+    // the following are default values, we don't need to set them. We do it for clarity purpose
+    locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
+    serverProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
+  }
+
+  private String buildClusterZipFile() throws Exception {
+    File clusterConfigDir = this.lsRule.getTempFolder().newFolder("cluster_config");
+
+    File clusterDir = new File(clusterConfigDir, "cluster");
+    String clusterXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
+        + "<region name=\"regionForCluster\">\n"
+        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
+        + "  </region>\n" + "</cache>\n";
+    writeFile(clusterDir, "cluster.xml", clusterXml);
+    writeFile(clusterDir, "cluster.properties", "log-file-size-limit=5000");
+    createJarFileWithClass("Cluster", "cluster.jar", clusterDir);
+
+    File group1Dir = new File(clusterConfigDir, "group1");
+    String group1Xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
+        + "<region name=\"regionForGroup1\">\n"
+        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
+        + "  </region>\n" + "</cache>\n";
+    writeFile(group1Dir, "group1.xml", group1Xml);
+    writeFile(group1Dir, "group1.properties", "log-file-size-limit=6000");
+    createJarFileWithClass("Group1", "group1.jar", group1Dir);
+
+
+    File group2Dir = new File(clusterConfigDir, "group2");
+    String group2Xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+        + "<cache xmlns=\"http://geode.apache.org/schema/cache\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" copy-on-read=\"false\" is-server=\"false\" lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" version=\"1.0\" xsi:schemaLocation=\"http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd\">\n"
+        + "<region name=\"regionForGroup2\">\n"
+        + "    <region-attributes data-policy=\"replicate\" scope=\"distributed-ack\"/>\n"
+        + "  </region>\n" + "</cache>\n";
+    writeFile(group2Dir, "group2.xml", group2Xml);
+    writeFile(group2Dir, "group2.properties", "log-file-size-limit=7000");
+    createJarFileWithClass("Group2", "group2.jar", group2Dir);
+
+
+    File clusterConfigZip = new File(lsRule.getTempFolder().newFolder(), "cluster_config.zip");
+    ZipUtils.zipDirectory(clusterConfigDir.getCanonicalPath(), clusterConfigZip.getCanonicalPath());
+
+    FileUtils.deleteDirectory(clusterConfigDir);
+    return clusterConfigZip.getCanonicalPath();
+  }
+
+  private File writeFile(File dir, String fileName, String content) throws IOException {
+    dir.mkdirs();
+    File file = new File(dir, fileName);
+    FileUtils.writeStringToFile(file, content);
+
+    return file;
+  }
+
+  protected String createJarFileWithClass(String className, String jarName, File dir)
+      throws IOException {
+    File jarFile = new File(dir, jarName);
+    new ClassBuilder().writeJarFromName(className, jarFile);
+    return jarFile.getCanonicalPath();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index 97c636b..34506c4 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -57,9 +57,18 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
 
   private TemporaryFolder temporaryFolder = new SerializableTemporaryFolder();
   private MemberVM[] members;
+  private final boolean bounceVms;
 
   public LocatorServerStartupRule() {
+    this(false);
+  }
+
+  /**
+   * If your DUnit tests fail due to insufficient cleanup, try setting bounceVms=true.
+   */
+  public LocatorServerStartupRule(boolean bounceVms) {
     DUnitLauncher.launchIfNeeded();
+    this.bounceVms = bounceVms;
   }
 
   @Override
@@ -67,6 +76,9 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     restoreSystemProperties.before();
     temporaryFolder.create();
     Invoke.invokeInEveryVM("Stop each VM", this::cleanupVm);
+    if (bounceVms) {
+      getHost(0).getAllVMs().forEach(VM::bounce);
+    }
     members = new MemberVM[4];
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
new file mode 100644
index 0000000..766963a
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
@@ -0,0 +1,30 @@
+import java.util.Properties;
+
+import org.apache.geode.cache.Declarable;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+
+public class FUNCTION_A implements Function, Declarable {
+  public String getId() {
+    return "FUNCTION_A";
+  }
+
+  public void init(Properties props) {
+  }
+
+  public void execute(FunctionContext context) {
+    context.getResultSender().lastResult("VERSION");
+  }
+
+  public boolean hasResult() {
+    return true;
+  }
+
+  public boolean optimizeForWrite() {
+    return false;
+  }
+
+  public boolean isHA() {
+    return false;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
new file mode 100644
index 0000000..b37a6cf
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
@@ -0,0 +1,26 @@
+package PACKAGE_B;
+
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+
+public class FUNCTION_B implements Function {
+  public boolean hasResult() {
+    return true;
+  }
+
+  public void execute(FunctionContext context) {
+    context.getResultSender().lastResult("VERSION");
+  }
+
+  public String getId() {
+    return "FUNCTION_B";
+  }
+
+  public boolean optimizeForWrite() {
+    return false;
+  }
+
+  public boolean isHA() {
+    return false;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/6f7f9439/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index da8bdf2..a9e3fdf 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -33,6 +33,7 @@ commons-digester.version=2.1
 commons-exec.version=1.3
 derby.version = 10.13.1.1
 dom4j.version = 1.6.1
+fast-classpath-scanner.version=2.0.11
 fastutil.version = 7.1.0
 google-gson.version=2.8.0
 guava.version = 21.0


[28/51] [abbrv] geode git commit: GEODE-2632: refactor code to use InternalCache and InternalResourceManager

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
index ed32be8..118fb4b 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
@@ -405,7 +405,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     // verify that stats on server2 are not changed by events on server1
     server2.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         assertEquals(0, irm.getStats().getEvictionStartEvents());
         assertEquals(0, irm.getStats().getHeapCriticalEvents());
         assertEquals(0, irm.getStats().getCriticalThreshold());
@@ -442,7 +442,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
         getCache().getLoggerI18n().fine(addExpectedExString);
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(950);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950);
         getCache().getLoggerI18n().fine(removeExpectedExString);
         return null;
       }
@@ -461,7 +461,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
         getCache().getLoggerI18n().fine(addExpectedBelow);
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(850);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(850);
         getCache().getLoggerI18n().fine(removeExpectedBelow);
         return null;
       }
@@ -477,7 +477,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     server2.invoke(new SerializableCallable("EVICTION->EVICTION") {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(840);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(840);
         return null;
       }
     });
@@ -492,7 +492,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     server2.invoke(new SerializableCallable("EVICTION->NORMAL") {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(750);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750);
         return null;
       }
     });
@@ -509,8 +509,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     server2.invoke(new SerializableCallable("NORMAL->CRITICAL->NORMAL") {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(950);
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(750);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(950);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(750);
         return null;
       }
     });
@@ -527,7 +527,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     server2.invoke(new SerializableCallable("NORMAL->EVICTION") {
       public Object call() throws Exception {
         GemFireCacheImpl gfCache = (GemFireCacheImpl) getCache();
-        gfCache.getResourceManager().getHeapMonitor().updateStateAndSendEvent(850);
+        gfCache.getInternalResourceManager().getHeapMonitor().updateStateAndSendEvent(850);
         return null;
       }
     });
@@ -1281,7 +1281,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
         getSystem(getServerProperties());
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
 
-        InternalResourceManager irm = cache.getResourceManager();
+        InternalResourceManager irm = cache.getInternalResourceManager();
         HeapMemoryMonitor hmm = irm.getHeapMonitor();
         hmm.setTestMaxMemoryBytes(1000);
         HeapMemoryMonitor.setTestBytesUsedForThresholdSet(500);
@@ -1411,7 +1411,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         getCache().getLoggerI18n().fine(addExpectedExString);
-        ((GemFireCacheImpl) getCache()).getResourceManager().getHeapMonitor()
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getHeapMonitor()
             .updateStateAndSendEvent(950);
         HeapMemoryMonitor.setTestBytesUsedForThresholdSet(950);
         getCache().getLoggerI18n().fine(removeExpectedExString);
@@ -1425,7 +1425,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
       public Object call() throws Exception {
         getCache().getLoggerI18n().fine(addExpectedBelow);
         HeapMemoryMonitor.setTestBytesUsedForThresholdSet(850);
-        ((GemFireCacheImpl) getCache()).getResourceManager().getHeapMonitor()
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getHeapMonitor()
             .updateStateAndSendEvent(850);
         getCache().getLoggerI18n().fine(removeExpectedBelow);
         return null;
@@ -1437,7 +1437,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         getCache().getLoggerI18n().fine(addExpectedBelow);
-        ((GemFireCacheImpl) getCache()).getResourceManager().getHeapMonitor()
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getHeapMonitor()
             .updateStateAndSendEvent(750);
         getCache().getLoggerI18n().fine(removeExpectedBelow);
         return null;
@@ -1462,7 +1462,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         TestMemoryThresholdListener listener = new TestMemoryThresholdListener();
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         irm.addResourceListener(ResourceType.HEAP_MEMORY, listener);
         assertTrue(irm.getResourceListeners(ResourceType.HEAP_MEMORY).contains(listener));
         return null;
@@ -1474,7 +1474,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         TestMemoryThresholdListener listener = new TestMemoryThresholdListener(true);
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         irm.addResourceListener(ResourceType.HEAP_MEMORY, listener);
         assertTrue(irm.getResourceListeners(ResourceType.HEAP_MEMORY).contains(listener));
         return null;
@@ -1496,8 +1496,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         WaitCriterion wc = null;
-        Set<ResourceListener> listeners =
-            getGemfireCache().getResourceManager().getResourceListeners(ResourceType.HEAP_MEMORY);
+        Set<ResourceListener> listeners = getGemfireCache().getInternalResourceManager()
+            .getResourceListeners(ResourceType.HEAP_MEMORY);
         TestMemoryThresholdListener tmp_listener = null;
         Iterator<ResourceListener> it = listeners.iterator();
         while (it.hasNext()) {
@@ -1598,7 +1598,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
   private void verifyProfiles(VM vm, final int numberOfProfiles) {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         final ResourceAdvisor ra = irm.getResourceAdvisor();
         WaitCriterion wc = new WaitCriterion() {
           public String description() {
@@ -1637,7 +1637,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
 
   private SerializableCallable resetResourceManager = new SerializableCallable() {
     public Object call() throws Exception {
-      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
       // Reset CRITICAL_UP by informing all that heap usage is now 1 byte (0 would disable).
       irm.getHeapMonitor().updateStateAndSendEvent(1);
       Set<ResourceListener> listeners = irm.getResourceListeners(ResourceType.HEAP_MEMORY);
@@ -2387,7 +2387,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
         int defaultTolerance = 1;
         HeapMemoryMonitor.setTestDisableMemoryUpdates(false);
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        InternalResourceManager irm = cache.getResourceManager();
+        InternalResourceManager irm = cache.getInternalResourceManager();
         HeapMemoryMonitor hmm = irm.getHeapMonitor();
         hmm.setTestMaxMemoryBytes(100);
         HeapMemoryMonitor.setTestBytesUsedForThresholdSet(1);
@@ -2421,7 +2421,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
         boolean isSun = (vendor.contains("Sun") || vendor.contains("Oracle"));
         int defaultTolerance = isSun ? 1 : 5;
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        InternalResourceManager irm = cache.getResourceManager();
+        InternalResourceManager irm = cache.getInternalResourceManager();
         HeapMemoryMonitor hmm = irm.getHeapMonitor();
         hmm.setTestMaxMemoryBytes(100);
         HeapMemoryMonitor.setTestBytesUsedForThresholdSet(1);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java
index d3b963c..b5dc9a9 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsOffHeapDUnitTest.java
@@ -126,7 +126,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
 
   private SerializableCallable resetResourceManager = new SerializableCallable() {
     public Object call() throws Exception {
-      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
       Set<ResourceListener> listeners = irm.getResourceListeners(ResourceType.OFFHEAP_MEMORY);
       Iterator<ResourceListener> it = listeners.iterator();
       while (it.hasNext()) {
@@ -278,7 +278,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     // verify that stats on server2 are not changed by events on server1
     server2.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         assertEquals(0, irm.getStats().getOffHeapEvictionStartEvents());
         assertEquals(0, irm.getStats().getOffHeapCriticalEvents());
         assertEquals(0, irm.getStats().getOffHeapCriticalThreshold());
@@ -1450,7 +1450,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     final long bytesUsedAfterSmallKey = (long) server.invoke(new SerializableCallable() {
       @Override
       public Object call() throws Exception {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         final OffHeapMemoryMonitor ohm = irm.getOffHeapMonitor();
         assertTrue(ohm.getState().isNormal());
         getCache().getLoggerI18n().fine(addExpectedExString);
@@ -1541,7 +1541,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     // make the region healthy in the server
     server.invoke(new SerializableRunnable() {
       public void run() {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         final OffHeapMemoryMonitor ohm = irm.getOffHeapMonitor();
         assertTrue(ohm.getState().isCritical());
         getCache().getLogger().fine(MemoryThresholdsOffHeapDUnitTest.this.addExpectedBelow);
@@ -1658,7 +1658,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
         TestMemoryThresholdListener listener = new TestMemoryThresholdListener();
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         irm.addResourceListener(ResourceType.OFFHEAP_MEMORY, listener);
         assertTrue(irm.getResourceListeners(ResourceType.OFFHEAP_MEMORY).contains(listener));
         return null;
@@ -1675,7 +1675,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
         getSystem(getOffHeapProperties());
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
 
-        InternalResourceManager irm = cache.getResourceManager();
+        InternalResourceManager irm = cache.getInternalResourceManager();
         irm.setEvictionOffHeapPercentage(evictionThreshold);
         irm.setCriticalOffHeapPercentage(criticalThreshold);
 
@@ -1744,7 +1744,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
       @Override
       public Object call() throws Exception {
         WaitCriterion wc = null;
-        Set<ResourceListener> listeners = getGemfireCache().getResourceManager()
+        Set<ResourceListener> listeners = getGemfireCache().getInternalResourceManager()
             .getResourceListeners(ResourceType.OFFHEAP_MEMORY);
         TestMemoryThresholdListener tmp_listener = null;
         Iterator<ResourceListener> it = listeners.iterator();
@@ -1856,7 +1856,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
   private void verifyProfiles(VM vm, final int numberOfProfiles) {
     vm.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
         final ResourceAdvisor ra = irm.getResourceAdvisor();
         WaitCriterion wc = new WaitCriterion() {
           public String description() {

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/cache/management/ResourceManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/management/ResourceManagerDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/management/ResourceManagerDUnitTest.java
index 0762547..13643ec 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/management/ResourceManagerDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/management/ResourceManagerDUnitTest.java
@@ -367,7 +367,7 @@ public class ResourceManagerDUnitTest extends JUnit4CacheTestCase {
           GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
           for (PartitionedRegion pr : cache.getPartitionedRegions()) {
             InternalPRInfo info = pr.getRedundancyProvider().buildPartitionedRegionInfo(true,
-                cache.getResourceManager().getLoadProbe());
+                cache.getInternalResourceManager().getLoadProbe());
             detailsSet.add(info);
           }
           if (vm == 0) {

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
index 8e3888f..903b212 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
@@ -108,7 +108,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
 
   private SerializableCallable resetResourceManager = new SerializableCallable() {
     public Object call() throws Exception {
-      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getResourceManager();
+      InternalResourceManager irm = ((GemFireCacheImpl) getCache()).getInternalResourceManager();
       // Reset CRITICAL_UP by informing all that heap usage is now 1 byte (0 would disable).
       irm.getHeapMonitor().updateStateAndSendEvent(NORMAL_HEAP_USED);
       Set<ResourceListener> listeners = irm.getResourceListeners(ResourceType.HEAP_MEMORY);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
index 8b1e87f..fe86910 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EvictionTestBase.java
@@ -104,7 +104,7 @@ public class EvictionTestBase extends JUnit4CacheTestCase {
 
         RegionEvictorTask.TEST_EVICTION_BURST_PAUSE_TIME_MILLIS = 0;
 
-        InternalResourceManager irm = ((GemFireCacheImpl) cache).getResourceManager();
+        InternalResourceManager irm = ((GemFireCacheImpl) cache).getInternalResourceManager();
         HeapMemoryMonitor hmm = irm.getHeapMonitor();
         hmm.setTestMaxMemoryBytes(100);
         hmm.updateStateAndSendEvent(90);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/OffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/OffHeapEvictionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/OffHeapEvictionDUnitTest.java
index 3770f4b..d9d1ecd 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/OffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/OffHeapEvictionDUnitTest.java
@@ -79,7 +79,8 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
       LogWriterUtils.getLogWriter().info("cache= " + cache);
       LogWriterUtils.getLogWriter().info("cache closed= " + cache.isClosed());
       cache.getResourceManager().setEvictionOffHeapPercentage(85);
-      ((GemFireCacheImpl) cache).getResourceManager().getOffHeapMonitor().stopMonitoring(true);
+      ((GemFireCacheImpl) cache).getInternalResourceManager().getOffHeapMonitor()
+          .stopMonitoring(true);
       LogWriterUtils.getLogWriter()
           .info("eviction= " + cache.getResourceManager().getEvictionOffHeapPercentage());
       LogWriterUtils.getLogWriter()
@@ -97,7 +98,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
         final LocalRegion region = (LocalRegion) cache.getRegion(prName);
         getEvictor().testAbortAfterLoopCount = 1;
 
-        ((GemFireCacheImpl) cache).getResourceManager().getOffHeapMonitor()
+        ((GemFireCacheImpl) cache).getInternalResourceManager().getOffHeapMonitor()
             .updateStateAndSendEvent(188743680);
 
         WaitCriterion wc = new WaitCriterion() {

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
index cc6616a..82108b0 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionEvictionDUnitTest.java
@@ -196,7 +196,8 @@ public class PartitionedRegionEvictionDUnitTest extends JUnit4CacheTestCase {
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "memoryEventTolerance", "0");
 
     setEvictionPercentage(85);
-    HeapMemoryMonitor hmm = ((GemFireCacheImpl) getCache()).getResourceManager().getHeapMonitor();
+    HeapMemoryMonitor hmm =
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getHeapMonitor();
     hmm.setTestMaxMemoryBytes(100);
 
     hmm.updateStateAndSendEvent(90);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
index a6d86ec..469d22d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionOffHeapEvictionDUnitTest.java
@@ -80,7 +80,7 @@ public class PartitionedRegionOffHeapEvictionDUnitTest extends PartitionedRegion
 
     setEvictionPercentage(85);
     OffHeapMemoryMonitor ohmm =
-        ((GemFireCacheImpl) getCache()).getResourceManager().getOffHeapMonitor();
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getOffHeapMonitor();
     ohmm.stopMonitoring(true);
 
     ohmm.updateStateAndSendEvent(94371840);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java
index 54145e1..9311051 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java
@@ -97,7 +97,7 @@ public class MemoryMonitorJUnitTest {
    */
   @Test
   public void testInvokeListeners() throws Exception {
-    InternalResourceManager internalManager = this.cache.getResourceManager();
+    InternalResourceManager internalManager = this.cache.getInternalResourceManager();
     HeapMemoryMonitor heapMonitor = internalManager.getHeapMonitor();
 
     heapMonitor.setTestMaxMemoryBytes(1000);
@@ -158,7 +158,7 @@ public class MemoryMonitorJUnitTest {
   // TODO: write a converse of this test when default values are enabled
   @Test
   public void testDefaultThresholds() throws Exception {
-    final InternalResourceManager irm = this.cache.getResourceManager();
+    final InternalResourceManager irm = this.cache.getInternalResourceManager();
     final HeapMemoryMonitor hmm = irm.getHeapMonitor();
     TestMemoryThresholdListener listener = new TestMemoryThresholdListener();
     irm.addResourceListener(ResourceType.HEAP_MEMORY, listener);
@@ -212,29 +212,29 @@ public class MemoryMonitorJUnitTest {
     Region parent = cache.createRegion("parent", factory.create());
     parent.createSubregion("sub", factory.create());
     parent.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
 
     // test nested local region
     parent = cache.createRegion("parent2", factory.create());
     parent.createSubregion("sub", factory.create()).createSubregion("subsub", factory.create());
     parent.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
 
     // test distributed sub region
     factory.setScope(Scope.DISTRIBUTED_ACK);
     parent = cache.createRegion("parent3", factory.create());
     parent.createSubregion("sub", factory.create());
     parent.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
     // test nested distributed region
     parent = cache.createRegion("parent4", factory.create());
     parent.createSubregion("sub", factory.create()).createSubregion("subsub", factory.create());
     parent.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   /**
@@ -248,8 +248,8 @@ public class MemoryMonitorJUnitTest {
     Region region = cache.createRegion("DistributedRegion", attr.create());
     checkOpRejection(region, false, true);
     region.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -259,8 +259,8 @@ public class MemoryMonitorJUnitTest {
     Region region = cache.createRegion("DistributedRegion", attr.create());
     checkOpRejection(region, true, true);
     region.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -270,8 +270,8 @@ public class MemoryMonitorJUnitTest {
     Region region = cache.createRegion("localRegion", attr.create());
     checkOpRejection(region, false, true);
     region.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -281,8 +281,8 @@ public class MemoryMonitorJUnitTest {
     Region region = cache.createRegion("localRegion", attr.create());
     checkOpRejection(region, true, true);
     region.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -293,12 +293,10 @@ public class MemoryMonitorJUnitTest {
         cache.createRegion("local1", factory.create()).createSubregion("sub1", factory.create());
     checkOpRejection(subRegion, false, true);
     subRegion.close();
-    assertEquals(1 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size()); // root
-                                                                                                // region
-                                                                                                // is
-                                                                                                // still
-                                                                                                // present
+
+    // root region is still present
+    assertEquals(1 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -309,12 +307,10 @@ public class MemoryMonitorJUnitTest {
         cache.createRegion("local1", factory.create()).createSubregion("sub1", factory.create());
     checkOpRejection(subRegion, true, true);
     subRegion.close();
-    assertEquals(1 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size()); // root
-                                                                                                // region
-                                                                                                // is
-                                                                                                // still
-                                                                                                // present
+
+    // root region is still present
+    assertEquals(1 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   @Test
@@ -324,8 +320,8 @@ public class MemoryMonitorJUnitTest {
     Region region = new RegionFactory().setPartitionAttributes(pa).create("parReg");
     checkOpRejection(region, false, true);
     region.close();
-    assertEquals(0 + SYSTEM_LISTENERS,
-        cache.getResourceManager(false).getResourceListeners(ResourceType.HEAP_MEMORY).size());
+    assertEquals(0 + SYSTEM_LISTENERS, cache.getInternalResourceManager(false)
+        .getResourceListeners(ResourceType.HEAP_MEMORY).size());
   }
 
   private void checkOpRejection(Region region, boolean useTransaction, boolean expectLowMemEx)
@@ -339,7 +335,7 @@ public class MemoryMonitorJUnitTest {
       addSubregion++;
     }
 
-    InternalResourceManager internalManager = cache.getResourceManager();
+    InternalResourceManager internalManager = cache.getInternalResourceManager();
     HeapMemoryMonitor heapMonitor = internalManager.getHeapMonitor();
     TestMemoryThresholdListener listener = new TestMemoryThresholdListener();
     internalManager.addResourceListener(ResourceType.HEAP_MEMORY, listener);
@@ -450,7 +446,7 @@ public class MemoryMonitorJUnitTest {
 
   @Test
   public void testHandleNotification() throws Exception {
-    final InternalResourceManager irm = this.cache.getResourceManager();
+    final InternalResourceManager irm = this.cache.getInternalResourceManager();
     final HeapMemoryMonitor hmm = irm.getHeapMonitor();
 
     hmm.setTestMaxMemoryBytes(100);
@@ -587,7 +583,7 @@ public class MemoryMonitorJUnitTest {
 
   @Test
   public void testDisabledThresholds() {
-    final InternalResourceManager irm = this.cache.getResourceManager();
+    final InternalResourceManager irm = this.cache.getInternalResourceManager();
     final HeapMemoryMonitor hmm = irm.getHeapMonitor();
     hmm.setTestMaxMemoryBytes(100);
     HeapMemoryMonitor.setTestBytesUsedForThresholdSet(50);
@@ -753,7 +749,7 @@ public class MemoryMonitorJUnitTest {
 
   @Test
   public void testAddListeners() {
-    final InternalResourceManager internalManager = this.cache.getResourceManager();
+    final InternalResourceManager internalManager = this.cache.getInternalResourceManager();
     ResourceListener<MemoryEvent> memoryListener = new ResourceListener<MemoryEvent>() {
       public void onEvent(MemoryEvent event) {
         cache.getLogger().info("Received MemoryEvent");

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
index 13c10b8..3dd883d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/MemoryMonitorOffHeapJUnitTest.java
@@ -80,7 +80,7 @@ public class MemoryMonitorOffHeapJUnitTest {
 
   @Test
   public void testGeneratingEvents() throws Exception {
-    InternalResourceManager internalManager = this.cache.getResourceManager();
+    InternalResourceManager internalManager = this.cache.getInternalResourceManager();
     OffHeapMemoryMonitor monitor = internalManager.getOffHeapMonitor();
 
     monitor.setEvictionThreshold(50.0f);
@@ -144,15 +144,15 @@ public class MemoryMonitorOffHeapJUnitTest {
   private void setThenTestListenersAndStats(final long memUsed, final int evictionStop,
       final int evictionStart, final int safe, final int critical, final int evictionEvents,
       final int criticalEvents, final int normalEvents) {
-    this.cache.getResourceManager().getOffHeapMonitor().updateStateAndSendEvent(memUsed);
-    ResourceManagerStats stats = this.cache.getResourceManager().getStats();
+    this.cache.getInternalResourceManager().getOffHeapMonitor().updateStateAndSendEvent(memUsed);
+    ResourceManagerStats stats = this.cache.getInternalResourceManager().getStats();
 
     assertEquals(evictionStop, stats.getOffHeapEvictionStopEvents());
     assertEquals(evictionStart, stats.getOffHeapEvictionStartEvents());
     assertEquals(critical, stats.getOffHeapCriticalEvents());
     assertEquals(safe, stats.getOffHeapSafeEvents());
 
-    for (ResourceListener listener : this.cache.getResourceManager()
+    for (ResourceListener listener : this.cache.getInternalResourceManager()
         .getResourceListeners(ResourceType.OFFHEAP_MEMORY)) {
       if (listener instanceof TestMemoryThresholdListener) {
         assertEquals(evictionEvents,
@@ -166,7 +166,7 @@ public class MemoryMonitorOffHeapJUnitTest {
 
   @Test
   public void testDisabledThresholds() throws Exception {
-    final InternalResourceManager irm = this.cache.getResourceManager();
+    final InternalResourceManager irm = this.cache.getInternalResourceManager();
     final OffHeapMemoryMonitor monitor = irm.getOffHeapMonitor();
 
     final RegionFactory regionFactory = this.cache.createRegionFactory(RegionShortcut.LOCAL);
@@ -220,7 +220,8 @@ public class MemoryMonitorOffHeapJUnitTest {
 
   @Test
   public void testAllowedThreholds() {
-    final OffHeapMemoryMonitor monitor = this.cache.getResourceManager().getOffHeapMonitor();
+    final OffHeapMemoryMonitor monitor =
+        this.cache.getInternalResourceManager().getOffHeapMonitor();
 
     // Test eviction bounds
     try {
@@ -289,7 +290,8 @@ public class MemoryMonitorOffHeapJUnitTest {
 
   @Test
   public void testMonitorRunning() {
-    final OffHeapMemoryMonitor monitor = this.cache.getResourceManager().getOffHeapMonitor();
+    final OffHeapMemoryMonitor monitor =
+        this.cache.getInternalResourceManager().getOffHeapMonitor();
 
     assertFalse("Off-heap monitor is not running", monitor.started);
 
@@ -314,7 +316,8 @@ public class MemoryMonitorOffHeapJUnitTest {
 
   @Test
   public void testGettersAndSetters() {
-    final OffHeapMemoryMonitor monitor = this.cache.getResourceManager().getOffHeapMonitor();
+    final OffHeapMemoryMonitor monitor =
+        this.cache.getInternalResourceManager().getOffHeapMonitor();
 
     assertEquals(0f, monitor.getEvictionThreshold(), 0.01);
     assertEquals(0f, monitor.getCriticalThreshold(), 0.01);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
index 5f1c7fe..ec59bf9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
@@ -1089,7 +1089,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
           }
         }
 
-        ResourceManagerStats stats = cache.getResourceManager().getStats();
+        ResourceManagerStats stats = cache.getInternalResourceManager().getStats();
 
         assertEquals(0, stats.getRebalancesInProgress());
         assertEquals(1, stats.getRebalancesCompleted());
@@ -1499,7 +1499,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
 
       public Object call() throws Exception {
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        InternalResourceManager manager = cache.getResourceManager();
+        InternalResourceManager manager = cache.getInternalResourceManager();
         final CountDownLatch rebalancingCancelled = new CountDownLatch(1);
         final CountDownLatch rebalancingFinished = new CountDownLatch(1);
         InternalResourceManager.setResourceObserver(new ResourceObserverAdapter() {
@@ -1600,7 +1600,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
 
       public Object call() throws Exception {
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        InternalResourceManager manager = cache.getResourceManager();
+        InternalResourceManager manager = cache.getInternalResourceManager();
         final CountDownLatch rebalancingStarted = new CountDownLatch(1);
         final CountDownLatch memberAdded = new CountDownLatch(1);
         InternalResourceManager.setResourceObserver(new ResourceObserverAdapter() {
@@ -3113,7 +3113,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
 
       public Object call() {
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        InternalResourceManager mgr = cache.getResourceManager();
+        InternalResourceManager mgr = cache.getInternalResourceManager();
         return mgr.setLoadProbe(probe);
       }
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
index afa2380..4a6d16a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsJUnitTest.java
@@ -367,9 +367,9 @@ public class MemberLevelStatsJUnitTest extends MBeanStatsTestCase {
   public void testCacheBasedStats() throws Exception {
     GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
     ManagementService service = ManagementService.getExistingManagementService(cache);
-    long start = cache.getResourceManager().getStats().startRebalance();
+    long start = cache.getInternalResourceManager().getStats().startRebalance();
     assertEquals(1, service.getMemberMXBean().getRebalancesInProgress());
-    cache.getResourceManager().getStats().endRebalance(start);
+    cache.getInternalResourceManager().getStats().endRebalance(start);
     assertEquals(0, service.getMemberMXBean().getRebalancesInProgress());
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
index fc2be39..1eac799 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
@@ -137,7 +137,7 @@ public class EvictionDUnitTest extends LuceneQueriesAccessorBase {
     getCache().getResourceManager()
         .setEvictionHeapPercentage(EVICTION_HEAP_PERCENTAGE_FAKE_NOTIFICATION);
     HeapMemoryMonitor heapMemoryMonitor =
-        ((GemFireCacheImpl) getCache()).getResourceManager().getHeapMonitor();
+        ((GemFireCacheImpl) getCache()).getInternalResourceManager().getHeapMonitor();
     heapMemoryMonitor.setTestMaxMemoryBytes(TEST_MAX_MEMORY);
 
     heapMemoryMonitor.updateStateAndSendEvent(MEMORY_USED_FAKE_NOTIFICATION);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
index aa96914..71d2051 100644
--- a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
+++ b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
@@ -359,7 +359,7 @@ public class AutoBalancer implements Declarable {
       GemFireCacheImpl cache = getCache();
       Map<PartitionedRegion, InternalPRInfo> detailsMap = new HashMap<>();
       for (PartitionedRegion region : cache.getPartitionedRegions()) {
-        LoadProbe probe = cache.getResourceManager().getLoadProbe();
+        LoadProbe probe = cache.getInternalResourceManager().getLoadProbe();
         InternalPRInfo info =
             region.getRedundancyProvider().buildPartitionedRegionInfo(true, probe);
         detailsMap.put(region, info);
@@ -413,7 +413,7 @@ public class AutoBalancer implements Declarable {
     public void incrementAttemptCounter() {
       GemFireCacheImpl cache = getCache();
       try {
-        cache.getResourceManager().getStats().incAutoRebalanceAttempts();
+        cache.getInternalResourceManager().getStats().incAutoRebalanceAttempts();
       } catch (Exception e) {
         logger.warn("Failed to increment AutoBalanceAttempts counter");
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java b/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java
index d3c48aa..38a8791 100755
--- a/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java
+++ b/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerIntegrationJUnitTest.java
@@ -83,26 +83,26 @@ public class AutoBalancerIntegrationJUnitTest {
 
   @Test
   public void testAutoRebalaceStatsOnLockSuccess() throws InterruptedException {
-    assertEquals(0, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(0, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
     AutoBalancer balancer = new AutoBalancer();
     balancer.getOOBAuditor().execute();
-    assertEquals(1, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(1, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
   }
 
   @Test
   public void testAutoRebalaceStatsOnLockFailure() throws InterruptedException {
     acquireLockInDifferentThread(1);
-    assertEquals(0, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(0, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
     AutoBalancer balancer = new AutoBalancer();
     balancer.getOOBAuditor().execute();
-    assertEquals(0, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(0, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
   }
 
   @Test
   public void testAutoBalanceStatUpdate() {
-    assertEquals(0, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(0, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
     new GeodeCacheFacade().incrementAttemptCounter();
-    assertEquals(1, cache.getResourceManager().getStats().getAutoRebalanceAttempts());
+    assertEquals(1, cache.getInternalResourceManager().getStats().getAutoRebalanceAttempts());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java b/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java
index 1137f68..958d8f9 100644
--- a/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java
+++ b/geode-rebalancer/src/test/java/org/apache/geode/cache/util/AutoBalancerJUnitTest.java
@@ -36,6 +36,7 @@ import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -353,11 +354,13 @@ public class AutoBalancerJUnitTest {
   }
 
   @Test
+  @Ignore("GEODE-2789: need to rewrite this test")
   public void testFacadeTotalTransferSize() throws Exception {
     assertEquals(12345, getFacadeForResourceManagerOps(true).getTotalTransferSize());
   }
 
   @Test
+  @Ignore("GEODE-2789: need to rewrite this test")
   public void testFacadeRebalance() throws Exception {
     getFacadeForResourceManagerOps(false).rebalance();
   }
@@ -406,6 +409,7 @@ public class AutoBalancerJUnitTest {
   }
 
   @Test
+  @Ignore("GEODE-2789: need to rewrite this test")
   public void testFacadeCollectMemberDetailsNoRegion() {
     final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class);
     mockContext.checking(new Expectations() {
@@ -423,6 +427,7 @@ public class AutoBalancerJUnitTest {
   }
 
   @Test
+  @Ignore("GEODE-2789: need to rewrite this test")
   public void testFacadeCollectMemberDetails2Regions() {
     final GemFireCacheImpl mockCache = mockContext.mock(GemFireCacheImpl.class);
     final InternalResourceManager mockRM = mockContext.mock(InternalResourceManager.class);
@@ -479,6 +484,7 @@ public class AutoBalancerJUnitTest {
   }
 
   @Test
+  @Ignore("GEODE-2789: need to rewrite this test")
   public void testFacadeTotalBytes2Regions() {
     final PartitionedRegion mockR1 = mockContext.mock(PartitionedRegion.class, "r1");
     final PartitionedRegion mockR2 = mockContext.mock(PartitionedRegion.class, "r2");


[36/51] [abbrv] geode git commit: Merge branch 'feature/GEODE-2103-2' into develop

Posted by ds...@apache.org.
Merge branch 'feature/GEODE-2103-2' into develop

    This closes #462


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

Branch: refs/heads/feature/GEODE-2097
Commit: 8ea0f906917b40156d711717985b212364be72e1
Parents: 76c4983 fdb7805
Author: Karen Miller <km...@pivotal.io>
Authored: Wed Apr 19 13:49:51 2017 -0700
Committer: Karen Miller <km...@pivotal.io>
Committed: Wed Apr 19 13:49:51 2017 -0700

----------------------------------------------------------------------
 .../gfsh/command-pages/start.html.md.erb        | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[15/51] [abbrv] geode git commit: GEODE-2686: Remove JarClassLoader

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
index c3d7f5e..b111e45 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
@@ -24,7 +24,7 @@ import org.apache.geode.cache.Cache;
 import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.InternalLocator;
 import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.lang.StringUtils;
@@ -36,6 +36,8 @@ import org.apache.geode.test.dunit.rules.Server;
 
 import java.io.File;
 import java.io.Serializable;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -137,7 +139,9 @@ public class ClusterConfig implements Serializable {
         .collect(Collectors.toSet());
     Set<String> actualJarNames = toSetIgnoringHiddenFiles(
         serverVM.getWorkingDir().list((dir, filename) -> filename.contains(".jar")));
-    assertThat(actualJarNames).isEqualTo(expectedJarNames);
+
+    // We will end up with extra jars on disk if they are deployed and then undeployed
+    assertThat(expectedJarNames).isSubsetOf(actualJarNames);
 
     // verify config exists in memory
     serverVM.invoke(() -> {
@@ -154,22 +158,21 @@ public class ClusterConfig implements Serializable {
       }
 
       for (String jar : this.getJarNames()) {
-        JarClassLoader jarClassLoader = findJarClassLoader(jar);
-        assertThat(jarClassLoader).isNotNull();
-        assertThat(Class.forName(nameOfClassContainedInJar(jar), true, jarClassLoader)).isNotNull();
+        DeployedJar deployedJar = ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jar);
+        assertThat(deployedJar).isNotNull();
+        assertThat(Class.forName(nameOfClassContainedInJar(jar), true,
+            new URLClassLoader(new URL[] {deployedJar.getFileURL()}))).isNotNull();
       }
-    });
-  }
 
-  private static JarClassLoader findJarClassLoader(final String jarName) {
-    Collection<ClassLoader> classLoaders = ClassPathLoader.getLatest().getClassLoaders();
-    for (ClassLoader classLoader : classLoaders) {
-      if (classLoader instanceof JarClassLoader
-          && ((JarClassLoader) classLoader).getJarName().equals(jarName)) {
-        return (JarClassLoader) classLoader;
+      // If we have extra jars on disk left over from undeploy, make sure they aren't used
+      Set<String> undeployedJarNames = new HashSet<>(actualJarNames);
+      undeployedJarNames.removeAll(expectedJarNames);
+      for (String jar : undeployedJarNames) {
+        DeployedJar undeployedJar =
+            ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jar);
+        assertThat(undeployedJar).isNull();
       }
-    }
-    return null;
+    });
   }
 
 
@@ -183,7 +186,7 @@ public class ClusterConfig implements Serializable {
   }
 
   private static String getServerJarName(String jarName) {
-    return JarDeployer.JAR_PREFIX + jarName + "#1";
+    return jarName.replace(".jar", "") + ".v1.jar";
   }
 
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 0a4785d..19a1662 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.test.dunit.rules;
 
+import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.geode.internal.lang.StringUtils;
@@ -23,6 +24,7 @@ import org.apache.geode.management.internal.cli.HeadlessGfsh;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
+import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.junit.rules.DescribedExternalResource;
 import org.json.JSONArray;
 import org.junit.rules.TemporaryFolder;
@@ -58,6 +60,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
   private PortType portType = PortType.jmxManger;
   private HeadlessGfsh gfsh = null;
   private boolean connected = false;
+  private IgnoredException ignoredException;
   private TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   public GfshShellConnectionRule() {
@@ -78,6 +81,9 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
   protected void before(Description description) throws Throwable {
     this.gfsh = new HeadlessGfsh(getClass().getName(), 30,
         temporaryFolder.newFolder("gfsh_files").getAbsolutePath());
+    ignoredException =
+        addIgnoredException("java.rmi.NoSuchObjectException: no such object in table");
+
     // do not auto connect if no port initialized
     if (portSupplier == null) {
       return;
@@ -168,6 +174,10 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
   @Override
   protected void after(Description description) throws Throwable {
     close();
+
+    if (ignoredException != null) {
+      ignoredException.remove();
+    }
   }
 
   public void disconnect() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
index 5f4cd74..2a6a03b 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpDUnitTest.java
@@ -33,7 +33,7 @@ import org.apache.geode.test.junit.runner.SuiteRunner;
     ListAndDescribeDiskStoreCommandsDUnitTest.class, ListIndexCommandDUnitTest.class,
     MemberCommandsDUnitTest.class, MiscellaneousCommandsDUnitTest.class,
     QueueCommandsDUnitTest.class, ShellCommandsDUnitTest.class, ShowDeadlockDUnitTest.class,
-    ShowMetricsDUnitTest.class, ShowStackTraceDUnitTest.class, UserCommandsDUnitTest.class})
+    ShowMetricsDUnitTest.class, ShowStackTraceDUnitTest.class})
 public class CommandOverHttpDUnitTest {
   @ClassRule
   public static ProvideSystemProperty provideSystemProperty =


[08/51] [abbrv] geode git commit: Merge branch 'feature/GEODE-2777' into develop

Posted by ds...@apache.org.
Merge branch 'feature/GEODE-2777' into develop

    This closes #453


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

Branch: refs/heads/feature/GEODE-2097
Commit: 3b783ed86b8b4031911443fb3776043d8606e1ec
Parents: 6a88f1b 1525097
Author: Karen Miller <km...@pivotal.io>
Authored: Fri Apr 14 08:52:26 2017 -0700
Committer: Karen Miller <km...@pivotal.io>
Committed: Fri Apr 14 08:52:26 2017 -0700

----------------------------------------------------------------------
 geode-book/config.yml                           |    5 +-
 .../source/subnavs/geode-subnav.erb             | 1730 +++++++++---------
 geode-book/redirects.rb                         |    5 +-
 3 files changed, 871 insertions(+), 869 deletions(-)
----------------------------------------------------------------------



[42/51] [abbrv] geode git commit: GEODE-2796: ClassPathLoader does not blow up with null TCCL

Posted by ds...@apache.org.
GEODE-2796: ClassPathLoader does not blow up with null TCCL


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

Branch: refs/heads/feature/GEODE-2097
Commit: 48d662aab7ae4110f36a05aadefe9c12b48c1293
Parents: aaef124
Author: Jared Stewart <js...@pivotal.io>
Authored: Tue Apr 18 14:08:19 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Wed Apr 19 20:08:04 2017 -0700

----------------------------------------------------------------------
 .../apache/geode/internal/ClassPathLoader.java  | 10 +++++++--
 .../ClassPathLoaderIntegrationTest.java         | 22 +++++++++++++++++---
 2 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/48d662aa/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java b/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
index 41cce05..39e9d62 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
@@ -32,6 +32,7 @@ import java.net.URLClassLoader;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
 
 /**
  * The delegating <tt>ClassLoader</tt> used by GemFire to load classes and other resources. This
@@ -303,10 +304,15 @@ public final class ClassPathLoader {
     ArrayList<ClassLoader> classLoaders = new ArrayList<>();
 
     if (!excludeTCCL) {
-      classLoaders.add(Thread.currentThread().getContextClassLoader());
+      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+      if (tccl != null) {
+        classLoaders.add(tccl);
+      }
     }
 
-    classLoaders.add(classLoaderForDeployedJars);
+    if (classLoaderForDeployedJars != null) {
+      classLoaders.add(classLoaderForDeployedJars);
+    }
 
     return classLoaders;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/48d662aa/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
index c783318..2a3a7dd 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
@@ -91,6 +91,24 @@ public class ClassPathLoaderIntegrationTest {
     ClassPathLoader.setLatestToDefault(temporaryFolder.getRoot());
   }
 
+  @Test
+  public void testClassLoaderWithNullTccl() throws IOException, ClassNotFoundException {
+    // GEODE-2796
+    Thread.currentThread().setContextClassLoader(null);
+    String jarName = "JarDeployerIntegrationTest.jar";
+
+    String classAResource = "integration/parent/ClassA.class";
+
+    String classAName = "integration.parent.ClassA";
+
+    byte[] firstJarBytes = createJarWithClass("ClassA");
+
+    // First deploy of the JAR file
+    ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, firstJarBytes).getFile();
+
+    assertThatClassCanBeLoaded(classAName);
+    assertThatResourceCanBeLoaded(classAResource);
+  }
 
   @Test
   public void testDeployFileAndChange() throws IOException, ClassNotFoundException {
@@ -258,13 +276,11 @@ public class ClassPathLoaderIntegrationTest {
     List<String> result = (List<String>) execution.execute("MyFunction").getResult();
     assertThat(result.get(0)).isEqualTo("Version1");
 
-
     ClassPathLoader.getLatest().getJarDeployer().deploy("MyJar.jar",
         FileUtils.readFileToByteArray(jarVersion2));
     result = (List<String>) execution.execute("MyFunction").getResult();
     assertThat(result.get(0)).isEqualTo("Version2");
 
-
     serverStarterRule.after();
   }
 
@@ -451,7 +467,7 @@ public class ClassPathLoaderIntegrationTest {
     /**
      * Currently unused but potentially useful for some future test. This causes this loader to only
      * generate a class that the parent could not find.
-     *
+     * 
      * @param parent the parent class loader to check with first
      */
     @SuppressWarnings("unused")


[09/51] [abbrv] geode git commit: GEODE-2762: fix varargs warnings

Posted by ds...@apache.org.
GEODE-2762: fix varargs warnings

* fix varargs compilation warnings
* remove unused import


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

Branch: refs/heads/feature/GEODE-2097
Commit: d939ceb9e2c3ce7c5445c1f1130f2df364376b27
Parents: 3b783ed
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Apr 13 15:20:39 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Apr 14 09:33:17 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/internal/util/ArrayUtilsTest.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/d939ceb9/geode-core/src/test/java/org/apache/geode/internal/util/ArrayUtilsTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/util/ArrayUtilsTest.java b/geode-core/src/test/java/org/apache/geode/internal/util/ArrayUtilsTest.java
index 70da91b..e6f586e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/util/ArrayUtilsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/util/ArrayUtilsTest.java
@@ -22,7 +22,6 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
-import java.util.Arrays;
 import java.util.List;
 
 import org.apache.geode.test.junit.categories.UnitTest;
@@ -96,12 +95,14 @@ public class ArrayUtilsTest {
 
   @Test
   public void getFirst_null_returnsNull() {
-    assertThat(getFirst((Object[]) null)).isNull();
+    Object nullObject = null;
+    assertThat(getFirst(nullObject)).isNull();
   }
 
   @Test
   public void getFirst_empty_returnsNull() {
-    assertThat(getFirst(new Object[0])).isNull();
+    Object[] emptyArray = new Object[0];
+    assertThat((Object[]) getFirst(emptyArray)).isNull();
   }
 
   @Test


[34/51] [abbrv] geode git commit: GEODE-2632: refactor code to use interfaces instead of impls

Posted by ds...@apache.org.
GEODE-2632: refactor code to use interfaces instead of impls

* use getInternalDistributedSystem instead of overriding getDistributedSystem
* use InternalCache instead of GemFireCacheImpl
* remove dead code
* remove useless javadocs and comments


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

Branch: refs/heads/feature/GEODE-2097
Commit: 76c498385995a9aabefd7523f057e32dd9d4a8fa
Parents: c5ee7cd
Author: Kirk Lund <kl...@apache.org>
Authored: Mon Apr 17 14:53:00 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Wed Apr 19 09:38:02 2017 -0700

----------------------------------------------------------------------
 ...erConfigurationServiceEndToEndDUnitTest.java |  2 +-
 .../internal/AsyncEventQueueFactoryImpl.java    | 13 ++--
 .../internal/ParallelAsyncEventQueueImpl.java   | 60 ++--------------
 .../internal/SerialAsyncEventQueueImpl.java     | 18 ++---
 .../geode/internal/cache/AbstractRegion.java    |  4 +-
 .../geode/internal/cache/CacheServerImpl.java   |  4 +-
 .../internal/cache/DiskStoreFactoryImpl.java    |  6 +-
 .../geode/internal/cache/DiskStoreImpl.java     |  4 +-
 .../geode/internal/cache/DiskStoreMonitor.java  |  2 +-
 .../DistTXStateProxyImplOnCoordinator.java      |  3 +-
 .../geode/internal/cache/DistributedRegion.java |  3 +-
 .../apache/geode/internal/cache/ExpiryTask.java |  2 +-
 .../geode/internal/cache/GemFireCacheImpl.java  | 17 +++--
 .../geode/internal/cache/InternalCache.java     | 13 ++++
 .../geode/internal/cache/LocalRegion.java       |  8 +--
 .../geode/internal/cache/PartitionedRegion.java | 11 +--
 .../internal/cache/PartitionedRegionHelper.java |  5 +-
 .../geode/internal/cache/ProxyBucketRegion.java |  2 +-
 .../cache/SearchLoadAndWriteProcessor.java      |  3 +-
 .../geode/internal/cache/ServerPingMessage.java |  2 +-
 .../apache/geode/internal/cache/TXMessage.java  |  2 +-
 .../cache/control/HeapMemoryMonitor.java        |  6 +-
 .../geode/internal/cache/ha/HARegionQueue.java  |  2 +-
 .../cache/persistence/BackupManager.java        |  7 +-
 .../cache/tier/sockets/CacheClientProxy.java    |  3 +-
 .../internal/cache/tx/ClientTXStateStub.java    |  2 +-
 .../cache/wan/AbstractGatewaySender.java        | 14 ++--
 .../cache/wan/GatewaySenderAdvisor.java         |  2 +-
 .../internal/cache/wan/WANServiceProvider.java  | 10 ++-
 .../parallel/ParallelGatewaySenderQueue.java    |  2 +-
 .../wan/serial/SerialGatewaySenderQueue.java    |  2 +-
 .../internal/cache/wan/spi/WANFactory.java      |  6 +-
 .../internal/cache/xmlcache/CacheCreation.java  | 34 ++++++---
 .../ParallelAsyncEventQueueCreation.java        | 48 +++----------
 .../xmlcache/ParallelGatewaySenderCreation.java | 46 ++----------
 .../xmlcache/SerialAsyncEventQueueCreation.java | 37 ++--------
 .../xmlcache/SerialGatewaySenderCreation.java   | 37 ++--------
 .../geode/management/internal/LocalManager.java |  2 +-
 .../management/internal/ManagementAgent.java    |  4 +-
 .../internal/beans/ManagementAdapter.java       |  7 +-
 .../internal/beans/MemberMBeanBridge.java       |  6 +-
 .../CreateAlterDestroyRegionCommands.java       |  2 +-
 .../internal/cli/functions/DeployFunction.java  |  4 +-
 .../cli/functions/ExportLogsFunction.java       |  6 +-
 .../cli/functions/SizeExportLogsFunction.java   |  2 +-
 .../pdx/internal/LonerTypeRegistration.java     |  2 +-
 .../pdx/internal/PeerTypeRegistration.java      | 14 ++--
 .../SerialAsyncEventQueueImplJUnitTest.java     |  5 +-
 .../geode/cache30/ReconnectDUnitTest.java       |  5 +-
 .../ReconnectedCacheServerDUnitTest.java        | 24 +++----
 .../geode/cache30/TXDistributedDUnitTest.java   |  4 +-
 .../geode/internal/cache/BackupJUnitTest.java   | 15 ++--
 .../cache/NetSearchMessagingDUnitTest.java      |  2 +-
 .../cache/SearchLoadAndWriteProcessorTest.java  |  1 +
 .../FetchEntriesMessageJUnitTest.java           |  2 +-
 .../java/org/apache/geode/test/fake/Fakes.java  | 17 +++--
 .../LuceneIndexForPartitionedRegion.java        | 18 ++---
 .../cache/lucene/internal/LuceneIndexImpl.java  | 11 ++-
 .../lucene/internal/LuceneIndexImplFactory.java |  5 +-
 .../cache/lucene/internal/LuceneRawIndex.java   |  5 +-
 .../lucene/internal/LuceneRawIndexFactory.java  |  5 +-
 .../lucene/internal/LuceneRegionListener.java   | 13 ++--
 .../lucene/internal/LuceneServiceImpl.java      | 13 ++--
 .../LuceneIndexCreationIntegrationTest.java     |  3 +-
 .../lucene/internal/LuceneIndexFactorySpy.java  | 19 +++--
 .../LuceneIndexForPartitionedRegionTest.java    | 26 +++----
 .../internal/LuceneIndexImplJUnitTest.java      |  8 ++-
 .../apache/geode/cache/util/AutoBalancer.java   | 18 ++---
 .../internal/locator/wan/WANFactoryImpl.java    |  8 +--
 .../cache/wan/AbstractRemoteGatewaySender.java  | 30 ++++----
 .../internal/cache/wan/GatewayReceiverImpl.java |  2 +-
 .../cache/wan/GatewaySenderFactoryImpl.java     | 21 +-----
 .../wan/parallel/ParallelGatewaySenderImpl.java | 75 ++------------------
 .../wan/serial/SerialGatewaySenderImpl.java     | 29 ++------
 .../ClusterConfigurationDUnitTest.java          |  2 +-
 75 files changed, 313 insertions(+), 564 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-assembly/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationServiceEndToEndDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationServiceEndToEndDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationServiceEndToEndDUnitTest.java
index 0103cf6..1a97cb6 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationServiceEndToEndDUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationServiceEndToEndDUnitTest.java
@@ -416,7 +416,7 @@ public class ClusterConfigurationServiceEndToEndDUnitTest extends CliCommandTest
       @Override
       public Object call() throws Exception {
         GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
-        ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+        ShutdownAllRequest.send(cache.getInternalDistributedSystem().getDistributionManager(), -1);
         return null;
       }
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
index b288108..1a4052b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java
@@ -14,11 +14,8 @@
  */
 package org.apache.geode.cache.asyncqueue.internal;
 
-import org.apache.geode.internal.cache.wan.AsyncEventQueueConfigurationException;
-
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueueFactory;
@@ -26,15 +23,14 @@ import org.apache.geode.cache.wan.GatewayEventFilter;
 import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
-import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.wan.AsyncEventQueueConfigurationException;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 import org.apache.geode.internal.cache.xmlcache.AsyncEventQueueCreation;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.cache.xmlcache.ParallelAsyncEventQueueCreation;
-import org.apache.geode.internal.cache.xmlcache.ParallelGatewaySenderCreation;
 import org.apache.geode.internal.cache.xmlcache.SerialAsyncEventQueueCreation;
-import org.apache.geode.internal.cache.xmlcache.SerialGatewaySenderCreation;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 
@@ -48,15 +44,14 @@ public class AsyncEventQueueFactoryImpl implements AsyncEventQueueFactory {
    */
   private GatewaySenderAttributes attrs = new GatewaySenderAttributes();
 
-  private Cache cache;
+  private InternalCache cache;
 
   /**
    * The default batchTimeInterval for AsyncEventQueue in milliseconds.
    */
   public static final int DEFAULT_BATCH_TIME_INTERVAL = 5;
 
-
-  public AsyncEventQueueFactoryImpl(Cache cache) {
+  public AsyncEventQueueFactoryImpl(InternalCache cache) {
     this.cache = cache;
     this.attrs = new GatewaySenderAttributes();
     // set a different default for batchTimeInterval for AsyncEventQueue

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
index 03f0799..e799880 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/ParallelAsyncEventQueueImpl.java
@@ -16,7 +16,6 @@ package org.apache.geode.cache.asyncqueue.internal;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.EntryOperation;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
@@ -27,6 +26,7 @@ import org.apache.geode.internal.cache.DistributedRegion;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegionHelper;
 import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
@@ -39,22 +39,13 @@ import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderPro
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingThreadGroup;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 
 public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
 
   private static final Logger logger = LogService.getLogger();
 
-  final ThreadGroup loggerGroup =
-      LoggingThreadGroup.createThreadGroup("Remote Site Discovery Logger Group", logger);
-
-  public ParallelAsyncEventQueueImpl() {
-    super();
-    this.isParallel = true;
-  }
-
-  public ParallelAsyncEventQueueImpl(Cache cache, GatewaySenderAttributes attrs) {
+  public ParallelAsyncEventQueueImpl(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
     if (!(this.cache instanceof CacheCreation)) {
       // this sender lies underneath the AsyncEventQueue. Need to have
@@ -76,8 +67,7 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
       }
 
       if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators =
-            ((GemFireCacheImpl) this.cache).getDistributedSystem().getConfig().getLocators();
+        String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
         if (locators.length() == 0) {
           throw new IllegalStateException(
               LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
@@ -91,14 +81,9 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
        * of Concurrent version of processor and queue.
        */
       eventProcessor = new ConcurrentParallelGatewaySenderEventProcessor(this);
-      /*
-       * if (getDispatcherThreads() > 1) { eventProcessor = new
-       * ConcurrentParallelGatewaySenderEventProcessor(this); } else { eventProcessor = new
-       * ParallelGatewaySenderEventProcessor(this); }
-       */
-
       eventProcessor.start();
       waitForRunningStatus();
+
       // Only notify the type registry if this is a WAN gateway queue
       if (!isAsyncEventQueue()) {
         ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
@@ -118,15 +103,6 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
     }
   }
 
-  // /**
-  // * The sender is not started but only the message queue i.e. shadowPR is created on the node.
-  // * @param targetPr
-  // */
-  // private void createMessageQueueOnAccessorNode(PartitionedRegion targetPr) {
-  // eventProcessor = new ParallelGatewaySenderEventProcessor(this, targetPr);
-  // }
-
-
   @Override
   public void stop() {
     this.getLifeCycleLock().writeLock().lock();
@@ -200,24 +176,11 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
     pf.isDiskSynchronous = isDiskSynchronous();
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(org.apache.geode.
-   * internal.cache.EntryEventImpl)
-   */
   @Override
   protected void setModifiedEventId(EntryEventImpl clonedEvent) {
     int bucketId = -1;
     // merged from 42004
     if (clonedEvent.getRegion() instanceof DistributedRegion) {
-      // if (getOrderPolicy() == OrderPolicy.THREAD) {
-      // bucketId = PartitionedRegionHelper.getHashKey(
-      // ((EntryEventImpl)clonedEvent).getEventId().getThreadID(),
-      // getMaxParallelismForReplicatedRegion());
-      // }
-      // else
       bucketId = PartitionedRegionHelper.getHashKey(clonedEvent.getKey(),
           getMaxParallelismForReplicatedRegion());
     } else {
@@ -230,21 +193,9 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
         originatingThreadId, getEventIdIndex());
 
     // In case of parallel as all events go through primary buckets
-    // we don't neet to generate different threadId for secondary buckets
+    // we don't need to generate different threadId for secondary buckets
     // as they will be rejected if seen at PR level itself
 
-    // boolean isPrimary = ((PartitionedRegion)getQueue().getRegion())
-    // .getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
-    // if (isPrimary) {
-    // newThreadId = ThreadIdentifier
-    // .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
-    // originatingThreadId);
-    // } else {
-    // newThreadId = ThreadIdentifier
-    // .createFakeThreadIDForParallelGSSecondaryBucket(bucketId,
-    // originatingThreadId);
-    // }
-
     EventID newEventId = new EventID(originalEventId.getMembershipID(), newThreadId,
         originalEventId.getSequenceID(), bucketId);
     if (logger.isDebugEnabled()) {
@@ -255,5 +206,4 @@ public class ParallelAsyncEventQueueImpl extends AbstractGatewaySender {
     }
     clonedEvent.setEventId(newEventId);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
index 08a5b00..9252dc7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImpl.java
@@ -14,10 +14,9 @@
  */
 package org.apache.geode.cache.asyncqueue.internal;
 
-import org.apache.geode.CancelException;
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.Cache;
+import org.apache.geode.CancelException;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
 import org.apache.geode.distributed.DistributedLockService;
@@ -27,6 +26,7 @@ import org.apache.geode.distributed.internal.ResourceEvent;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.RegionQueue;
 import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
@@ -41,22 +41,13 @@ import org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderQueue;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingThreadGroup;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 
 public class SerialAsyncEventQueueImpl extends AbstractGatewaySender {
 
   private static final Logger logger = LogService.getLogger();
 
-  final ThreadGroup loggerGroup =
-      LoggingThreadGroup.createThreadGroup("Remote Site Discovery Logger Group", logger);
-
-  public SerialAsyncEventQueueImpl() {
-    super();
-    this.isParallel = false;
-  }
-
-  public SerialAsyncEventQueueImpl(Cache cache, GatewaySenderAttributes attrs) {
+  public SerialAsyncEventQueueImpl(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
     if (!(this.cache instanceof CacheCreation)) {
       // this sender lies underneath the AsyncEventQueue. Need to have
@@ -80,8 +71,7 @@ public class SerialAsyncEventQueueImpl extends AbstractGatewaySender {
         return;
       }
       if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators =
-            ((GemFireCacheImpl) this.cache).getDistributedSystem().getConfig().getLocators();
+        String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
         if (locators.length() == 0) {
           throw new GatewaySenderConfigurationException(
               LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index e69f801..1f4e50c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -1768,7 +1768,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
   }
 
   public final long cacheTimeMillis() {
-    return this.cache.getDistributedSystem().getClock().cacheTimeMillis();
+    return this.cache.getInternalDistributedSystem().getClock().cacheTimeMillis();
   }
 
   public final RegionService getRegionService() {
@@ -1780,7 +1780,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
   }
 
   public InternalDistributedSystem getSystem() {
-    return getCache().getDistributedSystem();
+    return getCache().getInternalDistributedSystem();
   }
 
   // DataSerializableFixedID support

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
index a3c4a93..367b6f4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheServerImpl.java
@@ -355,7 +355,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
     }
 
     if (!isGatewayReceiver) {
-      InternalDistributedSystem system = ((GemFireCacheImpl) this.cache).getDistributedSystem();
+      InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
       system.handleResourceEvent(ResourceEvent.CACHE_SERVER_START, this);
     }
 
@@ -451,7 +451,7 @@ public class CacheServerImpl extends AbstractCacheServer implements Distribution
     txMgr.removeHostedTXStatesForClients();
 
     if (!isGatewayReceiver) {
-      InternalDistributedSystem system = ((GemFireCacheImpl) this.cache).getDistributedSystem();
+      InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
       system.handleResourceEvent(ResourceEvent.CACHE_SERVER_STOP, this);
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
index 71be7ec..000bf0d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
@@ -14,9 +14,7 @@
  */
 package org.apache.geode.internal.cache;
 
-
 import java.io.File;
-import java.io.IOException;
 import java.util.Arrays;
 
 import org.apache.geode.GemFireIOException;
@@ -24,7 +22,6 @@ import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.DiskStoreFactory;
 import org.apache.geode.cache.DiskStore;
 import org.apache.geode.distributed.internal.ResourceEvent;
-import org.apache.geode.internal.cache.DiskStoreAttributes;
 import org.apache.geode.internal.cache.persistence.BackupManager;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
@@ -145,7 +142,8 @@ public class DiskStoreFactoryImpl implements DiskStoreFactory {
           DiskStoreImpl dsi = new DiskStoreImpl(gfc, this.attrs);
           result = dsi;
           /** Added for M&M **/
-          gfc.getDistributedSystem().handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi);
+          gfc.getInternalDistributedSystem().handleResourceEvent(ResourceEvent.DISKSTORE_CREATE,
+              dsi);
           dsi.doInitialRecovery();
           gfc.addDiskStore(dsi);
           if (registry != null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
index b97f428..d13b4a6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
@@ -3243,7 +3243,7 @@ public class DiskStoreImpl implements DiskStore {
 
   public PersistentMemberID generatePersistentID(DiskRegionView dr) {
     File firstDir = getInfoFileDir().getDir();
-    InternalDistributedSystem ids = getCache().getDistributedSystem();
+    InternalDistributedSystem ids = getCache().getInternalDistributedSystem();
     InternalDistributedMember memberId = ids.getDistributionManager().getDistributionManagerId();
 
     // NOTE - do NOT use DM.cacheTimeMillis here. See bug #49920
@@ -3253,7 +3253,7 @@ public class DiskStoreImpl implements DiskStore {
   }
 
   public PersistentID getPersistentID() {
-    InetAddress host = cache.getDistributedSystem().getDistributedMember().getInetAddress();
+    InetAddress host = cache.getInternalDistributedSystem().getDistributedMember().getInetAddress();
     String dir = getDiskDirs()[0].getAbsolutePath();
     return new PersistentMemberPattern(host, dir, this.diskStoreID.toUUID(), 0);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
index 2bb5107..551f733 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreMonitor.java
@@ -211,7 +211,7 @@ public class DiskStoreMonitor {
     File log = null;
     GemFireCacheImpl gci = GemFireCacheImpl.getInstance();
     if (gci != null) {
-      InternalDistributedSystem ds = gci.getDistributedSystem();
+      InternalDistributedSystem ds = gci.getInternalDistributedSystem();
       if (ds != null) {
         DistributionConfig conf = ds.getConfig();
         if (conf != null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
index 52d155f..68bde4e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistTXStateProxyImplOnCoordinator.java
@@ -134,7 +134,8 @@ public class DistTXStateProxyImplOnCoordinator extends DistTXStateProxyImpl {
   private HashMap<DistributedMember, DistTXCoordinatorInterface> getSecondariesAndReplicasForTxOps() {
     final GemFireCacheImpl cache =
         GemFireCacheImpl.getExisting("getSecondariesAndReplicasForTxOps");
-    InternalDistributedMember currentNode = cache.getDistributedSystem().getDistributedMember();
+    InternalDistributedMember currentNode =
+        cache.getInternalDistributedSystem().getDistributedMember();
 
     HashMap<DistributedMember, DistTXCoordinatorInterface> secondaryTarget2realDeals =
         new HashMap<>();

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 68fdbeb..0c967c9 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -2504,7 +2504,8 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     }
     // Fix for #48066 - make sure that region operations are completely
     // distributed to peers before destroying the region.
-    long timeout = 1000L * getCache().getDistributedSystem().getConfig().getAckWaitThreshold();
+    long timeout =
+        1000L * getCache().getInternalDistributedSystem().getConfig().getAckWaitThreshold();
     Boolean flushOnClose =
         !Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "no-flush-on-close"); // test hook
     if (!this.cache.forcedDisconnect() && flushOnClose

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
index e12622d..d3f5987 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
@@ -467,7 +467,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
     GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
     if (cache != null) {
       // Use cache.cacheTimeMillis here. See bug 52267.
-      InternalDistributedSystem ids = cache.getDistributedSystem();
+      InternalDistributedSystem ids = cache.getInternalDistributedSystem();
       if (ids != null) {
         return ids.getClock().cacheTimeMillis();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 8691814..56243e1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -2019,8 +2019,8 @@ public class GemFireCacheImpl
         try {
           this.prLockService =
               DLockService.create(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME,
-                  getDistributedSystem(), true /* distributed */, true /* destroyOnDisconnect */,
-                  true /* automateFreeResources */);
+                  getInternalDistributedSystem(), true /* distributed */,
+                  true /* destroyOnDisconnect */, true /* automateFreeResources */);
         } catch (IllegalArgumentException e) {
           this.prLockService = DistributedLockService
               .getServiceNamed(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME);
@@ -2045,8 +2045,8 @@ public class GemFireCacheImpl
         if (this.gatewayLockService == null) {
           try {
             this.gatewayLockService = DLockService.create(AbstractGatewaySender.LOCK_SERVICE_NAME,
-                getDistributedSystem(), true /* distributed */, true /* destroyOnDisconnect */,
-                true /* automateFreeResources */);
+                getInternalDistributedSystem(), true /* distributed */,
+                true /* destroyOnDisconnect */, true /* automateFreeResources */);
           } catch (IllegalArgumentException e) {
             this.gatewayLockService =
                 DistributedLockService.getServiceNamed(AbstractGatewaySender.LOCK_SERVICE_NAME);
@@ -2858,7 +2858,12 @@ public class GemFireCacheImpl
   }
 
   @Override
-  public InternalDistributedSystem getDistributedSystem() {
+  public DistributedSystem getDistributedSystem() {
+    return this.system;
+  }
+
+  @Override
+  public InternalDistributedSystem getInternalDistributedSystem() {
     return this.system;
   }
 
@@ -4836,7 +4841,7 @@ public class GemFireCacheImpl
   }
 
   private void sendAddCacheServerProfileMessage() {
-    DM dm = this.getDistributedSystem().getDistributionManager();
+    DM dm = getInternalDistributedSystem().getDistributionManager();
     Set otherMembers = dm.getOtherDistributionManagerIds();
     AddCacheServerProfileMessage msg = new AddCacheServerProfileMessage();
     msg.operateOnLocalCache(this);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
index ee80014..709308b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
@@ -38,6 +38,7 @@ import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.distributed.DistributedLockService;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.SystemTimer;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.ResourceAdvisor;
@@ -167,4 +168,16 @@ public interface InternalCache extends Cache, Extensible<Cache> {
   LocalRegion getRegionByPath(String path);
 
   boolean isClient();
+
+  InternalDistributedSystem getInternalDistributedSystem();
+
+  Set<PartitionedRegion> getPartitionedRegions();
+
+  void addRegionListener(RegionListener l);
+
+  void removeRegionListener(RegionListener l);
+
+  Set<RegionListener> getRegionListeners();
+
+  CacheConfig getCacheConfig();
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 55ee6a8..5d5044b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -980,7 +980,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
             // instead of destroyLock in LocalRegion? ManagementAdapter is one
             // of the Resource Event listeners
 
-            InternalDistributedSystem system = this.cache.getDistributedSystem();
+            InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
             system.handleResourceEvent(ResourceEvent.REGION_CREATE, newRegion);
           }
         }
@@ -2683,7 +2683,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
         try {
           rgn.recursiveDestroyRegion(eventSet, event, cacheWrite);
           if (!rgn.isInternalRegion()) {
-            InternalDistributedSystem system = rgn.cache.getDistributedSystem();
+            InternalDistributedSystem system = rgn.cache.getInternalDistributedSystem();
             system.handleResourceEvent(ResourceEvent.REGION_REMOVE, rgn);
           }
         } catch (CancelException e) {
@@ -6507,7 +6507,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
            * artifacts From Management Layer
            **/
           if (!isInternalRegion()) {
-            InternalDistributedSystem system = this.cache.getDistributedSystem();
+            InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
             system.handleResourceEvent(ResourceEvent.REGION_REMOVE, this);
           }
 
@@ -7577,7 +7577,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
             .toLocalizedString(), e);
       } catch (TimeoutException e) {
         // not possible with local operation, no distributed locks possible
-        InternalDistributedSystem ids = (this.getCache().getDistributedSystem());
+        InternalDistributedSystem ids = (this.getCache().getInternalDistributedSystem());
         if (!ids.isDisconnecting()) {
           throw new InternalGemFireError(
               LocalizedStrings.LocalRegion_TIMEOUTEXCEPTION_SHOULD_NOT_BE_THROWN_HERE

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 8db8969..774ad0c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -625,7 +625,7 @@ public class PartitionedRegion extends LocalRegion
     // up upon
     // distributed system disconnect even this (or other) PRs are destroyed
     // (which prevents pridmap cleanup).
-    cache.getDistributedSystem().addDisconnectListener(dsPRIdCleanUpListener);
+    cache.getInternalDistributedSystem().addDisconnectListener(dsPRIdCleanUpListener);
 
     // this.userScope = ra.getScope();
     this.partitionAttributes = ra.getPartitionAttributes();
@@ -6892,7 +6892,7 @@ public class PartitionedRegion extends LocalRegion
         ReplyProcessor21.forceSevereAlertProcessing();
       }
       try {
-        DM dm = cache.getDistributedSystem().getDistributionManager();
+        DM dm = cache.getInternalDistributedSystem().getDistributionManager();
 
         long ackWaitThreshold = 0;
         long ackSAThreshold = dm.getConfig().getAckSevereAlertThreshold() * 1000;
@@ -6971,7 +6971,7 @@ public class PartitionedRegion extends LocalRegion
 
       final Object key = this.lockName;
 
-      final DM dm = cache.getDistributedSystem().getDistributionManager();
+      final DM dm = cache.getInternalDistributedSystem().getDistributionManager();
 
       long start = System.currentTimeMillis();
       long end;
@@ -6984,7 +6984,7 @@ public class PartitionedRegion extends LocalRegion
       }
 
       long ackSAThreshold =
-          cache.getDistributedSystem().getConfig().getAckSevereAlertThreshold() * 1000;
+          cache.getInternalDistributedSystem().getConfig().getAckSevereAlertThreshold() * 1000;
       boolean suspected = false;
       boolean severeAlertIssued = false;
       DistributedMember lockHolder = null;
@@ -6993,7 +6993,8 @@ public class PartitionedRegion extends LocalRegion
       long ackWaitThreshold;
 
       if (ackSAThreshold > 0) {
-        ackWaitThreshold = cache.getDistributedSystem().getConfig().getAckWaitThreshold() * 1000;
+        ackWaitThreshold =
+            cache.getInternalDistributedSystem().getConfig().getAckWaitThreshold() * 1000;
         waitInterval = ackWaitThreshold;
         start = System.currentTimeMillis();
       } else {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
index 99ab281..08dac6e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionHelper.java
@@ -331,7 +331,7 @@ public class PartitionedRegionHelper {
         return;
       }
 
-      DM dm = cache.getDistributedSystem().getDistributionManager();
+      DM dm = cache.getInternalDistributedSystem().getDistributionManager();
 
       if (logger.isDebugEnabled()) {
         logger.debug("Cleaning PartitionedRegion meta data for memberId={}", failedMemId);
@@ -859,7 +859,8 @@ public class PartitionedRegionHelper {
    * @return membership Set.
    */
   public static Set getMembershipSet(GemFireCacheImpl cache) {
-    return cache.getDistributedSystem().getDistributionManager().getDistributionManagerIds();
+    return cache.getInternalDistributedSystem().getDistributionManager()
+        .getDistributionManagerIds();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
index 27f73c7..06378f2 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
@@ -194,7 +194,7 @@ public final class ProxyBucketRegion implements Bucket {
   }
 
   public InternalDistributedSystem getSystem() {
-    return this.partitionedRegion.getCache().getDistributedSystem();
+    return this.partitionedRegion.getCache().getInternalDistributedSystem();
   }
 
   public String getName() {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
index 2a10792..65cda5d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
@@ -1184,7 +1184,8 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
   private synchronized void waitForObject2(final int timeoutMs) throws TimeoutException {
     if (this.requestInProgress) {
       try {
-        final DM dm = this.region.getCache().getDistributedSystem().getDistributionManager();
+        final DM dm =
+            this.region.getCache().getInternalDistributedSystem().getDistributionManager();
         long waitTimeMs = timeoutMs;
         final long endTime = System.currentTimeMillis() + waitTimeMs;
         for (;;) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
index 0e46891..aa37880 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ServerPingMessage.java
@@ -58,7 +58,7 @@ public class ServerPingMessage extends PooledDistributionMessage {
    */
   public static boolean send(GemFireCacheImpl cache, Set<InternalDistributedMember> recipients) {
 
-    InternalDistributedSystem ids = cache.getDistributedSystem();
+    InternalDistributedSystem ids = cache.getInternalDistributedSystem();
     DM dm = ids.getDistributionManager();
     Set<InternalDistributedMember> filteredRecipients = new HashSet<InternalDistributedMember>();
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
index 08ce99b..fd53fb1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
@@ -74,7 +74,7 @@ public abstract class TXMessage extends SerialDistributionMessage
         logger.debug("processing {}", this);
       }
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-      if (checkCacheClosing(cache) || checkDSClosing(cache.getDistributedSystem())) {
+      if (checkCacheClosing(cache) || checkDSClosing(cache.getInternalDistributedSystem())) {
         thr = new CacheClosedException(LocalizedStrings.PartitionMessage_REMOTE_CACHE_IS_CLOSED_0
             .toLocalizedString(dm.getId()));
         return;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
index 0de41bf..7578f15 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
@@ -279,7 +279,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
       }
 
       // Stop the stats listener
-      final GemFireStatSampler sampler = this.cache.getDistributedSystem().getStatSampler();
+      final GemFireStatSampler sampler = this.cache.getInternalDistributedSystem().getStatSampler();
       if (sampler != null) {
         sampler.removeLocalStatListener(this.statListener);
       }
@@ -294,7 +294,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
    * @return True of the listener was correctly started, false otherwise.
    */
   private boolean startCacheStatListener() {
-    final GemFireStatSampler sampler = this.cache.getDistributedSystem().getStatSampler();
+    final GemFireStatSampler sampler = this.cache.getInternalDistributedSystem().getStatSampler();
     if (sampler == null) {
       return false;
     }
@@ -302,7 +302,7 @@ public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
     try {
       sampler.waitForInitialization();
       String tenuredPoolName = getTenuredMemoryPoolMXBean().getName();
-      List list = this.cache.getDistributedSystem().getStatsList();
+      List list = this.cache.getInternalDistributedSystem().getStatsList();
       for (Object o : list) {
         if (o instanceof StatisticsImpl) {
           StatisticsImpl si = (StatisticsImpl) o;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
index 70224f2..7ee5a8d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
@@ -2783,7 +2783,7 @@ public class HARegionQueue implements RegionQueue {
      */
     @Override
     public void run() {
-      InternalDistributedSystem ids = cache.getDistributedSystem();
+      InternalDistributedSystem ids = cache.getInternalDistributedSystem();
       DM dm = ids.getDistributionManager();
 
       try { // ensure exit message is printed

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
index deb53cb..d2672df 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
@@ -68,7 +68,7 @@ public class BackupManager implements MembershipListener {
   }
 
   public void start() {
-    final DM distributionManager = cache.getDistributedSystem().getDistributionManager();
+    final DM distributionManager = cache.getInternalDistributedSystem().getDistributionManager();
     // We need to watch for pure admin guys that depart. this allMembershipListener set
     // looks like it should receive those events.
     Set allIds = distributionManager.addAllMembershipListenerAndGetAllIds(this);
@@ -85,7 +85,7 @@ public class BackupManager implements MembershipListener {
     for (DiskStoreImpl store : diskStores) {
       store.releaseBackupLock();
     }
-    final DM distributionManager = cache.getDistributedSystem().getDistributionManager();
+    final DM distributionManager = cache.getInternalDistributedSystem().getDistributionManager();
     distributionManager.removeAllMembershipListener(this);
     cache.clearBackupManager();
   }
@@ -326,7 +326,8 @@ public class BackupManager implements MembershipListener {
   }
 
   private File getBackupDir(File targetDir) throws IOException {
-    InternalDistributedMember memberId = cache.getDistributedSystem().getDistributedMember();
+    InternalDistributedMember memberId =
+        cache.getInternalDistributedSystem().getDistributedMember();
     String vmId = memberId.toString();
     vmId = cleanSpecialCharacters(vmId);
     File backupDir = new File(targetDir, vmId);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 3b0c2ff..18f13f8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -1320,7 +1320,8 @@ public class CacheClientProxy implements ClientSession {
       if (r instanceof PartitionedRegion) {
         // need to flush all buckets. SFO should be changed to target buckets
         // belonging to a particular PR, but it doesn't have that option right now
-        sfo = new StateFlushOperation(this._cache.getDistributedSystem().getDistributionManager());
+        sfo = new StateFlushOperation(
+            this._cache.getInternalDistributedSystem().getDistributionManager());
       } else {
         sfo = new StateFlushOperation((DistributedRegion) r);
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/tx/ClientTXStateStub.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/ClientTXStateStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/ClientTXStateStub.java
index ad3f103..8a1f8b1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/ClientTXStateStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/ClientTXStateStub.java
@@ -166,7 +166,7 @@ public class ClientTXStateStub extends TXStateStub {
       return;
     }
     cache.getCancelCriterion().checkCancelInProgress(null);
-    InternalDistributedSystem ds = cache.getDistributedSystem();
+    InternalDistributedSystem ds = cache.getInternalDistributedSystem();
     DM dm = ds.getDistributionManager();
 
     txcm.setDM(dm);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
index 1c94f94..ab3b3cf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
@@ -12,7 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.internal.cache.wan;
 
 import java.io.IOException;
@@ -26,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.geode.InternalGemFireError;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.BucketMovedException;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
 import org.apache.geode.internal.cache.wan.parallel.WaitUntilParallelGatewaySenderFlushedCoordinator;
@@ -82,16 +82,14 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
 /**
  * Abstract implementation of both Serial and Parallel GatewaySender. It handles common
  * functionality like initializing proxy.
- * 
- * 
+ *
  * @since GemFire 7.0
  */
-
 public abstract class AbstractGatewaySender implements GatewaySender, DistributionAdvisee {
 
   private static final Logger logger = LogService.getLogger();
 
-  protected Cache cache;
+  protected InternalCache cache;
 
   protected String id;
 
@@ -229,7 +227,7 @@ public abstract class AbstractGatewaySender implements GatewaySender, Distributi
 
   protected AbstractGatewaySender() {}
 
-  public AbstractGatewaySender(Cache cache, GatewaySenderAttributes attrs) {
+  public AbstractGatewaySender(InternalCache cache, GatewaySenderAttributes attrs) {
     this.cache = cache;
     this.id = attrs.getId();
     this.socketBufferSize = attrs.getSocketBufferSize();
@@ -258,8 +256,8 @@ public abstract class AbstractGatewaySender implements GatewaySender, Distributi
     // 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.myDSId =
+        this.cache.getInternalDistributedSystem().getDistributionManager().getDistributedSystemId();
     this.serialNumber = DistributionAdvisor.createSerialNumber();
     this.isMetaQueue = attrs.isMetaQueue();
     if (!(this.cache instanceof CacheCreation)) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
index baa9d9c..c831b26 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
@@ -300,7 +300,7 @@ public class GatewaySenderAdvisor extends DistributionAdvisor {
 
   public void initDLockService() {
     InternalDistributedSystem ds =
-        ((GemFireCacheImpl) this.sender.getCache()).getDistributedSystem();
+        ((GemFireCacheImpl) this.sender.getCache()).getInternalDistributedSystem();
     String dlsName = getDLockServiceName();
     this.lockService = DistributedLockService.getServiceNamed(dlsName);
     if (this.lockService == null) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/WANServiceProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/WANServiceProvider.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/WANServiceProvider.java
index 2aed0ee..229736a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/WANServiceProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/WANServiceProvider.java
@@ -17,11 +17,11 @@ package org.apache.geode.internal.cache.wan;
 import java.util.Iterator;
 import java.util.ServiceLoader;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.client.internal.locator.wan.LocatorMembershipListener;
 import org.apache.geode.cache.wan.GatewayReceiverFactory;
 import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.distributed.internal.WanLocatorDiscoverer;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.spi.WANFactory;
 
 public class WANServiceProvider {
@@ -38,7 +38,7 @@ public class WANServiceProvider {
     }
   }
 
-  public static GatewaySenderFactory createGatewaySenderFactory(Cache cache) {
+  public static GatewaySenderFactory createGatewaySenderFactory(InternalCache cache) {
     if (factory == null) {
       throw new IllegalStateException("WAN service is not available.");
     }
@@ -46,7 +46,7 @@ public class WANServiceProvider {
 
   }
 
-  public static GatewayReceiverFactory createGatewayReceiverFactory(Cache cache) {
+  public static GatewayReceiverFactory createGatewayReceiverFactory(InternalCache cache) {
     if (factory == null) {
       throw new IllegalStateException("WAN service is not available.");
     }
@@ -67,7 +67,5 @@ public class WANServiceProvider {
     return factory.createLocatorMembershipListener();
   }
 
-  private WANServiceProvider() {
-
-  }
+  private WANServiceProvider() {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index adc967f..cf4c5a9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -1664,7 +1664,7 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
     @Override
     public void run() {
       try {
-        InternalDistributedSystem ids = cache.getDistributedSystem();
+        InternalDistributedSystem ids = cache.getInternalDistributedSystem();
         DM dm = ids.getDistributionManager();
         for (;;) {
           try { // be somewhat tolerant of failures

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
index e6d54c5..02baf81 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderQueue.java
@@ -1089,7 +1089,7 @@ public class SerialGatewaySenderQueue implements RegionQueue {
 
     @Override
     public void run() {
-      InternalDistributedSystem ids = cache.getDistributedSystem();
+      InternalDistributedSystem ids = cache.getInternalDistributedSystem();
 
       try { // ensure exit message is printed
         // Long waitTime = Long.getLong(QUEUE_REMOVAL_WAIT_TIME, 1000);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/wan/spi/WANFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/spi/WANFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/spi/WANFactory.java
index 918c373..3af9bf8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/spi/WANFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/spi/WANFactory.java
@@ -14,17 +14,17 @@
  */
 package org.apache.geode.internal.cache.wan.spi;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.client.internal.locator.wan.LocatorMembershipListener;
 import org.apache.geode.cache.wan.GatewayReceiverFactory;
 import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.distributed.internal.WanLocatorDiscoverer;
+import org.apache.geode.internal.cache.InternalCache;
 
 public interface WANFactory {
 
-  GatewaySenderFactory createGatewaySenderFactory(Cache cache);
+  GatewaySenderFactory createGatewaySenderFactory(InternalCache cache);
 
-  GatewayReceiverFactory createGatewayReceiverFactory(Cache cache);
+  GatewayReceiverFactory createGatewayReceiverFactory(InternalCache cache);
 
   WanLocatorDiscoverer createLocatorDiscoverer();
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index b0b7d1b..a5f0fc2 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -29,7 +29,6 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.Executor;
@@ -115,6 +114,7 @@ import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PoolFactoryImpl;
 import org.apache.geode.internal.cache.PoolManagerImpl;
+import org.apache.geode.internal.cache.RegionListener;
 import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.internal.cache.TombstoneService;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
@@ -145,7 +145,6 @@ import org.apache.geode.pdx.internal.TypeRegistry;
  * {@link Cache} interface so that this class must be updated when {@link Cache} is modified. This
  * class is public for testing purposes.
  *
- *
  * @since GemFire 3.0
  */
 public class CacheCreation implements InternalCache {
@@ -1066,12 +1065,6 @@ public class CacheCreation implements InternalCache {
     return null;
   }
 
-  // public GatewayReceiver addGatewayReceiver(){
-  // GatewayReceiverCreation receiver = new GatewayReceiverCreation();
-  // this.gatewayReceivers.add(receiver);
-  // return receiver;
-  // }
-  //
   public Set<GatewayReceiver> getGatewayReceivers() {
     return this.gatewayReceivers;
   }
@@ -1296,6 +1289,31 @@ public class CacheCreation implements InternalCache {
     return false;
   }
 
+  @Override
+  public InternalDistributedSystem getInternalDistributedSystem() {
+    return InternalDistributedSystem.getAnyInstance();
+  }
+
+  @Override
+  public Set<PartitionedRegion> getPartitionedRegions() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void addRegionListener(final RegionListener l) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void removeRegionListener(final RegionListener l) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public Set<RegionListener> getRegionListeners() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
   public GatewaySenderFactory createGatewaySenderFactory() {
     return WANServiceProvider.createGatewaySenderFactory(this);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelAsyncEventQueueCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelAsyncEventQueueCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelAsyncEventQueueCreation.java
index 1e3429c..4d0aac9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelAsyncEventQueueCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelAsyncEventQueueCreation.java
@@ -17,107 +17,75 @@ package org.apache.geode.internal.cache.xmlcache;
 import java.util.List;
 
 import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionAdvisee;
 import org.apache.geode.distributed.internal.DistributionAdvisor;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EnumListenerEvent;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 
 public class ParallelAsyncEventQueueCreation extends AbstractGatewaySender
     implements GatewaySender {
 
-  public ParallelAsyncEventQueueCreation(Cache cache, GatewaySenderAttributes attrs) {
+  public ParallelAsyncEventQueueCreation(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
   public void distribute(EnumListenerEvent operation, EntryEventImpl event,
-      List<Integer> remoteDSIds) {
-    // TODO Auto-generated method stub
-
-  }
+      List<Integer> remoteDSIds) {}
 
   @Override
-  public void start() {
-    // TODO Auto-generated method stub
+  public void start() {}
 
-  }
-
-  public void stop() {
-    // TODO Auto-generated method stub
-
-  }
+  public void stop() {}
 
   public void rebalance() {
     throw new UnsupportedOperationException();
   }
 
-  public void fillInProfile(Profile profile) {
-    // TODO Auto-generated method stub
-
-  }
+  public void fillInProfile(Profile profile) {}
 
   public CancelCriterion getCancelCriterion() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisor getDistributionAdvisor() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DM getDistributionManager() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getFullPath() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getName() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisee getParentAdvisee() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public Profile getProfile() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public int getSerialNumber() {
-    // TODO Auto-generated method stub
     return 0;
   }
 
   public InternalDistributedSystem getSystem() {
-    // TODO Auto-generated method stub
     return null;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(org.apache.geode.
-   * internal.cache.EntryEventImpl)
-   */
   @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    // TODO Auto-generated method stub
-
-  }
-
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelGatewaySenderCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelGatewaySenderCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelGatewaySenderCreation.java
index 0dc6b82..3cd60c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelGatewaySenderCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ParallelGatewaySenderCreation.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.cache.xmlcache;
 import java.util.List;
 
 import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionAdvisee;
@@ -26,31 +25,23 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EnumListenerEvent;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 
 public class ParallelGatewaySenderCreation extends AbstractGatewaySender implements GatewaySender {
 
-  public ParallelGatewaySenderCreation(Cache cache, GatewaySenderAttributes attrs) {
+  public ParallelGatewaySenderCreation(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
   public void distribute(EnumListenerEvent operation, EntryEventImpl event,
-      List<Integer> remoteDSIds) {
-    // TODO Auto-generated method stub
-
-  }
+      List<Integer> remoteDSIds) {}
 
   @Override
-  public void start() {
-    // TODO Auto-generated method stub
-
-  }
-
-  public void stop() {
-    // TODO Auto-generated method stub
+  public void start() {}
 
-  }
+  public void stop() {}
 
   public void rebalance() {
     throw new UnsupportedOperationException();
@@ -59,67 +50,44 @@ public class ParallelGatewaySenderCreation extends AbstractGatewaySender impleme
   @Override
   public void destroy() {}
 
-  public void fillInProfile(Profile profile) {
-    // TODO Auto-generated method stub
-
-  }
+  public void fillInProfile(Profile profile) {}
 
   public CancelCriterion getCancelCriterion() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisor getDistributionAdvisor() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DM getDistributionManager() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getFullPath() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getName() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisee getParentAdvisee() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public Profile getProfile() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public int getSerialNumber() {
-    // TODO Auto-generated method stub
     return 0;
   }
 
   public InternalDistributedSystem getSystem() {
-    // TODO Auto-generated method stub
     return null;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(org.apache.geode.
-   * internal.cache.EntryEventImpl)
-   */
   @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    // TODO Auto-generated method stub
-
-  }
-
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialAsyncEventQueueCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialAsyncEventQueueCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialAsyncEventQueueCreation.java
index 856ec3c..89f345b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialAsyncEventQueueCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialAsyncEventQueueCreation.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.cache.xmlcache;
 import java.util.List;
 
 import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionAdvisee;
@@ -26,88 +25,66 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EnumListenerEvent;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 
-
 public class SerialAsyncEventQueueCreation extends AbstractGatewaySender implements GatewaySender {
 
-  public SerialAsyncEventQueueCreation(Cache cache, GatewaySenderAttributes attrs) {
+  public SerialAsyncEventQueueCreation(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
   public void distribute(EnumListenerEvent operation, EntryEventImpl event,
-      List<Integer> remoteDSIds) {
-
-  }
+      List<Integer> remoteDSIds) {}
 
   @Override
-  public void start() {
-
-  }
-
-  public void stop() {
+  public void start() {}
 
-  }
+  public void stop() {}
 
   public void rebalance() {
     throw new UnsupportedOperationException();
   }
 
-  public void fillInProfile(Profile profile) {
-    // TODO Auto-generated method stub
-
-  }
+  public void fillInProfile(Profile profile) {}
 
   public CancelCriterion getCancelCriterion() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisor getDistributionAdvisor() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DM getDistributionManager() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getFullPath() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getName() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisee getParentAdvisee() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public Profile getProfile() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public int getSerialNumber() {
-    // TODO Auto-generated method stub
     return 0;
   }
 
   public InternalDistributedSystem getSystem() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    // TODO Auto-generated method stub
-
-  }
-
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialGatewaySenderCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialGatewaySenderCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialGatewaySenderCreation.java
index 7764c58..9aff712 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialGatewaySenderCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/SerialGatewaySenderCreation.java
@@ -17,7 +17,6 @@ package org.apache.geode.internal.cache.xmlcache;
 import java.util.List;
 
 import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionAdvisee;
@@ -26,88 +25,66 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EnumListenerEvent;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 
-
 public class SerialGatewaySenderCreation extends AbstractGatewaySender implements GatewaySender {
 
-  public SerialGatewaySenderCreation(Cache cache, GatewaySenderAttributes attrs) {
+  public SerialGatewaySenderCreation(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
   public void distribute(EnumListenerEvent operation, EntryEventImpl event,
-      List<Integer> remoteDSIds) {
-
-  }
+      List<Integer> remoteDSIds) {}
 
   @Override
-  public void start() {
-
-  }
-
-  public void stop() {
+  public void start() {}
 
-  }
+  public void stop() {}
 
   public void rebalance() {
     throw new UnsupportedOperationException();
   }
 
-  public void fillInProfile(Profile profile) {
-    // TODO Auto-generated method stub
-
-  }
+  public void fillInProfile(Profile profile) {}
 
   public CancelCriterion getCancelCriterion() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisor getDistributionAdvisor() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DM getDistributionManager() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getFullPath() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public String getName() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public DistributionAdvisee getParentAdvisee() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public Profile getProfile() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   public int getSerialNumber() {
-    // TODO Auto-generated method stub
     return 0;
   }
 
   public InternalDistributedSystem getSystem() {
-    // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  protected void setModifiedEventId(EntryEventImpl clonedEvent) {
-    // TODO Auto-generated method stub
-
-  }
-
+  protected void setModifiedEventId(EntryEventImpl clonedEvent) {}
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java b/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
index 45916bc..3adbce0 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/LocalManager.java
@@ -220,7 +220,7 @@ public class LocalManager extends Manager {
         managementTask.run();
         // All local resources are created for the ManagementTask
         // Now Management tasks can proceed.
-        int updateRate = cache.getDistributedSystem().getConfig().getJmxManagerUpdateRate();
+        int updateRate = cache.getInternalDistributedSystem().getConfig().getJmxManagerUpdateRate();
         singleThreadFederationScheduler.scheduleAtFixedRate(managementTask, updateRate, updateRate,
             TimeUnit.MILLISECONDS);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 5cbb990..9394efb 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -123,9 +123,9 @@ public class ManagementAgent {
   }
 
   private boolean isServerNode(GemFireCacheImpl cache) {
-    return (cache.getDistributedSystem().getDistributedMember()
+    return (cache.getInternalDistributedSystem().getDistributedMember()
         .getVmKind() != DistributionManager.LOCATOR_DM_TYPE
-        && cache.getDistributedSystem().getDistributedMember()
+        && cache.getInternalDistributedSystem().getDistributedMember()
             .getVmKind() != DistributionManager.ADMIN_ONLY_DM_TYPE
         && !cache.isClient());
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
index 183a5a8..1dc90dc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
@@ -185,9 +185,9 @@ public class ManagementAdapter {
       }
 
 
-      if (cache.getDistributedSystem().getConfig().getJmxManager()) {
+      if (cache.getInternalDistributedSystem().getConfig().getJmxManager()) {
         this.service.createManager();
-        if (cache.getDistributedSystem().getConfig().getJmxManagerStart()) {
+        if (cache.getInternalDistributedSystem().getConfig().getJmxManagerStart()) {
           this.service.startManager();
         }
       }
@@ -1036,7 +1036,8 @@ public class ManagementAdapter {
       return;
     }
     // Don't register the CacheServices in the Locator
-    InternalDistributedMember member = cacheImpl.getDistributedSystem().getDistributedMember();
+    InternalDistributedMember member =
+        cacheImpl.getInternalDistributedSystem().getDistributedMember();
     if (member.getVmKind() == DistributionManager.LOCATOR_DM_TYPE) {
       return;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index 1559aad..d6a1efa 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -299,8 +299,8 @@ public class MemberMBeanBridge {
 
     if (dm instanceof DistributionManager) {
       DistributionManager distManager = (DistributionManager) system.getDistributionManager();
-      this.redundancyZone =
-          distManager.getRedundancyZone(cache.getDistributedSystem().getDistributedMember());
+      this.redundancyZone = distManager
+          .getRedundancyZone(cache.getInternalDistributedSystem().getDistributedMember());
     }
 
 
@@ -1038,7 +1038,7 @@ public class MemberMBeanBridge {
 
       try {
         BackupManager manager =
-            cache.startBackup(cache.getDistributedSystem().getDistributedMember());
+            cache.startBackup(cache.getInternalDistributedSystem().getDistributedMember());
         boolean abort = true;
         Set<PersistentID> existingDataStores;
         Set<PersistentID> successfulDataStores;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
index 6dd5615..28ce092 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
@@ -393,7 +393,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
   public boolean verifyDistributedRegionMbean(Cache cache, String regionName) {
     GemFireCacheImpl gemfireCache = (GemFireCacheImpl) cache;
     int federationInterval =
-        gemfireCache.getDistributedSystem().getConfig().getJmxManagerUpdateRate();
+        gemfireCache.getInternalDistributedSystem().getConfig().getJmxManagerUpdateRate();
     long timeEnd = System.currentTimeMillis() + federationInterval + 50;
 
     for (; System.currentTimeMillis() <= timeEnd;) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
index 148aa5f..421f9d7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
@@ -52,8 +52,8 @@ public class DeployFunction implements Function, InternalEntity {
       final byte[][] jarBytes = (byte[][]) args[1];
       Cache cache = CacheFactory.getAnyInstance();
 
-      final JarDeployer jarDeployer = new JarDeployer(
-          ((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
+      final JarDeployer jarDeployer = new JarDeployer(((GemFireCacheImpl) cache)
+          .getInternalDistributedSystem().getConfig().getDeployWorkingDir());
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 


[46/51] [abbrv] geode git commit: GEODE-2632: refactor code to use InternalCache instead of GemFireCacheImpl

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceVsdStats.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceVsdStats.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceVsdStats.java
index 8435c4c..5dc7bb0 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceVsdStats.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceVsdStats.java
@@ -25,9 +25,9 @@ import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.CqQuery;
 import org.apache.geode.cache.query.internal.DefaultQueryService;
 import org.apache.geode.internal.NanoTimer;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 import org.apache.geode.internal.cache.FilterProfile;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.logging.LogService;
 
 /**
@@ -44,35 +44,34 @@ public class CqServiceVsdStats {
   private static final StatisticsType _type;
 
   /** Name of the created CQs statistic */
-  protected static final String CQS_CREATED = "numCqsCreated";
+  private static final String CQS_CREATED = "numCqsCreated";
 
   /** Name of the active CQs statistic */
-  protected static final String CQS_ACTIVE = "numCqsActive";
+  private static final String CQS_ACTIVE = "numCqsActive";
 
   /** Name of the stopped CQs statistic */
-  protected static final String CQS_STOPPED = "numCqsStopped";
+  private static final String CQS_STOPPED = "numCqsStopped";
 
   /** Name of the closed CQs statistic */
-  protected static final String CQS_CLOSED = "numCqsClosed";
+  private static final String CQS_CLOSED = "numCqsClosed";
 
   /** Name of the client's CQs statistic */
-  protected static final String CQS_ON_CLIENT = "numCqsOnClient";
+  private static final String CQS_ON_CLIENT = "numCqsOnClient";
 
   /** Number of clients with CQs statistic */
-  protected static final String CLIENTS_WITH_CQS = "numClientsWithCqs";
-
+  private static final String CLIENTS_WITH_CQS = "numClientsWithCqs";
 
   /** CQ query execution time. */
-  protected static final String CQ_QUERY_EXECUTION_TIME = "cqQueryExecutionTime";
+  private static final String CQ_QUERY_EXECUTION_TIME = "cqQueryExecutionTime";
 
   /** CQ query execution in progress */
-  protected static final String CQ_QUERY_EXECUTION_IN_PROGRESS = "cqQueryExecutionInProgress";
+  private static final String CQ_QUERY_EXECUTION_IN_PROGRESS = "cqQueryExecutionInProgress";
 
   /** Completed CQ query executions */
-  protected static final String CQ_QUERY_EXECUTIONS_COMPLETED = "cqQueryExecutionsCompleted";
+  private static final String CQ_QUERY_EXECUTIONS_COMPLETED = "cqQueryExecutionsCompleted";
 
   /** Unique CQs, number of different CQ queries */
-  protected static final String UNIQUE_CQ_QUERY = "numUniqueCqQuery";
+  private static final String UNIQUE_CQ_QUERY = "numUniqueCqQuery";
 
   /** Id of the CQs created statistic */
   private static final int _numCqsCreatedId;
@@ -104,7 +103,7 @@ public class CqServiceVsdStats {
   /** Id for unique CQs, difference in CQ queries */
   private static final int _numUniqueCqQuery;
 
-  /**
+  /*
    * Static initializer to create and initialize the <code>StatisticsType</code>
    */
   static {
@@ -140,7 +139,6 @@ public class CqServiceVsdStats {
     _cqQueryExecutionsCompletedId = _type.nameToId(CQ_QUERY_EXECUTIONS_COMPLETED);
     _cqQueryExecutionInProgressId = _type.nameToId(CQ_QUERY_EXECUTION_IN_PROGRESS);
     _numUniqueCqQuery = _type.nameToId(UNIQUE_CQ_QUERY);
-
   }
 
   /** The <code>Statistics</code> instance to which most behavior is delegated */
@@ -152,12 +150,10 @@ public class CqServiceVsdStats {
    * @param factory The <code>StatisticsFactory</code> which creates the <code>Statistics</code>
    *        instance
    */
-  public CqServiceVsdStats(StatisticsFactory factory) {
+  CqServiceVsdStats(StatisticsFactory factory) {
     this._stats = factory.createAtomicStatistics(_type, "CqServiceStats");
   }
 
-  // /////////////////// Instance Methods /////////////////////
-
   /**
    * Closes the <code>HARegionQueueStats</code>.
    */
@@ -170,14 +166,14 @@ public class CqServiceVsdStats {
    * 
    * @return the current value of the "numCqsCreated" stat
    */
-  public long getNumCqsCreated() {
+  long getNumCqsCreated() {
     return this._stats.getLong(_numCqsCreatedId);
   }
 
   /**
    * Increments the "numCqsCreated" stat by 1.
    */
-  public void incCqsCreated() {
+  void incCqsCreated() {
     this._stats.incLong(_numCqsCreatedId, 1);
   }
 
@@ -186,21 +182,21 @@ public class CqServiceVsdStats {
    * 
    * @return the current value of the "numCqsActive" stat
    */
-  public long getNumCqsActive() {
+  long getNumCqsActive() {
     return this._stats.getLong(_numCqsActiveId);
   }
 
   /**
    * Increments the "numCqsActive" stat by 1.
    */
-  public void incCqsActive() {
+  void incCqsActive() {
     this._stats.incLong(_numCqsActiveId, 1);
   }
 
   /**
    * Decrements the "numCqsActive" stat by 1.
    */
-  public void decCqsActive() {
+  void decCqsActive() {
     this._stats.incLong(_numCqsActiveId, -1);
   }
 
@@ -209,21 +205,21 @@ public class CqServiceVsdStats {
    * 
    * @return the current value of the "numCqsStopped" stat
    */
-  public long getNumCqsStopped() {
+  long getNumCqsStopped() {
     return this._stats.getLong(_numCqsStoppedId);
   }
 
   /**
    * Increments the "numCqsStopped" stat by 1.
    */
-  public void incCqsStopped() {
+  void incCqsStopped() {
     this._stats.incLong(_numCqsStoppedId, 1);
   }
 
   /**
    * Decrements the "numCqsStopped" stat by 1.
    */
-  public void decCqsStopped() {
+  void decCqsStopped() {
     this._stats.incLong(_numCqsStoppedId, -1);
   }
 
@@ -232,14 +228,14 @@ public class CqServiceVsdStats {
    * 
    * @return the current value of the "numCqsClosed" stat
    */
-  public long getNumCqsClosed() {
+  long getNumCqsClosed() {
     return this._stats.getLong(_numCqsClosedId);
   }
 
   /**
    * Increments the "numCqsClosed" stat by 1.
    */
-  public void incCqsClosed() {
+  void incCqsClosed() {
     this._stats.incLong(_numCqsClosedId, 1);
   }
 
@@ -248,21 +244,21 @@ public class CqServiceVsdStats {
    * 
    * @return the current value of the "numCqsOnClient" stat
    */
-  public long getNumCqsOnClient() {
+  long getNumCqsOnClient() {
     return this._stats.getLong(_numCqsOnClientId);
   }
 
   /**
    * Increments the "numCqsOnClient" stat by 1.
    */
-  public void incCqsOnClient() {
+  void incCqsOnClient() {
     this._stats.incLong(_numCqsOnClientId, 1);
   }
 
   /**
    * Decrements the "numCqsOnClient" stat by 1.
    */
-  public void decCqsOnClient() {
+  void decCqsOnClient() {
     this._stats.incLong(_numCqsOnClientId, -1);
   }
 
@@ -278,21 +274,21 @@ public class CqServiceVsdStats {
   /**
    * Increments the "numClientsWithCqs" stat by 1.
    */
-  public void incClientsWithCqs() {
+  void incClientsWithCqs() {
     this._stats.incLong(_numClientsWithCqsId, 1);
   }
 
   /**
    * Decrements the "numCqsOnClient" stat by 1.
    */
-  public void decClientsWithCqs() {
+  void decClientsWithCqs() {
     this._stats.incLong(_numClientsWithCqsId, -1);
   }
 
   /**
    * Start the CQ Query Execution time.
    */
-  public long startCqQueryExecution() {
+  long startCqQueryExecution() {
     this._stats.incInt(_cqQueryExecutionInProgressId, 1);
     return NanoTimer.getTime();
   }
@@ -302,7 +298,7 @@ public class CqServiceVsdStats {
    * 
    * @param start long time value.
    */
-  public void endCqQueryExecution(long start) {
+  void endCqQueryExecution(long start) {
     long ts = NanoTimer.getTime();
     this._stats.incLong(_cqQueryExecutionTimeId, ts - start);
     this._stats.incInt(_cqQueryExecutionInProgressId, -1);
@@ -321,14 +317,14 @@ public class CqServiceVsdStats {
   /**
    * Increments number of Unique queries.
    */
-  public void incUniqueCqQuery() {
+  void incUniqueCqQuery() {
     this._stats.incInt(_numUniqueCqQuery, 1);
   }
 
   /**
    * Decrements number of unique Queries.
    */
-  public void decUniqueCqQuery() {
+  void decUniqueCqQuery() {
     this._stats.incInt(_numUniqueCqQuery, -1);
   }
 
@@ -338,11 +334,8 @@ public class CqServiceVsdStats {
    * tests.
    * <p>
    * Returns the number of CQs (active + suspended) on the given region.
-   * 
-   * @param regionName
    */
-  public long numCqsOnRegion(String regionName) {
-    GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+  public long numCqsOnRegion(final InternalCache cache, String regionName) {
     if (cache == null) {
       return 0;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ServerCQImpl.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ServerCQImpl.java b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ServerCQImpl.java
index ec6e984..c484105 100644
--- a/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ServerCQImpl.java
+++ b/geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/ServerCQImpl.java
@@ -21,24 +21,18 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializable;
 import org.apache.geode.DataSerializer;
-import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.DataPolicy;
 import org.apache.geode.cache.EvictionAction;
-import org.apache.geode.cache.client.internal.UserAttributes;
 import org.apache.geode.cache.query.CqAttributes;
 import org.apache.geode.cache.query.CqAttributesMutator;
 import org.apache.geode.cache.query.CqClosedException;
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.CqExistsException;
-import org.apache.geode.cache.query.CqListener;
 import org.apache.geode.cache.query.CqResults;
 import org.apache.geode.cache.query.Query;
 import org.apache.geode.cache.query.QueryException;
@@ -49,6 +43,7 @@ import org.apache.geode.cache.query.internal.CompiledRegion;
 import org.apache.geode.cache.query.internal.CompiledSelect;
 import org.apache.geode.cache.query.internal.CqStateImpl;
 import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.i18n.StringId;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.Token;
@@ -58,7 +53,6 @@ import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.geode.i18n.StringId;
 
 public class ServerCQImpl extends CqQueryImpl implements DataSerializable, ServerCQ {
   private static final Logger logger = LogService.getLogger();
@@ -84,7 +78,7 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
   public volatile boolean cqResultKeysInitialized = false;
 
   /** Boolean flag to see if the CQ is on Partitioned Region */
-  public volatile boolean isPR = false;
+  volatile boolean isPR = false;
 
   private ClientProxyMembershipID clientProxyId = null;
 
@@ -92,7 +86,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
   private String serverCqName;
 
-
   /** identifier assigned to this query for FilterRoutingInfos */
   private Long filterID;
 
@@ -106,21 +99,11 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     // For deserialization
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#getFilterID()
-   */
   @Override
   public Long getFilterID() {
     return this.filterID;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#setFilterID(java.lang.Long)
-   */
   @Override
   public void setFilterID(Long filterID) {
     this.filterID = filterID;
@@ -142,19 +125,12 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
     CacheClientProxy clientProxy = null;
     this.clientProxyId = p_clientProxyId;
-    // servConnection = serverSideConnection;
 
     if (p_ccn != null) {
       this.ccn = p_ccn;
       clientProxy = p_ccn.getClientProxy(p_clientProxyId, true);
     }
 
-    /*
-     * try { initCq(); } catch (CqExistsException cqe) { // Should not happen. throw new
-     * CqException(LocalizedStrings.CqQueryImpl_UNABLE_TO_CREATE_CQ_0_ERROR__1.toLocalizedString(new
-     * Object[] { cqName, cqe.getMessage()})); }
-     */
-
     validateCq();
 
     final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -228,13 +204,11 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
       throw new CqException(errMsg);
     }
 
-    // checkAndSetCqOnRegion();
-
     // Can be null by the time we are here
     if (clientProxy != null) {
       clientProxy.incCqCount();
       if (clientProxy.hasOneCq()) {
-        cqService.stats.incClientsWithCqs();
+        cqService.stats().incClientsWithCqs();
       }
       if (isDebugEnabled) {
         logger.debug("Added CQ to the base region: {} With key as: {}", cqBaseRegion.getFullPath(),
@@ -307,7 +281,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
    * query.
    * 
    * @return String modified query.
-   * @throws CqException
    */
   private Query constructServerSideQuery() throws QueryException {
     GemFireCacheImpl cache = (GemFireCacheImpl) cqService.getCache();
@@ -328,7 +301,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
    * Returns if the passed key is part of the CQs result set. This method needs to be called once
    * the CQ result key caching is completed (cqResultsCacheInitialized is true).
    * 
-   * @param key
    * @return true if key is in the Results Cache.
    */
   public boolean isPartOfCqResult(Object key) {
@@ -352,27 +324,18 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#addToCqResultKeys(java.lang.Object)
-   */
   @Override
   public void addToCqResultKeys(Object key) {
     if (!CqServiceProvider.MAINTAIN_KEYS) {
       return;
     }
 
-    // this.logger.fine("Adding key to Results Cache For CQ :" +
-    // this.cqName + " key :" + key);
     if (this.cqResultKeys != null) {
       synchronized (this.cqResultKeys) {
         this.cqResultKeys.put(key, TOKEN);
         if (!this.cqResultKeysInitialized) {
           // This key could be coming after add, destroy.
           // Remove this from destroy queue.
-          // this.logger.fine("Removing key from Destroy Cache For CQ :" +
-          // this.cqName + " key :" + key);
           if (this.destroysWhileCqResultsInProgress != null) {
             this.destroysWhileCqResultsInProgress.remove(key);
           }
@@ -381,21 +344,11 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     }
   }
 
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqQuery2#removeFromCqResultKeys(java.lang.Object,
-   * boolean)
-   */
   @Override
   public void removeFromCqResultKeys(Object key, boolean isTokenMode) {
     if (!CqServiceProvider.MAINTAIN_KEYS) {
       return;
     }
-    // this.logger.fine("Removing key from Results Cache For CQ :" +
-    // this.cqName + " key :" + key);
     if (this.cqResultKeys != null) {
       synchronized (this.cqResultKeys) {
         if (isTokenMode && this.cqResultKeys.get(key) != Token.DESTROYED) {
@@ -403,8 +356,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
         }
         this.cqResultKeys.remove(key);
         if (!this.cqResultKeysInitialized) {
-          // this.logger.fine("Adding key to Destroy Cache For CQ :" +
-          // this.cqName + " key :" + key);
           if (this.destroysWhileCqResultsInProgress != null) {
             this.destroysWhileCqResultsInProgress.add(key);
           }
@@ -415,10 +366,8 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
   /**
    * Marks the key as destroyed in the CQ Results key cache.
-   * 
-   * @param key
    */
-  public void markAsDestroyedInCqResultKeys(Object key) {
+  void markAsDestroyedInCqResultKeys(Object key) {
     if (!CqServiceProvider.MAINTAIN_KEYS) {
       return;
     }
@@ -439,12 +388,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     }
   }
 
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#setCqResultsCacheInitialized()
-   */
   @Override
   public void setCqResultsCacheInitialized() {
     if (CqServiceProvider.MAINTAIN_KEYS) {
@@ -466,13 +409,6 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.cache.query.internal.InternalCqQuery2#isOldValueRequiredForQueryProcessing(
-   * java.lang.Object)
-   */
   @Override
   public boolean isOldValueRequiredForQueryProcessing(Object key) {
     if (this.cqResultKeysInitialized && this.isPartOfCqResult(key)) {
@@ -484,18 +420,11 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
   /**
    * Closes the Query. On Client side, sends the cq close request to server. On Server side, takes
    * care of repository cleanup.
-   * 
-   * @throws CqException
    */
   public void close() throws CqClosedException, CqException {
     close(true);
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#close(boolean)
-   */
   @Override
   public void close(boolean sendRequestToServer) throws CqClosedException, CqException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -523,9 +452,9 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
       // Stat update.
       if (stateBeforeClosing == CqStateImpl.RUNNING) {
-        cqService.stats.decCqsActive();
+        cqService.stats().decCqsActive();
       } else if (stateBeforeClosing == CqStateImpl.STOPPED) {
-        cqService.stats.decCqsStopped();
+        cqService.stats().decCqsStopped();
       }
 
       // Clean-up the CQ Results Cache.
@@ -537,8 +466,8 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
       // Set the state to close, and update stats
       this.cqState.setState(CqStateImpl.CLOSED);
-      cqService.stats.incCqsClosed();
-      cqService.stats.decCqsOnClient();
+      cqService.stats().incCqsClosed();
+      cqService.stats().decCqsOnClient();
       if (this.stats != null)
         this.stats.close();
     }
@@ -564,9 +493,8 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
   /**
    * Clears the resource used by CQ.
-   * 
-   * @throws CqException
    */
+  @Override
   protected void cleanup() throws CqException {
     // CqBaseRegion
     try {
@@ -575,7 +503,7 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
         CacheClientProxy clientProxy = ccn.getClientProxy(clientProxyId);
         clientProxy.decCqCount();
         if (clientProxy.hasNoCq()) {
-          cqService.stats.decClientsWithCqs();
+          cqService.stats().decClientsWithCqs();
         }
       }
     } catch (Exception ex) {
@@ -587,16 +515,9 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
   }
 
   /**
-   * @param serverCqName The serverCqName to set.
-   */
-  public void setServerCqName(String serverCqName) {
-
-    this.serverCqName = serverCqName;
-  }
-
-  /**
    * Stop or pause executing the query.
    */
+  @Override
   public void stop() throws CqClosedException, CqException {
     boolean isStopped = false;
     synchronized (this.cqState) {
@@ -613,18 +534,16 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
 
       // Change state and stats on the client side
       this.cqState.setState(CqStateImpl.STOPPED);
-      this.cqService.stats.incCqsStopped();
-      this.cqService.stats.decCqsActive();
+      this.cqService.stats().incCqsStopped();
+      this.cqService.stats().decCqsActive();
       if (logger.isDebugEnabled()) {
         logger.debug("Successfully stopped the CQ. {}", cqName);
       }
     }
   }
 
-  /* DataSerializableFixedID methods ---------------------------------------- */
-
+  @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    // this.cqName = DataSerializer.readString(in);
     synchronized (cqState) {
       this.cqState.setState(DataSerializer.readInteger(in));
     }
@@ -633,23 +552,14 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     this.filterID = in.readLong();
   }
 
-  /*
-   * public int getDSFID() { return CQ_QUERY; }
-   */
-
+  @Override
   public void toData(DataOutput out) throws IOException {
-    // DataSerializer.writeString(this.cqName, out);
     DataSerializer.writeInteger(this.cqState.getState(), out);
     DataSerializer.writeBoolean(this.isDurable, out);
     DataSerializer.writeString(this.queryString, out);
     out.writeLong(this.filterID);
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.apache.geode.cache.query.internal.InternalCqQuery2#isPR()
-   */
   @Override
   public boolean isPR() {
     return isPR;
@@ -676,5 +586,4 @@ public class ServerCQImpl extends CqQueryImpl implements DataSerializable, Serve
     throw new IllegalStateException("Execute cannot be called on a CQ on the server");
   }
 
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
index bcf9806..9bddbc7 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
@@ -27,7 +27,6 @@ import org.apache.geode.cache.query.internal.DefaultQueryService;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.ServerCQ;
 import org.apache.geode.distributed.internal.DistributionStats;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
@@ -85,8 +84,7 @@ public class ExecuteCQ extends BaseCQCommand {
     ServerCQ cqQuery = null;
 
     try {
-      qService =
-          (DefaultQueryService) ((GemFireCacheImpl) crHelper.getCache()).getLocalQueryService();
+      qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
 
       // Authorization check
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
index f333b4b..de61445 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
@@ -28,7 +28,6 @@ import org.apache.geode.cache.query.internal.cq.CqServiceImpl;
 import org.apache.geode.cache.query.internal.cq.CqServiceProvider;
 import org.apache.geode.cache.query.internal.cq.ServerCQImpl;
 import org.apache.geode.distributed.internal.DistributionStats;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
@@ -111,8 +110,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
     ServerCQImpl cqQuery = null;
 
     try {
-      qService =
-          (DefaultQueryService) ((GemFireCacheImpl) crHelper.getCache()).getLocalQueryService();
+      qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
 
       // Authorization check
       AuthorizeRequest authzRequest = servConn.getAuthzRequest();

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
index eac9ed3..a2d201d 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
@@ -22,7 +22,6 @@ import java.util.List;
 import org.apache.geode.cache.query.CqException;
 import org.apache.geode.cache.query.internal.DefaultQueryService;
 import org.apache.geode.cache.query.internal.cq.CqService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.tier.CachedRegionHelper;
 import org.apache.geode.internal.cache.tier.Command;
 import org.apache.geode.internal.cache.tier.MessageType;
@@ -64,8 +63,7 @@ public class GetDurableCQs extends BaseCQCommand {
     CqService cqServiceForExec = null;
 
     try {
-      qService =
-          (DefaultQueryService) ((GemFireCacheImpl) crHelper.getCache()).getLocalQueryService();
+      qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
 
       this.securityService.authorizeClusterRead();
 

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsDUnitTest.java
index 7ace0e8..f4cd706 100644
--- a/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsDUnitTest.java
@@ -14,20 +14,15 @@
  */
 package org.apache.geode.cache.query.cq.dunit;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
 import java.util.Collection;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.query.CqException;
-import org.apache.geode.cache.query.CqQuery;
 import org.apache.geode.cache.query.CqServiceStatistics;
 import org.apache.geode.cache.query.CqStatistics;
 import org.apache.geode.cache.query.QueryService;
@@ -40,7 +35,7 @@ import org.apache.geode.cache.query.internal.cq.CqServiceImpl;
 import org.apache.geode.cache.query.internal.cq.CqServiceVsdStats;
 import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
 import org.apache.geode.cache30.CacheSerializableRunnable;
-import org.apache.geode.cache30.CacheTestCase;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.LogWriterUtils;
@@ -48,27 +43,26 @@ import org.apache.geode.test.dunit.NetworkUtils;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.Wait;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.junit.categories.DistributedTest;
 
 /**
- * This class tests the ContiunousQuery mechanism in GemFire. This includes the test with different
+ * This class tests the ContinuousQuery mechanism in GemFire. This includes the test with different
  * data activities.
- *
  */
 @Category(DistributedTest.class)
 public class CqStatsDUnitTest extends JUnit4CacheTestCase {
 
+  // TODO: delete this use of CqQueryDUnitTest
   private CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest();
 
-  public CqStatsDUnitTest() {
-    super();
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     // avoid IllegalStateException from HandShake by connecting all vms to
     // system before creating pool
     getSystem();
     Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
+      @Override
       public void run() {
         getSystem();
       }
@@ -81,6 +75,7 @@ public class CqStatsDUnitTest extends JUnit4CacheTestCase {
   public void validateCQStats(VM vm, final String cqName, final int creates, final int updates,
       final int deletes, final int totalEvents, final int cqListenerInvocations) {
     vm.invoke(new CacheSerializableRunnable("Validate CQs") {
+      @Override
       public void run2() throws CacheException {
         LogWriterUtils.getLogWriter().info("### Validating CQ Stats. ### " + cqName);
         // Get CQ Service.
@@ -161,6 +156,7 @@ public class CqStatsDUnitTest extends JUnit4CacheTestCase {
       final int stopped, final int closed, final int cqsOnClient, final int cqsOnRegion,
       final int clientsWithCqs) {
     vm.invoke(new CacheSerializableRunnable("Validate CQ Service Stats") {
+      @Override
       public void run2() throws CacheException {
         LogWriterUtils.getLogWriter().info("### Validating CQ Service Stats. ### ");
         // Get CQ Service.
@@ -176,7 +172,7 @@ public class CqStatsDUnitTest extends JUnit4CacheTestCase {
         CqServiceVsdStats cqServiceVsdStats = null;
         try {
           cqServiceVsdStats =
-              ((CqServiceImpl) ((DefaultQueryService) qService).getCqService()).stats;
+              ((CqServiceImpl) ((DefaultQueryService) qService).getCqService()).stats();
         } catch (CqException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
@@ -185,12 +181,14 @@ public class CqStatsDUnitTest extends JUnit4CacheTestCase {
           fail("Failed to get CQ Service Stats");
         }
 
-        getCache().getLogger().info("#### CQ Service stats: " + " CQs created: "
-            + cqServiceStats.numCqsCreated() + " CQs active: " + cqServiceStats.numCqsActive()
-            + " CQs stopped: " + cqServiceStats.numCqsStopped() + " CQs closed: "
-            + cqServiceStats.numCqsClosed() + " CQs on Client: " + cqServiceStats.numCqsOnClient()
-            + " CQs on region /root/regionA : " + cqServiceVsdStats.numCqsOnRegion("/root/regionA")
-            + " Clients with CQs: " + cqServiceVsdStats.getNumClientsWithCqs());
+        getCache().getLogger()
+            .info("#### CQ Service stats: " + " CQs created: " + cqServiceStats.numCqsCreated()
+                + " CQs active: " + cqServiceStats.numCqsActive() + " CQs stopped: "
+                + cqServiceStats.numCqsStopped() + " CQs closed: " + cqServiceStats.numCqsClosed()
+                + " CQs on Client: " + cqServiceStats.numCqsOnClient()
+                + " CQs on region /root/regionA : "
+                + cqServiceVsdStats.numCqsOnRegion(GemFireCacheImpl.getInstance(), "/root/regionA")
+                + " Clients with CQs: " + cqServiceVsdStats.getNumClientsWithCqs());
 
 
         // Check for created count.
@@ -223,7 +221,7 @@ public class CqStatsDUnitTest extends JUnit4CacheTestCase {
         // Check for CQs on region.
         if (cqsOnRegion != CqQueryDUnitTest.noTest) {
           assertEquals("Number of CQs on region /root/regionA mismatch", cqsOnRegion,
-              cqServiceVsdStats.numCqsOnRegion("/root/regionA"));
+              cqServiceVsdStats.numCqsOnRegion(GemFireCacheImpl.getInstance(), "/root/regionA"));
         }
 
         // Check for clients with CQs count.

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
index d6068f1..c03bb8b 100644
--- a/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/cache/query/cq/dunit/CqStatsUsingPoolDUnitTest.java
@@ -14,21 +14,16 @@
  */
 package org.apache.geode.cache.query.cq.dunit;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import org.apache.geode.distributed.*;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
+import java.util.Collection;
+import java.util.Properties;
 
-import java.util.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.query.CqException;
-import org.apache.geode.cache.query.CqQuery;
 import org.apache.geode.cache.query.CqServiceStatistics;
 import org.apache.geode.cache.query.CqStatistics;
 import org.apache.geode.cache.query.QueryService;
@@ -41,7 +36,8 @@ import org.apache.geode.cache.query.internal.cq.CqServiceImpl;
 import org.apache.geode.cache.query.internal.cq.CqServiceVsdStats;
 import org.apache.geode.cache.query.internal.cq.InternalCqQuery;
 import org.apache.geode.cache30.CacheSerializableRunnable;
-import org.apache.geode.cache30.CacheTestCase;
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.LogWriterUtils;
@@ -49,21 +45,19 @@ import org.apache.geode.test.dunit.NetworkUtils;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.Wait;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.junit.categories.DistributedTest;
 
 /**
- * This class tests the ContiunousQuery mechanism in GemFire. This includes the test with different
+ * This class tests the ContinuousQuery mechanism in GemFire. This includes the test with different
  * data activities.
- *
  */
 @Category(DistributedTest.class)
 public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
 
+  // TODO: delete this use of CqQueryUsingPoolDUnitTest
   private CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
 
-  public CqStatsUsingPoolDUnitTest() {
-    super();
-  }
-
   @Override
   public Properties getDistributedSystemProperties() {
     Properties result = super.getDistributedSystemProperties();
@@ -77,6 +71,7 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
     // system before creating pool
     getSystem();
     Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
+      @Override
       public void run() {
         getSystem();
       }
@@ -89,6 +84,7 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
   private void validateCQStats(VM vm, final String cqName, final int creates, final int updates,
       final int deletes, final int totalEvents, final int cqListenerInvocations) {
     vm.invoke(new CacheSerializableRunnable("Validate CQs") {
+      @Override
       public void run2() throws CacheException {
         LogWriterUtils.getLogWriter().info("### Validating CQ Stats. ### " + cqName);
         // Get CQ Service.
@@ -169,6 +165,7 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
       final int stopped, final int closed, final int cqsOnClient, final int cqsOnRegion,
       final int clientsWithCqs) {
     vm.invoke(new CacheSerializableRunnable("Validate CQ Service Stats") {
+      @Override
       public void run2() throws CacheException {
         LogWriterUtils.getLogWriter().info("### Validating CQ Service Stats. ### ");
         // Get CQ Service.
@@ -184,7 +181,7 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
         CqServiceVsdStats cqServiceVsdStats = null;
         try {
           cqServiceVsdStats =
-              ((CqServiceImpl) ((DefaultQueryService) qService).getCqService()).stats;
+              ((CqServiceImpl) ((DefaultQueryService) qService).getCqService()).stats();
         } catch (CqException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
@@ -193,12 +190,14 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
           fail("Failed to get CQ Service Stats");
         }
 
-        getCache().getLogger().info("#### CQ Service stats: " + " CQs created: "
-            + cqServiceStats.numCqsCreated() + " CQs active: " + cqServiceStats.numCqsActive()
-            + " CQs stopped: " + cqServiceStats.numCqsStopped() + " CQs closed: "
-            + cqServiceStats.numCqsClosed() + " CQs on Client: " + cqServiceStats.numCqsOnClient()
-            + " CQs on region /root/regionA : " + cqServiceVsdStats.numCqsOnRegion("/root/regionA")
-            + " Clients with CQs: " + cqServiceVsdStats.getNumClientsWithCqs());
+        getCache().getLogger()
+            .info("#### CQ Service stats: " + " CQs created: " + cqServiceStats.numCqsCreated()
+                + " CQs active: " + cqServiceStats.numCqsActive() + " CQs stopped: "
+                + cqServiceStats.numCqsStopped() + " CQs closed: " + cqServiceStats.numCqsClosed()
+                + " CQs on Client: " + cqServiceStats.numCqsOnClient()
+                + " CQs on region /root/regionA : "
+                + cqServiceVsdStats.numCqsOnRegion(GemFireCacheImpl.getInstance(), "/root/regionA")
+                + " Clients with CQs: " + cqServiceVsdStats.getNumClientsWithCqs());
 
 
         // Check for created count.
@@ -231,7 +230,7 @@ public class CqStatsUsingPoolDUnitTest extends JUnit4CacheTestCase {
         // Check for CQs on region.
         if (cqsOnRegion != CqQueryUsingPoolDUnitTest.noTest) {
           assertEquals("Number of CQs on region /root/regionA mismatch", cqsOnRegion,
-              cqServiceVsdStats.numCqsOnRegion("/root/regionA"));
+              cqServiceVsdStats.numCqsOnRegion(GemFireCacheImpl.getInstance(), "/root/regionA"));
         }
 
         // Check for clients with CQs count.

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
index 66c4c0a..5dd0d24 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollector.java
@@ -15,10 +15,8 @@
 
 package org.apache.geode.cache.lucene.internal.distributed;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.Logger;
@@ -27,7 +25,7 @@ import org.apache.geode.cache.execute.FunctionException;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.cache.lucene.LuceneQuery;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 
 /**
@@ -44,16 +42,15 @@ import org.apache.geode.internal.logging.LogService;
  */
 public class TopEntriesFunctionCollector
     implements ResultCollector<TopEntriesCollector, TopEntries> {
-  // Use this instance to perform reduce operation
-  final CollectorManager<TopEntriesCollector> manager;
+  private static final Logger logger = LogService.getLogger();
 
-  final String id;
+  // Use this instance to perform reduce operation
+  private final CollectorManager<TopEntriesCollector> manager;
 
-  // Instance of gemfire cache to check status and other utility methods
-  final private GemFireCacheImpl cache;
-  private static final Logger logger = LogService.getLogger();
+  private final String id;
 
   private final Collection<TopEntriesCollector> subResults = new ArrayList<>();
+
   private TopEntriesCollector mergedResults;
 
   public TopEntriesFunctionCollector() {
@@ -65,8 +62,7 @@ public class TopEntriesFunctionCollector
   }
 
   public TopEntriesFunctionCollector(LuceneFunctionContext<TopEntriesCollector> context,
-      GemFireCacheImpl cache) {
-    this.cache = cache;
+      InternalCache cache) {
     id = cache == null ? String.valueOf(this.hashCode()) : cache.getName();
 
     int limit = context == null ? 0 : context.getLimit();
@@ -115,4 +111,8 @@ public class TopEntriesFunctionCollector
       subResults.add(resultOfSingleExecution);
     }
   }
+
+  String id() {
+    return this.id;
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
index 5313ced..6690850 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
@@ -12,7 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.cache.lucene.internal.distributed;
 
 import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.DEFAULT_FIELD;
@@ -41,6 +40,7 @@ import org.apache.geode.cache.lucene.internal.StringQueryProvider;
 import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
 import org.apache.geode.cache.lucene.internal.repository.IndexResultCollector;
 import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
+import org.apache.geode.cache.lucene.test.LuceneTestUtilities;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException;
 import org.apache.geode.internal.cache.execute.InternalRegionFunctionContext;
@@ -58,30 +58,30 @@ import org.mockito.Mockito;
 @Category(UnitTest.class)
 public class LuceneQueryFunctionJUnitTest {
 
-  String regionPath = "/region";
-  String indexName = "index";
-  final EntryScore<String> r1_1 = new EntryScore<String>("key-1-1", .5f);
-  final EntryScore<String> r1_2 = new EntryScore<String>("key-1-2", .4f);
-  final EntryScore<String> r1_3 = new EntryScore<String>("key-1-3", .3f);
-  final EntryScore<String> r2_1 = new EntryScore<String>("key-2-1", .45f);
-  final EntryScore<String> r2_2 = new EntryScore<String>("key-2-2", .35f);
-
-  InternalRegionFunctionContext mockContext;
-  ResultSender<TopEntriesCollector> mockResultSender;
-  Region<Object, Object> mockRegion;
-
-  RepositoryManager mockRepoManager;
-  IndexRepository mockRepository1;
-  IndexRepository mockRepository2;
-  IndexResultCollector mockCollector;
-  InternalLuceneService mockService;
-  LuceneIndexImpl mockIndex;
-  LuceneIndexStats mockStats;
-
-  ArrayList<IndexRepository> repos;
-  LuceneFunctionContext<IndexResultCollector> searchArgs;
-  LuceneQueryProvider queryProvider;
-  Query query;
+  private String regionPath = "/region";
+
+  private final EntryScore<String> r1_1 = new EntryScore<>("key-1-1", .5f);
+  private final EntryScore<String> r1_2 = new EntryScore<>("key-1-2", .4f);
+  private final EntryScore<String> r1_3 = new EntryScore<>("key-1-3", .3f);
+  private final EntryScore<String> r2_1 = new EntryScore<>("key-2-1", .45f);
+  private final EntryScore<String> r2_2 = new EntryScore<>("key-2-2", .35f);
+
+  private InternalRegionFunctionContext mockContext;
+  private ResultSender<TopEntriesCollector> mockResultSender;
+  private Region<Object, Object> mockRegion;
+
+  private RepositoryManager mockRepoManager;
+  private IndexRepository mockRepository1;
+  private IndexRepository mockRepository2;
+  private IndexResultCollector mockCollector;
+  private InternalLuceneService mockService;
+  private LuceneIndexImpl mockIndex;
+  private LuceneIndexStats mockStats;
+
+  private ArrayList<IndexRepository> repos;
+  private LuceneFunctionContext<IndexResultCollector> searchArgs;
+  private LuceneQueryProvider queryProvider;
+  private Query query;
 
   private InternalCache mockCache;
 
@@ -120,7 +120,7 @@ public class LuceneQueryFunctionJUnitTest {
 
     List<EntryScore> hits = result.getEntries().getHits();
     assertEquals(5, hits.size());
-    TopEntriesJUnitTest.verifyResultOrder(result.getEntries().getHits(), r1_1, r2_1, r1_2, r2_2,
+    LuceneTestUtilities.verifyResultOrder(result.getEntries().getHits(), r1_1, r2_1, r1_2, r2_2,
         r1_3);
   }
 
@@ -161,7 +161,7 @@ public class LuceneQueryFunctionJUnitTest {
 
     List<EntryScore> hits = result.getEntries().getHits();
     assertEquals(3, hits.size());
-    TopEntriesJUnitTest.verifyResultOrder(result.getEntries().getHits(), r1_1, r2_1, r1_2);
+    LuceneTestUtilities.verifyResultOrder(result.getEntries().getHits(), r1_1, r2_1, r1_2);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
index 3bfebdf..5767390 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
@@ -26,21 +26,22 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.CopyHelper;
 import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
 import org.apache.geode.cache.lucene.internal.distributed.TopEntriesCollectorManager.ListScanner;
+import org.apache.geode.cache.lucene.test.LuceneTestUtilities;
 import org.apache.geode.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class TopEntriesCollectorJUnitTest {
 
-  private EntryScore<String> r1_1 = new EntryScore<String>("1-1", .9f);
-  private EntryScore<String> r1_2 = new EntryScore<String>("1-2", .7f);
-  private EntryScore<String> r1_3 = new EntryScore<String>("1-3", .5f);
+  private EntryScore<String> r1_1 = new EntryScore<>("1-1", .9f);
+  private EntryScore<String> r1_2 = new EntryScore<>("1-2", .7f);
+  private EntryScore<String> r1_3 = new EntryScore<>("1-3", .5f);
 
-  private EntryScore<String> r2_1 = new EntryScore<String>("2-1", .85f);
-  private EntryScore<String> r2_2 = new EntryScore<String>("2-2", .65f);
+  private EntryScore<String> r2_1 = new EntryScore<>("2-1", .85f);
+  private EntryScore<String> r2_2 = new EntryScore<>("2-2", .65f);
 
-  private EntryScore<String> r3_1 = new EntryScore<String>("3-1", .8f);
-  private EntryScore<String> r3_2 = new EntryScore<String>("3-2", .6f);
-  private EntryScore<String> r3_3 = new EntryScore<String>("3-3", .4f);
+  private EntryScore<String> r3_1 = new EntryScore<>("3-1", .8f);
+  private EntryScore<String> r3_2 = new EntryScore<>("3-2", .6f);
+  private EntryScore<String> r3_3 = new EntryScore<>("3-3", .4f);
 
   private TopEntriesCollectorManager manager;
 
@@ -72,7 +73,7 @@ public class TopEntriesCollectorJUnitTest {
 
     TopEntriesCollector hits = manager.reduce(collectors);
     assertEquals(8, hits.getEntries().getHits().size());
-    TopEntriesJUnitTest.verifyResultOrder(hits.getEntries().getHits(), r1_1, r2_1, r3_1, r1_2, r2_2,
+    LuceneTestUtilities.verifyResultOrder(hits.getEntries().getHits(), r1_1, r2_1, r3_1, r1_2, r2_2,
         r3_2, r1_3, r3_3);
 
     // input collector should not change
@@ -116,7 +117,7 @@ public class TopEntriesCollectorJUnitTest {
     c1.collect(r1_3.getKey(), r1_3.getScore());
 
     assertEquals(3, c1.getEntries().getHits().size());
-    TopEntriesJUnitTest.verifyResultOrder(c1.getEntries().getHits(), r1_1, r1_2, r1_3);
+    LuceneTestUtilities.verifyResultOrder(c1.getEntries().getHits(), r1_1, r1_2, r1_3);
 
     ListScanner scanner = new ListScanner(c1.getEntries().getHits());
     assertTrue(scanner.hasNext());
@@ -131,6 +132,6 @@ public class TopEntriesCollectorJUnitTest {
     assertFalse(scanner.hasNext());
 
     assertEquals(3, c1.getEntries().getHits().size());
-    TopEntriesJUnitTest.verifyResultOrder(c1.getEntries().getHits(), r1_1, r1_2, r1_3);
+    LuceneTestUtilities.verifyResultOrder(c1.getEntries().getHits(), r1_1, r1_2, r1_3);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
index bf08877..5fd9e2d 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
@@ -12,7 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.cache.lucene.internal.distributed;
 
 import static org.junit.Assert.*;
@@ -20,9 +19,7 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.*;
 
 import java.util.Collection;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
 
 import org.junit.Assert;
 import org.junit.Before;
@@ -31,25 +28,26 @@ import org.junit.experimental.categories.Category;
 import org.mockito.ArgumentMatcher;
 import org.mockito.Mockito;
 
-import org.apache.geode.CancelCriterion;
-import org.apache.geode.cache.execute.FunctionException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.cache.lucene.test.LuceneTestUtilities;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class TopEntriesFunctionCollectorJUnitTest {
-  EntryScore<String> r1_1;
-  EntryScore<String> r1_2;
-  EntryScore<String> r2_1;
-  EntryScore<String> r2_2;
-  TopEntriesCollector result1, result2;
+
+  private EntryScore<String> r1_1;
+  private EntryScore<String> r1_2;
+  private EntryScore<String> r2_1;
+  private EntryScore<String> r2_2;
+  private TopEntriesCollector result1;
+  private TopEntriesCollector result2;
 
   @Before
   public void initializeCommonObjects() {
-    r1_1 = new EntryScore<String>("3", .9f);
-    r1_2 = new EntryScore<String>("1", .8f);
-    r2_1 = new EntryScore<String>("2", 0.85f);
-    r2_2 = new EntryScore<String>("4", 0.1f);
+    r1_1 = new EntryScore<>("3", .9f);
+    r1_2 = new EntryScore<>("1", .8f);
+    r2_1 = new EntryScore<>("2", 0.85f);
+    r2_2 = new EntryScore<>("4", 0.1f);
 
     result1 = new TopEntriesCollector(null);
     result1.collect(r1_1);
@@ -73,13 +71,9 @@ public class TopEntriesFunctionCollectorJUnitTest {
     collector.addResult(null, result1);
     collector.addResult(null, result2);
 
-    final CountDownLatch insideThread = new CountDownLatch(1);
-    final CountDownLatch resultReceived = new CountDownLatch(1);
-
-    final AtomicReference<TopEntries> result = new AtomicReference<>();
     TopEntries merged = collector.getResult(1, TimeUnit.SECONDS);
     assertEquals(4, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
   }
 
   @Test
@@ -95,7 +89,7 @@ public class TopEntriesFunctionCollectorJUnitTest {
     TopEntries merged = collector.getResult();
     Assert.assertNotNull(merged);
     assertEquals(3, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2);
   }
 
   @Test
@@ -108,7 +102,7 @@ public class TopEntriesFunctionCollectorJUnitTest {
     TopEntries merged = collector.getResult();
     Assert.assertNotNull(merged);
     assertEquals(4, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
   }
 
   @Test
@@ -121,12 +115,12 @@ public class TopEntriesFunctionCollectorJUnitTest {
     TopEntries merged = collector.getResult();
     Assert.assertNotNull(merged);
     assertEquals(4, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
 
     merged = collector.getResult();
     Assert.assertNotNull(merged);
     assertEquals(4, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r1_1, r2_1, r1_2, r2_2);
   }
 
   @Test
@@ -167,7 +161,7 @@ public class TopEntriesFunctionCollectorJUnitTest {
     TopEntries merged = collector.getResult();
     Assert.assertNotNull(merged);
     assertEquals(2, merged.size());
-    TopEntriesJUnitTest.verifyResultOrder(merged.getHits(), r2_1, r2_2);
+    LuceneTestUtilities.verifyResultOrder(merged.getHits(), r2_1, r2_2);
   }
 
   @Test(expected = RuntimeException.class)
@@ -184,10 +178,10 @@ public class TopEntriesFunctionCollectorJUnitTest {
 
   @Test
   public void testCollectorName() {
-    GemFireCacheImpl mockCache = mock(GemFireCacheImpl.class);
+    InternalCache mockCache = mock(InternalCache.class);
     Mockito.doReturn("server").when(mockCache).getName();
 
     TopEntriesFunctionCollector function = new TopEntriesFunctionCollector(null, mockCache);
-    assertEquals("server", function.id);
+    assertEquals("server", function.id());
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
index fcfebbc..e21ac7f 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
@@ -16,9 +16,6 @@ package org.apache.geode.cache.lucene.internal.distributed;
 
 import static org.junit.Assert.*;
 
-import java.util.Collection;
-import java.util.Iterator;
-
 import org.jmock.Mockery;
 import org.jmock.lib.concurrent.Synchroniser;
 import org.jmock.lib.legacy.ClassImposteriser;
@@ -30,6 +27,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.CopyHelper;
 import org.apache.geode.cache.lucene.LuceneQueryFactory;
 import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
+import org.apache.geode.cache.lucene.test.LuceneTestUtilities;
 import org.apache.geode.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
@@ -44,34 +42,34 @@ public class TopEntriesJUnitTest {
 
   @Test
   public void testPopulateTopEntries() {
-    TopEntries<String> hits = new TopEntries<String>();
+    TopEntries<String> hits = new TopEntries<>();
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
     hits.addHit(r2_2);
 
     assertEquals(4, hits.size());
-    verifyResultOrder(hits.getHits(), r1_1, r2_1, r1_2, r2_2);
+    LuceneTestUtilities.verifyResultOrder(hits.getHits(), r1_1, r2_1, r1_2, r2_2);
   }
 
   @Test
   public void putSameScoreEntries() {
-    TopEntries<String> hits = new TopEntries<String>();
-    EntryScore<String> r1 = new EntryScore<String>("1", .8f);
-    EntryScore<String> r2 = new EntryScore<String>("2", .8f);
+    TopEntries<String> hits = new TopEntries<>();
+    EntryScore<String> r1 = new EntryScore<>("1", .8f);
+    EntryScore<String> r2 = new EntryScore<>("2", .8f);
     hits.addHit(r1);
     hits.addHit(r2);
 
     assertEquals(2, hits.size());
-    verifyResultOrder(hits.getHits(), r1, r2);
+    LuceneTestUtilities.verifyResultOrder(hits.getHits(), r1, r2);
   }
 
   @Test
   public void testInitialization() {
-    TopEntries<String> hits = new TopEntries<String>();
+    TopEntries<String> hits = new TopEntries<>();
     assertEquals(LuceneQueryFactory.DEFAULT_LIMIT, hits.getLimit());
 
-    hits = new TopEntries<String>(123);
+    hits = new TopEntries<>(123);
     assertEquals(123, hits.getLimit());
   }
 
@@ -82,47 +80,33 @@ public class TopEntriesJUnitTest {
 
   @Test
   public void enforceLimit() throws Exception {
-    TopEntries<String> hits = new TopEntries<String>(3);
+    TopEntries<String> hits = new TopEntries<>(3);
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
     hits.addHit(r2_2);
 
     assertEquals(3, hits.size());
-    verifyResultOrder(hits.getHits(), r1_1, r2_1, r1_2);
+    LuceneTestUtilities.verifyResultOrder(hits.getHits(), r1_1, r2_1, r1_2);
   }
 
   @Test
   public void testSerialization() {
     LuceneServiceImpl.registerDataSerializables();
-    TopEntries<String> hits = new TopEntries<String>(3);
+    TopEntries<String> hits = new TopEntries<>(3);
 
     TopEntries<String> copy = CopyHelper.deepCopy(hits);
     assertEquals(3, copy.getLimit());
     assertEquals(0, copy.getHits().size());
 
-    hits = new TopEntries<String>(3);
+    hits = new TopEntries<>(3);
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
 
     copy = CopyHelper.deepCopy(hits);
     assertEquals(3, copy.size());
-    verifyResultOrder(copy.getHits(), r1_1, r2_1, r1_2);
-  }
-
-  // TODO: extract to lucene test util class
-  public static void verifyResultOrder(Collection<EntryScore<String>> list,
-      EntryScore<String>... expectedEntries) {
-    Iterator<EntryScore<String>> iter = list.iterator();
-    for (EntryScore expectedEntry : expectedEntries) {
-      if (!iter.hasNext()) {
-        fail();
-      }
-      EntryScore toVerify = iter.next();
-      assertEquals(expectedEntry.getKey(), toVerify.getKey());
-      assertEquals(expectedEntry.getScore(), toVerify.getScore(), .0f);
-    }
+    LuceneTestUtilities.verifyResultOrder(copy.getHits(), r1_1, r2_1, r1_2);
   }
 
   @Before

http://git-wip-us.apache.org/repos/asf/geode/blob/363e50d2/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
index 5563112..17f4dea 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/LuceneTestUtilities.java
@@ -18,8 +18,10 @@ import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
@@ -44,6 +46,7 @@ import org.apache.geode.cache.lucene.LuceneService;
 import org.apache.geode.cache.lucene.LuceneServiceProvider;
 import org.apache.geode.cache.lucene.internal.LuceneIndexForPartitionedRegion;
 import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
+import org.apache.geode.cache.lucene.internal.distributed.EntryScore;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.test.dunit.VM;
@@ -82,6 +85,19 @@ public class LuceneTestUtilities {
   public static String Quarter3 = "Q3";
   public static String Quarter4 = "Q4";
 
+  public static void verifyResultOrder(Collection<EntryScore<String>> list,
+      EntryScore<String>... expectedEntries) {
+    Iterator<EntryScore<String>> iter = list.iterator();
+    for (EntryScore expectedEntry : expectedEntries) {
+      if (!iter.hasNext()) {
+        fail();
+      }
+      EntryScore toVerify = iter.next();
+      assertEquals(expectedEntry.getKey(), toVerify.getKey());
+      assertEquals(expectedEntry.getScore(), toVerify.getScore(), .0f);
+    }
+  }
+
   public static class IntRangeQueryProvider implements LuceneQueryProvider {
     String fieldName;
     int lowerValue;


[16/51] [abbrv] geode git commit: GEODE-2686: Remove JarClassLoader

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/JarDeployerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerDUnitTest.java
deleted file mode 100644
index a365899..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerDUnitTest.java
+++ /dev/null
@@ -1,574 +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 org.apache.geode.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.test.dunit.Assert;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileLock;
-import java.nio.file.Files;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.regex.Pattern;
-
-/**
- * Unit tests for the JarDeployer class
- * 
- * @since GemFire 7.0
- */
-@Category(DistributedTest.class)
-@SuppressWarnings("serial")
-public class JarDeployerDUnitTest extends JUnit4CacheTestCase {
-
-  static FileLock savedFileLock = null;
-  private final ClassBuilder classBuilder = new ClassBuilder();
-
-  @Override
-  public final void preTearDownCacheTestCase() throws Exception {
-    JarDeployer jarDeployer = new JarDeployer();
-    for (JarClassLoader jarClassLoader : jarDeployer.findJarClassLoaders()) {
-      if (jarClassLoader.getJarName().startsWith("JarDeployerDUnit")) {
-        jarDeployer.undeploy(jarClassLoader.getJarName());
-      }
-    }
-    for (String functionName : FunctionService.getRegisteredFunctions().keySet()) {
-      if (functionName.startsWith("JarDeployerDUnit")) {
-        FunctionService.unregisterFunction(functionName);
-      }
-    }
-    disconnectAllFromDS();
-    deleteSavedJarFiles();
-  }
-
-
-
-  @Test
-  public void testDeployExclusiveLock() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-    final File currentDir = new File(".").getAbsoluteFile();
-    final VM vm = Host.getHost(0).getVM(0);
-
-    // Deploy the Class JAR file
-    final File jarFile1 = jarDeployer.getNextVersionJarFile("JarDeployerDUnit.jar");
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDELA");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDELA");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    assertNotNull(ClassPathLoader.getLatest().getResource("JarDeployerDUnitDELA.class"));
-
-    // Attempt to acquire an exclusive lock in the other VM
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        FileOutputStream outStream = null;
-        FileLock fileLock = null;
-
-        try {
-          outStream = new FileOutputStream(jarFile1, true);
-          fileLock = outStream.getChannel().tryLock(0, 1, false);
-          if (fileLock != null) {
-            fail("Should not have been able to obtain exclusive lock on file:"
-                + jarFile1.getAbsolutePath());
-          }
-        } catch (FileNotFoundException fnfex) {
-          Assert.fail("JAR file not found where expected", fnfex);
-        } catch (IOException ioex) {
-          Assert.fail("IOException when trying to obtain exclusive lock", ioex);
-        } finally {
-          if (outStream != null) {
-            try {
-              outStream.close();
-            } catch (IOException ioex) {
-              fail("Could not close lock file output stream");
-            }
-          }
-          if (fileLock != null) {
-            try {
-              fileLock.channel().close();
-            } catch (IOException ioex) {
-              fail("Could not close lock file channel");
-            }
-          }
-        }
-      }
-    });
-  }
-
-  @Test
-  public void testDeploySharedLock() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-    final File currentDir = new File(".").getAbsoluteFile();
-    final VM vm = Host.getHost(0).getVM(0);
-
-    // Deploy the JAR file
-    final File jarFile1 = jarDeployer.getNextVersionJarFile("JarDeployerDUnit.jar");
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDSLA");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDSLA");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Acquire a shared lock in the other VM
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        if (!jarFile1.exists()) {
-          fail("JAR file not found where expected: " + jarFile1.getName());
-        }
-        try {
-          JarDeployerDUnitTest.savedFileLock = acquireSharedLock(jarFile1);
-        } catch (IOException ioex) {
-          fail("Unable to acquire the shared file lock");
-        }
-      }
-    });
-
-    // Now update the JAR file and make sure the first one isn't deleted
-    jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDSLB");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDSLB");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitC");
-      fail("Class should not be found on Classpath: JarDeployerDUniDSLA");
-    } catch (ClassNotFoundException expected) { // expected
-    }
-
-    if (!jarFile1.exists()) {
-      fail("JAR file should not have been deleted: " + jarFile1.getName());
-    }
-
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        try {
-          releaseLock(JarDeployerDUnitTest.savedFileLock, jarFile1);
-        } catch (IOException ioex) {
-          fail("Unable to release the shared file lock");
-        }
-      }
-    });
-  }
-
-  @Test
-  public void testUndeploySharedLock() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-    final File currentDir = new File(".").getAbsoluteFile();
-    final VM vm = Host.getHost(0).getVM(0);
-
-    // Deploy the JAR file
-    final File jarFile1 = jarDeployer.getNextVersionJarFile("JarDeployerDUnit.jar");
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitUSL");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitUSL");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Acquire a shared lock in the other VM
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        if (!jarFile1.exists()) {
-          fail("JAR file not found where expected: " + jarFile1.getName());
-        }
-        try {
-          JarDeployerDUnitTest.savedFileLock = acquireSharedLock(jarFile1);
-        } catch (IOException ioex) {
-          fail("Unable to acquire the shared file lock");
-        }
-      }
-    });
-
-    // Now undeploy the JAR file and make sure the first one isn't deleted
-    jarDeployer.undeploy("JarDeployerDUnit.jar");
-
-    if (!jarFile1.exists()) {
-      fail("JAR file should not have been deleted: " + jarFile1.getName());
-    }
-
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        try {
-          releaseLock(JarDeployerDUnitTest.savedFileLock, jarFile1);
-        } catch (IOException ioex) {
-          fail("Unable to release the shared file lock");
-        }
-      }
-    });
-  }
-
-  @Test
-  public void testDeployUpdateByAnotherVM() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-    final File currentDir = new File(".").getAbsoluteFile();
-    final VM vm = Host.getHost(0).getVM(0);
-
-    final File jarFile1 = jarDeployer.getNextVersionJarFile("JarDeployerDUnit.jar");
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDUBAVMA");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDUBAVMA");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    final File jarFile2 = jarDeployer.getNextVersionJarFile(jarFile1.getName());
-    final byte[] vmJarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDUBAVMB");
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        if (!jarFile1.exists()) {
-          fail("JAR file not found where expected: " + jarFile1.getName());
-        }
-
-        // The other VM writes out a newer version of the JAR file.
-        try {
-          writeJarBytesToFile(jarFile2, vmJarBytes);
-        } catch (IOException ioex) {
-          fail("Could not write JAR File");
-        }
-      }
-    });
-
-    // This VM is told to deploy the same JAR file.
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {vmJarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDUBAVMB");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDUBAVMA");
-      fail("Class should not be found on Classpath: JarDeployerDUnitDUBAVMA");
-    } catch (ClassNotFoundException expected) { // expected
-    }
-
-    if (!jarFile2.exists()) {
-      fail("JAR file should not have been deleted: " + jarFile2.getName());
-    }
-
-    // Make sure the second deploy didn't create a 3rd version of the JAR file.
-    final File jarFile3 = jarDeployer.getNextVersionJarFile(jarFile2.getName());
-    if (jarFile3.exists()) {
-      fail("JAR file should not have been created: " + jarFile3.getName());
-    }
-  }
-
-  @Test
-  public void testLoadPreviouslyDeployedJars() throws IOException {
-    final File parentJarFile = new File(JarDeployer.JAR_PREFIX + "JarDeployerDUnitAParent.jar#1");
-    final File usesJarFile = new File(JarDeployer.JAR_PREFIX + "JarDeployerDUnitUses.jar#1");
-    final File functionJarFile =
-        new File(JarDeployer.JAR_PREFIX + "JarDeployerDUnitFunction.jar#1");
-
-    // Write out a JAR files.
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("package jddunit.parent;");
-    stringBuffer.append("public class JarDeployerDUnitParent {");
-    stringBuffer.append("public String getValueParent() {");
-    stringBuffer.append("return \"PARENT\";}}");
-
-    byte[] jarBytes = this.classBuilder.createJarFromClassContent(
-        "jddunit/parent/JarDeployerDUnitParent", stringBuffer.toString());
-    FileOutputStream outStream = new FileOutputStream(parentJarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("package jddunit.uses;");
-    stringBuffer.append("public class JarDeployerDUnitUses {");
-    stringBuffer.append("public String getValueUses() {");
-    stringBuffer.append("return \"USES\";}}");
-
-    jarBytes = this.classBuilder.createJarFromClassContent("jddunit/uses/JarDeployerDUnitUses",
-        stringBuffer.toString());
-    outStream = new FileOutputStream(usesJarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("package jddunit.function;");
-    stringBuffer.append("import jddunit.parent.JarDeployerDUnitParent;");
-    stringBuffer.append("import jddunit.uses.JarDeployerDUnitUses;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append(
-        "public class JarDeployerDUnitFunction  extends JarDeployerDUnitParent implements Function {");
-    stringBuffer.append("private JarDeployerDUnitUses uses = new JarDeployerDUnitUses();");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(getValueParent() + \":\" + uses.getValueUses());}");
-    stringBuffer.append("public String getId() {return \"JarDeployerDUnitFunction\";}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-
-    ClassBuilder functionClassBuilder = new ClassBuilder();
-    functionClassBuilder.addToClassPath(parentJarFile.getAbsolutePath());
-    functionClassBuilder.addToClassPath(usesJarFile.getAbsolutePath());
-    jarBytes = functionClassBuilder.createJarFromClassContent(
-        "jddunit/function/JarDeployerDUnitFunction", stringBuffer.toString());
-    outStream = new FileOutputStream(functionJarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-
-    // Start the distributed system and check to see if the function executes correctly
-    DistributedSystem distributedSystem = getSystem();
-    getCache();
-
-    Execution execution =
-        FunctionService.onMember(distributedSystem, distributedSystem.getDistributedMember());
-    ResultCollector resultCollector = execution.execute("JarDeployerDUnitFunction");
-    @SuppressWarnings("unchecked")
-    List<String> result = (List<String>) resultCollector.getResult();
-    assertEquals("PARENT:USES", result.get(0));
-  }
-
-  @Test
-  public void testDeployToAlternateDirectory() throws IOException, ClassNotFoundException {
-    final File alternateDir = new File("JarDeployerDUnit");
-    alternateDir.mkdir();
-
-    // Add the alternate directory to the distributed system, get it back out, and then create
-    // a JarDeployer object with it.
-    Properties properties = new Properties();
-    properties.put(ConfigurationProperties.DEPLOY_WORKING_DIR, alternateDir.getAbsolutePath());
-    InternalDistributedSystem distributedSystem = getSystem(properties);
-    final JarDeployer jarDeployer =
-        new JarDeployer(distributedSystem.getConfig().getDeployWorkingDir());
-
-    File jarFile = jarDeployer.getNextVersionJarFile("JarDeployerDUnit.jar");
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDTAC");
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-
-    try {
-      ClassPathLoader.getLatest().forName("JarDeployerDUnitDTAC");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    if (!jarFile.exists()) {
-      fail("JAR file not found where expected: " + jarFile.getName());
-    }
-
-    if (!doesFileMatchBytes(jarFile, jarBytes)) {
-      fail("Contents of JAR file do not match those provided: " + jarFile.getName());
-    }
-  }
-
-
-
-  @Test
-  public void testSuspendAndResume() throws IOException, ClassNotFoundException {
-    AtomicReference<Boolean> okayToResume = new AtomicReference<>(false);
-
-    final JarDeployer jarDeployer = new JarDeployer();
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitSAR");
-    final JarDeployer suspendingJarDeployer = new JarDeployer();
-    final CountDownLatch latch = new CountDownLatch(1);
-
-    Thread thread = new Thread() {
-      @Override
-      public void run() {
-        try {
-          suspendingJarDeployer.suspendAll();
-          latch.countDown();
-          Thread.sleep(3000);
-        } catch (InterruptedException iex) {
-          // It doesn't matter, just fail the test
-        }
-        okayToResume.set(true);
-        suspendingJarDeployer.resumeAll();
-      }
-    };
-    thread.start();
-
-    try {
-      latch.await();
-    } catch (InterruptedException iex) {
-      // It doesn't matter, just fail the test
-    }
-    jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-    if (!okayToResume.get()) {
-      fail("JarDeployer did not suspend as expected");
-    }
-  }
-
-
-  @Test
-  public void testZeroLengthFile() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-
-    try {
-      jarDeployer.deploy(new String[] {"JarDeployerDUnitZLF.jar"}, new byte[][] {new byte[0]});
-      fail("Zero length files are not deployable");
-    } catch (IllegalArgumentException expected) {
-      // Expected
-    }
-
-    try {
-      jarDeployer.deploy(new String[] {"JarDeployerDUnitZLF1.jar", "JarDeployerDUnitZLF2.jar"},
-          new byte[][] {this.classBuilder.createJarFromName("JarDeployerDUnitZLF1"), new byte[0]});
-      fail("Zero length files are not deployable");
-    } catch (IllegalArgumentException expected) {
-      // Expected
-    }
-  }
-
-  @Test
-  public void testInvalidJarFile() throws IOException, ClassNotFoundException {
-    final JarDeployer jarDeployer = new JarDeployer();
-
-    try {
-      jarDeployer.deploy(new String[] {"JarDeployerDUnitIJF.jar"},
-          new byte[][] {"INVALID JAR CONTENT".getBytes()});
-      fail("Non-JAR files are not deployable");
-    } catch (IllegalArgumentException expected) {
-      // Expected
-    }
-
-    try {
-      jarDeployer.deploy(new String[] {"JarDeployerDUnitIJF1.jar", "JarDeployerDUnitIJF2.jar"},
-          new byte[][] {this.classBuilder.createJarFromName("JarDeployerDUnitIJF1"),
-              "INVALID JAR CONTENT".getBytes()});
-      fail("Non-JAR files are not deployable");
-    } catch (IllegalArgumentException expected) {
-      // Expected
-    }
-
-    final VM vm = Host.getHost(0).getVM(1);
-    vm.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        File invalidFile = new File(JarDeployer.JAR_PREFIX + "JarDeployerDUnitIJF.jar#3");
-        try {
-          RandomAccessFile randomAccessFile = new RandomAccessFile(invalidFile, "rw");
-          randomAccessFile.write("GARBAGE".getBytes(), 0, 7);
-          randomAccessFile.close();
-        } catch (IOException ioex) {
-          Assert.fail("Error trying to create garbage file for test", ioex);
-        }
-
-        getSystem();
-        getCache();
-
-        if (invalidFile.exists()) {
-          fail("Invalid JAR file should have been deleted at startup");
-        }
-      }
-    });
-  }
-
-  FileLock acquireSharedLock(final File file) throws IOException {
-    return new FileInputStream(file).getChannel().lock(0, 1, true);
-  }
-
-  void releaseLock(final FileLock fileLock, final File lockFile) throws IOException {
-    if (lockFile == null) {
-      return;
-    }
-
-    try {
-      if (fileLock != null) {
-        fileLock.release();
-        fileLock.channel().close();
-      }
-    } finally {
-      if (!lockFile.delete()) {
-        lockFile.deleteOnExit();
-      }
-    }
-  }
-
-  protected boolean doesFileMatchBytes(final File file, final byte[] bytes) throws IOException {
-    // If the don't have the same number of bytes then nothing to do
-    if (file.length() != bytes.length) {
-      return false;
-    }
-
-    // Open the file then loop comparing each byte
-    int index = 0;
-    try (InputStream inStream = new FileInputStream(file)) {
-      for (; index < bytes.length; index++) {
-        if (((byte) inStream.read()) != bytes[index])
-          break;
-      }
-    }
-
-    // If we didn't get to the end then something was different
-    return index >= bytes.length;
-  }
-
-  private void deleteSavedJarFiles() throws IOException {
-    Pattern pattern = Pattern.compile("^" + JarDeployer.JAR_PREFIX + "JarDeployerDUnit.*#\\d++$");
-    File[] files = new File(".").listFiles((dir1, name) -> pattern.matcher(name).matches());
-    if (files != null) {
-      for (File file : files) {
-        Files.delete(file.toPath());
-      }
-    }
-  }
-
-  void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws IOException {
-    final OutputStream outStream = new FileOutputStream(jarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
index 71daecc..9e42c20 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
@@ -11,9 +11,12 @@
  * 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 org.apache.geode.internal;
 
+
 import static org.apache.geode.internal.Assert.fail;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -22,162 +25,187 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Files;
+import java.util.Set;
+import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Category(IntegrationTest.class)
 public class JarDeployerIntegrationTest {
-
   private ClassBuilder classBuilder;
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
-  @Rule
-  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+  JarDeployer jarDeployer;
 
   @Before
   public void setup() {
-    System.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
     classBuilder = new ClassBuilder();
-    ClassPathLoader.setLatestToDefault();
+    jarDeployer = new JarDeployer(temporaryFolder.getRoot());
   }
 
-  @Test
-  public void testDeployFileAndChange() throws Exception {
-    final JarDeployer jarDeployer = new JarDeployer();
+  private byte[] createJarWithClass(String className) throws IOException {
+    String stringBuilder = "package integration.parent;" + "public class " + className + " {}";
 
-    // First deploy of the JAR file
-    byte[] jarBytes = this.classBuilder.createJarFromName("ClassA");
-    JarClassLoader jarClassLoader =
-        jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes})[0];
-    File deployedJar = new File(jarClassLoader.getFileCanonicalPath());
+    return this.classBuilder.createJarFromClassContent("integration/parent/" + className,
+        stringBuilder);
+  }
+
+  @Test
+  public void testFileVersioning() throws Exception {
+    String jarName = "JarDeployerIntegrationTest.jar";
 
-    assertThat(deployedJar).exists();
-    assertThat(deployedJar.getName()).contains("#1");
-    assertThat(deployedJar.getName()).doesNotContain("#2");
+    byte[] firstJarBytes = createJarWithClass("ClassA");
 
-    assertThat(ClassPathLoader.getLatest().forName("ClassA")).isNotNull();
+    // First deploy of the JAR file
+    DeployedJar firstDeployedJar = jarDeployer.deployWithoutRegistering(jarName, firstJarBytes);
 
-    assertThat(doesFileMatchBytes(deployedJar, jarBytes));
+    assertThat(firstDeployedJar.getFile()).exists().hasBinaryContent(firstJarBytes);
+    assertThat(firstDeployedJar.getFile().getName()).contains(".v1.").doesNotContain(".v2.");
 
     // Now deploy an updated JAR file and make sure that the next version of the JAR file
-    // was created and the first one was deleted.
-    jarBytes = this.classBuilder.createJarFromName("ClassB");
-    JarClassLoader newJarClassLoader =
-        jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes})[0];
-    File nextDeployedJar = new File(newJarClassLoader.getFileCanonicalPath());
-
-    assertThat(nextDeployedJar.exists());
-    assertThat(nextDeployedJar.getName()).contains("#2");
-    assertThat(doesFileMatchBytes(nextDeployedJar, jarBytes));
+    // was created
+    byte[] secondJarBytes = createJarWithClass("ClassB");
 
-    assertThat(ClassPathLoader.getLatest().forName("ClassB")).isNotNull();
+    DeployedJar secondDeployedJar = jarDeployer.deployWithoutRegistering(jarName, secondJarBytes);
+    File secondDeployedJarFile = new File(secondDeployedJar.getFileCanonicalPath());
 
-    assertThatThrownBy(() -> ClassPathLoader.getLatest().forName("ClassA"))
-        .isExactlyInstanceOf(ClassNotFoundException.class);
+    assertThat(secondDeployedJarFile).exists().hasBinaryContent(secondJarBytes);
+    assertThat(secondDeployedJarFile.getName()).contains(".v2.").doesNotContain(".v1.");
 
-    assertThat(jarDeployer.findSortedOldVersionsOfJar("JarDeployerDUnit.jar")).hasSize(1);
+    File[] sortedOldJars = jarDeployer.findSortedOldVersionsOfJar(jarName);
+    assertThat(sortedOldJars).hasSize(2);
+    assertThat(sortedOldJars[0].getName()).contains(".v2.");
+    assertThat(sortedOldJars[1].getName()).contains(".v1.");
     assertThat(jarDeployer.findDistinctDeployedJars()).hasSize(1);
   }
 
   @Test
-  public void testDeployNoUpdateWhenNoChange() throws Exception {
-    final JarDeployer jarDeployer = new JarDeployer();
-
-    // First deploy of the JAR file
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDNUWNC");
-    JarClassLoader jarClassLoader =
-        jarDeployer.deploy(new String[] {"JarDeployerDUnit2.jar"}, new byte[][] {jarBytes})[0];
-    File deployedJar = new File(jarClassLoader.getFileCanonicalPath());
-
-    assertThat(deployedJar).exists();
-    assertThat(deployedJar.getName()).contains("#1");
-    JarClassLoader newJarClassLoader =
-        jarDeployer.deploy(new String[] {"JarDeployerDUnit2.jar"}, new byte[][] {jarBytes})[0];
-    assertThat(newJarClassLoader).isNull();
-  }
-
-  @Test
-  public void testDeployToInvalidDirectory() throws IOException, ClassNotFoundException {
+  public void testDeployToInvalidDirectory() throws Exception {
     final File alternateDir = new File(temporaryFolder.getRoot(), "JarDeployerDUnit");
     alternateDir.delete();
 
     final JarDeployer jarDeployer = new JarDeployer(alternateDir);
+
     final CyclicBarrier barrier = new CyclicBarrier(2);
     final byte[] jarBytes = this.classBuilder.createJarFromName("JarDeployerDUnitDTID");
 
     // Test to verify that deployment fails if the directory doesn't exist.
     assertThatThrownBy(() -> {
-      jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
+      jarDeployer.deployWithoutRegistering("JarDeployerIntegrationTest.jar", jarBytes);
     }).isInstanceOf(IOException.class);
 
     // Test to verify that deployment succeeds if the directory doesn't
     // initially exist, but is then created while the JarDeployer is looping
     // looking for a valid directory.
-    Thread thread = new Thread() {
-      @Override
-      public void run() {
-        try {
-          barrier.await();
-        } catch (Exception e) {
-          fail(e);
-        }
-
-        try {
-          jarDeployer.deploy(new String[] {"JarDeployerDUnit.jar"}, new byte[][] {jarBytes});
-        } catch (Exception e) {
-          fail(e);
-        }
-      }
-    };
-    thread.start();
-
-    try {
+    Future<Boolean> done = Executors.newSingleThreadExecutor().submit(() -> {
       barrier.await();
-      Thread.sleep(500);
-      alternateDir.mkdir();
-      thread.join();
-    } catch (Exception e) {
-      fail(e);
-    }
+      jarDeployer.deployWithoutRegistering("JarDeployerIntegrationTest.jar", jarBytes);
+      return true;
+    });
+
+    barrier.await();
+    Thread.sleep(500);
+    alternateDir.mkdir();
+    assertThat(done.get(2, TimeUnit.MINUTES)).isTrue();
   }
 
   @Test
   public void testVersionNumberCreation() throws Exception {
-    JarDeployer jarDeployer = new JarDeployer();
-
-    File versionedName = jarDeployer.getNextVersionJarFile("myJar.jar");
-    assertThat(versionedName.getName()).isEqualTo(JarDeployer.JAR_PREFIX + "myJar.jar" + "#1");
+    File versionedName = jarDeployer.getNextVersionedJarFile("myJar.jar");
+    assertThat(versionedName.getName()).isEqualTo("myJar.v1.jar");
 
     byte[] jarBytes = this.classBuilder.createJarFromName("ClassA");
-    JarClassLoader jarClassLoader =
-        jarDeployer.deploy(new String[] {"myJar.jar"}, new byte[][] {jarBytes})[0];
-    File deployedJar = new File(jarClassLoader.getFileCanonicalPath());
+    File deployedJarFile = jarDeployer.deployWithoutRegistering("myJar.jar", jarBytes).getFile();
 
-    assertThat(deployedJar.getName()).isEqualTo(JarDeployer.JAR_PREFIX + "myJar.jar" + "#1");
-    assertThat(jarDeployer.getNextVersionJarFile(deployedJar.getName()).getName())
-        .isEqualTo(JarDeployer.JAR_PREFIX + "myJar.jar" + "#2");
+    assertThat(deployedJarFile.getName()).isEqualTo("myJar.v1.jar");
 
+    File secondDeployedJarFile =
+        jarDeployer.deployWithoutRegistering("myJar.jar", jarBytes).getFile();
+
+    assertThat(secondDeployedJarFile.getName()).isEqualTo("myJar.v2.jar");
   }
 
   @Test
-  public void testVersionNumberMatcher() throws Exception {
-    JarDeployer jarDeployer = new JarDeployer();
-    int version = jarDeployer.extractVersionFromFilename(
-        temporaryFolder.newFile(JarDeployer.JAR_PREFIX + "MyJar.jar" + "#1"));
+  public void testVersionNumberMatcher() throws IOException {
+    int version =
+        jarDeployer.extractVersionFromFilename(temporaryFolder.newFile("MyJar.v1.jar").getName());
 
     assertThat(version).isEqualTo(1);
   }
 
-  private boolean doesFileMatchBytes(final File file, final byte[] bytes) throws IOException {
-    return bytes == Files.readAllBytes(file.toPath());
+  @Test
+  public void testRenamingOfOldJarFiles() throws Exception {
+    File deployDir = jarDeployer.getDeployDirectory();
+
+    File jarAVersion1 = new File(deployDir, "vf.gf#myJarA.jar#1");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion1);
+
+    File jarAVersion2 = new File(deployDir, "vf.gf#myJarA.jar#2");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion2);
+
+    File jarBVersion2 = new File(deployDir, "vf.gf#myJarB.jar#2");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion2);
+
+    File jarBVersion3 = new File(deployDir, "vf.gf#myJarB.jar#3");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion3);
+
+    Set<File> deployedJarsBeforeRename = Stream
+        .of(jarAVersion1, jarAVersion2, jarBVersion2, jarBVersion3).collect(Collectors.toSet());
+
+    jarDeployer.renameJarsWithOldNamingConvention();
+
+    deployedJarsBeforeRename.forEach(oldJar -> assertThat(oldJar).doesNotExist());
+
+    File renamedJarAVersion1 = new File(deployDir, "myJarA.v1.jar");
+    File renamedJarAVersion2 = new File(deployDir, "myJarA.v2.jar");
+    File renamedJarBVersion2 = new File(deployDir, "myJarB.v2.jar");
+    File renamedJarBVersion3 = new File(deployDir, "myJarB.v3.jar");
+    Set<File> expectedJarsAfterRename = Stream
+        .of(renamedJarAVersion1, renamedJarAVersion2, renamedJarBVersion2, renamedJarBVersion3)
+        .collect(Collectors.toSet());
+
+    Set<File> actualJarsInDeployDir =
+        Stream.of(jarDeployer.getDeployDirectory().listFiles()).collect(Collectors.toSet());
+
+    assertThat(actualJarsInDeployDir).isEqualTo(expectedJarsAfterRename);
   }
 
+  @Test
+  public void testOldJarNameMatcher() throws Exception {
+    File deployDir = jarDeployer.getDeployDirectory();
+
+    File jarAVersion1 = new File(deployDir, "vf.gf#myJarA.jar#1");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion1);
+
+    File jarAVersion2 = new File(deployDir, "vf.gf#myJarA.jar#2");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion2);
+
+    File jarBVersion2 = new File(deployDir, "vf.gf#myJarB.jar#2");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion2);
+
+    File jarBVersion3 = new File(deployDir, "vf.gf#myJarB.jar#3");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion3);
+
+    Set<File> jarsWithOldNamingConvention = Stream
+        .of(jarAVersion1, jarAVersion2, jarBVersion2, jarBVersion3).collect(Collectors.toSet());
+
+    jarsWithOldNamingConvention.forEach(
+        jarFile -> assertThat(jarDeployer.isOldNamingConvention(jarFile.getName())).isTrue());
+
+    Set<File> foundJarsWithOldNamingConvention = jarDeployer.findJarsWithOldNamingConvention();
+    assertThat(foundJarsWithOldNamingConvention).isEqualTo(jarsWithOldNamingConvention);
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
index 0cc003e..dcbbeb0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
@@ -20,6 +20,22 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.geode.internal.ClassPathLoader;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.DirectoryFileFilter;
 import org.apache.commons.io.filefilter.RegexFileFilter;
@@ -38,7 +54,7 @@ import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.ClassBuilder;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.persistence.BackupManager;
 import org.apache.geode.internal.util.IOUtils;
@@ -1078,15 +1094,16 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     /*
      * Deploy a "dummy"�jar to the VM.
      */
-    vm0.invoke(new SerializableCallable() {
+    File deployedJarFile = (File) vm0.invoke(new SerializableCallable() {
       @Override
       public Object call() throws Exception {
-        JarDeployer deployer = new JarDeployer();
-        deployer.deploy(new String[] {jarName}, new byte[][] {classBytes});
-        return null;
+        DeployedJar deployedJar =
+            ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, classBytes);
+        return deployedJar.getFile();
       }
     });
 
+    assert (deployedJarFile.exists());
     /*
      * Perform backup. Make sure it is successful.
      */
@@ -1149,10 +1166,10 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
     vm0.invoke(new SerializableCallable() {
       @Override
       public Object call() throws Exception {
-        JarDeployer deployer = new JarDeployer();
-        for (JarClassLoader jarClassLoader : deployer.findJarClassLoaders()) {
+        for (DeployedJar jarClassLoader : ClassPathLoader.getLatest().getJarDeployer()
+            .findDeployedJars()) {
           if (jarClassLoader.getJarName().startsWith(jarName)) {
-            deployer.undeploy(jarClassLoader.getJarName());
+            ClassPathLoader.getLatest().getJarDeployer().undeploy(jarClassLoader.getJarName());
           }
         }
         return null;

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
new file mode 100644
index 0000000..3149432
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
@@ -0,0 +1,31 @@
+/*
+ * 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 org.apache.geode.management;
+
+import org.apache.geode.internal.ClassPathLoaderIntegrationTest;
+import org.apache.geode.internal.ClassPathLoaderTest;
+import org.apache.geode.internal.DeployedJarJUnitTest;
+import org.apache.geode.internal.JarDeployerIntegrationTest;
+import org.apache.geode.management.internal.cli.commands.DeployCommandRedeployDUnitTest;
+import org.apache.geode.management.internal.cli.commands.DeployCommandsDUnitTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({DeployedJarJUnitTest.class, DeployCommandsDUnitTest.class,
+    JarDeployerIntegrationTest.class, ClassPathLoaderIntegrationTest.class,
+    ClassPathLoaderTest.class, DeployCommandRedeployDUnitTest.class})
+public class DeployJarTestSuite {
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
new file mode 100644
index 0000000..8280f5d
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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 org.apache.geode.management.internal.cli.commands;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.internal.ClassBuilder;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.Locator;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.Server;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.List;
+
+@Category(DistributedTest.class)
+public class DeployCommandRedeployDUnitTest implements Serializable {
+  private static final String VERSION1 = "Version1";
+  private static final String VERSION2 = "Version2";
+
+  private static final String jarNameA = "DeployCommandRedeployDUnitTestA.jar";
+  private static final String functionA = "DeployCommandRedeployDUnitFunctionA";
+  private File jarAVersion1;
+  private File jarAVersion2;
+
+  private static final String jarNameB = "DeployCommandRedeployDUnitTestB.jar";
+  private static final String functionB = "DeployCommandRedeployDUnitFunctionB";
+  private static final String packageB = "jddunit.function";
+  private static final String fullyQualifiedFunctionB = packageB + "." + functionB;
+  private File jarBVersion1;
+  private File jarBVersion2;
+
+  private MemberVM locator;
+  private MemberVM server;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+
+  @Before
+  public void setup() throws Exception {
+    jarAVersion1 = createJarWithFunctionA(VERSION1);
+    jarAVersion2 = createJarWithFunctionA(VERSION2);
+
+    jarBVersion1 = createJarWithFunctionB(VERSION1);
+    jarBVersion2 = createJarWithFunctionB(VERSION2);
+
+    locator = lsRule.startLocatorVM(0);
+    server = lsRule.startServerVM(1, locator.getPort());
+
+    gfshConnector.connectAndVerify(locator);
+  }
+
+  @Test
+  public void redeployJarsWithNewVersionsOfFunctions() throws Exception {
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarAVersion1.getCanonicalPath());
+    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
+    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
+
+
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarBVersion1.getCanonicalPath());
+    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
+    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
+    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
+    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION1));
+
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarBVersion2.getCanonicalPath());
+    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
+    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
+    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION1));
+    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION2));
+
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + jarAVersion2.getCanonicalPath());
+    server.invoke(() -> assertThatCanLoad(jarNameA, functionA));
+    server.invoke(() -> assertThatCanLoad(jarNameB, fullyQualifiedFunctionB));
+    server.invoke(() -> assertThatFunctionHasVersion(functionA, VERSION2));
+    server.invoke(() -> assertThatFunctionHasVersion(functionB, VERSION2));
+  }
+
+  // Note that jar A is a Declarable Function, while jar B is only a Function.
+  // Also, the function for jar A resides in the default package, whereas jar B specifies a package.
+  // This ensures that this test has identical coverage to some tests that it replaced.
+  private File createJarWithFunctionA(String version) throws Exception {
+    String classContents =
+        "import java.util.Properties;" + "import org.apache.geode.cache.Declarable;"
+            + "import org.apache.geode.cache.execute.Function;"
+            + "import org.apache.geode.cache.execute.FunctionContext;" + "public class " + functionA
+            + " implements Function, Declarable {" + "public String getId() {return \"" + functionA
+            + "\";}" + "public void init(Properties props) {}"
+            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\""
+            + version + "\");}" + "public boolean hasResult() {return true;}"
+            + "public boolean optimizeForWrite() {return false;}"
+            + "public boolean isHA() {return false;}}";
+
+    File jar = new File(lsRule.getTempFolder().newFolder(jarNameA + version), this.jarNameA);
+    ClassBuilder functionClassBuilder = new ClassBuilder();
+    functionClassBuilder.writeJarFromContent(functionA, classContents, jar);
+
+    return jar;
+  }
+
+  private File createJarWithFunctionB(String version) throws IOException {
+    String classContents =
+        "package " + packageB + ";" + "import org.apache.geode.cache.execute.Function;"
+            + "import org.apache.geode.cache.execute.FunctionContext;" + "public class " + functionB
+            + " implements Function {" + "public boolean hasResult() {return true;}"
+            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\""
+            + version + "\");}" + "public String getId() {return \"" + functionB + "\";}"
+            + "public boolean optimizeForWrite() {return false;}"
+            + "public boolean isHA() {return false;}}";
+
+    File jar = new File(lsRule.getTempFolder().newFolder(jarNameB + version), this.jarNameB);
+    ClassBuilder functionClassBuilder = new ClassBuilder();
+    functionClassBuilder.writeJarFromContent("jddunit/function/" + functionB, classContents, jar);
+
+    return jar;
+  }
+
+  private void assertThatFunctionHasVersion(String functionId, String version) {
+    GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
+    DistributedSystem distributedSystem = gemFireCache.getDistributedSystem();
+    Execution execution =
+        FunctionService.onMember(distributedSystem, distributedSystem.getDistributedMember());
+    List<String> result = (List<String>) execution.execute(functionId).getResult();
+    assertThat(result.get(0)).isEqualTo(version);
+  }
+
+  private void assertThatCanLoad(String jarName, String className) throws ClassNotFoundException {
+    assertThat(ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jarName)).isNotNull();
+    assertThat(ClassPathLoader.getLatest().forName(className)).isNotNull();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
index 7b0823b..6df2572 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandsDUnitTest.java
@@ -14,53 +14,28 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.test.dunit.Assert.assertEquals;
-import static org.apache.geode.test.dunit.Assert.assertFalse;
-import static org.apache.geode.test.dunit.Assert.assertTrue;
-import static org.apache.geode.test.dunit.Assert.fail;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertNotNull;
 
-import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.distributed.internal.ClusterConfigurationService;
-import org.apache.geode.internal.AvailablePort;
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.ClassBuilder;
-import org.apache.geode.internal.JarDeployer;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.remote.CommandExecutionContext;
-import org.apache.geode.management.internal.cli.remote.CommandProcessor;
+import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.dunit.Assert;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.WaitCriterion;
-import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.Locator;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.Server;
 import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+import java.io.Serializable;
 import java.util.Properties;
-import java.util.regex.Pattern;
 
 /**
  * Unit tests for the DeployCommands class
@@ -69,453 +44,238 @@ import java.util.regex.Pattern;
  */
 @SuppressWarnings("serial")
 @Category(DistributedTest.class)
-public class DeployCommandsDUnitTest extends CliCommandTestBase {
-
-  private final Pattern pattern =
-      Pattern.compile("^" + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit.*#\\d++$");
-  private File newDeployableJarFile;
-  private transient ClassBuilder classBuilder;
-  private transient CommandProcessor commandProcessor;
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    this.newDeployableJarFile = new File(this.temporaryFolder.getRoot().getCanonicalPath()
-        + File.separator + "DeployCommandsDUnit1.jar");
-    this.classBuilder = new ClassBuilder();
-    this.commandProcessor = new CommandProcessor();
-    assertFalse(this.commandProcessor.isStopped());
-
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      public void run() {
-        deleteSavedJarFiles();
-      }
-    });
-    deleteSavedJarFiles();
+public class DeployCommandsDUnitTest implements Serializable {
+  private static final String GROUP1 = "Group1";
+  private static final String GROUP2 = "Group2";
+
+  private final String class1 = "DeployCommandsDUnitA";
+  private final String class2 = "DeployCommandsDUnitB";
+  private final String class3 = "DeployCommandsDUnitC";
+  private final String class4 = "DeployCommandsDUnitD";
+
+  private final String jarName1 = "DeployCommandsDUnit1.jar";
+  private final String jarName2 = "DeployCommandsDUnit2.jar";
+  private final String jarName3 = "DeployCommandsDUnit3.jar";
+  private final String jarName4 = "DeployCommandsDUnit4.jar";
+
+  private File jar1;
+  private File jar2;
+  private File jar3;
+  private File jar4;
+  private File subdirWithJars3and4;
+
+  private MemberVM locator;
+  private MemberVM server1;
+  private MemberVM server2;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+
+  @Before
+  public void setup() throws Exception {
+    ClassBuilder classBuilder = new ClassBuilder();
+    File jarsDir = lsRule.getTempFolder().newFolder();
+    jar1 = new File(jarsDir, jarName1);
+    jar2 = new File(jarsDir, jarName2);
+
+    subdirWithJars3and4 = new File(jarsDir, "subdir");
+    subdirWithJars3and4.mkdirs();
+    jar3 = new File(subdirWithJars3and4, jarName3);
+    jar4 = new File(subdirWithJars3and4, jarName4);
+
+    classBuilder.writeJarFromName(class1, jar1);
+    classBuilder.writeJarFromName(class2, jar2);
+    classBuilder.writeJarFromName(class3, jar3);
+    classBuilder.writeJarFromName(class4, jar4);
+
+    locator = lsRule.startLocatorVM(0);
+
+    Properties props = new Properties();
+    props.setProperty(GROUPS, GROUP1);
+    server1 = lsRule.startServerVM(1, props, locator.getPort());
+
+    props.setProperty(GROUPS, GROUP2);
+    server2 = lsRule.startServerVM(2, props, locator.getPort());
+
+    gfshConnector.connectAndVerify(locator);
   }
 
-  @SuppressWarnings("serial")
-  @Override
-  protected final void preTearDownCliCommandTestBase() throws Exception {
-    Host.getHost(0).getVM(1).invoke(new SerializableRunnable() {
-      public void run() {
-        DistributionManager.isDedicatedAdminVM = false;
-      }
-    });
+  @Test
+  public void deployJarToOneGroup() throws Exception {
+    // Deploy a jar to a single group
+    CommandResult cmdResult =
+        gfshConnector.executeAndVerifyCommand("deploy --jar=" + jar2 + " --group=" + GROUP1);
+    String resultString = commandResultToString(cmdResult);
 
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      public void run() {
-        deleteSavedJarFiles();
-      }
-    });
-    deleteSavedJarFiles();
+    assertThat(resultString).contains(server1.getName());
+    assertThat(resultString).doesNotContain(server2.getName());
+    assertThat(resultString).contains(jarName2);
+
+    server1.invoke(() -> assertThatCanLoad(jarName2, class2));
+    server2.invoke(() -> assertThatCannotLoad(jarName2, class2));
   }
 
   @Test
-  public void testDeploy() throws Exception {
-    final Properties props = new Properties();
-    final Host host = Host.getHost(0);
-    final VM vm = host.getVM(0);
-    final String vmName = "VM" + vm.getPid();
-
-    // Create the cache in this VM
-    props.setProperty(NAME, "Controller");
-    props.setProperty(GROUPS, "Group1");
-    getSystem(props);
-    getCache();
-
-    // Create the cache in the other VM
-    vm.invoke(new SerializableRunnable() {
-      public void run() {
-        props.setProperty(NAME, vmName);
-        props.setProperty(GROUPS, "Group2");
-        getSystem(props);
-        getCache();
-      }
+  public void deployMultipleJarsToOneGroup() throws Exception {
+    // Deploy of multiple JARs to a single group
+    CommandResult cmdResult = gfshConnector.executeAndVerifyCommand(
+        "deploy --group=" + GROUP1 + " --dir=" + subdirWithJars3and4.getCanonicalPath());
+    String resultString = commandResultToString(cmdResult);
+
+    assertThat(resultString).describedAs(resultString).contains(server1.getName());
+    assertThat(resultString).doesNotContain(server2.getName());
+    assertThat(resultString).contains(jarName3);
+    assertThat(resultString).contains(jarName4);
+
+    server1.invoke(() -> {
+      assertThatCanLoad(jarName3, class3);
+      assertThatCanLoad(jarName4, class4);
+    });
+    server2.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
     });
 
-    DeployCommands deployCommands = new DeployCommands();
-
-    // Single JAR all members
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit1.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitA")});
-    Result result = deployCommands.deploy(null, "DeployCommandsDUnit1.jar", null);
-
-    assertEquals(true, result.hasNextLine());
-
-    String resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(1, countMatchesInString(resultString, "Controller"));
-    assertEquals(1, countMatchesInString(resultString, vmName));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit1.jar"));
-
-    // Single JAR with group
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit2.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitB")});
-    result = deployCommands.deploy(new String[] {"Group2"}, "DeployCommandsDUnit2.jar", null);
-
-    assertEquals(true, result.hasNextLine());
-
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(false, resultString.contains("Controller"));
-    assertEquals(1, countMatchesInString(resultString, vmName));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit2.jar"));
-
-    // Multiple JARs to all members
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit3.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitC"),
-        "DeployCommandsDUnit4.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitD")});
-    result = deployCommands.deploy(null, null, "AnyDirectory");
-
-    assertEquals(true, result.hasNextLine());
-
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(2, countMatchesInString(resultString, "Controller"));
-    assertEquals(2, countMatchesInString(resultString, vmName));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit3.jar"));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit4.jar"));
-
-    // Multiple JARs to a group
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit5.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitE"),
-        "DeployCommandsDUnit6.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitF")});
-    result = deployCommands.deploy(new String[] {"Group1"}, null, "AnyDirectory");
-
-    assertEquals(true, result.hasNextLine());
-
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(2, countMatchesInString(resultString, "Controller"));
-    assertEquals(false, resultString.contains(vmName));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit5.jar"));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit6.jar"));
-  }
 
-  @Test
-  public void testUndeploy() throws Exception {
-    final Properties props = new Properties();
-    final Host host = Host.getHost(0);
-    final VM vm = host.getVM(0);
-    final String vmName = "VM" + vm.getPid();
-
-    // Create the cache in this VM
-    props.setProperty(NAME, "Controller");
-    props.setProperty(GROUPS, "Group1");
-    getSystem(props);
-    getCache();
-
-    // Create the cache in the other VM
-    vm.invoke(new SerializableRunnable() {
-      public void run() {
-        props.setProperty(NAME, vmName);
-        props.setProperty(GROUPS, "Group2");
-        getSystem(props);
-        getCache();
-      }
+    // Undeploy of multiple jars by specifying group
+    gfshConnector.executeAndVerifyCommand("undeploy --group=" + GROUP1);
+    server1.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
+    });
+    server2.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
     });
-
-    DeployCommands deployCommands = new DeployCommands();
-
-    // Deploy a couple of JAR files which can be undeployed
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit1.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitA")});
-    deployCommands.deploy(new String[] {"Group1"}, "DeployCommandsDUnit1.jar", null);
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit2.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitB")});
-    deployCommands.deploy(new String[] {"Group2"}, "DeployCommandsDUnit2.jar", null);
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit3.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitC")});
-    deployCommands.deploy(null, "DeployCommandsDUnit3.jar", null);
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit4.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitD")});
-    deployCommands.deploy(null, "DeployCommandsDUnit4.jar", null);
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit5.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitE")});
-    deployCommands.deploy(null, "DeployCommandsDUnit5.jar", null);
-
-    // Undeploy for 1 group
-    Result result = deployCommands.undeploy(new String[] {"Group1"}, "DeployCommandsDUnit1.jar");
-    assertEquals(true, result.hasNextLine());
-    String resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(1, countMatchesInString(resultString, "Controller"));
-    assertEquals(false, resultString.contains(vmName));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit1.jar"));
-
-    // Multiple Undeploy for all members
-    result = deployCommands.undeploy(null, "DeployCommandsDUnit2.jar, DeployCommandsDUnit3.jar");
-    assertEquals(true, result.hasNextLine());
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(2, countMatchesInString(resultString, "Controller"));
-    assertEquals(2, countMatchesInString(resultString, vmName));
-    assertEquals(3, countMatchesInString(resultString, "DeployCommandsDUnit2.jar"));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit3.jar"));
-
-    // Undeploy all (no JAR specified)
-    result = deployCommands.undeploy(null, null);
-    assertEquals(true, result.hasNextLine());
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(2, countMatchesInString(resultString, "Controller"));
-    assertEquals(2, countMatchesInString(resultString, vmName));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit4.jar"));
-    assertEquals(4, countMatchesInString(resultString, "DeployCommandsDUnit5.jar"));
   }
 
   @Test
-  public void testListDeployed() throws Exception {
-    final Properties props = new Properties();
-    final Host host = Host.getHost(0);
-    final VM vm = host.getVM(0);
-    final String vmName = "VM" + vm.getPid();
-
-    // Create the cache in this VM
-    props.setProperty(NAME, "Controller");
-    props.setProperty(GROUPS, "Group1");
-    getSystem(props);
-    getCache();
-
-    // Create the cache in the other VM
-    vm.invoke(new SerializableRunnable() {
-      public void run() {
-        props.setProperty(NAME, vmName);
-        props.setProperty(GROUPS, "Group2");
-        getSystem(props);
-        getCache();
-      }
-    });
-
-    DeployCommands deployCommands = new DeployCommands();
-
-    // Deploy a couple of JAR files which can be listed
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit1.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitA")});
-    deployCommands.deploy(new String[] {"Group1"}, "DeployCommandsDUnit1.jar", null);
-    CommandExecutionContext.setBytesFromShell(new byte[][] {"DeployCommandsDUnit2.jar".getBytes(),
-        this.classBuilder.createJarFromName("DeployCommandsDUnitB")});
-    deployCommands.deploy(new String[] {"Group2"}, "DeployCommandsDUnit2.jar", null);
-
-    // List for all members
-    Result result = deployCommands.listDeployed(null);
-    assertEquals(true, result.hasNextLine());
-    String resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(1, countMatchesInString(resultString, "Controller"));
-    assertEquals(1, countMatchesInString(resultString, vmName));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit1.jar"));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit2.jar"));
-
-    // List for members in Group1
-    result = deployCommands.listDeployed("Group1");
-    assertEquals(true, result.hasNextLine());
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(1, countMatchesInString(resultString, "Controller"));
-    assertEquals(false, resultString.contains(vmName));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit1.jar"));
-    assertEquals(false, resultString.contains("DeployCommandsDUnit2.jar"));
-
-    // List for members in Group2
-    result = deployCommands.listDeployed("Group2");
-    assertEquals(true, result.hasNextLine());
-    resultString = result.nextLine();
-    assertEquals(false, resultString.contains("ERROR"));
-    assertEquals(false, resultString.contains("Controller"));
-    assertEquals(1, countMatchesInString(resultString, vmName));
-    assertEquals(false, resultString.contains("DeployCommandsDUnit1.jar"));
-    assertEquals(2, countMatchesInString(resultString, "DeployCommandsDUnit2.jar"));
+  public void deployJarToAllServers() throws Exception {
+    // Deploy a jar to all servers
+    CommandResult cmdResult = gfshConnector.executeAndVerifyCommand("deploy --jar=" + jar1);
+
+    String resultString = commandResultToString(cmdResult);
+    assertThat(resultString).contains(server1.getName());
+    assertThat(resultString).contains(server2.getName());
+    assertThat(resultString).contains(jarName1);
+
+    server1.invoke(() -> assertThatCanLoad(jarName1, class1));
+    server2.invoke(() -> assertThatCanLoad(jarName1, class1));
+
+    // Undeploy of jar by specifying group
+    gfshConnector.executeAndVerifyCommand("undeploy --group=" + GROUP1);
+    server1.invoke(() -> assertThatCannotLoad(jarName1, class1));
+    server2.invoke(() -> assertThatCanLoad(jarName1, class1));
   }
 
-  /**
-   * Does an end-to-end test using the complete CLI framework while ensuring that the shared
-   * configuration is updated.
-   */
   @Test
-  public void testEndToEnd() throws Exception {
-    final String groupName = getName();
-    final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    jmxPort = ports[0];
-    httpPort = ports[1];
-    try {
-      jmxHost = InetAddress.getLocalHost().getHostName();
-    } catch (UnknownHostException ignore) {
-      jmxHost = "localhost";
-    }
+  public void deployMultipleJarsToAllServers() throws Exception {
+    gfshConnector.executeAndVerifyCommand("deploy --dir=" + subdirWithJars3and4.getCanonicalPath());
 
-    // Start the Locator and wait for shared configuration to be available
-    final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    final String locatorLogPath = this.temporaryFolder.getRoot().getCanonicalPath() + File.separator
-        + "locator-" + locatorPort + ".log";
-
-    final Properties locatorProps = new Properties();
-    locatorProps.setProperty(NAME, "Locator");
-    locatorProps.setProperty(MCAST_PORT, "0");
-    locatorProps.setProperty(LOG_LEVEL, "fine");
-    locatorProps.setProperty(ENABLE_CLUSTER_CONFIGURATION, "true");
-    locatorProps.setProperty(JMX_MANAGER, "true");
-    locatorProps.setProperty(JMX_MANAGER_START, "true");
-    locatorProps.setProperty(JMX_MANAGER_BIND_ADDRESS, String.valueOf(jmxHost));
-    locatorProps.setProperty(JMX_MANAGER_PORT, String.valueOf(jmxPort));
-    locatorProps.setProperty(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        final File locatorLogFile = new File(locatorLogPath);
-        try {
-          final InternalLocator locator = (InternalLocator) Locator.startLocatorAndDS(locatorPort,
-              locatorLogFile, null, locatorProps);
-
-          WaitCriterion wc = new WaitCriterion() {
-            @Override
-            public boolean done() {
-              return locator.isSharedConfigurationRunning();
-            }
-
-            @Override
-            public String description() {
-              return "Waiting for shared configuration to be started";
-            }
-          };
-          Wait.waitForCriterion(wc, 5000, 500, true);
-
-        } catch (IOException e) {
-          fail("Unable to create a locator with a shared configuration", e);
-        }
-      }
+    server1.invoke(() -> {
+      assertThatCanLoad(jarName3, class3);
+      assertThatCanLoad(jarName4, class4);
+    });
+    server2.invoke(() -> {
+      assertThatCanLoad(jarName3, class3);
+      assertThatCanLoad(jarName4, class4);
     });
 
-    connect(jmxHost, jmxPort, httpPort, getDefaultShell());
+    gfshConnector.executeAndVerifyCommand("undeploy");
 
-    Host.getHost(0).getVM(1).invoke(() -> {
-      Properties properties = new Properties();
-      properties.setProperty("name", "Manager");
-      properties.setProperty("groups", groupName);
-      ServerStarterRule serverStarterRule = new ServerStarterRule();
-      serverStarterRule.withProperties(properties).withConnectionToLocator(locatorPort)
-          .startServer();
+    server1.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
+    });
+    server2.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
     });
+  }
 
-    // Create a JAR file
-    this.classBuilder.writeJarFromName("DeployCommandsDUnitA", this.newDeployableJarFile);
+  @Test
+  public void undeployOfMultipleJars() throws Exception {
+    gfshConnector.executeAndVerifyCommand("deploy --dir=" + subdirWithJars3and4.getCanonicalPath());
 
-    // Deploy the JAR
-    CommandResult cmdResult =
-        executeCommand("deploy --jar=" + this.newDeployableJarFile.getCanonicalPath());
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-    String stringResult = commandResultToString(cmdResult);
-    assertEquals(3, countLinesInString(stringResult, false));
-    assertTrue(stringContainsLine(stringResult, "Member.*JAR.*JAR Location"));
-    assertTrue(stringContainsLine(stringResult, "Manager.*DeployCommandsDUnit1.jar.*"
-        + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1"));
-
-    // Undeploy the JAR
-    cmdResult = executeCommand("undeploy --jar=DeployCommandsDUnit1.jar");
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-    stringResult = commandResultToString(cmdResult);
-    assertEquals(3, countLinesInString(stringResult, false));
-    assertThat(stringContainsLine(stringResult, "Member.*JAR.*Un-Deployed From JAR Location"))
-        .describedAs(stringResult).isTrue();
-    assertThat(stringContainsLine(stringResult, "Manager.*DeployCommandsDUnit1.jar.*"
-        + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1")).describedAs(stringResult)
-            .isTrue();;
-
-
-    // Deploy the JAR to a group
-    cmdResult = executeCommand(
-        "deploy --jar=" + this.newDeployableJarFile.getCanonicalPath() + " --group=" + groupName);
-    assertThat(cmdResult.getStatus()).describedAs(cmdResult.toString()).isEqualTo(Result.Status.OK);
-
-    stringResult = commandResultToString(cmdResult);
-    assertEquals(3, countLinesInString(stringResult, false));
-    assertThat(stringContainsLine(stringResult, "Member.*JAR.*JAR Location"))
-        .describedAs(stringResult).isTrue();
-
-    assertThat(stringContainsLine(stringResult, "Manager.*DeployCommandsDUnit1.jar.*"
-        + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1")).describedAs(stringResult)
-            .isTrue();
-
-    // Make sure the deployed jar in the shared config
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        ClusterConfigurationService sharedConfig =
-            ((InternalLocator) Locator.getLocator()).getSharedConfiguration();
-        try {
-          assertTrue(sharedConfig.getConfiguration(groupName).getJarNames()
-              .contains("DeployCommandsDUnit1.jar"));
-        } catch (Exception e) {
-          Assert.fail("Error occurred in cluster configuration service", e);
-        }
-      }
+    server1.invoke(() -> {
+      assertThatCanLoad(jarName3, class3);
+      assertThatCanLoad(jarName4, class4);
+    });
+    server2.invoke(() -> {
+      assertThatCanLoad(jarName3, class3);
+      assertThatCanLoad(jarName4, class4);
     });
 
-    // List deployed for group
-    cmdResult = executeCommand("list deployed --group=" + groupName);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-    stringResult = commandResultToString(cmdResult);
-    assertEquals(3, countLinesInString(stringResult, false));
-    assertTrue(stringContainsLine(stringResult, "Member.*JAR.*JAR Location"));
-    assertTrue(stringContainsLine(stringResult, "Manager.*DeployCommandsDUnit1.jar.*"
-        + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1"));
-
-    // Undeploy for group
-    cmdResult = executeCommand("undeploy --group=" + groupName);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-    stringResult = commandResultToString(cmdResult);
-    assertEquals(3, countLinesInString(stringResult, false));
-    assertTrue(stringContainsLine(stringResult, "Member.*JAR.*Un-Deployed From JAR Location"));
-    assertTrue(stringContainsLine(stringResult, "Manager.*DeployCommandsDUnit1.jar.*"
-        + JarDeployer.JAR_PREFIX + "DeployCommandsDUnit1.jar#1"));
-
-    // Make sure the deployed jar was removed from the shared config
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        ClusterConfigurationService sharedConfig =
-            ((InternalLocator) Locator.getLocator()).getSharedConfiguration();
-        try {
-          assertFalse(sharedConfig.getConfiguration(groupName).getJarNames()
-              .contains("DeployCommandsDUnit1.jar"));
-        } catch (Exception e) {
-          Assert.fail("Error occurred in cluster configuration service", e);
-        }
-      }
+    gfshConnector
+        .executeAndVerifyCommand("undeploy --jars=" + jar3.getName() + "," + jar4.getName());
+    server1.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
     });
+    server2.invoke(() -> {
+      assertThatCannotLoad(jarName3, class3);
+      assertThatCannotLoad(jarName4, class4);
+    });
+  }
 
-    // List deployed with nothing deployed
-    cmdResult = executeCommand("list deployed");
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    assertTrue(
-        commandResultToString(cmdResult).contains(CliStrings.LIST_DEPLOYED__NO_JARS_FOUND_MESSAGE));
+  private void assertThatCanLoad(String jarName, String className) throws ClassNotFoundException {
+    assertThat(ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jarName)).isNotNull();
+    assertThat(ClassPathLoader.getLatest().forName(className)).isNotNull();
   }
 
-  private void deleteSavedJarFiles() {
-    this.newDeployableJarFile.delete();
+  private void assertThatCannotLoad(String jarName, String className) {
+    assertThat(ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jarName)).isNull();
+    assertThatThrownBy(() -> ClassPathLoader.getLatest().forName(className))
+        .isExactlyInstanceOf(ClassNotFoundException.class);
+  }
 
-    File dirFile = new File(".");
 
-    // Find all deployed JAR files
-    File[] oldJarFiles = dirFile.listFiles(new FilenameFilter() {
-      @Override
-      public boolean accept(final File file, final String name) {
-        return DeployCommandsDUnitTest.this.pattern.matcher(name).matches();
-      }
-    });
+  @Test
+  public void testListDeployed() throws Exception {
+    // Deploy a couple of JAR files which can be listed
+    gfshConnector.executeAndVerifyCommand(
+        "deploy jar --group=" + GROUP1 + " --jar=" + jar1.getCanonicalPath());
+    gfshConnector.executeAndVerifyCommand(
+        "deploy jar --group=" + GROUP2 + " --jar=" + jar2.getCanonicalPath());
+
+    // List for all members
+    CommandResult commandResult = gfshConnector.executeAndVerifyCommand("list deployed");
+    String resultString = commandResultToString(commandResult);
+    assertThat(resultString).contains(server1.getName());
+    assertThat(resultString).contains(server2.getName());
+    assertThat(resultString).contains(jarName1);
+    assertThat(resultString).contains(jarName2);
+
+    // List for members in Group1
+    commandResult = gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP1);
+    resultString = commandResultToString(commandResult);
+    assertThat(resultString).contains(server1.getName());
+    assertThat(resultString).doesNotContain(server2.getName());
+
+    assertThat(resultString).contains(jarName1);
+    assertThat(resultString).doesNotContain(jarName2);
+
+    // List for members in Group2
+    commandResult = gfshConnector.executeAndVerifyCommand("list deployed --group=" + GROUP2);
+    resultString = commandResultToString(commandResult);
+    assertThat(resultString).doesNotContain(server1.getName());
+    assertThat(resultString).contains(server2.getName());
+
+    assertThat(resultString).doesNotContain(jarName1);
+    assertThat(resultString).contains(jarName2);
+  }
 
-    // Now delete them
-    if (oldJarFiles != null) {
-      for (File oldJarFile : oldJarFiles) {
-        oldJarFile.delete();
-      }
+  protected static String commandResultToString(final CommandResult commandResult) {
+    assertNotNull(commandResult);
+    commandResult.resetToFirstLine();
+    StringBuilder buffer = new StringBuilder(commandResult.getHeader());
+    while (commandResult.hasNextLine()) {
+      buffer.append(commandResult.nextLine());
     }
+    buffer.append(commandResult.getFooter());
+    return buffer.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/UserCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/UserCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/UserCommandsDUnitTest.java
deleted file mode 100644
index 24f5cdb..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/UserCommandsDUnitTest.java
+++ /dev/null
@@ -1,164 +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 org.apache.geode.management.internal.cli.commands;
-
-import static org.apache.geode.test.dunit.Assert.assertEquals;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.internal.ClassBuilder;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CommandManager;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Unit tests for configuring user commands.
- *
- * @since GemFire 8.0
- */
-@Category(DistributedTest.class)
-public class UserCommandsDUnitTest extends CliCommandTestBase {
-
-  private static final long serialVersionUID = 1L;
-  final File jarDirectory = new File((new File(
-      ClassPathLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath()))
-          .getParent(),
-      "ext");
-  final File jarFile = new File(this.jarDirectory, "UserCommandsDUnit.jar");
-  boolean deleteJarDirectory = false;
-
-  @Override
-  public final void postSetUpCliCommandTestBase() throws Exception {
-    createUserCommandJarFile();
-  }
-
-  @Override
-  public final void postTearDownCacheTestCase() throws Exception {
-    if (this.deleteJarDirectory) {
-      FileUtils.deleteDirectory(this.jarDirectory);
-    } else {
-      FileUtils.forceDelete(this.jarFile);
-    }
-
-    System.clearProperty(CommandManager.USER_CMD_PACKAGES_PROPERTY);
-    ClassPathLoader.setLatestToDefault();
-    CommandManager.clearInstance();
-
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public void run() {
-        System.clearProperty(CommandManager.USER_CMD_PACKAGES_PROPERTY);
-        ClassPathLoader.setLatestToDefault();
-        CommandManager.clearInstance();
-      }
-    });
-  }
-
-  public void createUserCommandJarFile() throws IOException {
-    this.deleteJarDirectory = this.jarDirectory.mkdir();
-
-    StringBuffer stringBuffer = new StringBuffer();
-
-    stringBuffer.append("package junit.ucdunit;");
-    stringBuffer.append("import org.springframework.shell.core.CommandMarker;");
-    stringBuffer
-        .append("import org.springframework.shell.core.annotation.CliAvailabilityIndicator;");
-    stringBuffer.append("import org.springframework.shell.core.annotation.CliCommand;");
-    stringBuffer.append("import org.springframework.shell.core.annotation.CliOption;");
-    stringBuffer.append("import org.apache.geode.management.cli.Result;");
-    stringBuffer.append("import org.apache.geode.management.internal.cli.CliUtil;");
-    stringBuffer.append("import org.apache.geode.management.internal.cli.result.ResultBuilder;");
-    stringBuffer.append("import org.apache.geode.management.internal.cli.shell.Gfsh;");
-
-    stringBuffer.append(
-        "public final class UCDunitClass implements CommandMarker { public UCDunitClass() {}");
-    stringBuffer.append("@CliCommand(value = { \"ucdunitcmd\" }, help = \"ucdunitcmd help\")");
-    stringBuffer.append(
-        "public final Result ucdunitcmd(@CliOption(key = { \"name\" }, help = \"ucdunitcmd name help\") String name) {");
-    stringBuffer.append("return ResultBuilder.createInfoResult(\"ucdunitcmd \" + name); }");
-    stringBuffer.append("@CliAvailabilityIndicator({ \"ucdunitcmd\" })");
-    stringBuffer.append("public final boolean isAvailable() { return true; } }");
-
-    ClassBuilder classBuilder = new ClassBuilder();
-    final byte[] jarBytes = classBuilder.createJarFromClassContent("junit/ucdunit/UCDunitClass",
-        stringBuffer.toString());
-
-    final FileOutputStream outStream = new FileOutputStream(this.jarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-  }
-
-  @Test
-  public void testCommandLineProperty() {
-    System.setProperty(CommandManager.USER_CMD_PACKAGES_PROPERTY, "junit.ucdunit");
-
-    ClassPathLoader.setLatestToDefault();
-    CommandManager.clearInstance();
-
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public void run() {
-        System.setProperty(CommandManager.USER_CMD_PACKAGES_PROPERTY, "junit.ucdunit");
-        ClassPathLoader.setLatestToDefault();
-        CommandManager.clearInstance();
-      }
-    });
-
-    setUpJmxManagerOnVm0ThenConnect(null);
-
-    CommandResult cmdResult = executeCommand("ucdunitcmd");
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-  }
-
-  @Test
-  public void testGemFireProperty() {
-    System.setProperty(CommandManager.USER_CMD_PACKAGES_PROPERTY, "junit.ucdunit");
-
-    ClassPathLoader.setLatestToDefault();
-    CommandManager.clearInstance();
-
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      private static final long serialVersionUID = 1L;
-
-      @Override
-      public void run() {
-        ClassPathLoader.setLatestToDefault();
-        CommandManager.clearInstance();
-      }
-    });
-
-    Properties properties = new Properties();
-    properties.setProperty(ConfigurationProperties.USER_COMMAND_PACKAGES, "junit.ucdunit");
-    setUpJmxManagerOnVm0ThenConnect(properties);
-
-    CommandResult cmdResult = executeCommand("ucdunitcmd");
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-  }
-}


[50/51] [abbrv] geode git commit: GEODE-2808 - Fixing lock ordering issues in DeltaSession

Posted by ds...@apache.org.
GEODE-2808 - Fixing lock ordering issues in DeltaSession

Region expiration of sessions and explicit expiration of sessions had
lock ordering issues. Fixing the code so that expiration goes through
the region entry lock first, before getting the lock on StandardSession.

Adding a workaround for the fact that liferay calls removeAttribute
from within session expiration by ignoreing remoteAttribute calls during
expiration.

This closes #472


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

Branch: refs/heads/feature/GEODE-2097
Commit: 45dc6744154a08986e833852ef743af5d8bf19ba
Parents: 47d8c82
Author: Dan Smith <up...@apache.org>
Authored: Fri Apr 21 11:36:24 2017 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Fri Apr 21 16:23:24 2017 -0700

----------------------------------------------------------------------
 .../modules/session/catalina/DeltaSession7.java | 14 +++++++-
 .../modules/session/catalina/DeltaSession8.java | 14 +++++++-
 .../session/TestSessionsTomcat8Base.java        | 34 ++++++++++++++++++++
 .../modules/session/catalina/DeltaSession.java  | 14 +++++++-
 .../geode/modules/session/CommandServlet.java   |  4 +++
 .../geode/modules/session/QueryCommand.java     |  2 ++
 .../geode/modules/session/TestSessionsBase.java | 34 ++++++++++++++++++++
 7 files changed, 113 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java
index 204ff5e..d7f30bd 100644
--- a/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java
+++ b/extensions/geode-modules-tomcat7/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession7.java
@@ -263,6 +263,9 @@ public class DeltaSession7 extends StandardSession
 
   public void removeAttribute(String name, boolean notify) {
     checkBackingCacheAvailable();
+    if (expired) {
+      return;
+    }
     synchronized (this.changeLock) {
       // Remove the attribute locally
       super.removeAttribute(name, true);
@@ -322,7 +325,7 @@ public class DeltaSession7 extends StandardSession
     setExpired(true);
 
     // Do expire processing
-    expire();
+    super.expire(true);
 
     // Update statistics
     if (manager != null) {
@@ -330,6 +333,15 @@ public class DeltaSession7 extends StandardSession
     }
   }
 
+  @Override
+  public void expire(boolean notify) {
+    if (notify) {
+      getOperatingRegion().destroy(this.getId(), this);
+    } else {
+      super.expire(false);
+    }
+  }
+
   public void setMaxInactiveInterval(int interval) {
     super.setMaxInactiveInterval(interval);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java
index b5e7d0c..f69382a 100644
--- a/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java
+++ b/extensions/geode-modules-tomcat8/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession8.java
@@ -258,6 +258,9 @@ public class DeltaSession8 extends StandardSession
 
   public void removeAttribute(String name, boolean notify) {
     checkBackingCacheAvailable();
+    if (expired) {
+      return;
+    }
     synchronized (this.changeLock) {
       // Remove the attribute locally
       super.removeAttribute(name, true);
@@ -317,7 +320,7 @@ public class DeltaSession8 extends StandardSession
     setExpired(true);
 
     // Do expire processing
-    expire();
+    super.expire(true);
 
     // Update statistics
     if (manager != null) {
@@ -325,6 +328,15 @@ public class DeltaSession8 extends StandardSession
     }
   }
 
+  @Override
+  public void expire(boolean notify) {
+    if (notify) {
+      getOperatingRegion().destroy(this.getId(), this);
+    } else {
+      super.expire(false);
+    }
+  }
+
   public void setMaxInactiveInterval(int interval) {
     super.setMaxInactiveInterval(interval);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java
index 15b3874..1dc1d8b 100644
--- a/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java
+++ b/extensions/geode-modules-tomcat8/src/test/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java
@@ -233,6 +233,40 @@ public abstract class TestSessionsTomcat8Base extends JUnit4DistributedTestCase
   }
 
   /**
+   * Test expiration of a session by the tomcat container, rather than gemfire expiration
+   */
+  @Test
+  public void testSessionExpirationByContainer() throws Exception {
+
+    String key = "value_testSessionExpiration1";
+    String value = "Foo";
+
+    WebConversation wc = new WebConversation();
+    WebRequest req = new GetMethodWebRequest(String.format("http://localhost:%d/test", port));
+
+    // Set an attribute
+    req.setParameter("cmd", QueryCommand.SET.name());
+    req.setParameter("param", key);
+    req.setParameter("value", value);
+    WebResponse response = wc.getResponse(req);
+
+    // Set the session timeout of this one session.
+    req.setParameter("cmd", QueryCommand.SET_MAX_INACTIVE.name());
+    req.setParameter("value", "1");
+    response = wc.getResponse(req);
+
+    // Wait until the session should expire
+    Thread.sleep(2000);
+
+    // Do a request, which should cause the session to be expired
+    req.setParameter("cmd", QueryCommand.GET.name());
+    req.setParameter("param", key);
+    response = wc.getResponse(req);
+
+    assertEquals("", response.getText());
+  }
+
+  /**
    * Test that removing a session attribute also removes it from the region
    */
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
index bc421a5..ac612da 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
@@ -266,6 +266,9 @@ public class DeltaSession extends StandardSession
 
   public void removeAttribute(String name, boolean notify) {
     checkBackingCacheAvailable();
+    if (expired) {
+      return;
+    }
     synchronized (this.changeLock) {
       // Remove the attribute locally
       super.removeAttribute(name, true);
@@ -325,7 +328,7 @@ public class DeltaSession extends StandardSession
     setExpired(true);
 
     // Do expire processing
-    expire();
+    super.expire(true);
 
     // Update statistics
     if (manager != null) {
@@ -333,6 +336,15 @@ public class DeltaSession extends StandardSession
     }
   }
 
+  @Override
+  public void expire(boolean notify) {
+    if (notify) {
+      getOperatingRegion().destroy(this.getId(), this);
+    } else {
+      super.expire(false);
+    }
+  }
+
   public void setMaxInactiveInterval(int interval) {
     super.setMaxInactiveInterval(interval);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java
index 3fede62..a04194b 100644
--- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java
+++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/CommandServlet.java
@@ -60,6 +60,10 @@ public class CommandServlet extends HttpServlet {
         session = request.getSession();
         session.setAttribute(param, value);
         break;
+      case SET_MAX_INACTIVE:
+        session = request.getSession();
+        session.setMaxInactiveInterval(Integer.valueOf(value));
+        break;
       case GET:
         session = request.getSession();
         String val = (String) session.getAttribute(param);

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java
index 2b89e68..622866e 100644
--- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java
+++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/QueryCommand.java
@@ -21,6 +21,8 @@ public enum QueryCommand {
 
   SET,
 
+  SET_MAX_INACTIVE,
+
   GET,
 
   INVALIDATE,

http://git-wip-us.apache.org/repos/asf/geode/blob/45dc6744/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java
index d7674dd..a6bec6c 100644
--- a/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java
+++ b/extensions/geode-modules/src/test/java/org/apache/geode/modules/session/TestSessionsBase.java
@@ -267,6 +267,40 @@ public abstract class TestSessionsBase {
   }
 
   /**
+   * Test expiration of a session by the tomcat container, rather than gemfire expiration
+   */
+  @Test
+  public void testSessionExpirationByContainer() throws Exception {
+
+    String key = "value_testSessionExpiration1";
+    String value = "Foo";
+
+    WebConversation wc = new WebConversation();
+    WebRequest req = new GetMethodWebRequest(String.format("http://localhost:%d/test", port));
+
+    // Set an attribute
+    req.setParameter("cmd", QueryCommand.SET.name());
+    req.setParameter("param", key);
+    req.setParameter("value", value);
+    WebResponse response = wc.getResponse(req);
+
+    // Set the session timeout of this one session.
+    req.setParameter("cmd", QueryCommand.SET_MAX_INACTIVE.name());
+    req.setParameter("value", "1");
+    response = wc.getResponse(req);
+
+    // Wait until the session should expire
+    Thread.sleep(2000);
+
+    // Do a request, which should cause the session to be expired
+    req.setParameter("cmd", QueryCommand.GET.name());
+    req.setParameter("param", key);
+    response = wc.getResponse(req);
+
+    assertEquals("", response.getText());
+  }
+
+  /**
    * Test that removing a session attribute also removes it from the region
    */
   @Test


[23/51] [abbrv] geode git commit: GEODE-2770 - Move the shutdown of the rest interface to the same place as other client APIs.

Posted by ds...@apache.org.
GEODE-2770 - Move the shutdown of the rest interface to the same place as other client APIs.

* This will prevent a some client interaction from mutating the state of the system after key components are already shutdown.
* This closes #455


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

Branch: refs/heads/feature/GEODE-2097
Commit: 3a3077094b92699863284a574601585aca787dcd
Parents: 6f7f943
Author: Charlie Black <ch...@github.com>
Authored: Mon Apr 10 21:58:43 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Apr 17 08:03:24 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/geode/internal/cache/GemFireCacheImpl.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/3a307709/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 069b608..59aeac4 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -2232,6 +2232,8 @@ public class GemFireCacheImpl
 
           stopRedisServer();
 
+          stopRestAgentServer();
+
           // no need to track PR instances since we won't create any more
           // cacheServers or gatewayHubs
           if (this.partitionedRegions != null) {
@@ -2459,7 +2461,6 @@ public class GemFireCacheImpl
         CacheLifecycleListener listener = (CacheLifecycleListener) iter.next();
         listener.cacheClosed(this);
       }
-      stopRestAgentServer();
       // Fix for #49856
       SequenceLoggerImpl.signalCacheClose();
       SystemFailure.signalCacheClose();


[02/51] [abbrv] geode git commit: GEODE-2777 Update docs to be for Geode version 1.2

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/15250979/geode-book/master_middleman/source/subnavs/geode-subnav.erb
----------------------------------------------------------------------
diff --git a/geode-book/master_middleman/source/subnavs/geode-subnav.erb b/geode-book/master_middleman/source/subnavs/geode-subnav.erb
index eb9afae..c97e5ec 100644
--- a/geode-book/master_middleman/source/subnavs/geode-subnav.erb
+++ b/geode-book/master_middleman/source/subnavs/geode-subnav.erb
@@ -21,368 +21,368 @@ limitations under the License.
     <div class="nav-content">
         <ul>
             <li>
-                <a href="/docs/guide/11/about_geode.html">Apache Geode Documentation</a>
+                <a href="/docs/guide/12/about_geode.html">Apache Geode Documentation</a>
             </li>
             <li class="has_submenu">
-                <a href="/docs/guide/11/getting_started/book_intro.html">Getting Started with Apache Geode</a>
+                <a href="/docs/guide/12/getting_started/book_intro.html">Getting Started with Apache Geode</a>
                 <ul>
                     <li>
-                        <a href="/docs/guide/11/getting_started/geode_overview.html">About Apache Geode</a>
+                        <a href="/docs/guide/12/getting_started/geode_overview.html">About Apache Geode</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/getting_started/product_intro.html">Main Features of Apache Geode</a>
+                        <a href="/docs/guide/12/getting_started/product_intro.html">Main Features of Apache Geode</a>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/prereq_and_install.html">Prerequisites and Installation Instructions</a>
+                        <a href="/docs/guide/12/prereq_and_install.html">Prerequisites and Installation Instructions</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/getting_started/system_requirements/host_machine.html">Host Machine Requirements</a>
+                                <a href="/docs/guide/12/getting_started/system_requirements/host_machine.html">Host Machine Requirements</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/getting_started/installation/install_standalone.html">How to Install</a>
+                                <a href="/docs/guide/12/getting_started/installation/install_standalone.html">How to Install</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/getting_started/setup_classpath.html">Setting Up the CLASSPATH</a>
+                                <a href="/docs/guide/12/getting_started/setup_classpath.html">Setting Up the CLASSPATH</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/getting_started/uninstall_geode.html">How to Uninstall</a>
+                                <a href="/docs/guide/12/getting_started/uninstall_geode.html">How to Uninstall</a>
                             </li>
                         </ul>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/getting_started/15_minute_quickstart_gfsh.html">Apache Geode in 15 Minutes or Less</a>
+                        <a href="/docs/guide/12/getting_started/15_minute_quickstart_gfsh.html">Apache Geode in 15 Minutes or Less</a>
                     </li>
                 </ul>
             </li>
             <li class="has_submenu">
-                <a href="/docs/guide/11/configuring/chapter_overview.html">Configuring and Running a Cluster</a>
+                <a href="/docs/guide/12/configuring/chapter_overview.html">Configuring and Running a Cluster</a>
                 <ul>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/gfsh_persist.html">Overview of the Cluster Configuration Service</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/gfsh_persist.html">Overview of the Cluster Configuration Service</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/persisting_configurations.html">Tutorial\u2014Creating and Using a Cluster Configuration</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/persisting_configurations.html">Tutorial\u2014Creating and Using a Cluster Configuration</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/deploying_application_jars.html">Deploying Application JARs to Apache Geode Members</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/deploying_application_jars.html">Deploying Application JARs to Apache Geode Members</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/using_member_groups.html">Using Member Groups</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/using_member_groups.html">Using Member Groups</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/export-import.html">Exporting and Importing Cluster Configurations</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/export-import.html">Exporting and Importing Cluster Configurations</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/gfsh_config_troubleshooting.html">Cluster Configuration Files and Troubleshooting</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/gfsh_config_troubleshooting.html">Cluster Configuration Files and Troubleshooting</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/gfsh_load_from_shared_dir.html">Loading Existing Configuration Files into Cluster Configuration</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/gfsh_load_from_shared_dir.html">Loading Existing Configuration Files into Cluster Configuration</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/cluster_config/gfsh_remote.html">Using gfsh to Manage a Remote Cluster Over HTTP or HTTPS</a>
+                        <a href="/docs/guide/12/configuring/cluster_config/gfsh_remote.html">Using gfsh to Manage a Remote Cluster Over HTTP or HTTPS</a>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/configuring/running/deploying_config_files.html">Deploying Configuration Files without the Cluster Configuration Service</a>
+                        <a href="/docs/guide/12/configuring/running/deploying_config_files.html">Deploying Configuration Files without the Cluster Configuration Service</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/deploy_config_files_intro.html">Main Steps to Deploying Configuration Files</a>
+                                <a href="/docs/guide/12/configuring/running/deploy_config_files_intro.html">Main Steps to Deploying Configuration Files</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/default_file_specs.html">Default File Specifications and Search Locations</a>
+                                <a href="/docs/guide/12/configuring/running/default_file_specs.html">Default File Specifications and Search Locations</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/change_file_spec.html">Changing the File Specifications</a>
+                                <a href="/docs/guide/12/configuring/running/change_file_spec.html">Changing the File Specifications</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/deploying_config_jar_files.html">Deploying Configuration Files in JAR Files</a>
+                                <a href="/docs/guide/12/configuring/running/deploying_config_jar_files.html">Deploying Configuration Files in JAR Files</a>
                             </li>
                         </ul>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/running/starting_up_shutting_down.html">Starting Up and Shutting Down Your System</a>
+                        <a href="/docs/guide/12/configuring/running/starting_up_shutting_down.html">Starting Up and Shutting Down Your System</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/running/running_the_locator.html">Running Geode Locator Processes</a>
+                        <a href="/docs/guide/12/configuring/running/running_the_locator.html">Running Geode Locator Processes</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/running/running_the_cacheserver.html">Running Geode Server Processes</a>
+                        <a href="/docs/guide/12/configuring/running/running_the_cacheserver.html">Running Geode Server Processes</a>
                     </li>
                     <li>
-                        <a href="/docs/guide/11/configuring/running/managing_output_files.html">Managing System Output Files</a>
+                        <a href="/docs/guide/12/configuring/running/managing_output_files.html">Managing System Output Files</a>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/configuring/running/firewall_ports_config.html">Firewall Considerations</a>
+                        <a href="/docs/guide/12/configuring/running/firewall_ports_config.html">Firewall Considerations</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/firewalls_connections.html">Firewalls and Connections</a>
+                                <a href="/docs/guide/12/configuring/running/firewalls_connections.html">Firewalls and Connections</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/configuring/running/firewalls_ports.html">Firewalls and Ports</a>
+                                <a href="/docs/guide/12/configuring/running/firewalls_ports.html">Firewalls and Ports</a>
                             </li>
                         </ul>
                     </li>
                 </ul>
             </li>
             <li class="has_submenu">
-                <a href="/docs/guide/11/basic_config/book_intro.html">Basic Configuration and Programming</a>
+                <a href="/docs/guide/12/basic_config/book_intro.html">Basic Configuration and Programming</a>
                 <ul>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/basic_config/config_concepts/chapter_overview.html">
+                        <a href="/docs/guide/12/basic_config/config_concepts/chapter_overview.html">
                             Distributed System and Cache Configuration</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/basic_config/config_concepts/distributed_system_member_configuration.html">Distributed System Members</a>
+                                <a href="/docs/guide/12/basic_config/config_concepts/distributed_system_member_configuration.html">Distributed System Members</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/gemfire_properties/setting_distributed_properties.html">Setting Properties</a>
+                                <a href="/docs/guide/12/basic_config/gemfire_properties/setting_distributed_properties.html">Setting Properties</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/setting_cache_properties.html">Options for Configuring the Cache and Data Regions
+                                <a href="/docs/guide/12/basic_config/the_cache/setting_cache_properties.html">Options for Configuring the Cache and Data Regions
                                 </a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/config_concepts/local_vs_remote.html">Local and Remote Membership and Caching</a>
+                                <a href="/docs/guide/12/basic_config/config_concepts/local_vs_remote.html">Local and Remote Membership and Caching</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/basic_config/the_cache/chapter_overview.html">Cache Management</a>
+                        <a href="/docs/guide/12/basic_config/the_cache/chapter_overview.html">Cache Management</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/intro_cache_management.html">Introduction to Cache Management</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/intro_cache_management.html">Introduction to Cache Management</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/managing_a_peer_server_cache.html">Managing a Peer or Server Cache</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/managing_a_peer_server_cache.html">Managing a Peer or Server Cache</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/managing_a_client_cache.html">Managing a Client Cache</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/managing_a_client_cache.html">Managing a Client Cache</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/managing_a_secure_cache.html">Managing a Cache in a Secure System</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/managing_a_secure_cache.html">Managing a Cache in a Secure System</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/managing_a_multiuser_cache.html">Managing RegionServices for Multiple Secure Users</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/managing_a_multiuser_cache.html">Managing RegionServices for Multiple Secure Users</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/the_cache/setting_cache_initializer.html">Launching an Application after Initializing the Cache</a>
+                                <a href="/docs/guide/12/basic_config/the_cache/setting_cache_initializer.html">Launching an Application after Initializing the Cache</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/basic_config/data_regions/chapter_overview.html">Data Regions</a>
+                        <a href="/docs/guide/12/basic_config/data_regions/chapter_overview.html">Data Regions</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/managing_data_regions.html">Region Management</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/managing_data_regions.html">Region Management</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/region_naming.html">Region Naming</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/region_naming.html">Region Naming</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/region_shortcuts.html">Region Shortcuts and Custom Named Region Attributes</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/region_shortcuts.html">Region Shortcuts and Custom Named Region Attributes</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/store_retrieve_region_shortcuts.html">Storing and Retrieving Region Shortcuts and Custom Named Region Attributes</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/store_retrieve_region_shortcuts.html">Storing and Retrieving Region Shortcuts and Custom Named Region Attributes</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/managing_region_attributes.html">Managing Region Attributes</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/managing_region_attributes.html">Managing Region Attributes</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/creating_custom_attributes.html">Creating Custom Attributes for Regions and Entries</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/creating_custom_attributes.html">Creating Custom Attributes for Regions and Entries</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_regions/new_region_existing_data.html">Building a New Region with Existing Content</a>
+                                <a href="/docs/guide/12/basic_config/data_regions/new_region_existing_data.html">Building a New Region with Existing Content</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/basic_config/data_entries_custom_classes/chapter_overview.html">
+                        <a href="/docs/guide/12/basic_config/data_entries_custom_classes/chapter_overview.html">
                             Data Entries
                         </a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_entries_custom_classes/managing_data_entries.html">Managing Data Entries</a>
+                                <a href="/docs/guide/12/basic_config/data_entries_custom_classes/managing_data_entries.html">Managing Data Entries</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/basic_config/data_entries_custom_classes/using_custom_classes.html">Requirements for Using Custom Classes in Data Caching</a>
+                                <a href="/docs/guide/12/basic_config/data_entries_custom_classes/using_custom_classes.html">Requirements for Using Custom Classes in Data Caching</a>
                             </li>
                         </ul>
                     </li>
                 </ul>
             </li>
             <li class="has_submenu">
-                <a href="/docs/guide/11/topologies_and_comm/book_intro.html">Topologies and Communication</a>
+                <a href="/docs/guide/12/topologies_and_comm/book_intro.html">Topologies and Communication</a>
                 <ul>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/chapter_overview.html">Topology and Communication General Concepts</a>
+                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/chapter_overview.html">Topology and Communication General Concepts</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/topology_types.html">Topology Types</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/topology_types.html">Topology Types</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/member_communication.html">Planning Topology and Communication
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/member_communication.html">Planning Topology and Communication
                                 </a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/how_member_discovery_works.html">How Member Discovery Works</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/how_member_discovery_works.html">How Member Discovery Works</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/how_communication_works.html">How Communication Works</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/how_communication_works.html">How Communication Works</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/using_bind_addresses.html">Using Bind Addresses</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/using_bind_addresses.html">Using Bind Addresses</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/IPv4_and_IPv6.html">Choosing Between IPv4 and IPv6</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/IPv4_and_IPv6.html">Choosing Between IPv4 and IPv6</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/topologies_and_comm/p2p_configuration/chapter_overview.html">Peer-to-Peer Configuration</a>
+                        <a href="/docs/guide/12/topologies_and_comm/p2p_configuration/chapter_overview.html">Peer-to-Peer Configuration</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/p2p_configuration/setting_up_a_p2p_system.html">Configuring Peer-to-Peer Discovery</a>
+                                <a href="/docs/guide/12/topologies_and_comm/p2p_configuration/setting_up_a_p2p_system.html">Configuring Peer-to-Peer Discovery</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/p2p_configuration/setting_up_peer_communication.html">Configuring Peer Communication</a>
+                                <a href="/docs/guide/12/topologies_and_comm/p2p_configuration/setting_up_peer_communication.html">Configuring Peer Communication</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/p2p_configuration/configuring_peer_member_groups.html">Organizing Peers into Logical Member Groups</a>
+                                <a href="/docs/guide/12/topologies_and_comm/p2p_configuration/configuring_peer_member_groups.html">Organizing Peers into Logical Member Groups</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/topologies_and_comm/cs_configuration/chapter_overview.html">Client/Server Configuration</a>
+                        <a href="/docs/guide/12/topologies_and_comm/cs_configuration/chapter_overview.html">Client/Server Configuration</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/cs_configuration/standard_client_server_deployment.html">Standard Client/Server Deployment</a>
+                                <a href="/docs/guide/12/topologies_and_comm/cs_configuration/standard_client_server_deployment.html">Standard Client/Server Deployment</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/how_server_discovery_works.html">How Server Discovery Works</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/how_server_discovery_works.html">How Server Discovery Works</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/how_the_pool_manages_connections.html">How Client/Server Connections Work</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/how_the_pool_manages_connections.html">How Client/Server Connections Work</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/cs_configuration/setting_up_a_client_server_system.html">Configuring a Client/Server System</a>
+                                <a href="/docs/guide/12/topologies_and_comm/cs_configuration/setting_up_a_client_server_system.html">Configuring a Client/Server System</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/cs_configuration/configure_servers_into_logical_groups.html">Organizing Servers Into Logical Member Groups</a>
+                                <a href="/docs/guide/12/topologies_and_comm/cs_configuration/configure_servers_into_logical_groups.html">Organizing Servers Into Logical Member Groups</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/cs_configuration/client_server_example_configurations.html">Client/Server Example Configurations</a>
+                                <a href="/docs/guide/12/topologies_and_comm/cs_configuration/client_server_example_configurations.html">Client/Server Example Configurations</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/cs_configuration/client_server_whats_next.html">Fine-Tuning Your Client/Server Configuration</a>
+                                <a href="/docs/guide/12/topologies_and_comm/cs_configuration/client_server_whats_next.html">Fine-Tuning Your Client/Server Configuration</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/topologies_and_comm/multi_site_configuration/chapter_overview.html">Multi-site (WAN) Configuration</a>
+                        <a href="/docs/guide/12/topologies_and_comm/multi_site_configuration/chapter_overview.html">Multi-site (WAN) Configuration</a>
                         <ul>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/topologies_and_comm/topology_concepts/how_multisite_systems_work.html">How Multi-site (WAN) Systems Work</a>
+                                <a href="/docs/guide/12/topologies_and_comm/topology_concepts/how_multisite_systems_work.html">How Multi-site (WAN) Systems Work</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/multisite_overview.html#topic_70045702D3994BC692E75102CE01BD7C">
+                                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/multisite_overview.html#topic_70045702D3994BC692E75102CE01BD7C">
                                             Overview of Multi-site Caching</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/multisite_overview.html#topic_C74A0961937640B199396DC925D8D782">Consistency for WAN Updates</a>
+                                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/multisite_overview.html#topic_C74A0961937640B199396DC925D8D782">Consistency for WAN Updates</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/multisite_overview.html#topic_1742957C8D4B4F7590847EB8DB6CD4F7">Discovery for Multi-Site Systems</a>
+                                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/multisite_overview.html#topic_1742957C8D4B4F7590847EB8DB6CD4F7">Discovery for Multi-Site Systems</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/multisite_overview.html#topic_9AA37B43642D4DE19072CA3367C849BA">Gateway Senders</a>
+                                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/multisite_overview.html#topic_9AA37B43642D4DE19072CA3367C849BA">Gateway Senders</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/topologies_and_comm/topology_concepts/multisite_overview.html#topic_4DB3D9CF01AD4F4899457D1250468D00">Gateway Receivers</a>
+                                        <a href="/docs/guide/12/topologies_and_comm/topology_concepts/multisite_overview.html#topic_4DB3D9CF01AD4F4899457D1250468D00">Gateway Receivers</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/multi_site_configuration/multisite_topologies.html">Multi-site (WAN) Topologies</a>
+                                <a href="/docs/guide/12/topologies_and_comm/multi_site_configuration/multisite_topologies.html">Multi-site (WAN) Topologies</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/topologies_and_comm/multi_site_configuration/setting_up_a_multisite_system.html">Configuring a Multi-site (WAN) System</a>
+                                <a href="/docs/guide/12/topologies_and_comm/multi_site_configuration/setting_up_a_multisite_system.html">Configuring a Multi-site (WAN) System</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/developing/events/filtering_multisite_events.html">Filtering Events for Multi-Site (WAN) Distribution</a>
+                                <a href="/docs/guide/12/developing/events/filtering_multisite_events.html">Filtering Events for Multi-Site (WAN) Distribution</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/developing/events/resolving_multisite_conflicts.html">Resolving Conflicting Events</a>
+                                <a href="/docs/guide/12/developing/events/resolving_multisite_conflicts.html">Resolving Conflicting Events</a>
                             </li>
                         </ul>
                     </li>
                 </ul>
             </li>
             <li class="has_submenu">
-                <a href="/docs/guide/11/managing/book_intro.html">Managing Apache Geode</a>
+                <a href="/docs/guide/12/managing/book_intro.html">Managing Apache Geode</a>
                 <ul>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/management/management_and_monitoring.html">Apache Geode Management and Monitoring</a>
+                        <a href="/docs/guide/12/managing/management/management_and_monitoring.html">Apache Geode Management and Monitoring</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/management/management_and_monitoring_features.html">Management and Monitoring Features</a>
+                                <a href="/docs/guide/12/managing/management/management_and_monitoring_features.html">Management and Monitoring Features</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/management/mm_overview.html">Overview of Geode Management and Monitoring Tools</a>
+                                <a href="/docs/guide/12/managing/management/mm_overview.html">Overview of Geode Management and Monitoring Tools</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/management/management_system_overview.html">
+                                <a href="/docs/guide/12/managing/management/management_system_overview.html">
                                     Architecture and Components</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/management/jmx_manager_node.html#topic_36C918B4202D45F3AC225FFD23B11D7C">JMX Manager Operations</a>
+                                <a href="/docs/guide/12/managing/management/jmx_manager_node.html#topic_36C918B4202D45F3AC225FFD23B12D7C">JMX Manager Operations</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/management/jmx_manager_operations.html">Starting a JMX Manager</a>
+                                        <a href="/docs/guide/12/managing/management/jmx_manager_operations.html">Starting a JMX Manager</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/management/jmx_manager_operations.html#topic_263072624B8D4CDBAD18B82E07AA44B6">Configuring a JMX Manager</a>
+                                        <a href="/docs/guide/12/managing/management/jmx_manager_operations.html#topic_263072624B8D4CDBAD18B82E07AA44B6">Configuring a JMX Manager</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/management/jmx_manager_operations.html#topic_5B6DF783A14241399DC25C6EE8D0048A">Stopping a JMX Manager</a>
+                                        <a href="/docs/guide/12/managing/management/jmx_manager_operations.html#topic_5B6DF783A14241399DC25C6EE8D0048A">Stopping a JMX Manager</a>
                                     </li>
                                 </ul>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/management/mbean_architecture.html">Federated MBean Architecture</a>
+                                <a href="/docs/guide/12/managing/management/mbean_architecture.html">Federated MBean Architecture</a>
                                 <ul>
                                     <li class="has_submenu">
-                                        <a href="/docs/guide/11/managing/management/list_of_mbeans.html">List of Geode JMX MBeans</a>
+                                        <a href="/docs/guide/12/managing/management/list_of_mbeans.html">List of Geode JMX MBeans</a>
                                         <ul>
                                             <li>
-                                                <a href="/docs/guide/11/managing/management/list_of_mbeans_full.html">JMX Manager MBeans</a>
+                                                <a href="/docs/guide/12/managing/management/list_of_mbeans_full.html">JMX Manager MBeans</a>
                                             </li>
                                             <li>
-                                                <a href="/docs/guide/11/managing/management/list_of_mbeans_full.html#topic_48194A5BDF3F40F68E95A114DD702413">Managed Node MBeans</a>
+                                                <a href="/docs/guide/12/managing/management/list_of_mbeans_full.html#topic_48194A5BDF3F40F68E95A124DD702413">Managed Node MBeans</a>
                                             </li>
                                         </ul>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/management/mbeans_jconsole.html">Browsing Geode MBeans through JConsole</a>
+                                        <a href="/docs/guide/12/managing/management/mbeans_jconsole.html">Browsing Geode MBeans through JConsole</a>
                                     </li>
                                     <li class="has_submenu">
-                                        <a href="/docs/guide/11/managing/management/mbean_notifications.html">Geode JMX MBean Notifications</a>
+                                        <a href="/docs/guide/12/managing/management/mbean_notifications.html">Geode JMX MBean Notifications</a>
                                         <ul>
                                             <li>
-                                                <a href="/docs/guide/11/managing/management/notification_federation_and_alerts.html">Notification Federation</a>
+                                                <a href="/docs/guide/12/managing/management/notification_federation_and_alerts.html">Notification Federation</a>
                                             </li>
                                             <li class="has_submenu">
-                                                <a href="/docs/guide/11/managing/management/list_of_mbean_notifications.html">List of JMX MBean Notifications</a>
+                                                <a href="/docs/guide/12/managing/management/list_of_mbean_notifications.html">List of JMX MBean Notifications</a>
                                                 <ul>
                                                     <li>
-                                                        <a href="/docs/guide/11/managing/management/list_of_mbean_notifications.html#reference_czt_hq2_vj">MemberMXBean Notifications</a>
+                                                        <a href="/docs/guide/12/managing/management/list_of_mbean_notifications.html#reference_czt_hq2_vj">MemberMXBean Notifications</a>
                                                     </li>
                                                     <li>
-                                                        <a href="/docs/guide/11/managing/management/list_of_mbean_notifications.html#reference_dzt_hq2_vj">MemberMXBean Gateway Notifications</a>
+                                                        <a href="/docs/guide/12/managing/management/list_of_mbean_notifications.html#reference_dzt_hq2_vj">MemberMXBean Gateway Notifications</a>
                                                     </li>
                                                     <li>
-                                                        <a href="/docs/guide/11/managing/management/list_of_mbean_notifications.html#cacheservermxbean_notifications">CacheServerMXBean Notifications</a>
+                                                        <a href="/docs/guide/12/managing/management/list_of_mbean_notifications.html#cacheservermxbean_notifications">CacheServerMXBean Notifications</a>
                                                     </li>
                                                     <li>
-                                                        <a href="/docs/guide/11/managing/management/list_of_mbean_notifications.html#distributedsystemmxbean_notifications">DistributedSystemMXBean Notifications</a>
+                                                        <a href="/docs/guide/12/managing/management/list_of_mbean_notifications.html#distributedsystemmxbean_notifications">DistributedSystemMXBean Notifications</a>
                                                     </li>
                                                 </ul>
                                             </li>
@@ -391,1309 +391,1309 @@ limitations under the License.
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/management/configuring_rmi_connector.html">Configuring RMI Registry Ports and RMI Connectors</a>
+                                <a href="/docs/guide/12/managing/management/configuring_rmi_connector.html">Configuring RMI Registry Ports and RMI Connectors</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/management/gfsh_and_management_api.html">Executing gfsh Commands through the Management API</a>
+                                <a href="/docs/guide/12/managing/management/gfsh_and_management_api.html">Executing gfsh Commands through the Management API</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/heap_use/heap_management.html">Managing Heap and Off-heap Memory</a>
+                        <a href="/docs/guide/12/managing/heap_use/heap_management.html">Managing Heap and Off-heap Memory</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#section_590DA955523246ED980E4E351FF81F71">Tuning the JVM's Garbage Collection Parameters</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#section_590DA955523246ED980E4E351FF81F71">Tuning the JVM's Garbage Collection Parameters</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#how_the_resource_manager_works">Using the Geode Resource Manager</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#how_the_resource_manager_works">Using the Geode Resource Manager</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#configuring_resource_manager_controlling_heap_use">Controlling Heap Use with the Resource Manager</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#configuring_resource_manager_controlling_heap_use">Controlling Heap Use with the Resource Manager</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#configuring_resource_manager__section_4949882892DA46F6BB8588FA97037F45">Configure Geode for Heap LRU Management</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#configuring_resource_manager__section_4949882892DA46F6BB8588FA97037F45">Configure Geode for Heap LRU Management</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#set_jvm_gc_tuning_params">Set the JVM GC Tuning Parameters</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#set_jvm_gc_tuning_params">Set the JVM GC Tuning Parameters</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#configuring_resource_manager__section_DE1CC494C2B547B083AA00821250972A">Monitor and Tune Heap LRU Configurations</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#configuring_resource_manager__section_DE1CC494C2B547B083AA00821250972A">Monitor and Tune Heap LRU Configurations</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/heap_management.html#resource_manager_example_configurations">Resource Manager Example Configurations</a>
+                                <a href="/docs/guide/12/managing/heap_use/heap_management.html#resource_manager_example_configurations">Resource Manager Example Configurations</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/off_heap_management.html">Managing Off-Heap Memory</a>
+                                <a href="/docs/guide/12/managing/heap_use/off_heap_management.html">Managing Off-Heap Memory</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/heap_use/lock_memory.html">Locking Memory (Linux Systems Only)</a>
+                                <a href="/docs/guide/12/managing/heap_use/lock_memory.html">Locking Memory (Linux Systems Only)</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/disk_storage/chapter_overview.html">Disk Storage</a>
+                        <a href="/docs/guide/12/managing/disk_storage/chapter_overview.html">Disk Storage</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/how_disk_stores_work.html">How Disk Stores Work</a>
+                                <a href="/docs/guide/12/managing/disk_storage/how_disk_stores_work.html">How Disk Stores Work</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/file_names_and_extensions.html">Disk Store File Names and Extensions</a>
+                                <a href="/docs/guide/12/managing/disk_storage/file_names_and_extensions.html">Disk Store File Names and Extensions</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/operation_logs.html">Disk Store Operation Logs</a>
+                                <a href="/docs/guide/12/managing/disk_storage/operation_logs.html">Disk Store Operation Logs</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/disk_storage/overview_using_disk_stores.html">Configuring Disk Stores</a>
+                                <a href="/docs/guide/12/managing/disk_storage/overview_using_disk_stores.html">Configuring Disk Stores</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/using_disk_stores.html">Designing and Configuring Disk Stores</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/using_disk_stores.html">Designing and Configuring Disk Stores</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/disk_store_configuration_params.html">Disk Store Configuration Parameters</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/disk_store_configuration_params.html">Disk Store Configuration Parameters</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/using_the_default_disk_store.html">Modifying the Default Disk Store</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/using_the_default_disk_store.html">Modifying the Default Disk Store</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/optimize_availability_and_performance.html">
+                                <a href="/docs/guide/12/managing/disk_storage/optimize_availability_and_performance.html">
                                     Optimizing a System with Disk Stores</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/starting_system_with_disk_stores.html">Start Up and Shut Down with Disk Stores</a>
+                                <a href="/docs/guide/12/managing/disk_storage/starting_system_with_disk_stores.html">Start Up and Shut Down with Disk Stores</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/disk_storage/managing_disk_stores.html">Disk Store Management</a>
+                                <a href="/docs/guide/12/managing/disk_storage/managing_disk_stores.html">Disk Store Management</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/managing_disk_stores_cmds.html">Disk Store Management Commands and Operations</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/managing_disk_stores_cmds.html">Disk Store Management Commands and Operations</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/validating_disk_store.html">Validating a Disk Store</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/validating_disk_store.html">Validating a Disk Store</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/compacting_disk_stores.html">Running Compaction on Disk Store Log Files</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/compacting_disk_stores.html">Running Compaction on Disk Store Log Files</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/keeping_offline_disk_store_in_sync.html">Keeping a Disk Store Synchronized with the Cache</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/keeping_offline_disk_store_in_sync.html">Keeping a Disk Store Synchronized with the Cache</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/disk_free_space_monitoring.html">Configuring Disk Free Space Monitoring
+                                        <a href="/docs/guide/12/managing/disk_storage/disk_free_space_monitoring.html">Configuring Disk Free Space Monitoring
                                         </a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/handling_missing_disk_stores.html">Handling Missing Disk Stores</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/handling_missing_disk_stores.html">Handling Missing Disk Stores</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/disk_storage/managing_disk_buffer_flushes.html">Altering When Buffers Are Flushed to Disk</a>
+                                        <a href="/docs/guide/12/managing/disk_storage/managing_disk_buffer_flushes.html">Altering When Buffers Are Flushed to Disk</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/disk_storage/backup_restore_disk_store.html">Creating Backups for System Recovery and Operational Management</a>
+                                <a href="/docs/guide/12/managing/disk_storage/backup_restore_disk_store.html">Creating Backups for System Recovery and Operational Management</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/cache_snapshots/chapter_overview.html">Cache and Region Snapshots</a>
+                        <a href="/docs/guide/12/managing/cache_snapshots/chapter_overview.html">Cache and Region Snapshots</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/cache_snapshots/using_cache_and_region_snapshots.html">Usage and Performance Notes</a>
+                                <a href="/docs/guide/12/managing/cache_snapshots/using_cache_and_region_snapshots.html">Usage and Performance Notes</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/cache_snapshots/exporting_a_snapshot.html">Exporting Cache and Region Snapshots</a>
+                                <a href="/docs/guide/12/managing/cache_snapshots/exporting_a_snapshot.html">Exporting Cache and Region Snapshots</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/cache_snapshots/importing_a_snapshot.html">Importing Cache and Region Snapshots</a>
+                                <a href="/docs/guide/12/managing/cache_snapshots/importing_a_snapshot.html">Importing Cache and Region Snapshots</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/cache_snapshots/filtering_snapshot_entries.html">Filtering Entries During Import or Export</a>
+                                <a href="/docs/guide/12/managing/cache_snapshots/filtering_snapshot_entries.html">Filtering Entries During Import or Export</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/cache_snapshots/read_snapshots_programmatically.html">Reading Snapshots Programmatically</a>
+                                <a href="/docs/guide/12/managing/cache_snapshots/read_snapshots_programmatically.html">Reading Snapshots Programmatically</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/region_compression/region_compression.html">Region Compression</a>
+                        <a href="/docs/guide/12/managing/region_compression/region_compression.html">Region Compression</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/region_compression/region_compression.html#concept_a2c_rhc_gl">Guidelines on Using Compression</a>
+                                <a href="/docs/guide/12/managing/region_compression/region_compression.html#concept_a2c_rhc_gl">Guidelines on Using Compression</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/region_compression/region_compression.html#topic_inm_whc_gl">How to Enable Compression in a Region</a>
+                                <a href="/docs/guide/12/managing/region_compression/region_compression.html#topic_inm_whc_gl">How to Enable Compression in a Region</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/region_compression/region_compression.html#topic_hqf_syj_g4">Working with Compressors
+                                <a href="/docs/guide/12/managing/region_compression/region_compression.html#topic_hqf_syj_g4">Working with Compressors
                                 </a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/region_compression/region_compression.html#topic_omw_j3c_gl">Comparing Performance of Compressed and Non-Compressed Regions</a>
+                                <a href="/docs/guide/12/managing/region_compression/region_compression.html#topic_omw_j3c_gl">Comparing Performance of Compressed and Non-Compressed Regions</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/network_partitioning/chapter_overview.html">Network Partitioning</a>
+                        <a href="/docs/guide/12/managing/network_partitioning/chapter_overview.html">Network Partitioning</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/how_network_partitioning_management_works.html">How Network Partitioning Management Works</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/how_network_partitioning_management_works.html">How Network Partitioning Management Works</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/failure_detection.html">Failure Detection and Membership Views</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/failure_detection.html">Failure Detection and Membership Views</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/membership_coordinators_lead_members_and_weighting.html">Membership Coordinators, Lead Members and Member Weighting</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/membership_coordinators_lead_members_and_weighting.html">Membership Coordinators, Lead Members and Member Weighting</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/network_partitioning_scenarios.html">Network Partitioning Scenarios</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/network_partitioning_scenarios.html">Network Partitioning Scenarios</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/handling_network_partitioning.html">Configure Apache Geode to Handle Network Partitioning</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/handling_network_partitioning.html">Configure Apache Geode to Handle Network Partitioning</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/network_partitioning/preventing_network_partitions.html">Preventing Network Partitions</a>
+                                <a href="/docs/guide/12/managing/network_partitioning/preventing_network_partitions.html">Preventing Network Partitions</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/security/chapter_overview.html">Security</a>
+                        <a href="/docs/guide/12/managing/security/chapter_overview.html">Security</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/security/implementing_security.html">Security Implementation Introduction and Overview</a>
+                                <a href="/docs/guide/12/managing/security/implementing_security.html">Security Implementation Introduction and Overview</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/security/security_audit_overview.html">Security Detail Considerations</a>
+                                <a href="/docs/guide/12/managing/security/security_audit_overview.html">Security Detail Considerations</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/security-audit.html">External Interfaces, Ports, and Services</a>
+                                        <a href="/docs/guide/12/managing/security/security-audit.html">External Interfaces, Ports, and Services</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/security-audit.html#topic_263072624B8D4CDBAD18B82E07AA44B6">Resources That Must Be Protected</a>
+                                        <a href="/docs/guide/12/managing/security/security-audit.html#topic_263072624B8D4CDBAD18B82E07AA44B6">Resources That Must Be Protected</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/security-audit.html#topic_5B6DF783A14241399DC25C6EE8D0048A">Log File Locations</a>
+                                        <a href="/docs/guide/12/managing/security/security-audit.html#topic_5B6DF783A14241399DC25C6EE8D0048A">Log File Locations</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/properties_file.html">Where to Place Security Configuration Settings</a>
+                                        <a href="/docs/guide/12/managing/security/properties_file.html">Where to Place Security Configuration Settings</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/security/enable_security.html">Enable Security with Property Definitions</a>
+                                <a href="/docs/guide/12/managing/security/enable_security.html">Enable Security with Property Definitions</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/security/authentication_overview.html">Authentication</a>
+                                <a href="/docs/guide/12/managing/security/authentication_overview.html">Authentication</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_authentication.html">Implementing Authentication</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_authentication.html">Implementing Authentication</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/encrypting_passwords.html">Encrypting Passwords for Use in cache.xml</a>
+                                        <a href="/docs/guide/12/managing/security/encrypting_passwords.html">Encrypting Passwords for Use in cache.xml</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/encrypting_with_diffie_helman.html">Encrypt Credentials with Diffie-Hellman</a>
+                                        <a href="/docs/guide/12/managing/security/encrypting_with_diffie_helman.html">Encrypt Credentials with Diffie-Hellman</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/authentication_examples.html">Authentication Example</a>
+                                        <a href="/docs/guide/12/managing/security/authentication_examples.html">Authentication Example</a>
                                     </li>
                                 </ul>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/security/authorization_overview.html">Authorization</a>
+                                <a href="/docs/guide/12/managing/security/authorization_overview.html">Authorization</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_authorization.html">Implementing Authorization</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_authorization.html">Implementing Authorization</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/authorization_example.html">Authorization Example</a>
+                                        <a href="/docs/guide/12/managing/security/authorization_example.html">Authorization Example</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/security/post_processing.html">Post Processing of Region Data</a>
+                                <a href="/docs/guide/12/managing/security/post_processing.html">Post Processing of Region Data</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/security/ssl_overview.html">SSL</a>
+                                <a href="/docs/guide/12/managing/security/ssl_overview.html">SSL</a>
                                 <ul>
                                     <li class="has_submenu">
-                                        <a href="/docs/guide/11/managing/security/implementing_ssl.html">Configuring SSL</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_ssl.html">Configuring SSL</a>
                                     <ul>
                                         <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_ssl.html#ssl_configurable_components">SSL-Configurable Components</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_ssl.html#ssl_configurable_components">SSL-Configurable Components</a>
                                         </li>
                                         <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_ssl.html#ssl_configuration_properties">SSL Configuration Properties</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_ssl.html#ssl_configuration_properties">SSL Configuration Properties</a>
                                         </li>
                                         <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_ssl.html#ssl_property_reference_tables">SSL Property Reference Tables</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_ssl.html#ssl_property_reference_tables">SSL Property Reference Tables</a>
                                         </li>
                                         <li>
-                                        <a href="/docs/guide/11/managing/security/implementing_ssl.html#implementing_ssl__sec_ssl_impl_proc">Procedure</a>
+                                        <a href="/docs/guide/12/managing/security/implementing_ssl.html#implementing_ssl__sec_ssl_impl_proc">Procedure</a>
                                         </li>
                                     </ul>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/security/ssl_example.html">SSL Sample Implementation</a>
+                                        <a href="/docs/guide/12/managing/security/ssl_example.html">SSL Sample Implementation</a>
                                     </li>
                                 </ul>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/monitor_tune/chapter_overview.html">Performance Tuning and Configuration</a>
+                        <a href="/docs/guide/12/managing/monitor_tune/chapter_overview.html">Performance Tuning and Configuration</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/monitor_tune/performance_on_vsphere.html">Improving Performance on vSphere</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/performance_on_vsphere.html">Improving Performance on vSphere</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/monitor_tune/performance_controls.html">Performance Controls</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/performance_controls.html">Performance Controls</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/performance_controls_data_serialization.html">Data Serialization</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/performance_controls_data_serialization.html">Data Serialization</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/performance_controls_setting_cache_timeouts.html">Setting Cache Timeouts</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/performance_controls_setting_cache_timeouts.html">Setting Cache Timeouts</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/performance_controls_controlling_socket_use.html">Controlling Socket Use</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/performance_controls_controlling_socket_use.html">Controlling Socket Use</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/performance_controls_managing_slow_receivers.html">Management of Slow Receivers</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/performance_controls_managing_slow_receivers.html">Management of Slow Receivers</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/performance_controls_increasing_cache_hits.html">Increasing the Ratio of Cache Hits</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/performance_controls_increasing_cache_hits.html">Increasing the Ratio of Cache Hits</a>
                                     </li>
                                 </ul>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/monitor_tune/system_member_performance.html">System Member Performance</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/system_member_performance.html">System Member Performance</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/system_member_performance_distributed_system_member.html">Distributed System Member Properties</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/system_member_performance_distributed_system_member.html">Distributed System Member Properties</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/system_member_performance_jvm_mem_settings.html">JVM Memory Settings and System Performance</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/system_member_performance_jvm_mem_settings.html">JVM Memory Settings and System Performance</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/system_member_performance_garbage.html">Garbage Collection and System Performance</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/system_member_performance_garbage.html">Garbage Collection and System Performance</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/system_member_performance_connection_thread_settings.html">Connection Thread Settings and Performance</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/system_member_performance_connection_thread_settings.html">Connection Thread Settings and Performance</a>
                                     </li>
                                 </ul>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/monitor_tune/slow_receivers.html">Slow Receivers with TCP/IP</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/slow_receivers.html">Slow Receivers with TCP/IP</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/slow_receivers_preventing_problems.html">Preventing Slow Receivers</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/slow_receivers_preventing_problems.html">Preventing Slow Receivers</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/slow_receivers_managing.html">Managing Slow Receivers</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/slow_receivers_managing.html">Managing Slow Receivers</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/monitor_tune/slow_messages.html">Slow distributed-ack Messages</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/slow_messages.html">Slow distributed-ack Messages</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/monitor_tune/socket_communication.html">Socket Communication</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/socket_communication.html">Socket Communication</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/socket_communication_setting_socket_buffer_sizes.html">Setting Socket Buffer Sizes</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/socket_communication_setting_socket_buffer_sizes.html">Setting Socket Buffer Sizes</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/socket_communication_ephemeral_tcp_port_limits.html">Ephemeral TCP Port Limits</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/socket_communication_ephemeral_tcp_port_limits.html">Ephemeral TCP Port Limits</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/socket_communication_have_enough_sockets.html">Making Sure You Have Enough Sockets</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/socket_communication_have_enough_sockets.html">Making Sure You Have Enough Sockets</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/socket_tcp_keepalive.html">TCP/IP KeepAlive Configuration</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/socket_tcp_keepalive.html">TCP/IP KeepAlive Configuration</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/socket_communication_tcpip_p2p_handshake_timeouts.html">TCP/IP Peer-to-Peer Handshake Timeouts</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/socket_communication_tcpip_p2p_handshake_timeouts.html">TCP/IP Peer-to-Peer Handshake Timeouts</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/monitor_tune/udp_communication.html">UDP Communication</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/udp_communication.html">UDP Communication</a>
                             </li>
                             <li class="has_submenu">
-                                <a href="/docs/guide/11/managing/monitor_tune/multicast_communication.html">Multicast Communication</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/multicast_communication.html">Multicast Communication</a>
                                 <ul>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/multicast_communication_provisioning_bandwidth.html">Provisioning Bandwidth for Multicast</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/multicast_communication_provisioning_bandwidth.html">Provisioning Bandwidth for Multicast</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/multicast_communication_testing_multicast_speed_limits.html">Testing Multicast Speed Limits</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/multicast_communication_testing_multicast_speed_limits.html">Testing Multicast Speed Limits</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/multicast_communication_configuring_speed_limits.html">Configuring Multicast Speed Limits</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/multicast_communication_configuring_speed_limits.html">Configuring Multicast Speed Limits</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/multicast_communication_runtime_considerations.html">Run-time Considerations for Multicast</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/multicast_communication_runtime_considerations.html">Run-time Considerations for Multicast</a>
                                     </li>
                                     <li>
-                                        <a href="/docs/guide/11/managing/monitor_tune/multicast_communication_troubleshooting.html">Troubleshooting the Multicast Tuning Process</a>
+                                        <a href="/docs/guide/12/managing/monitor_tune/multicast_communication_troubleshooting.html">Troubleshooting the Multicast Tuning Process</a>
                                     </li>
                                 </ul>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/monitor_tune/cache_consistency.html">Maintaining Cache Consistency</a>
+                                <a href="/docs/guide/12/managing/monitor_tune/cache_consistency.html">Maintaining Cache Consistency</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/logging/logging.html">Logging</a>
+                        <a href="/docs/guide/12/managing/logging/logging.html">Logging</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/logging/how_logging_works.html">How Geode Logging Works</a>
+                                <a href="/docs/guide/12/managing/logging/how_logging_works.html">How Geode Logging Works</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/logging/logging_categories.html">Understanding Log Messages and Their Categories</a>
+                                <a href="/docs/guide/12/managing/logging/logging_categories.html">Understanding Log Messages and Their Categories</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/logging/logging_whats_next.html">Naming, Searching, and Creating Log Files</a>
+                                <a href="/docs/guide/12/managing/logging/logging_whats_next.html">Naming, Searching, and Creating Log Files</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/logging/setting_up_logging.html">Set Up Logging</a>
+                                <a href="/docs/guide/12/managing/logging/setting_up_logging.html">Set Up Logging</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/logging/configuring_log4j2.html">Advanced Users\u2014Configuring Log4j 2 for Geode</a>
+                                <a href="/docs/guide/12/managing/logging/configuring_log4j2.html">Advanced Users\u2014Configuring Log4j 2 for Geode</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/statistics/chapter_overview.html">Statistics</a>
+                        <a href="/docs/guide/12/managing/statistics/chapter_overview.html">Statistics</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/statistics/how_statistics_work.html">How Statistics Work</a>
+                                <a href="/docs/guide/12/managing/statistics/how_statistics_work.html">How Statistics Work</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/statistics/transient_region_and_entry_statistics.html">Transient Region and Entry Statistics</a>
+                                <a href="/docs/guide/12/managing/statistics/transient_region_and_entry_statistics.html">Transient Region and Entry Statistics</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/statistics/application_defined_statistics.html">Application-Defined and Custom Statistics</a>
+                                <a href="/docs/guide/12/managing/statistics/application_defined_statistics.html">Application-Defined and Custom Statistics</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/statistics/setting_up_statistics.html">Configuring and Using Statistics</a>
+                                <a href="/docs/guide/12/managing/statistics/setting_up_statistics.html">Configuring and Using Statistics</a>
                             </li>
                             <li>
-                                <a href="/docs/guide/11/managing/statistics/viewing_statistics.html">Viewing Archived Statistics</a>
+                                <a href="/docs/guide/12/managing/statistics/viewing_statistics.html">Viewing Archived Statistics</a>
                             </li>
                         </ul>
                     </li>
                     <li class="has_submenu">
-                        <a href="/docs/guide/11/managing/troubleshooting/chapter_overview.html">Troubleshooting and System Recovery</a>
+                        <a href="/docs/guide/12/managing/troubleshooting/chapter_overview.html">Troubleshooting and System Recovery</a>
                         <ul>
                             <li>
-                                <a href="/docs/guide/11/managing/troubleshooting/producing_troubleshooting_artifacts.html">Producing Artifacts for Troubleshoot

<TRUNCATED>

[17/51] [abbrv] geode git commit: GEODE-2686: Remove JarClassLoader

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
index 6baddaf..0d26caf 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
@@ -14,7 +14,9 @@
  */
 package org.apache.geode.internal;
 
-import static org.junit.Assert.*;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -62,7 +64,22 @@ public class ClassPathLoaderTest {
   public void testLatestExists() throws Exception {
     System.out.println("\nStarting ClassPathLoaderTest#testLatestExists");
 
-    assertNotNull(ClassPathLoader.getLatest());
+    assertThat(ClassPathLoader.getLatest()).isNotNull();
+  }
+
+  @Test
+  public void testZeroLengthFile() throws IOException, ClassNotFoundException {
+    assertThatThrownBy(() -> {
+      ClassPathLoader.getLatest().getJarDeployer().deploy(new String[] {"JarDeployerDUnitZLF.jar"},
+          new byte[][] {new byte[0]});
+    }).isInstanceOf(IllegalArgumentException.class);
+
+    assertThatThrownBy(() -> {
+      ClassPathLoader.getLatest().getJarDeployer().deploy(
+          new String[] {"JarDeployerDUnitZLF1.jar", "JarDeployerDUnitZLF2.jar"},
+          new byte[][] {new ClassBuilder().createJarFromName("JarDeployerDUnitZLF1"), new byte[0]});
+
+    }).isInstanceOf(IllegalArgumentException.class);
   }
 
   /**
@@ -73,13 +90,10 @@ public class ClassPathLoaderTest {
   public void testForNameThrowsClassNotFoundException() throws Exception {
     System.out.println("\nStarting ClassPathLoaderTest#testForNameThrowsClassNotFoundException");
 
-    try {
-      String classToLoad = "com.nowhere.DoesNotExist";
-      ClassPathLoader.getLatest().forName(classToLoad);
-      fail();
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
+    String classToLoad = "com.nowhere.DoesNotExist";
+
+    assertThatThrownBy(() -> ClassPathLoader.getLatest().forName(classToLoad))
+        .isInstanceOf(ClassNotFoundException.class);
   }
 
   /**
@@ -92,7 +106,7 @@ public class ClassPathLoaderTest {
 
     String classToLoad = "org.apache.geode.internal.classpathloaderjunittest.DoesExist";
     Class<?> clazz = ClassPathLoader.getLatest().forName(classToLoad);
-    assertNotNull(clazz);
+    assertThat(clazz).isNotNull();
   }
 
   /**
@@ -105,10 +119,10 @@ public class ClassPathLoaderTest {
 
     String resourceToGet = "org/apache/geode/internal/classpathloaderjunittest/DoesExist.class";
     URL url = ClassPathLoader.getLatest().getResource(resourceToGet);
-    assertNotNull(url);
+    assertThat(url).isNotNull();
 
     InputStream is = url != null ? url.openStream() : null;
-    assertNotNull(is);
+    assertThat(is).isNotNull();
 
     int totalBytesRead = 0;
     byte[] input = new byte[256];
@@ -122,7 +136,7 @@ public class ClassPathLoaderTest {
 
     // if the following fails then maybe javac changed and DoesExist.class
     // contains other than 374 bytes of data... consider updating this test
-    assertEquals(GENERATED_CLASS_BYTES_COUNT, totalBytesRead);
+    assertThat(totalBytesRead).isEqualTo(GENERATED_CLASS_BYTES_COUNT);
   }
 
   /**
@@ -135,12 +149,12 @@ public class ClassPathLoaderTest {
 
     String resourceToGet = "org/apache/geode/internal/classpathloaderjunittest/DoesExist.class";
     Enumeration<URL> urls = ClassPathLoader.getLatest().getResources(resourceToGet);
-    assertNotNull(urls);
-    assertTrue(urls.hasMoreElements());
+    assertThat(urls).isNotNull();
+    assertThat(urls.hasMoreElements()).isTrue();
 
     URL url = urls.nextElement();
     InputStream is = url != null ? url.openStream() : null;
-    assertNotNull(is);
+    assertThat(is).isNotNull();
 
     int totalBytesRead = 0;
     byte[] input = new byte[256];
@@ -154,7 +168,7 @@ public class ClassPathLoaderTest {
 
     // if the following fails then maybe javac changed and DoesExist.class
     // contains other than 374 bytes of data... consider updating this test
-    assertEquals(GENERATED_CLASS_BYTES_COUNT, totalBytesRead);
+    assertThat(totalBytesRead).isEqualTo(GENERATED_CLASS_BYTES_COUNT);
   }
 
   /**
@@ -167,7 +181,7 @@ public class ClassPathLoaderTest {
 
     String resourceToGet = "org/apache/geode/internal/classpathloaderjunittest/DoesExist.class";
     InputStream is = ClassPathLoader.getLatest().getResourceAsStream(resourceToGet);
-    assertNotNull(is);
+    assertThat(is).isNotNull();
 
     int totalBytesRead = 0;
     byte[] input = new byte[256];
@@ -181,7 +195,7 @@ public class ClassPathLoaderTest {
 
     // if the following fails then maybe javac changed and DoesExist.class
     // contains other than 374 bytes of data... consider updating this test
-    assertEquals(GENERATED_CLASS_BYTES_COUNT, totalBytesRead);
+    assertThat(totalBytesRead).isEqualTo(GENERATED_CLASS_BYTES_COUNT);
   }
 
   /**
@@ -197,44 +211,22 @@ public class ClassPathLoaderTest {
     String classToLoad = "com.nowhere.TestGeneratingClassLoader";
 
     Class<?> clazz = gcl.loadClass(classToLoad);
-    assertNotNull(clazz);
-    assertEquals(classToLoad, clazz.getName());
+    assertThat(clazz).isNotNull();
+    assertThat(clazz.getName()).isEqualTo(classToLoad);
 
     Object obj = clazz.newInstance();
-    assertEquals(clazz.getName(), obj.getClass().getName());
+    assertThat(obj.getClass().getName()).isEqualTo(clazz.getName());
 
-    try {
+    assertThatThrownBy(() -> {
       Class.forName(classToLoad);
-      fail("Should have thrown ClassNotFoundException");
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
+    }).isInstanceOf(ClassNotFoundException.class);
 
     Class<?> clazzForName = Class.forName(classToLoad, true, gcl);
-    assertNotNull(clazzForName);
-    assertEquals(clazz, clazzForName);
+    assertThat(clazzForName).isNotNull();
+    assertThat(clazzForName).isEqualTo(clazz);
 
     Object objForName = clazzForName.newInstance();
-    assertEquals(classToLoad, objForName.getClass().getName());
-  }
-
-  /**
-   * Verifies that custom loader is used to load class.
-   */
-  @Test
-  public void testForNameWithCustomLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testForNameWithCustomLoader");
-
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
-
-    String classToLoad = "com.nowhere.TestForNameWithCustomLoader";
-    Class<?> clazz = dcl.forName(classToLoad);
-    assertNotNull(clazz);
-    assertEquals(classToLoad, clazz.getName());
-
-    Object obj = clazz.newInstance();
-    assertEquals(classToLoad, obj.getClass().getName());
+    assertThat(objForName.getClass().getName()).isEqualTo(classToLoad);
   }
 
   /**
@@ -251,7 +243,7 @@ public class ClassPathLoaderTest {
     String classToLoad = "[Ljava.lang.String;";
     Class<?> clazz = null;
     clazz = dcl.forName(classToLoad);
-    assertEquals(classToLoad, clazz.getName());
+    assertThat(clazz.getName()).isEqualTo(classToLoad);
   }
 
   /**
@@ -265,33 +257,27 @@ public class ClassPathLoaderTest {
     final ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
     final String classToLoad = "com.nowhere.TestForNameWithTCCL";
 
-    try {
+    assertThatThrownBy(() -> {
       dcl.forName(classToLoad);
-      fail("Should have thrown ClassNotFoundException");
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
+
+    }).isInstanceOf(ClassNotFoundException.class);
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
     try {
       // ensure that TCCL is only CL that can find this class
       Thread.currentThread().setContextClassLoader(new GeneratingClassLoader());
       Class<?> clazz = dcl.forName(classToLoad);
-      assertNotNull(clazz);
+      assertThat(clazz).isNotNull();
       Object instance = clazz.newInstance();
-      assertNotNull(instance);
-      assertEquals(classToLoad, instance.getClass().getName());
+      assertThat(instance).isNotNull();
+      assertThat(instance.getClass().getName()).isEqualTo(classToLoad);
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
 
-    try {
+    assertThatThrownBy(() -> {
       dcl.forName(classToLoad);
-      fail("Should have thrown ClassNotFoundException");
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
-
+    }).isInstanceOf(ClassNotFoundException.class);
   }
 
   /**
@@ -305,20 +291,17 @@ public class ClassPathLoaderTest {
     ClassLoader cl = new NullClassLoader();
     String classToLoad = "java.lang.String";
 
-    try {
+    assertThatThrownBy(() -> {
       Class.forName(classToLoad, true, cl);
-      fail();
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
+    }).isInstanceOf(ClassNotFoundException.class);
 
     String resourceToGet = "java/lang/String.class";
 
     URL url = cl.getResource(resourceToGet);
-    assertNull(url);
+    assertThat(url).isNull();
 
     InputStream is = cl.getResourceAsStream(resourceToGet);
-    assertNull(is);
+    assertThat(is).isNull();
   }
 
   /**
@@ -333,15 +316,15 @@ public class ClassPathLoaderTest {
     String classToLoad = "java.lang.String";
 
     Class<?> clazz = Class.forName(classToLoad, true, cl);
-    assertNotNull(clazz);
+    assertThat(clazz).isNotNull();
 
     String resourceToGet = "java/lang/String.class";
 
     URL url = cl.getResource(resourceToGet);
-    assertNotNull(url);
+    assertThat(url).isNotNull();
 
     InputStream is = cl.getResourceAsStream(resourceToGet);
-    assertNotNull(is);
+    assertThat(is).isNotNull();
   }
 
   /**
@@ -355,28 +338,19 @@ public class ClassPathLoaderTest {
     ClassLoader cl = new BrokenClassLoader();
 
     String classToLoad = "java.lang.String";
-    try {
+
+    assertThatThrownBy(() -> {
       Class.forName(classToLoad, true, cl);
-      fail();
-    } catch (ClassNotFoundException e) {
-      throw e;
-    } catch (BrokenError expected) {
-      // Expected
-    }
+    }).isInstanceOf(BrokenError.class);
 
     String resourceToGet = "java/lang/String.class";
-    try {
+    assertThatThrownBy(() -> {
       cl.getResource(resourceToGet);
-      fail();
-    } catch (BrokenError expected) {
-      // Expected
-    }
-    try {
+    }).isInstanceOf(BrokenError.class);
+
+    assertThatThrownBy(() -> {
       cl.getResourceAsStream(resourceToGet);
-      fail();
-    } catch (BrokenError expected) {
-      // Expected
-    }
+    }).isInstanceOf(BrokenError.class);
   }
 
   /**
@@ -390,7 +364,6 @@ public class ClassPathLoaderTest {
     System.out.println("\nStarting ClassPathLoaderTest#testBrokenTCCLThrowsErrors");
 
     ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl.addOrReplace(new NullClassLoader());
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
     try {
@@ -398,29 +371,18 @@ public class ClassPathLoaderTest {
       Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
 
       String classToLoad = "java.lang.String";
-      try {
+      assertThatThrownBy(() -> {
         dcl.forName(classToLoad);
-        fail();
-      } catch (ClassNotFoundException e) {
-        throw e;
-      } catch (BrokenError expected) {
-        // Expected
-      }
+      }).isInstanceOf(BrokenError.class);
 
       String resourceToGet = "java/lang/String.class";
-      try {
+      assertThatThrownBy(() -> {
         dcl.getResource(resourceToGet);
-        fail();
-      } catch (BrokenError expected) {
-        // Expected
-      }
+      }).isInstanceOf(BrokenError.class);
 
-      try {
+      assertThatThrownBy(() -> {
         dcl.getResourceAsStream(resourceToGet);
-        fail();
-      } catch (BrokenError expected) {
-        // Expected
-      }
+      }).isInstanceOf(BrokenError.class);
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
@@ -436,7 +398,6 @@ public class ClassPathLoaderTest {
 
     // create DCL such that parent cannot find anything
     ClassPathLoader dcl = ClassPathLoader.createWithDefaults(true);
-    dcl.addOrReplace(new NullClassLoader());
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
     try {
@@ -445,52 +406,13 @@ public class ClassPathLoaderTest {
 
       String classToLoad = "java.lang.String";
       Class<?> clazz = dcl.forName(classToLoad);
-      assertNotNull(clazz);
+      assertThat(clazz).isNotNull();
 
       String resourceToGet = "java/lang/String.class";
       URL url = dcl.getResource(resourceToGet);
-      assertNotNull(url);
+      assertThat(url).isNotNull();
       InputStream is = dcl.getResourceAsStream(resourceToGet);
-      assertNotNull(is);
-    } finally {
-      Thread.currentThread().setContextClassLoader(cl);
-    }
-  }
-
-  /**
-   * Verifies that the 3rd custom loader will find the class. Parent cannot find it and TCCL is
-   * broken. This verifies that all custom loaders are checked and that the custom loaders are all
-   * checked before TCCL.
-   */
-  @Test
-  public void testForNameWithMultipleCustomLoaders() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testForNameWithMultipleCustomLoaders");
-
-    // create DCL such that the 3rd loader should find the class
-    // first custom loader becomes parent which won't find anything
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    final GeneratingClassLoader generatingClassLoader = new GeneratingClassLoader();
-    dcl = dcl.addOrReplace(generatingClassLoader);
-    dcl = dcl.addOrReplace(new SimpleClassLoader(getClass().getClassLoader()));
-    dcl = dcl.addOrReplace(new NullClassLoader());
-
-    String classToLoad = "com.nowhere.TestForNameWithMultipleCustomLoaders";
-
-    ClassLoader cl = Thread.currentThread().getContextClassLoader();
-    try {
-      // set TCCL to throw errors which makes sure we find before checking TCCL
-      Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
-
-      Class<?> clazz = dcl.forName(classToLoad);
-      assertNotNull(clazz);
-      assertEquals(classToLoad, clazz.getName());
-      assertTrue("Class not loaded by a GeneratingClassLoader.",
-          clazz.getClassLoader() instanceof GeneratingClassLoader);
-      assertEquals("Class not loaded by generatingClassLoader.", generatingClassLoader,
-          clazz.getClassLoader());
-
-      Object obj = clazz.newInstance();
-      assertEquals(classToLoad, obj.getClass().getName());
+      assertThat(is).isNotNull();
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
@@ -508,28 +430,24 @@ public class ClassPathLoaderTest {
 
     String classToLoad = "com.nowhere.TestExcludeTCCL";
 
-    try {
+    assertThatThrownBy(() -> {
       dcl.forName(classToLoad);
-      fail("Should have thrown ClassNotFoundException");
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
+
+    }).isInstanceOf(ClassNotFoundException.class);
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
     try {
-      // ensure that TCCL is only CL that can find this class
       Thread.currentThread().setContextClassLoader(new GeneratingClassLoader());
-      dcl.forName(classToLoad);
-      fail("Should have thrown ClassNotFoundException");
-    } catch (ClassNotFoundException expected) {
-      // Expected
+
+      assertThatThrownBy(() -> {
+        dcl.forName(classToLoad);
+      }).isInstanceOf(ClassNotFoundException.class);
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
-
   }
 
-
   /**
    * Verifies that <tt>getResource</tt> will skip TCCL if <tt>excludeThreadContextClassLoader</tt>
    * has been set to true.
@@ -541,13 +459,13 @@ public class ClassPathLoaderTest {
     ClassPathLoader dcl = ClassPathLoader.createWithDefaults(true);
 
     String resourceToGet = "com/nowhere/testGetResourceExcludeTCCL.rsc";
-    assertNull(dcl.getResource(resourceToGet));
+    assertThat(dcl.getResource(resourceToGet)).isNull();
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
     try {
       // ensure that TCCL is only CL that can find this resource
       Thread.currentThread().setContextClassLoader(new GeneratingClassLoader());
-      assertNull(dcl.getResource(resourceToGet));
+      assertThat(dcl.getResource(resourceToGet)).isNull();
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
@@ -564,161 +482,18 @@ public class ClassPathLoaderTest {
     ClassPathLoader dcl = ClassPathLoader.createWithDefaults(true);
 
     String resourceToGet = "com/nowhere/testGetResourceAsStreamExcludeTCCL.rsc";
-    assertNull(dcl.getResourceAsStream(resourceToGet));
+    assertThat(dcl.getResourceAsStream(resourceToGet)).isNull();
 
     ClassLoader cl = Thread.currentThread().getContextClassLoader();
     try {
       // ensure that TCCL is only CL that can find this resource
       Thread.currentThread().setContextClassLoader(new GeneratingClassLoader());
-      assertNull(dcl.getResourceAsStream(resourceToGet));
-    } finally {
-      Thread.currentThread().setContextClassLoader(cl);
-    }
-  }
-
-  @Test
-  public void testAddFindsLatestClassLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testAddFindsLatestClassLoader");
-
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
-
-    String classToLoad = "com.nowhere.TestAddFindsLatestClassLoader";
-    Class<?> clazz = dcl.forName(classToLoad);
-    assertNotNull(clazz);
-
-    dcl = dcl.addOrReplace(new BrokenClassLoader());
-
-    try {
-      dcl.forName(classToLoad);
-      fail();
-    } catch (BrokenError expected) {
-      // Expected
-    }
-  }
-
-  /**
-   * Verifies removing a ClassLoader.
-   */
-  @Test
-  public void testRemoveClassLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testRemoveClassLoader");
-
-    GeneratingClassLoader genClassLoader = new GeneratingClassLoader();
-    ClassPathLoader cpl = ClassPathLoader.createWithDefaults(false);
-    cpl = cpl.addOrReplace(genClassLoader);
-
-    String classToLoad = "com.nowhere.TestRemoveClassLoader";
-    Class<?> clazz = cpl.forName(classToLoad);
-    assertNotNull(clazz);
-
-    cpl = cpl.remove(genClassLoader);
-
-    try {
-      clazz = cpl.forName(classToLoad);
-      fail();
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
-  }
-
-  /**
-   * Verifies that a ClassLoader will be replaced when added more than once.
-   */
-  @Test
-  public void testClassLoaderReplace() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testClassLoaderReplace");
-
-    String class1ToLoad = "ClassA";
-    String class2ToLoad = "ClassB";
-
-    ClassPathLoader cpl = ClassPathLoader.createWithDefaults(false);
-    cpl = cpl.addOrReplace(new OneClassClassLoader(class1ToLoad));
-
-    try {
-      @SuppressWarnings("unused")
-      Class<?> clazz = cpl.forName(class1ToLoad);
-    } catch (ClassNotFoundException unexpected) {
-      fail();
-    }
-
-    try {
-      @SuppressWarnings("unused")
-      Class<?> clazz = cpl.forName(class2ToLoad);
-      fail();
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
-
-    cpl = cpl.addOrReplace(new OneClassClassLoader(class2ToLoad));
-    try {
-      @SuppressWarnings("unused")
-      Class<?> clazz = cpl.forName(class2ToLoad);
-    } catch (ClassNotFoundException unexpected) {
-      fail();
-    }
-
-    try {
-      @SuppressWarnings("unused")
-      Class<?> clazz = cpl.forName(class1ToLoad);
-      fail();
-    } catch (ClassNotFoundException expected) {
-      // Expected
-    }
-  }
-
-  @Test
-  public void testAsClassLoaderLoadClassWithMultipleCustomLoaders() throws Exception {
-    System.out.println(
-        "\nStarting ClassPathLoaderTest#testAsClassLoaderLoadClassWithMultipleCustomLoaders");
-
-    // create DCL such that the 3rd loader should find the class
-    // first custom loader becomes parent which won't find anything
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    final GeneratingClassLoader generatingClassLoader = new GeneratingClassLoader();
-    dcl = dcl.addOrReplace(generatingClassLoader);
-    dcl = dcl.addOrReplace(new SimpleClassLoader(getClass().getClassLoader()));
-    dcl = dcl.addOrReplace(new NullClassLoader());
-
-    final String classToLoad = "com.nowhere.TestForNameWithMultipleCustomLoaders";
-
-    ClassLoader cl = Thread.currentThread().getContextClassLoader();
-    try {
-      // set TCCL to throw errors which makes sure we find before checking TCCL
-      Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
-
-      final ClassLoader classLoader = dcl.asClassLoader();
-      final Class<?> clazz = classLoader.loadClass(classToLoad);
-      assertNotNull(clazz);
-      assertEquals(classToLoad, clazz.getName());
-      assertTrue(clazz.getClassLoader() instanceof GeneratingClassLoader);
-      assertEquals(generatingClassLoader, clazz.getClassLoader());
-
-      final Object obj = clazz.newInstance();
-      assertEquals(classToLoad, obj.getClass().getName());
-
-      final Class<?> clazz2 = dcl.forName(classToLoad);
-      assertSame("Should load same class as calling classLoader.", clazz, clazz2);
-
-      final Class<?> clazz3 = Class.forName(classToLoad, true, classLoader);
-      assertSame("Should load same class as calling classLoader.", clazz, clazz3);
-
+      assertThat(dcl.getResourceAsStream(resourceToGet)).isNull();
     } finally {
       Thread.currentThread().setContextClassLoader(cl);
     }
   }
 
-  private static void exploreClassLoaders() {
-    System.out.println("Thread.currentThread().getContextClassLoader()...");
-    exploreClassLoader(Thread.currentThread().getContextClassLoader(), 1);
-
-    System.out.println("class.getClassLoader()...");
-    exploreClassLoader(ClassPathLoaderTest.class.getClassLoader(), 1);
-
-    System.out.println("ClassLoader.getSystemClassLoader()...");
-    exploreClassLoader(ClassLoader.getSystemClassLoader(), 1);
-  }
-
   private static void exploreClassLoader(ClassLoader cl, int indent) {
     String prefix = "";
     for (int i = 0; i < indent; i++) {
@@ -734,8 +509,9 @@ public class ClassPathLoaderTest {
       URL[] urls = ((URLClassLoader) cl).getURLs();
       StringBuilder sb = new StringBuilder(prefix).append("ClassLoader getURLs = [");
       for (int i = 0; i < urls.length; i++) {
-        if (i > 0)
+        if (i > 0) {
           sb.append(", ");
+        }
         sb.append(urls[i].toString());
       }
       sb.append("]");
@@ -816,7 +592,7 @@ public class ClassPathLoaderTest {
     /**
      * Currently unused but potentially useful for some future test. This causes this loader to only
      * generate a class that the parent could not find.
-     *
+     * 
      * @param parent the parent class loader to check with first
      */
     @SuppressWarnings("unused")

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
new file mode 100644
index 0000000..7216463
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/DeployedJarJUnitTest.java
@@ -0,0 +1,538 @@
+/*
+ * 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 org.apache.geode.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.internal.cache.execute.FunctionContextImpl;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Random;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * TODO: Need to fix this testDeclarableFunctionsWithParms and testClassOnClasspath on Windows:
+ */
+@Category(IntegrationTest.class)
+public class DeployedJarJUnitTest {
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+  private final ClassBuilder classBuilder = new ClassBuilder();
+
+  @Before
+  public void setup() throws Exception {
+    File workingDir = temporaryFolder.newFolder();
+
+    ClassPathLoader.setLatestToDefault(workingDir);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    for (String functionName : FunctionService.getRegisteredFunctions().keySet()) {
+      FunctionService.unregisterFunction(functionName);
+    }
+
+    ClassPathLoader.setLatestToDefault();
+  }
+
+  @Test
+  public void testIsValidJarContent() throws IOException {
+    assertTrue(
+        DeployedJar.isValidJarContent(this.classBuilder.createJarFromName("JarClassLoaderJUnitA")));
+  }
+
+  @Test
+  public void testIsInvalidJarContent() {
+    assertFalse(DeployedJar.isValidJarContent("INVALID JAR CONTENT".getBytes()));
+  }
+
+  @Test
+  public void testClassOnClasspath() throws Exception {
+    // Deploy the first JAR file and make sure the class is on the Classpath
+    byte[] jarBytes =
+        this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitA",
+            "package com.jcljunit; public class JarClassLoaderJUnitA {}");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
+
+    try {
+      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA");
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath");
+    }
+
+    // Update the JAR file and make sure the first class is no longer on the Classpath
+    // and the second one is.
+    jarBytes = this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitB",
+        "package com.jcljunit; public class JarClassLoaderJUnitB {}");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
+
+    try {
+      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitB");
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath");
+    }
+
+    try {
+      ClassPathLoader.getLatest().forName("com.jcljunit.JarClassLoaderJUnitA");
+      fail("Class should not be found on Classpath");
+    } catch (ClassNotFoundException expected) { // expected
+    }
+
+  }
+
+  @Test
+  public void testFailingCompilation() throws Exception {
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("import org.apache.geode.cache.Declarable;");
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
+    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {}");
+    String functionString = stringBuffer.toString();
+
+    try {
+      this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
+      fail("This code should have failed to compile and thrown an exception");
+    } catch (Exception ex) {
+      // All good
+    }
+  }
+
+  @Test
+  public void testFunctions() throws IOException, ClassNotFoundException {
+    // Test creating a JAR file with a function
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("import java.util.Properties;");
+    stringBuffer.append("import org.apache.geode.cache.Declarable;");
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
+    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {");
+    stringBuffer.append("public void init(Properties props) {}");
+    stringBuffer.append("public boolean hasResult() {return true;}");
+    stringBuffer.append(
+        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"GOODv1\");}");
+    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
+    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
+    stringBuffer.append("public boolean isHA() {return false;}}");
+    String functionString = stringBuffer.toString();
+
+    byte[] jarBytes =
+        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
+
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
+
+    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
+    assertNotNull(function);
+    TestResultSender resultSender = new TestResultSender();
+    FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
+    function.execute(functionContext);
+    assertEquals("GOODv1", (String) resultSender.getResults());
+
+    // Test updating the function with a new JAR file
+    functionString = functionString.replace("v1", "v2");
+    jarBytes =
+        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
+
+    function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
+    assertNotNull(function);
+    resultSender = new TestResultSender();
+    functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
+    function.execute(functionContext);
+    assertEquals("GOODv2", (String) resultSender.getResults());
+
+    // Test returning null for the Id
+    String functionNullIdString =
+        functionString.replace("return \"JarClassLoaderJUnitFunction\"", "return null");
+    jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction",
+        functionNullIdString);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnit.jar", jarBytes);
+
+    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
+
+    // Test removing the JAR
+    ClassPathLoader.getLatest().getJarDeployer().undeploy("JarClassLoaderJUnit.jar");
+    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
+  }
+
+  /**
+   * Ensure that abstract functions aren't added to the Function Service.
+   */
+  @Test
+  public void testAbstractFunction() throws IOException, ClassNotFoundException {
+    // Add an abstract Function to the Classpath
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("public abstract class JarClassLoaderJUnitFunction implements Function {");
+    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}}");
+    String functionString = stringBuffer.toString();
+
+    byte[] jarBytes =
+        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitFunction.jar",
+        jarBytes);
+
+    try {
+      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath");
+    }
+
+    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
+    assertNull(function);
+  }
+
+  @Test
+  public void testDeclarableFunctionsWithNoCacheXml() throws Exception {
+
+    final String jarName = "JarClassLoaderJUnitNoXml.jar";
+
+    // Add a Declarable Function without parameters for the class to the Classpath
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("import java.util.Properties;");
+    stringBuffer.append("import org.apache.geode.cache.Declarable;");
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
+    stringBuffer
+        .append("public class JarClassLoaderJUnitFunctionNoXml implements Function, Declarable {");
+    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunctionNoXml\";}");
+    stringBuffer.append("public void init(Properties props) {}");
+    stringBuffer.append(
+        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"NOPARMSv1\");}");
+    stringBuffer.append("public boolean hasResult() {return true;}");
+    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
+    stringBuffer.append("public boolean isHA() {return false;}}");
+    String functionString = stringBuffer.toString();
+
+    byte[] jarBytes = this.classBuilder
+        .createJarFromClassContent("JarClassLoaderJUnitFunctionNoXml", functionString);
+
+    ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, jarBytes);
+
+    try {
+      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunctionNoXml");
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath");
+    }
+
+    // Check to see if the function without parameters executes correctly
+    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunctionNoXml");
+    assertNotNull(function);
+    TestResultSender resultSender = new TestResultSender();
+    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
+    assertEquals("NOPARMSv1", (String) resultSender.getResults());
+  }
+
+  @Test
+  public void testDependencyBetweenJars() throws IOException, ClassNotFoundException {
+    final File parentJarFile = temporaryFolder.newFile("JarClassLoaderJUnitParent.jar");
+    final File usesJarFile = temporaryFolder.newFile("JarClassLoaderJUnitUses.jar");
+
+    JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
+
+    // Write out a JAR files.
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("package jcljunit.parent;");
+    stringBuffer.append("public class JarClassLoaderJUnitParent {");
+    stringBuffer.append("public String getValueParent() {");
+    stringBuffer.append("return \"PARENT\";}}");
+
+    byte[] jarBytes = this.classBuilder.createJarFromClassContent(
+        "jcljunit/parent/JarClassLoaderJUnitParent", stringBuffer.toString());
+    writeJarBytesToFile(parentJarFile, jarBytes);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitParent.jar", jarBytes);
+
+    stringBuffer = new StringBuffer();
+    stringBuffer.append("package jcljunit.uses;");
+    stringBuffer.append("public class JarClassLoaderJUnitUses {");
+    stringBuffer.append("public String getValueUses() {");
+    stringBuffer.append("return \"USES\";}}");
+
+    jarBytes = this.classBuilder.createJarFromClassContent("jcljunit/uses/JarClassLoaderJUnitUses",
+        stringBuffer.toString());
+    writeJarBytesToFile(usesJarFile, jarBytes);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitUses.jar", jarBytes);
+
+    stringBuffer = new StringBuffer();
+    stringBuffer.append("package jcljunit.function;");
+    stringBuffer.append("import jcljunit.parent.JarClassLoaderJUnitParent;");
+    stringBuffer.append("import jcljunit.uses.JarClassLoaderJUnitUses;");
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
+    stringBuffer.append(
+        "public class JarClassLoaderJUnitFunction  extends JarClassLoaderJUnitParent implements Function {");
+    stringBuffer.append("private JarClassLoaderJUnitUses uses = new JarClassLoaderJUnitUses();");
+    stringBuffer.append("public boolean hasResult() {return true;}");
+    stringBuffer.append(
+        "public void execute(FunctionContext context) {context.getResultSender().lastResult(getValueParent() + \":\" + uses.getValueUses());}");
+    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
+    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
+    stringBuffer.append("public boolean isHA() {return false;}}");
+
+    ClassBuilder functionClassBuilder = new ClassBuilder();
+    functionClassBuilder.addToClassPath(parentJarFile.getAbsolutePath());
+    functionClassBuilder.addToClassPath(usesJarFile.getAbsolutePath());
+    jarBytes = functionClassBuilder.createJarFromClassContent(
+        "jcljunit/function/JarClassLoaderJUnitFunction", stringBuffer.toString());
+
+
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitFunction.jar",
+        jarBytes);
+
+
+    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
+    assertNotNull(function);
+    TestResultSender resultSender = new TestResultSender();
+    FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
+    function.execute(functionContext);
+    assertEquals("PARENT:USES", (String) resultSender.getResults());
+  }
+
+  @Test
+  public void testFindResource() throws IOException, ClassNotFoundException {
+    final String fileName = "file.txt";
+    final String fileContent = "FILE CONTENT";
+
+    byte[] jarBytes = this.classBuilder.createJarFromFileContent(fileName, fileContent);
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitResource.jar",
+        jarBytes);
+
+    InputStream inputStream = ClassPathLoader.getLatest().getResourceAsStream(fileName);
+    assertNotNull(inputStream);
+
+    final byte[] fileBytes = new byte[fileContent.length()];
+    inputStream.read(fileBytes);
+    inputStream.close();
+    assertTrue(fileContent.equals(new String(fileBytes)));
+  }
+
+  @Test
+  public void testUpdateClassInJar() throws IOException, ClassNotFoundException {
+    // First use of the JAR file
+    byte[] jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitTestClass",
+        "public class JarClassLoaderJUnitTestClass { public Integer getValue5() { return new Integer(5); } }");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitUpdate.jar", jarBytes);
+
+    try {
+      Class<?> clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
+      Object object = clazz.newInstance();
+      Method getValue5Method = clazz.getMethod("getValue5", new Class[] {});
+      Integer value = (Integer) getValue5Method.invoke(object, new Object[] {});
+      assertEquals(value.intValue(), 5);
+
+    } catch (InvocationTargetException itex) {
+      fail("JAR file not correctly added to Classpath" + itex);
+    } catch (NoSuchMethodException nsmex) {
+      fail("JAR file not correctly added to Classpath" + nsmex);
+    } catch (InstantiationException iex) {
+      fail("JAR file not correctly added to Classpath" + iex);
+    } catch (IllegalAccessException iaex) {
+      fail("JAR file not correctly added to Classpath" + iaex);
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath" + cnfex);
+    }
+
+    // Now create an updated JAR file and make sure that the method from the new
+    // class is available.
+    jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitTestClass",
+        "public class JarClassLoaderJUnitTestClass { public Integer getValue10() { return new Integer(10); } }");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitUpdate.jar", jarBytes);
+
+
+    try {
+      Class<?> clazz = ClassPathLoader.getLatest().forName("JarClassLoaderJUnitTestClass");
+      Object object = clazz.newInstance();
+      Method getValue10Method = clazz.getMethod("getValue10", new Class[] {});
+      Integer value = (Integer) getValue10Method.invoke(object, new Object[] {});
+      assertEquals(value.intValue(), 10);
+
+    } catch (InvocationTargetException itex) {
+      fail("JAR file not correctly added to Classpath" + itex);
+    } catch (NoSuchMethodException nsmex) {
+      fail("JAR file not correctly added to Classpath" + nsmex);
+    } catch (InstantiationException iex) {
+      fail("JAR file not correctly added to Classpath" + iex);
+    } catch (IllegalAccessException iaex) {
+      fail("JAR file not correctly added to Classpath" + iaex);
+    } catch (ClassNotFoundException cnfex) {
+      fail("JAR file not correctly added to Classpath" + cnfex);
+    }
+  }
+
+  @Test
+  public void testMultiThread() throws IOException, ClassNotFoundException {
+    // Add two JARs to the classpath
+    byte[] jarBytes = this.classBuilder.createJarFromName("JarClassLoaderJUnitA");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitA.jar", jarBytes);
+
+    jarBytes = this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitB",
+        "package com.jcljunit; public class JarClassLoaderJUnitB {}");
+    ClassPathLoader.getLatest().getJarDeployer().deploy("JarClassLoaderJUnitB.jar", jarBytes);
+
+    String[] classNames = new String[] {"JarClassLoaderJUnitA", "com.jcljunit.JarClassLoaderJUnitB",
+        "NON-EXISTENT CLASS"};
+
+    // Spawn some threads which try to instantiate these classes
+    final int threadCount = 10;
+    final int numLoops = 1000;
+    final CyclicBarrier cyclicBarrier = new CyclicBarrier(threadCount + 1);
+    for (int i = 0; i < threadCount; i++) {
+      new ForNameExerciser(cyclicBarrier, numLoops, classNames).start();
+    }
+
+    // Wait for all of the threads to be ready
+    try {
+      cyclicBarrier.await();
+    } catch (InterruptedException iex) {
+      fail("Interrupted while waiting for barrier");
+    } catch (BrokenBarrierException bbex) {
+      fail("Broken barrier while waiting");
+    }
+
+    // Loop while each thread tries N times to instantiate a non-existent class
+    for (int i = 0; i < numLoops; i++) {
+      try {
+        cyclicBarrier.await(5, TimeUnit.SECONDS);
+      } catch (InterruptedException iex) {
+        fail("Interrupted while waiting for barrier");
+      } catch (TimeoutException tex) {
+        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+        long[] threadIds = threadMXBean.findDeadlockedThreads();
+
+        if (threadIds != null) {
+          StringBuffer deadLockTrace = new StringBuffer();
+          for (long threadId : threadIds) {
+            ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId, 100);
+            deadLockTrace.append(threadInfo.getThreadName()).append("\n");
+            for (StackTraceElement stackTraceElem : threadInfo.getStackTrace()) {
+              deadLockTrace.append("\t").append(stackTraceElem).append("\n");
+            }
+          }
+
+          fail("Deadlock with trace:\n" + deadLockTrace.toString());
+        }
+
+        fail("Timeout while waiting for barrier - no deadlock detected");
+      } catch (BrokenBarrierException bbex) {
+        fail("Broken barrier while waiting");
+      }
+    }
+  }
+
+
+  private void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws IOException {
+    final OutputStream outStream = new FileOutputStream(jarFile);
+    outStream.write(jarBytes);
+    outStream.close();
+  }
+
+  private static class TestResultSender implements ResultSender<Object> {
+    private Object result;
+
+    public TestResultSender() {}
+
+    protected Object getResults() {
+      return this.result;
+    }
+
+    @Override
+    public void lastResult(final Object lastResult) {
+      this.result = lastResult;
+    }
+
+    @Override
+    public void sendResult(final Object oneResult) {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void sendException(final Throwable t) {
+      throw new UnsupportedOperationException();
+    }
+  }
+
+  static final Random random = new Random();
+
+  private class ForNameExerciser extends Thread {
+    private final CyclicBarrier cyclicBarrier;
+    private final int numLoops;
+    private final String[] classNames;
+
+    ForNameExerciser(final CyclicBarrier cyclicBarrier, final int numLoops,
+        final String[] classNames) {
+      this.cyclicBarrier = cyclicBarrier;
+      this.numLoops = numLoops;
+      this.classNames = classNames;
+    }
+
+    @Override
+    public void run() {
+      try {
+        this.cyclicBarrier.await();
+      } catch (InterruptedException iex) {
+        fail("Interrupted while waiting for latch");
+      } catch (BrokenBarrierException bbex) {
+        fail("Broken barrier while waiting");
+      }
+      for (int i = 0; i < this.numLoops; i++) {
+        try {
+          // Random select a name from the list of class names and try to load it
+          String className = this.classNames[random.nextInt(this.classNames.length)];
+          ClassPathLoader.getLatest().forName(className);
+        } catch (ClassNotFoundException expected) { // expected
+        }
+        try {
+          this.cyclicBarrier.await();
+        } catch (InterruptedException iex) {
+          fail("Interrupted while waiting for barrrier");
+        } catch (BrokenBarrierException bbex) {
+          fail("Broken barrier while waiting");
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/JarClassLoaderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/JarClassLoaderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/JarClassLoaderJUnitTest.java
deleted file mode 100644
index adc1d2e..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/JarClassLoaderJUnitTest.java
+++ /dev/null
@@ -1,851 +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 org.apache.geode.internal;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.Random;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.regex.Pattern;
-
-import org.junit.After;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultSender;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.cache.execute.FunctionContextImpl;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-/**
- * TODO: Need to fix this testDeclarableFunctionsWithParms and testClassOnClasspath on Windows:
- */
-@Category(IntegrationTest.class)
-public class JarClassLoaderJUnitTest {
-
-  private static final String JAR_PREFIX = "vf.gf#";
-
-  private final ClassBuilder classBuilder = new ClassBuilder();
-  final Pattern pattern = Pattern.compile("^" + JAR_PREFIX + "JarClassLoaderJUnit.*#\\d++$");
-
-  private InternalCache cache;
-
-  @After
-  public void tearDown() throws Exception {
-    for (ClassLoader classLoader : ClassPathLoader.getLatest().getClassLoaders()) {
-      if (classLoader instanceof JarClassLoader) {
-        JarClassLoader jarClassLoader = (JarClassLoader) classLoader;
-        if (jarClassLoader.getJarName().startsWith("JarClassLoaderJUnit")) {
-          ClassPathLoader.getLatest().removeAndSetLatest(jarClassLoader);
-        }
-      }
-    }
-    for (String functionName : FunctionService.getRegisteredFunctions().keySet()) {
-      if (functionName.startsWith("JarClassLoaderJUnit")) {
-        FunctionService.unregisterFunction(functionName);
-      }
-    }
-
-    if (this.cache != null) {
-      this.cache.close();
-    }
-
-    deleteSavedJarFiles();
-  }
-
-  @Test
-  public void testValidJarContent() throws IOException {
-    assertTrue(JarClassLoader
-        .isValidJarContent(this.classBuilder.createJarFromName("JarClassLoaderJUnitA")));
-  }
-
-  @Test
-  public void testInvalidJarContent() {
-    assertFalse(JarClassLoader.isValidJarContent("INVALID JAR CONTENT".getBytes()));
-  }
-
-  @Test
-  public void testClassOnClasspath() throws IOException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2");
-    ClassPathLoader classPathLoader = ClassPathLoader.createWithDefaults(false);
-
-    // Deploy the first JAR file and make sure the class is on the Classpath
-    byte[] jarBytes =
-        this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitA",
-            "package com.jcljunit; public class JarClassLoaderJUnitA {}");
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-
-    try {
-      classPathLoader.forName("com.jcljunit.JarClassLoaderJUnitA");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Update the JAR file and make sure the first class is no longer on the Classpath
-    // and the second one is.
-    jarBytes = this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitB",
-        "package com.jcljunit; public class JarClassLoaderJUnitB {}");
-    writeJarBytesToFile(jarFile2, jarBytes);
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-
-    try {
-      classPathLoader.forName("com.jcljunit.JarClassLoaderJUnitB");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    try {
-      classPathLoader.forName("com.jcljunit.JarClassLoaderJUnitA");
-      fail("Class should not be found on Classpath");
-    } catch (ClassNotFoundException expected) { // expected
-    }
-
-    classPathLoader.remove(classLoader);
-  }
-
-  @Test
-  public void testFailingCompilation() throws Exception {
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {}");
-    String functionString = stringBuffer.toString();
-
-    try {
-      this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-      fail("This code should have failed to compile and thrown an exception");
-    } catch (Exception ex) {
-      // All good
-    }
-  }
-
-  @Test
-  public void testFunctions() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2");
-    ClassPathLoader classPathLoader = ClassPathLoader.createWithDefaults(false);
-
-    // Test creating a JAR file with a function
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append("public class JarClassLoaderJUnitFunction implements Function {");
-    stringBuffer.append("public void init(Properties props) {}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"GOODv1\");}");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
-
-    byte[] jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
-    TestResultSender resultSender = new TestResultSender();
-    FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
-    function.execute(functionContext);
-    assertEquals("GOODv1", (String) resultSender.getResults());
-
-    // Test updating the function with a new JAR file
-    functionString = functionString.replace("v1", "v2");
-    jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile2, jarBytes);
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
-    resultSender = new TestResultSender();
-    functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
-    function.execute(functionContext);
-    assertEquals("GOODv2", (String) resultSender.getResults());
-
-    // Test returning null for the Id
-    String functionNullIdString =
-        functionString.replace("return \"JarClassLoaderJUnitFunction\"", "return null");
-    jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction",
-        functionNullIdString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
-
-    // Test removing the JAR
-    classPathLoader = classPathLoader.remove(classLoader);
-    assertNull(FunctionService.getFunction("JarClassLoaderJUnitFunction"));
-  }
-
-  /**
-   * Ensure that abstract functions aren't added to the Function Service.
-   */
-  @Test
-  public void testAbstractFunction() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-
-    Properties properties = new Properties();
-    properties.setProperty(MCAST_PORT, "0");
-    CacheFactory cacheFactory = new CacheFactory(properties);
-    this.cache = (InternalCache) cacheFactory.create();
-
-    // Add an abstract Function to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("public abstract class JarClassLoaderJUnitFunction implements Function {");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}}");
-    String functionString = stringBuffer.toString();
-
-    byte[] jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader =
-        new JarClassLoader(jarFile1, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNull(function);
-  }
-
-  @Test
-  public void testDeclarableFunctionsWithNoCacheXml() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnitNoXml.jar#1");
-
-    // Add a Declarable Function without parameters for the class to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer
-        .append("public class JarClassLoaderJUnitFunctionNoXml implements Function, Declarable {");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunctionNoXml\";}");
-    stringBuffer.append("public void init(Properties props) {}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"NOPARMSv1\");}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
-
-    byte[] jarBytes = this.classBuilder
-        .createJarFromClassContent("JarClassLoaderJUnitFunctionNoXml", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader =
-        new JarClassLoader(jarFile1, "JarClassLoaderJUnitFunctionNoXml.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunctionNoXml");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Check to see if the function without parameters executes correctly
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunctionNoXml");
-    assertNotNull(function);
-    TestResultSender resultSender = new TestResultSender();
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("NOPARMSv1", (String) resultSender.getResults());
-  }
-
-  @Test
-  public void testDeclarableFunctionsWithoutParms() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2");
-
-    Properties properties = new Properties();
-    properties.setProperty(MCAST_PORT, "0");
-    CacheFactory cacheFactory = new CacheFactory(properties);
-    this.cache = (InternalCache) cacheFactory.create();
-
-    // Add a Declarable Function without parameters for the class to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer
-        .append("public class JarClassLoaderJUnitFunction implements Function, Declarable {");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
-    stringBuffer.append("public void init(Properties props) {}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(\"NOPARMSv1\");}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
-
-    byte[] jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader =
-        new JarClassLoader(jarFile1, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Create a cache.xml file and configure the cache with it
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("<?xml version=\"1.0\"?>");
-    stringBuffer.append("<!DOCTYPE cache PUBLIC");
-    stringBuffer.append("  \"-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN\"");
-    stringBuffer.append("  \"http://www.gemstone.com/dtd/cache7_0.dtd\">");
-    stringBuffer.append("<cache>");
-    stringBuffer.append("  <function-service>");
-    stringBuffer.append("    <function>");
-    stringBuffer.append("      <class-name>JarClassLoaderJUnitFunction</class-name>");
-    stringBuffer.append("    </function>");
-    stringBuffer.append(" </function-service>");
-    stringBuffer.append("</cache>");
-    String cacheXmlString = stringBuffer.toString();
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
-
-    // Check to see if the function without parameters executes correctly
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
-    TestResultSender resultSender = new TestResultSender();
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("NOPARMSv1", (String) resultSender.getResults());
-
-    // Update the second function (change the value returned from execute) by deploying a JAR file
-    functionString = functionString.replace("v1", "v2");
-    jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile2, jarBytes);
-
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    // Check to see if the updated function without parameters executes correctly
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("NOPARMSv2", (String) resultSender.getResults());
-  }
-
-  @Test
-  public void testDeclarableFunctionsWithParms() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2");
-
-    Properties properties = new Properties();
-    properties.setProperty(MCAST_PORT, "0");
-    CacheFactory cacheFactory = new CacheFactory(properties);
-    this.cache = (InternalCache) cacheFactory.create();
-
-    // Add a Declarable Function with parameters to the class to the Classpath
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("import java.util.Properties;");
-    stringBuffer.append("import org.apache.geode.cache.Declarable;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer
-        .append("public class JarClassLoaderJUnitFunction implements Function, Declarable {");
-    stringBuffer.append("private Properties properties;");
-    stringBuffer.append(
-        "public String getId() {if(this.properties==null) {return \"JarClassLoaderJUnitFunction\";} else {return (String) this.properties.get(\"id\");}}");
-    stringBuffer.append("public void init(Properties props) {properties = props;}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(properties.get(\"returnValue\") + \"v1\");}");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-    String functionString = stringBuffer.toString();
-
-    byte[] jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader =
-        new JarClassLoader(jarFile1, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      ClassPathLoader.getLatest().forName("JarClassLoaderJUnitFunction");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    // Create a cache.xml file and configure the cache with it
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("<?xml version=\"1.0\"?>");
-    stringBuffer.append("<!DOCTYPE cache PUBLIC");
-    stringBuffer.append("  \"-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN\"");
-    stringBuffer.append("  \"http://www.gemstone.com/dtd/cache7_0.dtd\">");
-    stringBuffer.append("<cache>");
-    stringBuffer.append("  <function-service>");
-    stringBuffer.append("    <function>");
-    stringBuffer.append("      <class-name>JarClassLoaderJUnitFunction</class-name>");
-    stringBuffer.append(
-        "      <parameter name=\"id\"><string>JarClassLoaderJUnitFunctionA</string></parameter>");
-    stringBuffer.append("      <parameter name=\"returnValue\"><string>DOG</string></parameter>");
-    stringBuffer.append("    </function>");
-    stringBuffer.append("    <function>");
-    stringBuffer.append("      <class-name>JarClassLoaderJUnitFunction</class-name>");
-    stringBuffer.append(
-        "      <parameter name=\"id\"><string>JarClassLoaderJUnitFunctionB</string></parameter>");
-    stringBuffer.append("      <parameter name=\"returnValue\"><string>CAT</string></parameter>");
-    stringBuffer.append("    </function>");
-    stringBuffer.append(" </function-service>");
-    stringBuffer.append("</cache>");
-    String cacheXmlString = stringBuffer.toString();
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
-
-    // Check to see if the functions with parameters execute correctly
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunctionA");
-    assertNotNull(function);
-    TestResultSender resultSender = new TestResultSender();
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("DOGv1", (String) resultSender.getResults());
-
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionB");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("CATv1", (String) resultSender.getResults());
-
-    // Update the first function (change the value returned from execute)
-    functionString = functionString.replace("v1", "v2");
-    jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile2, jarBytes);
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    // Check to see if the updated functions with parameters execute correctly
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionA");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("DOGv2", (String) resultSender.getResults());
-
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionB");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("CATv2", (String) resultSender.getResults());
-
-    // Update cache xml to add a new function and replace an existing one
-    cacheXmlString =
-        cacheXmlString.replace("JarClassLoaderJUnitFunctionA", "JarClassLoaderJUnitFunctionC")
-            .replace("CAT", "BIRD");
-    this.cache.loadCacheXml(new ByteArrayInputStream(cacheXmlString.getBytes()));
-
-    // Update the first function (change the value returned from execute)
-    functionString = functionString.replace("v2", "v3");
-    jarBytes =
-        this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitFunction", functionString);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnitFunction.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    // Check to see if the updated functions with parameters execute correctly
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionA");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("DOGv3", (String) resultSender.getResults());
-
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionC");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("DOGv3", (String) resultSender.getResults());
-
-    function = FunctionService.getFunction("JarClassLoaderJUnitFunctionB");
-    assertNotNull(function);
-    function.execute(new FunctionContextImpl(function.getId(), null, resultSender));
-    assertEquals("BIRDv3", (String) resultSender.getResults());
-  }
-
-  @Test
-  public void testDependencyBetweenJars() throws IOException, ClassNotFoundException {
-    final File parentJarFile = new File(JAR_PREFIX + "JarClassLoaderJUnitParent.jar#1");
-    final File usesJarFile = new File(JAR_PREFIX + "JarClassLoaderJUnitUses.jar#1");
-    final File functionJarFile = new File(JAR_PREFIX + "JarClassLoaderJUnitFunction.jar#1");
-
-    // Write out a JAR files.
-    StringBuffer stringBuffer = new StringBuffer();
-    stringBuffer.append("package jcljunit.parent;");
-    stringBuffer.append("public class JarClassLoaderJUnitParent {");
-    stringBuffer.append("public String getValueParent() {");
-    stringBuffer.append("return \"PARENT\";}}");
-
-    byte[] jarBytes = this.classBuilder.createJarFromClassContent(
-        "jcljunit/parent/JarClassLoaderJUnitParent", stringBuffer.toString());
-    writeJarBytesToFile(parentJarFile, jarBytes);
-    JarClassLoader parentClassLoader =
-        new JarClassLoader(parentJarFile, "JarClassLoaderJUnitParent.jar", jarBytes);
-
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("package jcljunit.uses;");
-    stringBuffer.append("public class JarClassLoaderJUnitUses {");
-    stringBuffer.append("public String getValueUses() {");
-    stringBuffer.append("return \"USES\";}}");
-
-    jarBytes = this.classBuilder.createJarFromClassContent("jcljunit/uses/JarClassLoaderJUnitUses",
-        stringBuffer.toString());
-    writeJarBytesToFile(usesJarFile, jarBytes);
-    JarClassLoader usesClassLoader =
-        new JarClassLoader(usesJarFile, "JarClassLoaderJUnitUses.jar", jarBytes);
-
-    stringBuffer = new StringBuffer();
-    stringBuffer.append("package jcljunit.function;");
-    stringBuffer.append("import jcljunit.parent.JarClassLoaderJUnitParent;");
-    stringBuffer.append("import jcljunit.uses.JarClassLoaderJUnitUses;");
-    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
-    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
-    stringBuffer.append(
-        "public class JarClassLoaderJUnitFunction  extends JarClassLoaderJUnitParent implements Function {");
-    stringBuffer.append("private JarClassLoaderJUnitUses uses = new JarClassLoaderJUnitUses();");
-    stringBuffer.append("public boolean hasResult() {return true;}");
-    stringBuffer.append(
-        "public void execute(FunctionContext context) {context.getResultSender().lastResult(getValueParent() + \":\" + uses.getValueUses());}");
-    stringBuffer.append("public String getId() {return \"JarClassLoaderJUnitFunction\";}");
-    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
-    stringBuffer.append("public boolean isHA() {return false;}}");
-
-    ClassBuilder functionClassBuilder = new ClassBuilder();
-    functionClassBuilder.addToClassPath(parentJarFile.getAbsolutePath());
-    functionClassBuilder.addToClassPath(usesJarFile.getAbsolutePath());
-    jarBytes = functionClassBuilder.createJarFromClassContent(
-        "jcljunit/function/JarClassLoaderJUnitFunction", stringBuffer.toString());
-    writeJarBytesToFile(functionJarFile, jarBytes);
-    JarClassLoader functionClassLoader =
-        new JarClassLoader(functionJarFile, "JarClassLoaderJUnitFunction.jar", jarBytes);
-
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(functionClassLoader);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(parentClassLoader);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(usesClassLoader);
-
-    functionClassLoader.loadClassesAndRegisterFunctions();
-
-    Function function = FunctionService.getFunction("JarClassLoaderJUnitFunction");
-    assertNotNull(function);
-    TestResultSender resultSender = new TestResultSender();
-    FunctionContext functionContext = new FunctionContextImpl(function.getId(), null, resultSender);
-    function.execute(functionContext);
-    assertEquals("PARENT:USES", (String) resultSender.getResults());
-  }
-
-  @Test
-  public void testFindResource() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnitResource.jar#1");
-    ClassPathLoader classPathLoader = ClassPathLoader.createWithDefaults(false);
-    final String fileName = "file.txt";
-    final String fileContent = "FILE CONTENT";
-
-    byte[] jarBytes = this.classBuilder.createJarFromFileContent(fileName, fileContent);
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader =
-        new JarClassLoader(jarFile1, "JarClassLoaderJUnitResource.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    InputStream inputStream = classLoader.getResourceAsStream(fileName);
-    assertNotNull(inputStream);
-
-    final byte[] fileBytes = new byte[fileContent.length()];
-    inputStream.read(fileBytes);
-    inputStream.close();
-    assertTrue(fileContent.equals(new String(fileBytes)));
-  }
-
-  @Test
-  public void testUpdateClassInJar() throws IOException, ClassNotFoundException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnit.jar#2");
-    ClassPathLoader classPathLoader = ClassPathLoader.createWithDefaults(false);
-
-    // First use of the JAR file
-    byte[] jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitTestClass",
-        "public class JarClassLoaderJUnitTestClass { public Integer getValue5() { return new Integer(5); } }");
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      Class<?> clazz = classPathLoader.forName("JarClassLoaderJUnitTestClass");
-      Object object = clazz.newInstance();
-      Method getValue5Method = clazz.getMethod("getValue5", new Class[] {});
-      Integer value = (Integer) getValue5Method.invoke(object, new Object[] {});
-      assertEquals(value.intValue(), 5);
-
-    } catch (InvocationTargetException itex) {
-      fail("JAR file not correctly added to Classpath" + itex);
-    } catch (NoSuchMethodException nsmex) {
-      fail("JAR file not correctly added to Classpath" + nsmex);
-    } catch (InstantiationException iex) {
-      fail("JAR file not correctly added to Classpath" + iex);
-    } catch (IllegalAccessException iaex) {
-      fail("JAR file not correctly added to Classpath" + iaex);
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath" + cnfex);
-    }
-
-    // Now create an updated JAR file and make sure that the method from the new
-    // class is available.
-    jarBytes = this.classBuilder.createJarFromClassContent("JarClassLoaderJUnitTestClass",
-        "public class JarClassLoaderJUnitTestClass { public Integer getValue10() { return new Integer(10); } }");
-    writeJarBytesToFile(jarFile2, jarBytes);
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnit.jar", jarBytes);
-    classPathLoader = classPathLoader.addOrReplace(classLoader);
-    classLoader.loadClassesAndRegisterFunctions();
-
-    try {
-      Class<?> clazz = classPathLoader.forName("JarClassLoaderJUnitTestClass");
-      Object object = clazz.newInstance();
-      Method getValue10Method = clazz.getMethod("getValue10", new Class[] {});
-      Integer value = (Integer) getValue10Method.invoke(object, new Object[] {});
-      assertEquals(value.intValue(), 10);
-
-    } catch (InvocationTargetException itex) {
-      fail("JAR file not correctly added to Classpath" + itex);
-    } catch (NoSuchMethodException nsmex) {
-      fail("JAR file not correctly added to Classpath" + nsmex);
-    } catch (InstantiationException iex) {
-      fail("JAR file not correctly added to Classpath" + iex);
-    } catch (IllegalAccessException iaex) {
-      fail("JAR file not correctly added to Classpath" + iaex);
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath" + cnfex);
-    }
-  }
-
-  @Test
-  public void testMultiThread() throws IOException {
-    final File jarFile1 = new File(JAR_PREFIX + "JarClassLoaderJUnitA.jar#1");
-    final File jarFile2 = new File(JAR_PREFIX + "JarClassLoaderJUnitB.jar#1");
-
-    // Add two JARs to the classpath
-    byte[] jarBytes = this.classBuilder.createJarFromName("JarClassLoaderJUnitA");
-    writeJarBytesToFile(jarFile1, jarBytes);
-    JarClassLoader classLoader = new JarClassLoader(jarFile1, "JarClassLoaderJUnitA.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-
-    jarBytes = this.classBuilder.createJarFromClassContent("com/jcljunit/JarClassLoaderJUnitB",
-        "package com.jcljunit; public class JarClassLoaderJUnitB {}");
-    writeJarBytesToFile(jarFile2, jarBytes);
-    classLoader = new JarClassLoader(jarFile2, "JarClassLoaderJUnitB.jar", jarBytes);
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(classLoader);
-
-    String[] classNames = new String[] {"JarClassLoaderJUnitA", "com.jcljunit.JarClassLoaderJUnitB",
-        "NON-EXISTENT CLASS"};
-
-    // Spawn some threads which try to instantiate these classes
-    final int threadCount = 10;
-    final int numLoops = 1000;
-    final CyclicBarrier cyclicBarrier = new CyclicBarrier(threadCount + 1);
-    for (int i = 0; i < threadCount; i++) {
-      new ForNameExerciser(cyclicBarrier, numLoops, classNames).start();
-    }
-
-    // Wait for all of the threads to be ready
-    try {
-      cyclicBarrier.await();
-    } catch (InterruptedException iex) {
-      fail("Interrupted while waiting for barrier");
-    } catch (BrokenBarrierException bbex) {
-      fail("Broken barrier while waiting");
-    }
-
-    // Loop while each thread tries N times to instantiate a non-existent class
-    for (int i = 0; i < numLoops; i++) {
-      try {
-        cyclicBarrier.await(5, TimeUnit.SECONDS);
-      } catch (InterruptedException iex) {
-        fail("Interrupted while waiting for barrier");
-      } catch (TimeoutException tex) {
-        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-        long[] threadIds = threadMXBean.findDeadlockedThreads();
-
-        if (threadIds != null) {
-          StringBuffer deadLockTrace = new StringBuffer();
-          for (long threadId : threadIds) {
-            ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId, 100);
-            deadLockTrace.append(threadInfo.getThreadName()).append("\n");
-            for (StackTraceElement stackTraceElem : threadInfo.getStackTrace()) {
-              deadLockTrace.append("\t").append(stackTraceElem).append("\n");
-            }
-          }
-
-          fail("Deadlock with trace:\n" + deadLockTrace.toString());
-        }
-
-        fail("Timeout while waiting for barrier - no deadlock detected");
-      } catch (BrokenBarrierException bbex) {
-        fail("Broken barrier while waiting");
-      }
-    }
-  }
-
-  private void deleteSavedJarFiles() {
-    File dirFile = new File(".");
-
-    // Find all created JAR files
-    File[] oldJarFiles = dirFile.listFiles(new FilenameFilter() {
-      @Override
-      public boolean accept(final File file, final String name) {
-        return JarClassLoaderJUnitTest.this.pattern.matcher(name).matches();
-      }
-    });
-
-    // Now delete them
-    if (oldJarFiles != null) {
-      for (File oldJarFile : oldJarFiles) {
-        if (!oldJarFile.delete()) {
-          RandomAccessFile randomAccessFile = null;
-          try {
-            randomAccessFile = new RandomAccessFile(oldJarFile, "rw");
-            randomAccessFile.setLength(0);
-          } catch (IOException ioex) {
-            fail("IOException when trying to deal with a stubborn JAR file");
-          } finally {
-            try {
-              if (randomAccessFile != null) {
-                randomAccessFile.close();
-              }
-            } catch (IOException ioex) {
-              fail("IOException when trying to deal with a stubborn JAR file");
-            }
-          }
-          oldJarFile.deleteOnExit();
-        }
-      }
-    }
-  }
-
-  private void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws IOException {
-    final OutputStream outStream = new FileOutputStream(jarFile);
-    outStream.write(jarBytes);
-    outStream.close();
-  }
-
-  private static class TestResultSender implements ResultSender<Object> {
-    private Object result;
-
-    public TestResultSender() {}
-
-    protected Object getResults() {
-      return this.result;
-    }
-
-    @Override
-    public void lastResult(final Object lastResult) {
-      this.result = lastResult;
-    }
-
-    @Override
-    public void sendResult(final Object oneResult) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void sendException(final Throwable t) {
-      throw new UnsupportedOperationException();
-    }
-  }
-
-  static final Random random = new Random();
-
-  private class ForNameExerciser extends Thread {
-    private final CyclicBarrier cyclicBarrier;
-    private final int numLoops;
-    private final String[] classNames;
-
-    ForNameExerciser(final CyclicBarrier cyclicBarrier, final int numLoops,
-        final String[] classNames) {
-      this.cyclicBarrier = cyclicBarrier;
-      this.numLoops = numLoops;
-      this.classNames = classNames;
-    }
-
-    @Override
-    public void run() {
-      try {
-        this.cyclicBarrier.await();
-      } catch (InterruptedException iex) {
-        fail("Interrupted while waiting for latch");
-      } catch (BrokenBarrierException bbex) {
-        fail("Broken barrier while waiting");
-      }
-      for (int i = 0; i < this.numLoops; i++) {
-        try {
-          // Random select a name from the list of class names and try to load it
-          String className = this.classNames[random.nextInt(this.classNames.length)];
-          ClassPathLoader.getLatest().forName(className);
-        } catch (ClassNotFoundException expected) { // expected
-        }
-        try {
-          this.cyclicBarrier.await();
-        } catch (InterruptedException iex) {
-          fail("Interrupted while waiting for barrrier");
-        } catch (BrokenBarrierException bbex) {
-          fail("Broken barrier while waiting");
-        }
-      }
-    }
-  }
-}


[18/51] [abbrv] geode git commit: GEODE-2686: Remove JarClassLoader

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
index 18d4b42..ad5c435 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
@@ -14,44 +14,60 @@
  */
 package org.apache.geode.internal;
 
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toSet;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.geode.GemFireException;
+import org.apache.geode.GemFireIOException;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.logging.log4j.Logger;
 
 import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.RandomAccessFile;
 import java.io.Serializable;
-import java.nio.channels.FileLock;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Stream;
 
 public class JarDeployer implements Serializable {
   private static final long serialVersionUID = 1L;
   private static final Logger logger = LogService.getLogger();
-  public static final String JAR_PREFIX = "vf.gf#";
-  public static final String JAR_PREFIX_FOR_REGEX = "^vf\\.gf#";
+  public static final String JAR_PREFIX = "";
+  public static final String JAR_PREFIX_FOR_REGEX = "";
   private static final Lock lock = new ReentrantLock();
 
+  private final Map<String, DeployedJar> deployedJars = new ConcurrentHashMap<>();
+
+
   // Split a versioned filename into its name and version
   public static final Pattern versionedPattern =
-      Pattern.compile(JAR_PREFIX_FOR_REGEX + "(.*)#(\\d++)$");
+      Pattern.compile(JAR_PREFIX_FOR_REGEX + "(.*)\\.v(\\d++).jar$");
 
   private final File deployDirectory;
 
@@ -63,262 +79,36 @@ public class JarDeployer implements Serializable {
     this.deployDirectory = deployDirectory;
   }
 
-  /**
-   * Re-deploy all previously deployed JAR files.
-   */
-  public void loadPreviouslyDeployedJars() {
-    List<JarClassLoader> jarClassLoaders = new ArrayList<JarClassLoader>();
-
-    lock.lock();
-    try {
-      try {
-        verifyWritableDeployDirectory();
-        final Set<String> jarNames = findDistinctDeployedJars();
-        if (!jarNames.isEmpty()) {
-          for (String jarName : jarNames) {
-            final File[] jarFiles = findSortedOldVersionsOfJar(jarName);
-
-            // It's possible the JARs were deleted by another process
-            if (jarFiles.length != 0) {
-              JarClassLoader jarClassLoader = findJarClassLoader(jarName);
-
-              try {
-                final byte[] jarBytes = getJarContent(jarFiles[0]);
-                if (!JarClassLoader.isValidJarContent(jarBytes)) {
-                  logger.warn("Invalid JAR file found and deleted: {}",
-                      jarFiles[0].getAbsolutePath());
-                  jarFiles[0].delete();
-                } else {
-                  // Test to see if the exact same file is already in use
-                  if (jarClassLoader == null
-                      || !jarClassLoader.getFileName().equals(jarFiles[0].getName())) {
-                    jarClassLoader = new JarClassLoader(jarFiles[0], jarName, jarBytes);
-                    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(jarClassLoader);
-                    jarClassLoaders.add(jarClassLoader);
-                  }
-                }
-              } catch (IOException ioex) {
-                // Another process deleted the file so don't bother doing anything else with it
-                if (logger.isDebugEnabled()) {
-                  logger.debug("Failed attempt to use JAR to create JarClassLoader for: {}",
-                      jarName);
-                }
-              }
-
-              // Remove any old left-behind versions of this JAR file
-              for (File jarFile : jarFiles) {
-                if (jarFile.exists() && (jarClassLoader == null
-                    || !jarClassLoader.getFileName().equals(jarFile.getName()))) {
-                  attemptFileLockAndDelete(jarFile);
-                }
-              }
-            }
-          }
-        }
-
-        for (JarClassLoader jarClassLoader : jarClassLoaders) {
-          jarClassLoader.loadClassesAndRegisterFunctions();
-        }
-      } catch (VirtualMachineError e) {
-        SystemFailure.initiateFailure(e);
-        throw e;
-      } catch (Throwable th) {
-        SystemFailure.checkFailure();
-        logger.error("Error when attempting to deploy JAR files on load.", th);
-      }
-    } finally {
-      lock.unlock();
-    }
+  public File getDeployDirectory() {
+    return this.deployDirectory;
   }
 
-  /**
-   * Deploy the given JAR files.
-   * 
-   * @param jarNames Array of names of the JAR files to deploy.
-   * @param jarBytes Array of contents of the JAR files to deploy.
-   * @return An array of newly created JAR class loaders. Entries will be null for an JARs that were
-   *         already deployed.
-   * @throws IOException When there's an error saving the JAR file to disk
-   */
-  public JarClassLoader[] deploy(final String jarNames[], final byte[][] jarBytes)
-      throws IOException, ClassNotFoundException {
-    JarClassLoader[] jarClassLoaders = new JarClassLoader[jarNames.length];
-    verifyWritableDeployDirectory();
-
+  public DeployedJar deployWithoutRegistering(final String jarName, final byte[] jarBytes)
+      throws IOException {
     lock.lock();
+
     try {
-      for (int i = 0; i < jarNames.length; i++) {
-        if (!JarClassLoader.isValidJarContent(jarBytes[i])) {
-          throw new IllegalArgumentException(
-              "File does not contain valid JAR content: " + jarNames[i]);
-        }
-      }
+      verifyWritableDeployDirectory();
 
-      for (int i = 0; i < jarNames.length; i++) {
-        jarClassLoaders[i] = deployWithoutRegistering(jarNames[i], jarBytes[i]);
-      }
+      File newVersionedJarFile = getNextVersionedJarFile(jarName);
+      writeJarBytesToFile(newVersionedJarFile, jarBytes);
 
-      for (JarClassLoader jarClassLoader : jarClassLoaders) {
-        if (jarClassLoader != null) {
-          jarClassLoader.loadClassesAndRegisterFunctions();
-        }
-      }
+      return new DeployedJar(newVersionedJarFile, jarName, jarBytes);
     } finally {
       lock.unlock();
     }
-    return jarClassLoaders;
   }
 
-  /**
-   * Deploy the given JAR file without registering functions.
-   * 
-   * @param jarName Name of the JAR file to deploy.
-   * @param jarBytes Contents of the JAR file to deploy.
-   * @return The newly created JarClassLoader or null if the JAR was already deployed
-   * @throws IOException When there's an error saving the JAR file to disk
-   */
-  private JarClassLoader deployWithoutRegistering(final String jarName, final byte[] jarBytes)
-      throws IOException {
-    JarClassLoader oldJarClassLoader = findJarClassLoader(jarName);
-
-    final boolean isDebugEnabled = logger.isDebugEnabled();
-    if (isDebugEnabled) {
-      logger.debug("Deploying {}: {}", jarName, (oldJarClassLoader == null ? ": not yet deployed"
-          : ": already deployed as " + oldJarClassLoader.getFileCanonicalPath()));
-    }
-
-    // Test to see if the exact same file is being deployed
-    if (oldJarClassLoader != null && oldJarClassLoader.hasSameContent(jarBytes)) {
-      return null;
-    }
-
-    JarClassLoader newJarClassLoader = null;
-
-    do {
-      File[] oldJarFiles = findSortedOldVersionsOfJar(jarName);
-
-      try {
-        // If this is the first version of this JAR file we've seen ...
-        if (oldJarFiles.length == 0) {
-          if (isDebugEnabled) {
-            logger.debug("There were no pre-existing versions for JAR: {}", jarName);
-          }
-          File nextVersionJarFile = getNextVersionJarFile(jarName);
-          if (writeJarBytesToFile(nextVersionJarFile, jarBytes)) {
-            newJarClassLoader = new JarClassLoader(nextVersionJarFile, jarName, jarBytes);
-            if (isDebugEnabled) {
-              logger.debug("Successfully created initial JarClassLoader at file: {}",
-                  nextVersionJarFile.getAbsolutePath());
-            }
-          } else {
-            if (isDebugEnabled) {
-              logger.debug("Unable to write contents for first version of JAR to file: {}",
-                  nextVersionJarFile.getAbsolutePath());
-            }
-          }
-
-        } else {
-          // Most recent is at the beginning of the list, see if this JAR matches what's
-          // already on disk.
-          if (doesFileMatchBytes(oldJarFiles[0], jarBytes)) {
-            if (isDebugEnabled) {
-              logger.debug("A version on disk was an exact match for the JAR being deployed: {}",
-                  oldJarFiles[0].getAbsolutePath());
-            }
-            newJarClassLoader = new JarClassLoader(oldJarFiles[0], jarName, jarBytes);
-            if (isDebugEnabled) {
-              logger.debug("Successfully reused JAR to create JarClassLoader from file: {}",
-                  oldJarFiles[0].getAbsolutePath());
-            }
-          } else {
-            // This JAR isn't on disk
-            if (isDebugEnabled) {
-              logger.debug("Need to create a new version for JAR: {}", jarName);
-            }
-            File nextVersionJarFile = getNextVersionJarFile(oldJarFiles[0].getName());
-            if (writeJarBytesToFile(nextVersionJarFile, jarBytes)) {
-              newJarClassLoader = new JarClassLoader(nextVersionJarFile, jarName, jarBytes);
-              if (isDebugEnabled) {
-                logger.debug("Successfully created next JarClassLoader at file: {}",
-                    nextVersionJarFile.getAbsolutePath());
-              }
-            } else {
-              if (isDebugEnabled) {
-                logger.debug("Unable to write contents for next version of JAR to file: {}",
-                    nextVersionJarFile.getAbsolutePath());
-              }
-            }
-          }
-        }
-      } catch (IOException ioex) {
-        // Another process deleted the file before we could get to it, just start again
-        logger.info("Failed attempt to use JAR to create JarClassLoader for: {} : {}", jarName,
-            ioex.getMessage());
-      }
-
-      if (isDebugEnabled) {
-        if (newJarClassLoader == null) {
-          logger.debug("Unable to determine a JAR file location, will loop and try again: {}",
-              jarName);
-        } else {
-          logger.debug("Exiting loop for JarClassLoader creation using file: {}",
-              newJarClassLoader.getFileName());
-        }
-      }
-    } while (newJarClassLoader == null);
-
-    ClassPathLoader.getLatest().addOrReplaceAndSetLatest(newJarClassLoader);
-
-    // Remove the JAR file that was undeployed as part of this redeploy
-    if (oldJarClassLoader != null) {
-      attemptFileLockAndDelete(new File(this.deployDirectory, oldJarClassLoader.getFileName()));
-    }
-
-    return newJarClassLoader;
-  }
 
   /**
-   * Undeploy the given JAR file.
+   * Get a list of all currently deployed jars.
    * 
-   * @param jarName The name of the JAR file to undeploy
-   * @return The path to the location on disk where the JAR file had been deployed
-   * @throws IOException If there's a problem deleting the file
+   * @return The list of DeployedJars
    */
-  public String undeploy(final String jarName) throws IOException {
-    JarClassLoader jarClassLoader = null;
-    verifyWritableDeployDirectory();
-
-    lock.lock();
-    try {
-      jarClassLoader = findJarClassLoader(jarName);
-      if (jarClassLoader == null) {
-        throw new IllegalArgumentException("JAR not deployed");
-      }
-
-      ClassPathLoader.getLatest().removeAndSetLatest(jarClassLoader);
-      attemptFileLockAndDelete(new File(this.deployDirectory, jarClassLoader.getFileName()));
-      return jarClassLoader.getFileCanonicalPath();
-    } finally {
-      lock.unlock();
-    }
+  public List<DeployedJar> findDeployedJars() {
+    return getDeployedJars().values().stream().collect(toList());
   }
 
-  /**
-   * Get a list of all currently deployed JarClassLoaders.
-   * 
-   * @return The list of JarClassLoaders
-   */
-  public List<JarClassLoader> findJarClassLoaders() {
-    List<JarClassLoader> returnList = new ArrayList<JarClassLoader>();
-    Collection<ClassLoader> classLoaders = ClassPathLoader.getLatest().getClassLoaders();
-    for (ClassLoader classLoader : classLoaders) {
-      if (classLoader instanceof JarClassLoader) {
-        returnList.add((JarClassLoader) classLoader);
-      }
-    }
-
-    return returnList;
-  }
 
   /**
    * Suspend all deploy and undeploy operations. This is done by acquiring and holding the lock
@@ -339,26 +129,19 @@ public class JarDeployer implements Serializable {
     lock.unlock();
   }
 
-  /**
-   * Figure out the next version of a JAR file
-   * 
-   * @param latestVersionedJarName The previous most recent version of the JAR file or original name
-   *        if there wasn't one
-   * @return The file that represents the next version
-   */
-  protected File getNextVersionJarFile(final String latestVersionedJarName) {
-    String newFileName;
-    final Matcher matcher = versionedPattern.matcher(latestVersionedJarName);
-    if (matcher.find()) {
-      newFileName = JAR_PREFIX + matcher.group(1) + "#" + (Integer.parseInt(matcher.group(2)) + 1);
+  protected File getNextVersionedJarFile(String unversionedJarName) {
+    File[] oldVersions = findSortedOldVersionsOfJar(unversionedJarName);
+
+    String nextVersionedJarName;
+    if (oldVersions == null || oldVersions.length == 0) {
+      nextVersionedJarName = removeJarExtension(unversionedJarName) + ".v1.jar";
     } else {
-      newFileName = JAR_PREFIX + latestVersionedJarName + "#1";
+      String latestVersionedJarName = oldVersions[0].getName();
+      int nextVersion = extractVersionFromFilename(latestVersionedJarName) + 1;
+      nextVersionedJarName = removeJarExtension(unversionedJarName) + ".v" + nextVersion + ".jar";
     }
 
-    if (logger.isDebugEnabled()) {
-      logger.debug("Next version file name will be: {}", newFileName);
-    }
-    return new File(this.deployDirectory, newFileName);
+    return new File(deployDirectory, nextVersionedJarName);
   }
 
   /**
@@ -370,27 +153,18 @@ public class JarDeployer implements Serializable {
    * @param jarBytes Contents of the JAR file to deploy.
    * @return True if the file was successfully written, false otherwise
    */
-  private boolean writeJarBytesToFile(final File file, final byte[] jarBytes) {
+  private boolean writeJarBytesToFile(final File file, final byte[] jarBytes) throws IOException {
     final boolean isDebugEnabled = logger.isDebugEnabled();
-    try {
-      if (file.createNewFile()) {
-        if (isDebugEnabled) {
-          logger.debug("Successfully created new JAR file: {}", file.getAbsolutePath());
-        }
-        final OutputStream outStream = new FileOutputStream(file);
-        outStream.write(jarBytes);
-        outStream.close();
-        return true;
-      }
-      return doesFileMatchBytes(file, jarBytes);
-
-    } catch (IOException ioex) {
-      // Another VM clobbered what was happening here, try again
+    if (file.createNewFile()) {
       if (isDebugEnabled) {
-        logger.debug("IOException while trying to write JAR content to file: {}", ioex);
+        logger.debug("Successfully created new JAR file: {}", file.getAbsolutePath());
       }
-      return false;
+      final OutputStream outStream = new FileOutputStream(file);
+      outStream.write(jarBytes);
+      outStream.close();
+      return true;
     }
+    return doesFileMatchBytes(file, jarBytes);
   }
 
   /**
@@ -457,86 +231,22 @@ public class JarDeployer implements Serializable {
     return true;
   }
 
-  private void attemptFileLockAndDelete(final File file) throws IOException {
-    final String absolutePath = file.getAbsolutePath();
-    FileOutputStream fileOutputStream = new FileOutputStream(file, true);
-    final boolean isDebugEnabled = logger.isDebugEnabled();
-    try {
-      FileLock fileLock = null;
-      try {
-        fileLock = fileOutputStream.getChannel().tryLock();
-
-        if (fileLock != null) {
-          if (isDebugEnabled) {
-            logger.debug("Tried and acquired exclusive lock for file: {}, w/ channel {}",
-                absolutePath, fileLock.channel());
-          }
-
-          if (file.delete()) {
-            if (isDebugEnabled) {
-              logger.debug("Deleted file with name: {}", absolutePath);
-            }
-          } else {
-            if (isDebugEnabled) {
-              logger.debug("Could not delete file, will truncate instead and delete on exit: {}",
-                  absolutePath);
-            }
-            file.deleteOnExit();
-
-            RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
-            try {
-              randomAccessFile.setLength(0);
-            } finally {
-              try {
-                randomAccessFile.close();
-              } catch (IOException ioex) {
-                logger.error("Could not close file when attempting to set zero length", ioex);
-              }
-            }
-          }
-        } else {
-          if (isDebugEnabled) {
-            logger.debug("Will not delete file since exclusive lock unavailable: {}", absolutePath);
-          }
-        }
-
-      } finally {
-        if (fileLock != null) {
-          try {
-            fileLock.release();
-            fileLock.channel().close();
-            if (isDebugEnabled) {
-              logger.debug("Released file lock for file: {}, w/ channel: {}", absolutePath,
-                  fileLock.channel());
-            }
-          } catch (IOException ioex) {
-            logger.error("Could not close channel on JAR lock file", ioex);
-          }
-        }
-      }
-    } finally {
-      try {
-        fileOutputStream.close();
-      } catch (IOException ioex) {
-        logger.error("Could not close output stream on JAR file", ioex);
-      }
-    }
-  }
-
   /**
    * Find the version number that's embedded in the name of this file
    * 
-   * @param file File to get the version number from
+   * @param filename Filename to get the version number from
    * @return The version number embedded in the filename
    */
-  int extractVersionFromFilename(final File file) {
-    final Matcher matcher = versionedPattern.matcher(file.getName());
-    matcher.find();
-    return Integer.parseInt(matcher.group(2));
+  public static int extractVersionFromFilename(final String filename) {
+    final Matcher matcher = versionedPattern.matcher(filename);
+    if (matcher.find()) {
+      return Integer.parseInt(matcher.group(2));
+    } else {
+      return 0;
+    }
   }
 
   protected Set<String> findDistinctDeployedJars() {
-
     // Find all deployed JAR files
     final File[] oldFiles = this.deployDirectory.listFiles(new FilenameFilter() {
       @Override
@@ -559,41 +269,32 @@ public class JarDeployer implements Serializable {
    * Find all versions of the JAR file that are currently on disk and return them sorted from newest
    * (highest version) to oldest
    * 
-   * @param jarFilename Name of the JAR file that we want old versions of
+   * @param unversionedJarName Name of the JAR file that we want old versions of
    * @return Sorted array of files that are older versions of the given JAR
    */
-  protected File[] findSortedOldVersionsOfJar(final String jarFilename) {
+  protected File[] findSortedOldVersionsOfJar(final String unversionedJarName) {
     // Find all matching files
-    final Pattern pattern = Pattern.compile(JAR_PREFIX_FOR_REGEX + jarFilename + "#\\d++$");
-    final File[] oldJarFiles = this.deployDirectory.listFiles(new FilenameFilter() {
-      @Override
-      public boolean accept(final File file, final String name) {
-        return (pattern.matcher(name).matches());
-      }
-    });
+    final Pattern pattern = Pattern.compile(
+        JAR_PREFIX_FOR_REGEX + removeJarExtension(unversionedJarName) + "\\.v\\d++\\.jar$");
+    final File[] oldJarFiles =
+        this.deployDirectory.listFiles((file, name) -> (pattern.matcher(name).matches()));
 
     // Sort them in order from newest (highest version) to oldest
-    Arrays.sort(oldJarFiles, new Comparator<File>() {
-      @Override
-      public int compare(final File file1, final File file2) {
-        int file1Version = extractVersionFromFilename(file1);
-        int file2Version = extractVersionFromFilename(file2);
-        return file2Version - file1Version;
-      }
+    Arrays.sort(oldJarFiles, (file1, file2) -> {
+      int file1Version = extractVersionFromFilename(file1.getName());
+      int file2Version = extractVersionFromFilename(file2.getName());
+      return file2Version - file1Version;
     });
 
     return oldJarFiles;
   }
 
-  private JarClassLoader findJarClassLoader(final String jarName) {
-    Collection<ClassLoader> classLoaders = ClassPathLoader.getLatest().getClassLoaders();
-    for (ClassLoader classLoader : classLoaders) {
-      if (classLoader instanceof JarClassLoader
-          && ((JarClassLoader) classLoader).getJarName().equals(jarName)) {
-        return (JarClassLoader) classLoader;
-      }
+  protected String removeJarExtension(String jarName) {
+    if (jarName != null && jarName.endsWith(".jar")) {
+      return jarName.replaceAll("\\.jar$", "");
+    } else {
+      return jarName;
     }
-    return null;
   }
 
   /**
@@ -601,7 +302,7 @@ public class JarDeployer implements Serializable {
    * 
    * @throws IOException If the directory isn't writable
    */
-  private void verifyWritableDeployDirectory() throws IOException {
+  public void verifyWritableDeployDirectory() throws IOException {
     Exception exception = null;
     int tryCount = 0;
     do {
@@ -627,20 +328,246 @@ public class JarDeployer implements Serializable {
         "Unable to write to deploy directory: " + this.deployDirectory.getCanonicalPath());
   }
 
-  private byte[] getJarContent(File jarFile) throws IOException {
-    InputStream inputStream = new FileInputStream(jarFile);
+  final Pattern oldNamingPattern = Pattern.compile("^vf\\.gf#(.*)\\.jar#(\\d+)$");
+
+  /*
+   * In Geode 1.1.0, the deployed version of 'myjar.jar' would be named 'vf.gf#myjar.jar#1'. Now it
+   * is be named 'myjar.v1.jar'. We need to rename all existing deployed jars to the new convention
+   * if this is the first time starting up with the new naming format.
+   */
+  protected void renameJarsWithOldNamingConvention() throws IOException {
+    Set<File> jarsWithOldNamingConvention = findJarsWithOldNamingConvention();
+
+    if (jarsWithOldNamingConvention.isEmpty()) {
+      return;
+    }
+
+    for (File jar : jarsWithOldNamingConvention) {
+      renameJarWithOldNamingConvention(jar);
+    }
+  }
+
+  protected Set<File> findJarsWithOldNamingConvention() {
+    return Stream.of(this.deployDirectory.listFiles())
+        .filter((File file) -> isOldNamingConvention(file.getName())).collect(toSet());
+  }
+
+  protected boolean isOldNamingConvention(String fileName) {
+    return oldNamingPattern.matcher(fileName).matches();
+  }
+
+  private void renameJarWithOldNamingConvention(File oldJar) throws IOException {
+    Matcher matcher = oldNamingPattern.matcher(oldJar.getName());
+    if (!matcher.matches()) {
+      throw new IllegalArgumentException("The given jar " + oldJar.getCanonicalPath()
+          + " does not match the old naming convention");
+    }
+
+    String unversionedJarNameWithoutExtension = matcher.group(1);
+    String jarVersion = matcher.group(2);
+    String newJarName = unversionedJarNameWithoutExtension + ".v" + jarVersion + ".jar";
+
+    File newJar = new File(this.deployDirectory, newJarName);
+    logger.debug("Renaming deployed jar from " + oldJar.getCanonicalPath() + " to "
+        + newJar.getCanonicalPath());
+
+    FileUtils.moveFile(oldJar, newJar);
+    FileUtils.deleteQuietly(oldJar);
+  }
+
+  /**
+   * Re-deploy all previously deployed JAR files.
+   */
+  public void loadPreviouslyDeployedJars() {
+    lock.lock();
+    try {
+      verifyWritableDeployDirectory();
+      renameJarsWithOldNamingConvention();
+
+      final Set<String> jarNames = findDistinctDeployedJars();
+      if (jarNames.isEmpty()) {
+        return;
+      }
+
+      Map<String, DeployedJar> latestVersionOfEachJar = new LinkedHashMap<>();
+
+      for (String jarName : jarNames) {
+        final File[] jarFiles = findSortedOldVersionsOfJar(jarName);
+
+        Optional<File> latestValidDeployedJarOptional =
+            Arrays.stream(jarFiles).filter(Objects::nonNull).filter(jarFile -> {
+              try {
+                return DeployedJar.isValidJarContent(FileUtils.readFileToByteArray(jarFile));
+              } catch (IOException e) {
+                return false;
+              }
+            }).findFirst();
+
+        if (!latestValidDeployedJarOptional.isPresent()) {
+          // No valid version of this jar
+          continue;
+        }
+
+        File latestValidDeployedJar = latestValidDeployedJarOptional.get();
+        latestVersionOfEachJar.put(jarName, new DeployedJar(latestValidDeployedJar, jarName));
+
+        // Remove any old left-behind versions of this JAR file
+        for (File jarFile : jarFiles) {
+          if (!latestValidDeployedJar.equals(jarFile)) {
+            FileUtils.deleteQuietly(jarFile);
+          }
+        }
+      }
+
+      registerNewVersions(latestVersionOfEachJar.values().stream().collect(toList()));
+      // ClassPathLoader.getLatest().deploy(latestVersionOfEachJar.keySet().toArray(),
+      // latestVersionOfEachJar.values().toArray())
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    } finally {
+      lock.unlock();
+    }
+  }
+
+
+  public URL[] getDeployedJarURLs() {
+    return this.deployedJars.values().stream().map(DeployedJar::getFileURL).toArray(URL[]::new);
+
+  }
+
+  public List<DeployedJar> registerNewVersions(List<DeployedJar> deployedJars)
+      throws ClassNotFoundException {
+    lock.lock();
+    try {
+      for (DeployedJar deployedJar : deployedJars) {
+        if (deployedJar != null) {
+          DeployedJar oldJar = this.deployedJars.put(deployedJar.getJarName(), deployedJar);
+          if (oldJar != null) {
+            oldJar.cleanUp();
+          }
+        }
+      }
+
+      ClassPathLoader.getLatest().rebuildClassLoaderForDeployedJars();
+
+      for (DeployedJar deployedJar : deployedJars) {
+        if (deployedJar != null) {
+          deployedJar.loadClassesAndRegisterFunctions();
+        }
+      }
+    } finally {
+      lock.unlock();
+    }
+
+    return deployedJars;
+  }
+
+  /**
+   * Deploy the given JAR files.
+   * 
+   * @param jarNames Array of names of the JAR files to deploy.
+   * @param jarBytes Array of contents of the JAR files to deploy.
+   * @return An array of newly created JAR class loaders. Entries will be null for an JARs that were
+   *         already deployed.
+   * @throws IOException When there's an error saving the JAR file to disk
+   */
+  public List<DeployedJar> deploy(final String jarNames[], final byte[][] jarBytes)
+      throws IOException, ClassNotFoundException {
+    DeployedJar[] deployedJars = new DeployedJar[jarNames.length];
+
+    for (int i = 0; i < jarNames.length; i++) {
+      if (!DeployedJar.isValidJarContent(jarBytes[i])) {
+        throw new IllegalArgumentException(
+            "File does not contain valid JAR content: " + jarNames[i]);
+      }
+    }
+
+    lock.lock();
+    try {
+      for (int i = 0; i < jarNames.length; i++) {
+        String jarName = jarNames[i];
+        byte[] newJarBytes = jarBytes[i];
+
+        boolean shouldDeployNewVersion = shouldDeployNewVersion(jarName, newJarBytes);
+
+        if (shouldDeployNewVersion) {
+          deployedJars[i] = deployWithoutRegistering(jarName, newJarBytes);
+        } else {
+          deployedJars[i] = null;
+        }
+      }
+
+      return registerNewVersions(Arrays.asList(deployedJars));
+    } finally {
+      lock.unlock();
+    }
+  }
+
+  private boolean shouldDeployNewVersion(String jarName, byte[] newJarBytes) throws IOException {
+    DeployedJar oldDeployedJar = this.deployedJars.get(jarName);
+
+    if (oldDeployedJar == null) {
+      return true;
+    }
+
+    if (oldDeployedJar.hasSameContentAs(newJarBytes)) {
+      logger.warn("Jar is identical to the latest deployed version: ",
+          oldDeployedJar.getFileCanonicalPath());
+
+      return false;
+    }
+
+    return true;
+  }
+
+  public DeployedJar findDeployedJar(String jarName) {
+    return this.deployedJars.get(jarName);
+  }
+
+  public DeployedJar deploy(final String jarName, final byte[] jarBytes)
+      throws IOException, ClassNotFoundException {
+    lock.lock();
+
     try {
-      final ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
-      final byte[] bytes = new byte[4096];
+      List<DeployedJar> deployedJars = deploy(new String[] {jarName}, new byte[][] {jarBytes});
+      if (deployedJars == null || deployedJars.size() == 0) {
+        return null;
+      }
+
+      return deployedJars.get(0);
+    } finally {
+      lock.unlock();
+    }
+
+  }
 
-      int bytesRead;
-      while (((bytesRead = inputStream.read(bytes)) != -1)) {
-        byteOutStream.write(bytes, 0, bytesRead);
+  public Map<String, DeployedJar> getDeployedJars() {
+    return Collections.unmodifiableMap(this.deployedJars);
+  }
+
+  /**
+   * Undeploy the given JAR file.
+   * 
+   * @param jarName The name of the JAR file to undeploy
+   * @return The path to the location on disk where the JAR file had been deployed
+   * @throws IOException If there's a problem deleting the file
+   */
+  public String undeploy(final String jarName) throws IOException {
+    lock.lock();
+
+    try {
+      DeployedJar deployedJar = deployedJars.remove(jarName);
+      if (deployedJar == null) {
+        throw new IllegalArgumentException("JAR not deployed");
       }
 
-      return byteOutStream.toByteArray();
+      ClassPathLoader.getLatest().rebuildClassLoaderForDeployedJars();
+
+      deployedJar.cleanUp();
+
+      return deployedJar.getFileCanonicalPath();
     } finally {
-      inputStream.close();
+      lock.unlock();
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
index f904af1..2b627b2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
@@ -24,9 +24,11 @@ import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
 import java.util.Set;
 
+import org.apache.geode.internal.ClassPathLoader;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.UnmodifiableException;
@@ -35,7 +37,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.tcpserver.TcpClient;
 import org.apache.geode.internal.ConfigSource;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.admin.remote.DistributionLocatorId;
 import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -56,45 +58,38 @@ public class ClusterConfigurationLoader {
    * 
    * @param cache Cache of this member
    * @param response {@link ConfigurationResponse} received from the locators
-   * @throws IOException
-   * @throws ClassNotFoundException
    */
   public static void deployJarsReceivedFromClusterConfiguration(Cache cache,
       ConfigurationResponse response) throws IOException, ClassNotFoundException {
-    if (response == null)
+    if (response == null) {
       return;
+    }
 
     String[] jarFileNames = response.getJarNames();
     byte[][] jarBytes = response.getJars();
 
-    final JarDeployer jarDeployer = new JarDeployer(
-        ((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
-
-    /******
-     * Un-deploy the existing jars, deployed during cache creation, do not delete anything
-     */
-
     if (jarFileNames != null && jarBytes != null) {
-      JarClassLoader[] jarClassLoaders = jarDeployer.deploy(jarFileNames, jarBytes);
-      for (int i = 0; i < jarFileNames.length; i++) {
-        if (jarClassLoaders[i] != null) {
-          logger.info("Deployed " + (jarClassLoaders[i].getFileCanonicalPath()));
-        }
-      }
+      List<DeployedJar> deployedJars =
+          ClassPathLoader.getLatest().getJarDeployer().deploy(jarFileNames, jarBytes);
+
+      deployedJars.stream().filter(Objects::nonNull)
+          .forEach((jar) -> logger.info("Deployed " + (jar.getFile().getAbsolutePath())));
     }
+    // TODO: Jared - Does this need to actually undeploy extra jars like the javadoc says?
   }
 
   /***
    * Apply the cache-xml cluster configuration on this member
-   * 
+   *
    * @param cache Cache created for this member
    * @param response {@link ConfigurationResponse} containing the requested {@link Configuration}
    * @param config this member's config.
    */
   public static void applyClusterXmlConfiguration(Cache cache, ConfigurationResponse response,
       DistributionConfig config) {
-    if (response == null || response.getRequestedConfiguration().isEmpty())
+    if (response == null || response.getRequestedConfiguration().isEmpty()) {
       return;
+    }
 
     List<String> groups = getGroups(config);
     Map<String, Configuration> requestedConfiguration = response.getRequestedConfiguration();
@@ -138,15 +133,16 @@ public class ClusterConfigurationLoader {
 
   /***
    * Apply the gemfire properties cluster configuration on this member
-   * 
+   *
    * @param cache Cache created for this member
    * @param response {@link ConfigurationResponse} containing the requested {@link Configuration}
    * @param config this member's config
    */
   public static void applyClusterPropertiesConfiguration(Cache cache,
       ConfigurationResponse response, DistributionConfig config) {
-    if (response == null || response.getRequestedConfiguration().isEmpty())
+    if (response == null || response.getRequestedConfiguration().isEmpty()) {
       return;
+    }
 
     List<String> groups = getGroups(config);
     Map<String, Configuration> requestedConfiguration = response.getRequestedConfiguration();
@@ -189,8 +185,6 @@ public class ClusterConfigurationLoader {
    * 
    * @param config this member's configuration.
    * @return {@link ConfigurationResponse}
-   * @throws ClusterConfigurationNotAvailableException
-   * @throws UnknownHostException
    */
   public static ConfigurationResponse requestConfigurationFromLocators(DistributionConfig config,
       List<String> locatorList)

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 08f916b..fb311e7 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -1192,7 +1192,7 @@ public class GemFireCacheImpl
       listener.cacheCreated(this);
     }
 
-    ClassPathLoader.setLatestToDefault();
+    ClassPathLoader.setLatestToDefault(this.system.getConfig().getDeployWorkingDir());
 
     // request and check cluster configuration
     ConfigurationResponse configurationResponse = requestSharedConfiguration();
@@ -1239,7 +1239,7 @@ public class GemFireCacheImpl
 
     try {
       // Deploy all the jars from the deploy working dir.
-      new JarDeployer(this.system.getConfig().getDeployWorkingDir()).loadPreviouslyDeployedJars();
+      ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJars();
       ClusterConfigurationLoader.applyClusterXmlConfiguration(this, configurationResponse,
           system.getConfig());
       initializeDeclarativeCache();

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
index d052551..deb53cb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupManager.java
@@ -22,7 +22,8 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.MembershipListener;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -290,21 +291,20 @@ public class BackupManager implements MembershipListener {
     JarDeployer deployer = null;
 
     try {
-      deployer = new JarDeployer();
-
       /*
        * Suspend any user deployed jar file updates during this backup.
        */
+      deployer = ClassPathLoader.getLatest().getJarDeployer();
       deployer.suspendAll();
 
-      List<JarClassLoader> jarList = deployer.findJarClassLoaders();
+      List<DeployedJar> jarList = deployer.findDeployedJars();
       if (!jarList.isEmpty()) {
         File userBackupDir = new File(backupDir, USER_FILES);
         if (!userBackupDir.exists()) {
           userBackupDir.mkdir();
         }
 
-        for (JarClassLoader loader : jarList) {
+        for (DeployedJar loader : jarList) {
           File source = new File(loader.getFileCanonicalPath());
           File dest = new File(userBackupDir, source.getName());
           if (source.isDirectory()) {

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
index 5f1f161..148aa5f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DeployFunction.java
@@ -15,8 +15,10 @@
 package org.apache.geode.management.internal.cli.functions;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
+import org.apache.geode.internal.ClassPathLoader;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
@@ -27,7 +29,7 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.logging.LogService;
@@ -62,11 +64,12 @@ public class DeployFunction implements Function, InternalEntity {
       }
 
       List<String> deployedList = new ArrayList<String>();
-      JarClassLoader[] jarClassLoaders = jarDeployer.deploy(jarFilenames, jarBytes);
+      List<DeployedJar> jarClassLoaders =
+          ClassPathLoader.getLatest().getJarDeployer().deploy(jarFilenames, jarBytes);
       for (int i = 0; i < jarFilenames.length; i++) {
         deployedList.add(jarFilenames[i]);
-        if (jarClassLoaders[i] != null) {
-          deployedList.add(jarClassLoaders[i].getFileCanonicalPath());
+        if (jarClassLoaders.get(i) != null) {
+          deployedList.add(jarClassLoaders.get(i).getFileCanonicalPath());
         } else {
           deployedList.add("Already deployed");
         }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
index 8df24db..3d6a321 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ListDeployedFunction.java
@@ -16,6 +16,8 @@ package org.apache.geode.management.internal.cli.functions;
 
 import java.util.List;
 
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
@@ -26,7 +28,6 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.JarClassLoader;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.logging.LogService;
@@ -45,8 +46,7 @@ public class ListDeployedFunction implements Function, InternalEntity {
 
     try {
       Cache cache = CacheFactory.getAnyInstance();
-      final JarDeployer jarDeployer = new JarDeployer(
-          ((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
+      final JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -56,10 +56,10 @@ public class ListDeployedFunction implements Function, InternalEntity {
         memberId = member.getName();
       }
 
-      final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
+      final List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
       final String[] jars = new String[jarClassLoaders.size() * 2];
       int index = 0;
-      for (JarClassLoader jarClassLoader : jarClassLoaders) {
+      for (DeployedJar jarClassLoader : jarClassLoaders) {
         jars[index++] = jarClassLoader.getJarName();
         jars[index++] = jarClassLoader.getFileCanonicalPath();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
index 3f05082..14d875e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UndeployFunction.java
@@ -18,6 +18,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
 
+import org.apache.geode.internal.ClassPathLoader;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.SystemFailure;
@@ -28,7 +29,7 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.JarClassLoader;
+import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.logging.LogService;
@@ -50,8 +51,7 @@ public class UndeployFunction implements Function, InternalEntity {
       final String jarFilenameList = (String) args[0]; // Comma separated
       Cache cache = CacheFactory.getAnyInstance();
 
-      final JarDeployer jarDeployer = new JarDeployer(
-          ((GemFireCacheImpl) cache).getDistributedSystem().getConfig().getDeployWorkingDir());
+      final JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
 
       DistributedMember member = cache.getDistributedSystem().getDistributedMember();
 
@@ -63,13 +63,14 @@ public class UndeployFunction implements Function, InternalEntity {
 
       String[] undeployedJars = new String[0];
       if (jarFilenameList == null || jarFilenameList.equals("")) {
-        final List<JarClassLoader> jarClassLoaders = jarDeployer.findJarClassLoaders();
+        final List<DeployedJar> jarClassLoaders = jarDeployer.findDeployedJars();
         undeployedJars = new String[jarClassLoaders.size() * 2];
         int index = 0;
-        for (JarClassLoader jarClassLoader : jarClassLoaders) {
+        for (DeployedJar jarClassLoader : jarClassLoaders) {
           undeployedJars[index++] = jarClassLoader.getJarName();
           try {
-            undeployedJars[index++] = jarDeployer.undeploy(jarClassLoader.getJarName());
+            undeployedJars[index++] =
+                ClassPathLoader.getLatest().getJarDeployer().undeploy(jarClassLoader.getJarName());
           } catch (IllegalArgumentException iaex) {
             // It's okay for it to have have been uneployed from this server
             undeployedJars[index++] = iaex.getMessage();
@@ -82,7 +83,7 @@ public class UndeployFunction implements Function, InternalEntity {
           String jarFilename = jarTokenizer.nextToken().trim();
           try {
             undeployedList.add(jarFilename);
-            undeployedList.add(jarDeployer.undeploy(jarFilename));
+            undeployedList.add(ClassPathLoader.getLatest().getJarDeployer().undeploy(jarFilename));
           } catch (IllegalArgumentException iaex) {
             // It's okay for it to not have been deployed to this server
             undeployedList.add(iaex.getMessage());

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
index c52d575..d30feb6 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.internal;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.*;
 
 import java.io.BufferedInputStream;
@@ -24,11 +26,20 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
 import java.util.Vector;
 
 import org.apache.bcel.Constants;
 import org.apache.bcel.classfile.JavaClass;
 import org.apache.bcel.generic.ClassGen;
+import org.apache.commons.io.FileUtils;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -53,8 +64,9 @@ public class ClassPathLoaderIntegrationTest {
 
   private static final int TEMP_FILE_BYTES_COUNT = 256;
 
-  private volatile File tempFile;
-  private volatile File tempFile2;
+  private File tempFile;
+  private File tempFile2;
+  private File extLibsDir;
 
   @Rule
   public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
@@ -65,8 +77,9 @@ public class ClassPathLoaderIntegrationTest {
   @Before
   public void setUp() throws Exception {
     System.setProperty(ClassPathLoader.EXCLUDE_TCCL_PROPERTY, "false");
-    System.setProperty(ClassPathLoader.EXT_LIB_DIR_PARENT_PROPERTY,
-        this.temporaryFolder.getRoot().getAbsolutePath());
+
+    extLibsDir = new File(this.temporaryFolder.getRoot(), "ext");
+    extLibsDir.mkdirs();
 
     this.tempFile = this.temporaryFolder.newFile("tempFile1.tmp");
     FileOutputStream fos = new FileOutputStream(this.tempFile);
@@ -77,98 +90,248 @@ public class ClassPathLoaderIntegrationTest {
     fos = new FileOutputStream(this.tempFile2);
     fos.write(new byte[TEMP_FILE_BYTES_COUNT]);
     fos.close();
+
+    System.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
+    ClassPathLoader.setLatestToDefault(temporaryFolder.getRoot());
   }
 
-  /**
-   * Verifies that <tt>getResource</tt> works with custom loader from {@link ClassPathLoader}.
-   */
+
   @Test
-  public void testGetResourceWithCustomLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testGetResourceWithCustomLoader");
+  public void testDeployFileAndChange() throws IOException, ClassNotFoundException {
+    String jarName = "JarDeployerIntegrationTest.jar";
 
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
+    String classAResource = "integration/parent/ClassA.class";
+    String classBResource = "integration/parent/ClassB.class";
 
-    String resourceToGet = "com/nowhere/testGetResourceWithCustomLoader.rsc";
-    URL url = dcl.getResource(resourceToGet);
-    assertNotNull(url);
+    String classAName = "integration.parent.ClassA";
+    String classBName = "integration.parent.ClassB";
 
-    InputStream is = url != null ? url.openStream() : null;
-    assertNotNull(is);
+    byte[] firstJarBytes = createJarWithClass("ClassA");
 
-    int totalBytesRead = 0;
-    byte[] input = new byte[128];
+    // First deploy of the JAR file
+    File firstDeployedJarFile =
+        ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, firstJarBytes).getFile();
 
-    BufferedInputStream bis = new BufferedInputStream(is);
-    for (int bytesRead = bis.read(input); bytesRead > -1;) {
-      totalBytesRead += bytesRead;
-      bytesRead = bis.read(input);
-    }
-    bis.close();
+    assertThat(firstDeployedJarFile).exists().hasBinaryContent(firstJarBytes);
+    assertThat(firstDeployedJarFile.getName()).contains(".v1.").doesNotContain(".v2.");
+
+    assertThatClassCanBeLoaded(classAName);
+    assertThatClassCannotBeLoaded(classBName);
+
+    assertThatResourceCanBeLoaded(classAResource);
+    assertThatResourceCannotBeLoaded(classBResource);
 
-    assertEquals(TEMP_FILE_BYTES_COUNT, totalBytesRead);
+    // Now deploy an updated JAR file and make sure that the next version of the JAR file
+    // was created and the first one is no longer used
+    byte[] secondJarBytes = createJarWithClass("ClassB");
+
+    File secondDeployedJarFile =
+        ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, secondJarBytes).getFile();
+
+    assertThat(secondDeployedJarFile).exists().hasBinaryContent(secondJarBytes);
+    assertThat(secondDeployedJarFile.getName()).contains(".v2.").doesNotContain(".v1.");
+
+    assertThatClassCanBeLoaded(classBName);
+    assertThatClassCannotBeLoaded(classAName);
+
+    assertThatResourceCanBeLoaded(classBResource);
+    assertThatResourceCannotBeLoaded(classAResource);
+
+    // Now undeploy JAR and make sure it gets cleaned up
+    ClassPathLoader.getLatest().getJarDeployer().undeploy(jarName);
+    assertThatClassCannotBeLoaded(classBName);
+    assertThatClassCannotBeLoaded(classAName);
+
+    assertThatResourceCannotBeLoaded(classBResource);
+    assertThatResourceCannotBeLoaded(classAResource);
   }
 
-  /**
-   * Verifies that <tt>getResources</tt> works with custom loader from {@link ClassPathLoader}.
-   */
   @Test
-  public void testGetResourcesWithCustomLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testGetResourceWithCustomLoader");
+  public void testDeployNoUpdateWhenNoChange() throws IOException, ClassNotFoundException {
+    String jarName = "JarDeployerIntegrationTest.jar";
 
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
+    // First deploy of the JAR file
+    byte[] jarBytes = new ClassBuilder().createJarFromName("JarDeployerDUnitDNUWNC");
+    DeployedJar jarClassLoader =
+        ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, jarBytes);
+    File deployedJar = new File(jarClassLoader.getFileCanonicalPath());
 
-    String resourceToGet = "com/nowhere/testGetResourceWithCustomLoader.rsc";
-    Enumeration<URL> urls = dcl.getResources(resourceToGet);
-    assertNotNull(urls);
-    assertTrue(urls.hasMoreElements());
+    assertThat(deployedJar).exists();
+    assertThat(deployedJar.getName()).contains(".v1.");
 
-    URL url = urls.nextElement();
-    InputStream is = url != null ? url.openStream() : null;
-    assertNotNull(is);
+    // Re-deploy of the same JAR should do nothing
+    DeployedJar newJarClassLoader =
+        ClassPathLoader.getLatest().getJarDeployer().deploy(jarName, jarBytes);
+    assertThat(newJarClassLoader).isNull();
+    assertThat(deployedJar).exists();
 
-    int totalBytesRead = 0;
-    byte[] input = new byte[128];
+  }
 
-    BufferedInputStream bis = new BufferedInputStream(is);
-    for (int bytesRead = bis.read(input); bytesRead > -1;) {
-      totalBytesRead += bytesRead;
-      bytesRead = bis.read(input);
-    }
-    bis.close();
+  @Test
+  public void testDeployWithExistingDependentJars() throws Exception {
+    ClassBuilder classBuilder = new ClassBuilder();
+    final File parentJarFile =
+        new File(temporaryFolder.getRoot(), "JarDeployerDUnitAParent.v1.jar");
+    final File usesJarFile = new File(temporaryFolder.getRoot(), "JarDeployerDUnitUses.v1.jar");
+    final File functionJarFile =
+        new File(temporaryFolder.getRoot(), "JarDeployerDUnitFunction.v1.jar");
+
+    // Write out a JAR files.
+    StringBuffer stringBuffer = new StringBuffer();
+    stringBuffer.append("package jddunit.parent;");
+    stringBuffer.append("public class JarDeployerDUnitParent {");
+    stringBuffer.append("public String getValueParent() {");
+    stringBuffer.append("return \"PARENT\";}}");
+
+    byte[] jarBytes = classBuilder.createJarFromClassContent(
+        "jddunit/parent/JarDeployerDUnitParent", stringBuffer.toString());
+    FileOutputStream outStream = new FileOutputStream(parentJarFile);
+    outStream.write(jarBytes);
+    outStream.close();
+
+    stringBuffer = new StringBuffer();
+    stringBuffer.append("package jddunit.uses;");
+    stringBuffer.append("public class JarDeployerDUnitUses {");
+    stringBuffer.append("public String getValueUses() {");
+    stringBuffer.append("return \"USES\";}}");
 
-    assertEquals(TEMP_FILE_BYTES_COUNT, totalBytesRead);
+    jarBytes = classBuilder.createJarFromClassContent("jddunit/uses/JarDeployerDUnitUses",
+        stringBuffer.toString());
+    outStream = new FileOutputStream(usesJarFile);
+    outStream.write(jarBytes);
+    outStream.close();
+
+    stringBuffer = new StringBuffer();
+    stringBuffer.append("package jddunit.function;");
+    stringBuffer.append("import jddunit.parent.JarDeployerDUnitParent;");
+    stringBuffer.append("import jddunit.uses.JarDeployerDUnitUses;");
+    stringBuffer.append("import org.apache.geode.cache.execute.Function;");
+    stringBuffer.append("import org.apache.geode.cache.execute.FunctionContext;");
+    stringBuffer.append(
+        "public class JarDeployerDUnitFunction  extends JarDeployerDUnitParent implements Function {");
+    stringBuffer.append("private JarDeployerDUnitUses uses = new JarDeployerDUnitUses();");
+    stringBuffer.append("public boolean hasResult() {return true;}");
+    stringBuffer.append(
+        "public void execute(FunctionContext context) {context.getResultSender().lastResult(getValueParent() + \":\" + uses.getValueUses());}");
+    stringBuffer.append("public String getId() {return \"JarDeployerDUnitFunction\";}");
+    stringBuffer.append("public boolean optimizeForWrite() {return false;}");
+    stringBuffer.append("public boolean isHA() {return false;}}");
+
+    ClassBuilder functionClassBuilder = new ClassBuilder();
+    functionClassBuilder.addToClassPath(parentJarFile.getAbsolutePath());
+    functionClassBuilder.addToClassPath(usesJarFile.getAbsolutePath());
+    jarBytes = functionClassBuilder.createJarFromClassContent(
+        "jddunit/function/JarDeployerDUnitFunction", stringBuffer.toString());
+    outStream = new FileOutputStream(functionJarFile);
+    outStream.write(jarBytes);
+    outStream.close();
+
+    Properties properties = new Properties();
+    properties.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
+    ServerStarterRule serverStarterRule = new ServerStarterRule();
+    serverStarterRule.startServer();
+
+    GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
+    DistributedSystem distributedSystem = gemFireCache.getDistributedSystem();
+    Execution execution =
+        FunctionService.onMember(distributedSystem, distributedSystem.getDistributedMember());
+    ResultCollector resultCollector = execution.execute("JarDeployerDUnitFunction");
+    @SuppressWarnings("unchecked")
+    List<String> result = (List<String>) resultCollector.getResult();
+    assertEquals("PARENT:USES", result.get(0));
+
+    serverStarterRule.after();
   }
 
-  /**
-   * Verifies that <tt>getResourceAsStream</tt> works with custom loader from
-   * {@link ClassPathLoader}.
-   */
   @Test
-  public void testGetResourceAsStreamWithCustomLoader() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testGetResourceAsStreamWithCustomLoader");
+  public void deployNewVersionOfFunctionOverOldVersion() throws Exception {
+    File jarVersion1 = createVersionOfJar("Version1", "MyFunction", "MyJar.jar");
+    File jarVersion2 = createVersionOfJar("Version2", "MyFunction", "MyJar.jar");
 
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
+    Properties properties = new Properties();
+    properties.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
+    ServerStarterRule serverStarterRule = new ServerStarterRule();
+    serverStarterRule.startServer();
 
-    String resourceToGet = "com/nowhere/testGetResourceAsStreamWithCustomLoader.rsc";
-    InputStream is = dcl.getResourceAsStream(resourceToGet);
-    assertNotNull(is);
+    GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
+    DistributedSystem distributedSystem = gemFireCache.getDistributedSystem();
 
-    int totalBytesRead = 0;
-    byte[] input = new byte[128];
+    ClassPathLoader.getLatest().getJarDeployer().deploy("MyJar.jar",
+        FileUtils.readFileToByteArray(jarVersion1));
 
-    BufferedInputStream bis = new BufferedInputStream(is);
-    for (int bytesRead = bis.read(input); bytesRead > -1;) {
-      totalBytesRead += bytesRead;
-      bytesRead = bis.read(input);
-    }
-    bis.close();
+    assertThatClassCanBeLoaded("jddunit.function.MyFunction");
+    Execution execution =
+        FunctionService.onMember(distributedSystem, distributedSystem.getDistributedMember());
+
+    List<String> result = (List<String>) execution.execute("MyFunction").getResult();
+    assertThat(result.get(0)).isEqualTo("Version1");
+
+
+    ClassPathLoader.getLatest().getJarDeployer().deploy("MyJar.jar",
+        FileUtils.readFileToByteArray(jarVersion2));
+    result = (List<String>) execution.execute("MyFunction").getResult();
+    assertThat(result.get(0)).isEqualTo("Version2");
 
-    assertEquals(TEMP_FILE_BYTES_COUNT, totalBytesRead);
+
+    serverStarterRule.after();
   }
 
+
+  private File createVersionOfJar(String version, String functionName, String jarName)
+      throws IOException {
+    String classContents =
+        "package jddunit.function;" + "import org.apache.geode.cache.execute.Function;"
+            + "import org.apache.geode.cache.execute.FunctionContext;" + "public class "
+            + functionName + " implements Function {" + "public boolean hasResult() {return true;}"
+            + "public String getId() {return \"" + functionName + "\";}"
+            + "public void execute(FunctionContext context) {context.getResultSender().lastResult(\""
+            + version + "\");}}";
+
+    File jar = new File(this.temporaryFolder.newFolder(version), jarName);
+    ClassBuilder functionClassBuilder = new ClassBuilder();
+    functionClassBuilder.writeJarFromContent("jddunit/function/" + functionName, classContents,
+        jar);
+
+    return jar;
+  }
+
+  private void assertThatClassCanBeLoaded(String className) throws ClassNotFoundException {
+    assertThat(ClassPathLoader.getLatest().forName(className)).isNotNull();
+  }
+
+  private void assertThatClassCannotBeLoaded(String className) throws ClassNotFoundException {
+    assertThatThrownBy(() -> ClassPathLoader.getLatest().forName(className))
+        .isExactlyInstanceOf(ClassNotFoundException.class);
+  }
+
+  private void assertThatResourceCanBeLoaded(String resourceName) throws IOException {
+    // ClassPathLoader.getResource
+    assertThat(ClassPathLoader.getLatest().getResource(resourceName)).isNotNull();
+
+    // ClassPathLoader.getResources
+    Enumeration<URL> urls = ClassPathLoader.getLatest().getResources(resourceName);
+    assertThat(urls).isNotNull();
+    assertThat(urls.hasMoreElements()).isTrue();
+
+    // ClassPathLoader.getResourceAsStream
+    InputStream is = ClassPathLoader.getLatest().getResourceAsStream(resourceName);
+    assertThat(is).isNotNull();
+  }
+
+  private void assertThatResourceCannotBeLoaded(String resourceName) throws IOException {
+    // ClassPathLoader.getResource
+    assertThat(ClassPathLoader.getLatest().getResource(resourceName)).isNull();
+
+    // ClassPathLoader.getResources
+    Enumeration<URL> urls = ClassPathLoader.getLatest().getResources(resourceName);
+    assertThat(urls.hasMoreElements()).isFalse();
+
+    // ClassPathLoader.getResourceAsStream
+    InputStream is = ClassPathLoader.getLatest().getResourceAsStream(resourceName);
+    assertThat(is).isNull();
+  }
+
+
   /**
    * Verifies that <tt>getResource</tt> works with TCCL from {@link ClassPathLoader}.
    */
@@ -281,154 +444,6 @@ public class ClassPathLoaderIntegrationTest {
     }
   }
 
-  /**
-   * Verifies that JAR files found in the extlib directory will be correctly added to the
-   * {@link ClassPathLoader}.
-   */
-  @Test
-  public void testJarsInExtLib() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testJarsInExtLib");
-
-    File EXT_LIB_DIR = ClassPathLoader.defineEXT_LIB_DIR();
-    EXT_LIB_DIR.mkdir();
-
-    File subdir = new File(EXT_LIB_DIR, "cplju");
-    subdir.mkdir();
-
-    final ClassBuilder classBuilder = new ClassBuilder();
-
-    writeJarBytesToFile(new File(EXT_LIB_DIR, "ClassPathLoaderJUnit1.jar"),
-        classBuilder.createJarFromClassContent("com/cpljunit1/ClassPathLoaderJUnit1",
-            "package com.cpljunit1; public class ClassPathLoaderJUnit1 {}"));
-    writeJarBytesToFile(new File(subdir, "ClassPathLoaderJUnit2.jar"),
-        classBuilder.createJarFromClassContent("com/cpljunit2/ClassPathLoaderJUnit2",
-            "package com.cpljunit2; public class ClassPathLoaderJUnit2 {}"));
-
-    ClassPathLoader classPathLoader = ClassPathLoader.createWithDefaults(false);
-    try {
-      classPathLoader.forName("com.cpljunit1.ClassPathLoaderJUnit1");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    try {
-      classPathLoader.forName("com.cpljunit2.ClassPathLoaderJUnit2");
-    } catch (ClassNotFoundException cnfex) {
-      fail("JAR file not correctly added to Classpath");
-    }
-
-    assertNotNull(classPathLoader.getResource("com/cpljunit2/ClassPathLoaderJUnit2.class"));
-
-    Enumeration<URL> urls = classPathLoader.getResources("com/cpljunit1");
-    if (!urls.hasMoreElements()) {
-      fail("Resources should return one element");
-    }
-  }
-
-  /**
-   * Verifies that the 3rd custom loader will get the resource. Parent cannot find it and TCCL is
-   * broken. This verifies that all custom loaders are checked and that the custom loaders are all
-   * checked before TCCL.
-   */
-  @Test
-  public void testGetResourceAsStreamWithMultipleCustomLoaders() throws Exception {
-    System.out
-        .println("\nStarting ClassPathLoaderTest#testGetResourceAsStreamWithMultipleCustomLoaders");
-
-    // create DCL such that the 3rd loader should find the resource
-    // first custom loader becomes parent which won't find anything
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
-    dcl = dcl.addOrReplace(new SimpleClassLoader(getClass().getClassLoader()));
-    dcl = dcl.addOrReplace(new NullClassLoader());
-
-    String resourceToGet = "com/nowhere/testGetResourceAsStreamWithMultipleCustomLoaders.rsc";
-
-    ClassLoader cl = Thread.currentThread().getContextClassLoader();
-    try {
-      // set TCCL to throw errors which makes sure we find before checking TCCL
-      Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
-
-      InputStream is = dcl.getResourceAsStream(resourceToGet);
-      assertNotNull(is);
-      is.close();
-    } finally {
-      Thread.currentThread().setContextClassLoader(cl);
-    }
-  }
-
-  /**
-   * Verifies that the 3rd custom loader will get the resource. Parent cannot find it and TCCL is
-   * broken. This verifies that all custom loaders are checked and that the custom loaders are all
-   * checked before TCCL.
-   */
-  @Test
-  public void testGetResourceWithMultipleCustomLoaders() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testGetResourceWithMultipleCustomLoaders");
-
-    // create DCL such that the 3rd loader should find the resource
-    // first custom loader becomes parent which won't find anything
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
-    dcl = dcl.addOrReplace(new SimpleClassLoader(getClass().getClassLoader()));
-    dcl = dcl.addOrReplace(new NullClassLoader());
-
-    String resourceToGet = "com/nowhere/testGetResourceWithMultipleCustomLoaders.rsc";
-
-    ClassLoader cl = Thread.currentThread().getContextClassLoader();
-    try {
-      // set TCCL to throw errors which makes sure we find before checking TCCL
-      Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
-
-      URL url = dcl.getResource(resourceToGet);
-      assertNotNull(url);
-    } finally {
-      Thread.currentThread().setContextClassLoader(cl);
-    }
-  }
-
-  /**
-   * Verifies that the 3rd custom loader will get the resources. Parent cannot find it and TCCL is
-   * broken. This verifies that all custom loaders are checked and that the custom loaders are all
-   * checked before TCCL.
-   */
-  @Test
-  public void testGetResourcesWithMultipleCustomLoaders() throws Exception {
-    System.out.println("\nStarting ClassPathLoaderTest#testGetResourceWithMultipleCustomLoaders");
-
-    // create DCL such that the 3rd loader should find the resource
-    // first custom loader becomes parent which won't find anything
-    ClassPathLoader dcl = ClassPathLoader.createWithDefaults(false);
-    dcl = dcl.addOrReplace(new GeneratingClassLoader());
-    dcl = dcl.addOrReplace(new GeneratingClassLoader2());
-    dcl = dcl.addOrReplace(new SimpleClassLoader(getClass().getClassLoader()));
-    dcl = dcl.addOrReplace(new NullClassLoader());
-
-    String resourceToGet = "com/nowhere/testGetResourceWithMultipleCustomLoaders.rsc";
-
-    ClassLoader cl = Thread.currentThread().getContextClassLoader();
-    try {
-      // set TCCL to throw errors which makes sure we find before checking TCCL
-      Thread.currentThread().setContextClassLoader(new BrokenClassLoader());
-
-      Enumeration<URL> urls = dcl.getResources(resourceToGet);
-      assertNotNull(urls);
-      assertTrue(urls.hasMoreElements());
-
-      URL url = urls.nextElement();
-      assertNotNull(url);
-
-      // Should find two with unique URLs
-      assertTrue("Did not find all resources.", urls.hasMoreElements());
-      URL url2 = urls.nextElement();
-      assertNotNull(url2);
-      assertTrue("Resource URLs should be unique.", !url.equals(url2));
-
-    } finally {
-      Thread.currentThread().setContextClassLoader(cl);
-    }
-  }
-
   private void writeJarBytesToFile(File jarFile, byte[] jarBytes) throws IOException {
     final OutputStream outStream = new FileOutputStream(jarFile);
     outStream.write(jarBytes);
@@ -508,4 +523,11 @@ public class ClassPathLoaderIntegrationTest {
       return tempFile2;
     }
   }
+
+  private byte[] createJarWithClass(String className) throws IOException {
+    String stringBuilder = "package integration.parent;" + "public class " + className + " {}";
+
+    return new ClassBuilder().createJarFromClassContent("integration/parent/" + className,
+        stringBuilder);
+  }
 }


[05/51] [abbrv] geode git commit: GEODE-2730: refactor rules

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
index a018f4c..0763407 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
@@ -29,8 +29,7 @@ import org.apache.geode.internal.cache.functions.TestFunction;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -49,11 +48,11 @@ public class ClientExecuteRegionFunctionAuthDUnitTest extends JUnit4DistributedT
   private final static Function function = new TestFunction(true, TestFunction.TEST_FUNCTION1);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testExecuteRegionFunction() {
@@ -61,7 +60,7 @@ public class ClientExecuteRegionFunctionAuthDUnitTest extends JUnit4DistributedT
     FunctionService.registerFunction(function);
 
     client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("dataReader", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       FunctionService.registerFunction(function);
@@ -71,7 +70,7 @@ public class ClientExecuteRegionFunctionAuthDUnitTest extends JUnit4DistributedT
     });
 
     client2.invoke("logging in with super-user", () -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       FunctionService.registerFunction(function);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientGetAllAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientGetAllAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientGetAllAuthDUnitTest.java
index 92eda18..7339c27 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientGetAllAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientGetAllAuthDUnitTest.java
@@ -26,8 +26,7 @@ import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -47,16 +46,16 @@ public class ClientGetAllAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testGetAll() {
     client1.invoke("logging in Stranger", () -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       Map emptyMap = region.getAll(Arrays.asList("key1", "key2", "key3", "key4"));
@@ -64,7 +63,7 @@ public class ClientGetAllAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke("logging in authRegionReader", () -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       Map filledMap = region.getAll(Arrays.asList("key1", "key2", "key3", "key4"));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientGetEntryAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientGetEntryAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientGetEntryAuthDUnitTest.java
index fad77f5..5aaff24 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientGetEntryAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientGetEntryAuthDUnitTest.java
@@ -21,13 +21,13 @@ import static org.apache.geode.security.SecurityTestUtil.createProxyRegion;
 
 import org.apache.geode.cache.CacheTransactionManager;
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -45,15 +45,16 @@ public class ClientGetEntryAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .buildInThisVM();
+          .withAutoStart();
 
   @Before
   public void before() throws Exception {
-    Region region = server.getCache().createRegionFactory().create(REGION_NAME);
+    Region region =
+        server.getCache().createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME);
     for (int i = 0; i < 5; i++) {
       region.put("key" + i, "value" + i);
     }
@@ -63,7 +64,7 @@ public class ClientGetEntryAuthDUnitTest extends JUnit4DistributedTestCase {
   public void testGetEntry() throws Exception {
     // client1 connects to server as a user not authorized to do any operations
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
 
       CacheTransactionManager transactionManager = cache.getCacheTransactionManager();
       transactionManager.begin();
@@ -77,7 +78,7 @@ public class ClientGetEntryAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getPort());
 
       CacheTransactionManager transactionManager = cache.getCacheTransactionManager();
       transactionManager.begin();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientGetPutAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientGetPutAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientGetPutAuthDUnitTest.java
index a816a12..2b933bf 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientGetPutAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientGetPutAuthDUnitTest.java
@@ -27,8 +27,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -53,11 +52,11 @@ public class ClientGetPutAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client3 = host.getVM(3);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .buildInThisVM();
+          .withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -80,7 +79,7 @@ public class ClientGetPutAuthDUnitTest extends JUnit4DistributedTestCase {
 
     // client1 connects to server as a user not authorized to do any operations
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       assertNotAuthorized(() -> region.put("key3", "value3"), "DATA:WRITE:AuthRegion:key3");
@@ -99,7 +98,7 @@ public class ClientGetPutAuthDUnitTest extends JUnit4DistributedTestCase {
 
     // client2 connects to user as a user authorized to use AuthRegion region
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       region.put("key3", "value3");
@@ -119,7 +118,7 @@ public class ClientGetPutAuthDUnitTest extends JUnit4DistributedTestCase {
 
     // client3 connects to user as a user authorized to use key1 in AuthRegion region
     AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("key1User", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       assertNotAuthorized(() -> region.put("key2", "value1"), "DATA:WRITE:AuthRegion:key2");

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientRegionClearAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientRegionClearAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientRegionClearAuthDUnitTest.java
index 99a77b6..f512178 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientRegionClearAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientRegionClearAuthDUnitTest.java
@@ -26,8 +26,7 @@ import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -44,11 +43,11 @@ public class ClientRegionClearAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testRegionClear() throws InterruptedException {
@@ -56,7 +55,7 @@ public class ClientRegionClearAuthDUnitTest extends JUnit4DistributedTestCase {
     SerializableRunnable clearUnauthorized = new SerializableRunnable() {
       @Override
       public void run() {
-        ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+        ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
         Region region = createProxyRegion(cache, REGION_NAME);
         assertNotAuthorized(() -> region.clear(), "DATA:WRITE:AuthRegion");
       }
@@ -67,7 +66,7 @@ public class ClientRegionClearAuthDUnitTest extends JUnit4DistributedTestCase {
     SerializableRunnable clearAuthorized = new SerializableRunnable() {
       @Override
       public void run() {
-        ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+        ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
         Region region = createProxyRegion(cache, REGION_NAME);
         region.clear();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientRegisterInterestAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientRegisterInterestAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientRegisterInterestAuthDUnitTest.java
index 9c24d42..f120723 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientRegisterInterestAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientRegisterInterestAuthDUnitTest.java
@@ -27,8 +27,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -49,31 +48,31 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
   final VM client3 = host.getVM(3);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testRegisterInterest() throws Exception {
     // client1 connects to server as a user not authorized to do any operations
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       assertNotAuthorized(() -> region.registerInterest("key3"), "DATA:READ:AuthRegion:key3");
     });
 
     // client2 connects to user as a user authorized to use AuthRegion region
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       region.registerInterest("key3"); // DATA:READ:AuthRegion:key3;
     });
 
     // client3 connects to user as a user authorized to use key1 in AuthRegion region
     AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("key1User", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       assertNotAuthorized(() -> region.registerInterest("key2"), "DATA:READ:AuthRegion:key2");
     });
@@ -87,7 +86,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
   public void testRegisterInterestRegex() throws Exception {
     // client1 connects to server as a user not authorized to do any operations
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -96,7 +95,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
 
     // client2 connects to user as a user authorized to use AuthRegion region
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -105,7 +104,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
 
     // client3 connects to user as a user authorized to use key1 in AuthRegion region
     AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("key1User", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -126,7 +125,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
 
     // client1 connects to server as a user not authorized to do any operations
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -135,7 +134,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
 
     // client2 connects to user as a user authorized to use AuthRegion region
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -144,7 +143,7 @@ public class ClientRegisterInterestAuthDUnitTest extends JUnit4DistributedTestCa
 
     // client3 connects to user as a user authorized to use key1 in AuthRegion region
     AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("key1User", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientRemoveAllAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientRemoveAllAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientRemoveAllAuthDUnitTest.java
index 44887d9..8814b09 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientRemoveAllAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientRemoveAllAuthDUnitTest.java
@@ -27,8 +27,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -47,17 +46,17 @@ public class ClientRemoveAllAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testRemoveAll() throws Exception {
 
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       assertNotAuthorized(() -> region.removeAll(Arrays.asList("key1", "key2", "key3", "key4")),
@@ -65,7 +64,7 @@ public class ClientRemoveAllAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionWriter", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionWriter", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       region.removeAll(Arrays.asList("key1", "key2", "key3", "key4"));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientUnregisterInterestAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientUnregisterInterestAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientUnregisterInterestAuthDUnitTest.java
index e62aa6a..25a578d 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientUnregisterInterestAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientUnregisterInterestAuthDUnitTest.java
@@ -25,8 +25,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Rule;
@@ -43,17 +42,17 @@ public class ClientUnregisterInterestAuthDUnitTest extends JUnit4DistributedTest
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testUnregisterInterest() throws Exception {
     // client2 connects to user as a user authorized to use AuthRegion region
     AsyncInvocation ai1 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
 
       Region region = createProxyRegion(cache, REGION_NAME);
       region.registerInterest("key3");

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
index c6b2735..71051e2 100644
--- a/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
@@ -32,8 +32,7 @@ import org.apache.geode.cache.query.SelectResults;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -54,12 +53,12 @@ public class NoShowValue1PostProcessorDUnitTest extends JUnit4DistributedTestCas
   final VM client1 = host.getVM(1);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
           .withProperty(SECURITY_POST_PROCESSOR, NoShowValue1PostProcessor.class.getName())
-          .buildInThisVM();
+          .withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -77,7 +76,7 @@ public class NoShowValue1PostProcessorDUnitTest extends JUnit4DistributedTestCas
     keys.add("key2");
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for get

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
index c735313..e952386 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
@@ -40,8 +40,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
@@ -81,18 +80,18 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   }
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
           .withProperty(SECURITY_POST_PROCESSOR, PDXPostProcessor.class.getName())
           .withProperty("security-pdx", pdxPersistent + "").withJMXManager()
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testRegionGet() {
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
@@ -101,7 +100,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for get the client domain object
@@ -122,7 +121,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   @Test
   public void testQuery() {
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
@@ -130,7 +129,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for query
@@ -158,7 +157,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   public void testRegisterInterest() {
     IgnoredException.addIgnoredException("NoAvailableServersException");
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
 
       ClientRegionFactory factory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
       factory.addCacheListener(new CacheListenerAdapter() {
@@ -181,7 +180,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("dataUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("dataUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
@@ -199,7 +198,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   public void testGfshCommand() {
     // have client2 input some domain data into the region
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/PostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PostProcessorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/PostProcessorDUnitTest.java
index 89a6752..dc924ab 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PostProcessorDUnitTest.java
@@ -34,8 +34,7 @@ import org.apache.geode.cache.util.CacheListenerAdapter;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -56,11 +55,11 @@ public class PostProcessorDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).buildInThisVM();
+          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -78,7 +77,7 @@ public class PostProcessorDUnitTest extends JUnit4DistributedTestCase {
     keys.add("key2");
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for get
@@ -96,7 +95,7 @@ public class PostProcessorDUnitTest extends JUnit4DistributedTestCase {
   @Test
   public void testPostProcessQuery() {
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for query
@@ -123,7 +122,7 @@ public class PostProcessorDUnitTest extends JUnit4DistributedTestCase {
   @Test
   public void testRegisterInterestPostProcess() {
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
 
       ClientRegionFactory factory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
       factory.addCacheListener(new CacheListenerAdapter() {
@@ -140,7 +139,7 @@ public class PostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("dataUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("dataUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       region.put("key1", "value2");
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
index 4f84f7b..1fe4175 100644
--- a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
@@ -31,7 +31,6 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
 import org.junit.Rule;
@@ -64,7 +63,6 @@ public class SecurityClusterConfigDUnitTest {
     lsRule.startLocatorVM(0, props);
   }
 
-  @Category(FlakyTest.class) // GEODE-1977
   @Test
   public void testStartServerWithClusterConfig() throws Exception {
     Properties props = new Properties();
@@ -104,7 +102,6 @@ public class SecurityClusterConfigDUnitTest {
     assertTrue(secProps.containsKey("security-post-processor"));
   }
 
-  @Category(FlakyTest.class) // GEODE-1975
   @Test
   public void serverWithDifferentSecurityManagerShouldThrowException() {
     Properties props = new Properties();
@@ -139,7 +136,6 @@ public class SecurityClusterConfigDUnitTest {
 
   }
 
-  @Category(FlakyTest.class) // GEODE-1974
   @Test
   public void serverConnectingToSecuredLocatorMustUseClusterConfig() {
     Properties props = new Properties();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 02bad30..0a4785d 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -28,6 +28,8 @@ import org.json.JSONArray;
 import org.junit.rules.TemporaryFolder;
 import org.junit.runner.Description;
 
+import java.util.function.Supplier;
+
 /**
  * Class which eases the connection to the locator/jmxManager in Gfsh shell and execute gfsh
  * commands.
@@ -52,7 +54,7 @@ import org.junit.runner.Description;
  */
 public class GfshShellConnectionRule extends DescribedExternalResource {
 
-  private int port = -1;
+  private Supplier<Integer> portSupplier;
   private PortType portType = PortType.jmxManger;
   private HeadlessGfsh gfsh = null;
   private boolean connected = false;
@@ -66,10 +68,10 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
     }
   }
 
-  public GfshShellConnectionRule(int port, PortType portType) {
+  public GfshShellConnectionRule(Supplier<Integer> portSupplier, PortType portType) {
     this();
     this.portType = portType;
-    this.port = port;
+    this.portSupplier = portSupplier;
   }
 
   @Override
@@ -77,7 +79,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
     this.gfsh = new HeadlessGfsh(getClass().getName(), 30,
         temporaryFolder.newFolder("gfsh_files").getAbsolutePath());
     // do not auto connect if no port initialized
-    if (port < 0) {
+    if (portSupplier == null) {
       return;
     }
 
@@ -87,7 +89,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
       return;
     }
 
-    connect(port, portType, CliStrings.CONNECT__USERNAME, config.user(),
+    connect(portSupplier.get(), portType, CliStrings.CONNECT__USERNAME, config.user(),
         CliStrings.CONNECT__PASSWORD, config.password());
 
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalLocatorStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalLocatorStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalLocatorStarterRule.java
deleted file mode 100644
index 21be585..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalLocatorStarterRule.java
+++ /dev/null
@@ -1,99 +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 org.apache.geode.test.dunit.rules;
-
-import static org.apache.geode.distributed.Locator.startLocatorAndDS;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.internal.AvailablePort;
-import org.apache.geode.internal.datasource.ConfigProperty;
-import org.awaitility.Awaitility;
-import org.junit.rules.ExternalResource;
-
-import java.io.IOException;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Stream;
-
-public class LocalLocatorStarterRule extends ExternalResource {
-  private volatile InternalLocator internalLocator;
-  private final Properties properties;
-  private final AvailablePort.Keeper locatorPort;
-  private final AvailablePort.Keeper jmxPort;
-  private final AvailablePort.Keeper httpPort;
-  private final AvailablePort.Keeper tcpPort;
-
-  LocalLocatorStarterRule(LocatorStarterBuilder locatorStarterBuilder) {
-    this.properties = locatorStarterBuilder.getProperties();
-    this.locatorPort = locatorStarterBuilder.getLocatorPort();
-    this.jmxPort = locatorStarterBuilder.getJmxPort();
-    this.httpPort = locatorStarterBuilder.getHttpPort();
-    this.tcpPort = locatorStarterBuilder.getTcpPort();
-  }
-
-  public String getHostname() {
-    return "localhost";
-  }
-
-  public int getLocatorPort() {
-    return this.locatorPort.getPort();
-  }
-
-  public int getHttpPort() {
-    String httpPort = properties.getProperty(ConfigurationProperties.HTTP_SERVICE_PORT);
-    if (httpPort == null) {
-      throw new IllegalStateException("No http port specified");
-    }
-    return Integer.valueOf(httpPort);
-  }
-
-  private void releasePortKeepers() {
-    Stream.of(locatorPort, jmxPort, httpPort, tcpPort).filter(Objects::nonNull)
-        .forEach(AvailablePort.Keeper::release);
-  }
-
-  @Override
-  protected void before() {
-    releasePortKeepers();
-    try {
-      // this will start a jmx manager and admin rest service by default
-      this.internalLocator =
-          (InternalLocator) startLocatorAndDS(locatorPort.getPort(), null, properties);
-    } catch (IOException e) {
-      throw new RuntimeException("unable to start up locator.", e);
-    }
-
-    DistributionConfig config = this.internalLocator.getConfig();
-
-    if (config.getEnableClusterConfiguration()) {
-      Awaitility.await().atMost(65, TimeUnit.SECONDS)
-          .until(() -> assertTrue(internalLocator.isSharedConfigurationRunning()));
-    }
-  }
-
-  @Override
-  protected void after() {
-    releasePortKeepers();
-
-    if (internalLocator != null) {
-      internalLocator.stop();
-      internalLocator = null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalServerStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalServerStarterRule.java
deleted file mode 100644
index 3106948..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocalServerStarterRule.java
+++ /dev/null
@@ -1,159 +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 org.apache.geode.test.dunit.rules;
-
-import static org.apache.geode.distributed.Locator.startLocatorAndDS;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.AvailablePort;
-import org.junit.rules.ExternalResource;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.File;
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.stream.Stream;
-
-public class LocalServerStarterRule extends ExternalResource implements Serializable {
-  private volatile transient Cache cache;
-  private volatile transient CacheServer server;
-  private final transient TemporaryFolder temporaryFolder;
-
-  private final Properties properties;
-  private final Map<String, RegionShortcut> regionsToCreate;
-
-  private final AvailablePort.Keeper serverPort;
-  private final AvailablePort.Keeper jmxPort;
-  private final AvailablePort.Keeper httpPort;
-  private final AvailablePort.Keeper tcpPort;
-
-  LocalServerStarterRule(ServerStarterBuilder serverStarterBuilder) {
-    this.properties = serverStarterBuilder.getProperties();
-    if (serverStarterBuilder.hasAutomaticallyManagedWorkingDir()) {
-      temporaryFolder = new TemporaryFolder();
-    } else {
-      temporaryFolder = null;
-    }
-
-    this.serverPort = serverStarterBuilder.getServerPort();
-    this.jmxPort = serverStarterBuilder.getJmxPort();
-    this.httpPort = serverStarterBuilder.getHttpPort();
-    this.tcpPort = serverStarterBuilder.getTcpPort();
-
-    this.regionsToCreate = serverStarterBuilder.getRegionsToCreate();
-  }
-
-  @Override
-  public void before() throws Throwable {
-    if (temporaryFolder != null) {
-      temporaryFolder.create();
-      this.properties.setProperty(ConfigurationProperties.DEPLOY_WORKING_DIR,
-          temporaryFolder.getRoot().getAbsolutePath());
-    }
-
-    releasePortKeepers();
-    CacheFactory cf = new CacheFactory(this.properties);
-
-    cache = cf.create();
-    server = cache.addCacheServer();
-    server.setPort(this.serverPort.getPort());
-    server.start();
-
-    for (Map.Entry<String, RegionShortcut> region : regionsToCreate.entrySet()) {
-      cache.createRegionFactory(region.getValue()).create(region.getKey());
-    }
-  }
-
-  @Override
-  public void after() {
-    if (cache != null) {
-      cache.close();
-      cache = null;
-    }
-    if (server != null) {
-      server.stop();
-      server = null;
-    }
-
-    if (temporaryFolder != null) {
-      temporaryFolder.delete();
-    }
-
-    releasePortKeepers();
-  }
-
-  private void releasePortKeepers() {
-    Stream.of(serverPort, jmxPort, httpPort, tcpPort).filter(Objects::nonNull)
-        .forEach(AvailablePort.Keeper::release);
-  }
-
-  public int getHttpPort() {
-    String httpPort = properties.getProperty(ConfigurationProperties.HTTP_SERVICE_PORT);
-
-    if (httpPort != null) {
-      return (Integer.valueOf(httpPort));
-    }
-
-    if (properties.getProperty(ConfigurationProperties.START_DEV_REST_API) != null) {
-      throw new IllegalStateException("No HTTP_SERVICE_PORT has been specified");
-    } else {
-      throw new IllegalStateException("Dev rest api not configured for this server");
-    }
-  }
-
-  public Cache getCache() {
-    return cache;
-  }
-
-  public CacheServer getServer() {
-    return server;
-  }
-
-  public File getWorkingDir() {
-    if (cache == null) {
-      throw new IllegalStateException("Server not yet initialized");
-    }
-    return ((InternalDistributedSystem) cache.getDistributedSystem()).getConfig()
-        .getDeployWorkingDir();
-  }
-
-  public String getHostname() {
-    return "localhost";
-  }
-
-
-  public Integer getJmxPort() {
-    String jmxPort = properties.getProperty(ConfigurationProperties.JMX_MANAGER_PORT);
-    if (jmxPort == null) {
-      return null;
-    }
-
-    return Integer.valueOf(jmxPort);
-  }
-
-  public int getServerPort() {
-    return this.serverPort.getPort();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
index 7350241..97c636b 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorServerStartupRule.java
@@ -95,7 +95,9 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     VM locatorVM = getHost(0).getVM(index);
     Locator locator = locatorVM.invoke(() -> {
       locatorStarter = new LocatorStarterRule(workingDir);
-      return locatorStarter.withProperties(properties).startLocator();
+      locatorStarter.withProperties(properties).withAutoStart();
+      locatorStarter.before();
+      return locatorStarter;
     });
     members[index] = new MemberVM(locator, locatorVM);
     return members[index];
@@ -126,7 +128,9 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     VM serverVM = getHost(0).getVM(index);
     Server server = serverVM.invoke(() -> {
       serverStarter = new ServerStarterRule(workingDir);
-      return serverStarter.withEmbeddedLocator().withName(name).withJMXManager().startServer();
+      serverStarter.withEmbeddedLocator().withName(name).withJMXManager().withAutoStart();
+      serverStarter.before();
+      return serverStarter;
     });
     members[index] = new MemberVM(server, serverVM);
     return members[index];
@@ -149,8 +153,9 @@ public class LocatorServerStartupRule extends ExternalResource implements Serial
     VM serverVM = getHost(0).getVM(index);
     Server server = serverVM.invoke(() -> {
       serverStarter = new ServerStarterRule(workingDir);
-      return serverStarter.withProperties(properties).withConnectionToLocator(locatorPort)
-          .startServer();
+      serverStarter.withProperties(properties).withConnectionToLocator(locatorPort).withAutoStart();
+      serverStarter.before();
+      return serverStarter;
     });
     members[index] = new MemberVM(server, serverVM);
     return members[index];

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterBuilder.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterBuilder.java
deleted file mode 100644
index 169d41e..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterBuilder.java
+++ /dev/null
@@ -1,121 +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 org.apache.geode.test.dunit.rules;
-
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
-
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.internal.AvailablePort;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.security.SecurityManager;
-
-import java.util.Properties;
-
-public class LocatorStarterBuilder {
-  private Properties properties = new Properties();
-  private AvailablePort.Keeper locatorPort;
-  private AvailablePort.Keeper jmxPort;
-  private AvailablePort.Keeper httpPort;
-  private AvailablePort.Keeper tcpPort;
-
-  public LocatorStarterBuilder() {}
-
-  public LocatorStarterBuilder withSecurityManager(
-      Class<? extends SecurityManager> securityManager) {
-    properties.setProperty(SECURITY_MANAGER, securityManager.getName());
-    return this;
-  }
-
-  public LocalLocatorStarterRule buildInThisVM() {
-    setDefaultProperties();
-    throwIfPortsAreHardcoded();
-    setPortPropertiesFromKeepers();
-    return new LocalLocatorStarterRule(this);
-  }
-
-  Properties getProperties() {
-    return this.properties;
-  }
-
-  private void setDefaultProperties() {
-    properties.putIfAbsent(ConfigurationProperties.NAME, "locator");
-    // properties.putIfAbsent(LOG_FILE, new File(properties.get(ConfigurationProperties.NAME) +
-    // ".log").getAbsolutePath().toString());
-
-    if (locatorPort == null) {
-      this.locatorPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-    if (jmxPort == null) {
-      this.jmxPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-    if (httpPort == null) {
-      this.httpPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-    if (locatorPort == null) {
-      this.tcpPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    properties.putIfAbsent(JMX_MANAGER, "true");
-    properties.putIfAbsent(JMX_MANAGER_START, "true");
-    properties.putIfAbsent(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-    properties.putIfAbsent(JMX_MANAGER_HOSTNAME_FOR_CLIENTS, "localhost");
-  }
-
-  private void setPortPropertiesFromKeepers() {
-    if (jmxPort != null) {
-      properties.setProperty(JMX_MANAGER_PORT, Integer.toString(jmxPort.getPort()));
-    }
-
-    if (httpPort != null) {
-      properties.setProperty(HTTP_SERVICE_PORT, Integer.toString(httpPort.getPort()));
-    }
-
-    if (tcpPort != null) {
-      properties.setProperty(TCP_PORT, Integer.toString(tcpPort.getPort()));
-    }
-  }
-
-  private void throwIfPortsAreHardcoded() {
-    if (properties.getProperty(JMX_MANAGER_PORT) != null
-        || properties.getProperty(HTTP_SERVICE_PORT) != null
-        || properties.getProperty(TCP_PORT) != null) {
-      throw new IllegalArgumentException("Ports cannot be hardcoded.");
-    }
-  }
-
-  AvailablePort.Keeper getLocatorPort() {
-    return locatorPort;
-  }
-
-  AvailablePort.Keeper getJmxPort() {
-    return jmxPort;
-  }
-
-  AvailablePort.Keeper getHttpPort() {
-    return httpPort;
-  }
-
-  AvailablePort.Keeper getTcpPort() {
-    return tcpPort;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterRule.java
index 097adb7..e1c14ce 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/LocatorStarterRule.java
@@ -29,10 +29,14 @@ import java.util.concurrent.TimeUnit;
 /**
  * This is a rule to start up a locator in your current VM. It's useful for your Integration Tests.
  *
- * You can create this rule with and without a Property. If the rule is created with a property, the
- * locator will started automatically for you. If not, you can start the locator by using one of the
- * startLocator function. Either way, the rule will handle shutting down the locator properly for
- * you.
+ * This rules allows you to create/start a locator using any @ConfigurationProperties, you can chain
+ * the configuration of the rule like this: LocatorStarterRule locator = new LocatorStarterRule()
+ * .withProperty(key, value) .withName(name) .withProperties(properties) .withSecurityManager(class)
+ * .withJmxManager() etc, etc. If your rule calls withAutoStart(), the locator will be started
+ * before your test code.
+ *
+ * In your test code, you can use the rule to access the locator's attributes, like the port
+ * information, working dir, name, and the InternalLocator it creates.
  *
  * If you need a rule to start a server/locator in different VMs for Distributed tests, You should
  * use {@link LocatorServerStartupRule}.
@@ -59,14 +63,19 @@ public class LocatorStarterRule extends MemberStarterRule<LocatorStarterRule> im
     }
   }
 
-  public LocatorStarterRule startLocator() {
+  @Override
+  public void before() {
     normalizeProperties();
-    // start locator will start a jmx manager by default, if withJMXManager is not called explicitly
-    // the tests will use random ports by default.
+    // always use a random jmxPort/httpPort when using the rule to start the locator
     if (jmxPort < 0) {
-      withJMXManager();
+      withJMXManager(false);
     }
+    if (autoStart) {
+      startLocator();
+    }
+  }
 
+  public void startLocator() {
     try {
       // this will start a jmx manager and admin rest service by default
       locator = (InternalLocator) startLocatorAndDS(0, null, properties);
@@ -83,6 +92,5 @@ public class LocatorStarterRule extends MemberStarterRule<LocatorStarterRule> im
       Awaitility.await().atMost(65, TimeUnit.SECONDS)
           .until(() -> assertTrue(locator.isSharedConfigurationRunning()));
     }
-    return this;
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
index 9c6f81e..3addc4e 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
 import javax.management.JMX;
 import javax.management.MBeanServerConnection;
 import javax.management.MalformedObjectNameException;
@@ -48,7 +49,7 @@ import javax.management.remote.JMXServiceURL;
  */
 public class MBeanServerConnectionRule extends DescribedExternalResource {
 
-  private int jmxServerPort = -1;
+  private Supplier<Integer> portSupplier;
   private JMXConnector jmxConnector;
   private MBeanServerConnection con;
 
@@ -57,10 +58,10 @@ public class MBeanServerConnectionRule extends DescribedExternalResource {
   /**
    * Rule constructor
    *
-   * @param port The JMX server port to connect to
+   * @param portSupplier The JMX server port to connect to
    */
-  public MBeanServerConnectionRule(int port) {
-    this.jmxServerPort = port;
+  public MBeanServerConnectionRule(Supplier<Integer> portSupplier) {
+    this.portSupplier = portSupplier;
   }
 
   /**
@@ -115,7 +116,7 @@ public class MBeanServerConnectionRule extends DescribedExternalResource {
   @Override
   protected void before(Description description) throws Throwable {
     // do not auto connect if port is not set
-    if (jmxServerPort < 0)
+    if (portSupplier == null)
       return;
 
     // do not auto connect if no ConnectionConfiguration is defined.
@@ -127,7 +128,7 @@ public class MBeanServerConnectionRule extends DescribedExternalResource {
     String user = config.user();
     String password = config.password();
     env.put(JMXConnector.CREDENTIALS, new String[] {user, password});
-    connect(null, jmxServerPort, env);
+    connect(null, portSupplier.get(), env);
   }
 
   public void connect(int jmxPort) throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberStarterRule.java
index 3fda85a..e5e598e 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberStarterRule.java
@@ -25,9 +25,10 @@ import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 
 import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.dunit.VM;
+import org.apache.geode.security.SecurityManager;
 import org.junit.rules.ExternalResource;
 import org.junit.rules.TemporaryFolder;
 
@@ -36,7 +37,8 @@ import java.io.IOException;
 import java.util.Properties;
 
 /**
- * A server or locator inside a DUnit {@link VM}.
+ * the abstract class that's used by LocatorStarterRule and ServerStarterRule to avoid code
+ * duplication.
  */
 public abstract class MemberStarterRule<T> extends ExternalResource implements Member {
   protected transient TemporaryFolder temporaryFolder;
@@ -50,6 +52,8 @@ public abstract class MemberStarterRule<T> extends ExternalResource implements M
   protected String name;
   protected Properties properties = new Properties();
 
+  protected boolean autoStart = false;
+
   public MemberStarterRule() {
     this(null);
   }
@@ -98,6 +102,16 @@ public abstract class MemberStarterRule<T> extends ExternalResource implements M
     return (T) this;
   }
 
+  public T withSecurityManager(Class<? extends SecurityManager> securityManager) {
+    properties.setProperty(SECURITY_MANAGER, securityManager.getName());
+    return (T) this;
+  }
+
+  public T withAutoStart() {
+    this.autoStart = true;
+    return (T) this;
+  }
+
   public T withName(String name) {
     this.name = name;
     properties.setProperty(NAME, name);
@@ -116,16 +130,19 @@ public abstract class MemberStarterRule<T> extends ExternalResource implements M
   /**
    * be able to start JMX manager and admin rest on default ports
    */
-  public T withJMXManager(boolean useDefault) {
-    // the real port numbers will be set after we started the server/locator.
-    this.jmxPort = 0;
-    this.httpPort = 0;
-    if (!useDefault) {
+  public T withJMXManager(boolean useProductDefaultPorts) {
+    if (!useProductDefaultPorts) {
       // do no override these properties if already exists
       properties.putIfAbsent(JMX_MANAGER_PORT,
           AvailablePortHelper.getRandomAvailableTCPPort() + "");
       properties.putIfAbsent(HTTP_SERVICE_PORT,
           AvailablePortHelper.getRandomAvailableTCPPort() + "");
+      this.jmxPort = Integer.parseInt(properties.getProperty(JMX_MANAGER_PORT));
+      this.httpPort = Integer.parseInt(properties.getProperty(HTTP_SERVICE_PORT));
+    } else {
+      // the real port numbers will be set after we started the server/locator.
+      this.jmxPort = 0;
+      this.httpPort = 0;
     }
     properties.putIfAbsent(JMX_MANAGER, "true");
     properties.putIfAbsent(JMX_MANAGER_START, "true");

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterBuilder.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterBuilder.java
deleted file mode 100644
index 5d8947c..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterBuilder.java
+++ /dev/null
@@ -1,185 +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 org.apache.geode.test.dunit.rules;
-
-import static org.apache.geode.distributed.ConfigurationProperties.DEPLOY_WORKING_DIR;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
-import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
-
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.distributed.ConfigurationProperties;
-import org.apache.geode.internal.AvailablePort;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.security.SecurityManager;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-public class ServerStarterBuilder {
-  private Properties properties = new Properties();
-  private Map<String, RegionShortcut> regionsToCreate = new HashMap<>();
-
-  private AvailablePort.Keeper serverPort;
-  private AvailablePort.Keeper jmxPort;
-  private AvailablePort.Keeper httpPort;
-  private AvailablePort.Keeper tcpPort;
-
-  /**
-   * If this flag is true, the Rule will create a temporary folder and set the server's
-   * DEPLOY_WORKING_DIR to that folder. Otherwise, a user must manage their own working directory.
-   */
-  private boolean hasAutomaticallyManagedWorkingDir;
-
-  public LocalServerStarterRule buildInThisVM() {
-    setDefaultProperties();
-    throwIfPortsAreHardcoded();
-    setPortPropertiesFromKeepers();
-
-    return new LocalServerStarterRule(this);
-  }
-
-  public ServerStarterBuilder withJMXManager() {
-    if (this.jmxPort == null) {
-      this.jmxPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    if (this.httpPort == null) {
-      this.httpPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    properties.setProperty(JMX_MANAGER, "true");
-    properties.setProperty(JMX_MANAGER_START, "true");
-    properties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-    return this;
-  }
-
-  /**
-   * Enables the Dev REST API with a random http port
-   */
-  public ServerStarterBuilder withRestService() {
-    if (this.httpPort == null) {
-      this.httpPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    properties.setProperty(START_DEV_REST_API, "true");
-    properties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-    return this;
-  }
-
-  public ServerStarterBuilder withSecurityManager(
-      Class<? extends SecurityManager> securityManager) {
-    properties.setProperty(SECURITY_MANAGER, securityManager.getName());
-    return this;
-  }
-
-  public ServerStarterBuilder withProperty(String key, String value) {
-    properties.setProperty(key, value);
-    return this;
-  }
-
-  public ServerStarterBuilder withRegion(RegionShortcut type, String name) {
-    regionsToCreate.put(name, type);
-    return this;
-  }
-
-
-  private void setDefaultProperties() {
-    String workingDir = properties.getProperty(DEPLOY_WORKING_DIR);
-    if (workingDir == null) {
-      hasAutomaticallyManagedWorkingDir = true;
-    }
-
-    properties.putIfAbsent(ConfigurationProperties.NAME, "server");
-
-    if (this.serverPort == null) {
-      this.serverPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    if (this.tcpPort == null) {
-      this.tcpPort = AvailablePortHelper.getRandomAvailableTCPPortKeepers(1).get(0);
-    }
-
-    properties.putIfAbsent(MCAST_PORT, "0");
-    properties.putIfAbsent(LOCATORS, "");
-  }
-
-  /**
-   * We want to make sure that all tests use AvailablePort.Keeper rather than setting port numbers
-   * manually so that we can avoid flaky tests caused by BindExceptions.
-   * 
-   * @throws IllegalArgumentException - if ports are hardcoded.
-   */
-  private void throwIfPortsAreHardcoded() {
-    if (properties.getProperty(JMX_MANAGER_PORT) != null
-        || properties.getProperty(HTTP_SERVICE_PORT) != null
-        || properties.getProperty(TCP_PORT) != null) {
-      throw new IllegalArgumentException("Ports cannot be hardcoded.");
-    }
-  }
-
-  private void setPortPropertiesFromKeepers() {
-    if (jmxPort != null) {
-      properties.setProperty(JMX_MANAGER_PORT, Integer.toString(jmxPort.getPort()));
-    }
-
-    if (httpPort != null) {
-      properties.setProperty(HTTP_SERVICE_PORT, Integer.toString(httpPort.getPort()));
-    }
-
-    if (tcpPort != null) {
-      properties.setProperty(TCP_PORT, Integer.toString(tcpPort.getPort()));
-
-    }
-  }
-
-  AvailablePort.Keeper getServerPort() {
-    return serverPort;
-  }
-
-  AvailablePort.Keeper getJmxPort() {
-    return jmxPort;
-  }
-
-  AvailablePort.Keeper getHttpPort() {
-    return httpPort;
-  }
-
-  AvailablePort.Keeper getTcpPort() {
-    return tcpPort;
-  }
-
-  Map<String, RegionShortcut> getRegionsToCreate() {
-    return this.regionsToCreate;
-  }
-
-  Properties getProperties() {
-    return this.properties;
-  }
-
-  boolean hasAutomaticallyManagedWorkingDir() {
-    return this.hasAutomaticallyManagedWorkingDir;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
index fea2e9d..0e65354 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
@@ -30,21 +30,33 @@ import org.apache.geode.internal.cache.GemFireCacheImpl;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Properties;
 
 
 /**
  * This is a rule to start up a server in your current VM. It's useful for your Integration Tests.
  *
+ * This rules allows you to create/start a server using any @ConfigurationProperties, you can chain
+ * the configuration of the rule like this: ServerStarterRule server = new ServerStarterRule()
+ * .withProperty(key, value) .withName(name) .withProperties(properties) .withSecurityManager(class)
+ * .withJmxManager() .withRestService() .withEmbeddedLocator() .withRegion(type, name) etc, etc. If
+ * your rule calls withAutoStart(), the server will be started before your test code.
+ *
+ * In your test code, you can use the rule to access the server's attributes, like the port
+ * information, working dir, name, and the cache and cacheServer it creates.
+ *
  * If you need a rule to start a server/locator in different VMs for Distributed tests, You should
  * use {@link LocatorServerStartupRule}.
  */
 public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> implements Server {
-
   private transient Cache cache;
   private transient CacheServer server;
   private int embeddedLocatorPort = -1;
 
+  private Map<String, RegionShortcut> regions = new HashMap<>();
+
   /**
    * Default constructor, if used, the rule will create a temporary folder as the server's working
    * dir, and will delete it when the test is done.
@@ -70,6 +82,17 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
   }
 
   @Override
+  public void before() {
+    normalizeProperties();
+    if (autoStart) {
+      startServer();
+      regions.forEach((regionName, regionType) -> {
+        getCache().createRegionFactory(regionType).create(regionName);
+      });
+    }
+  }
+
+  @Override
   void stopMember() {
     // make sure this cache is the one currently open. A server cache can be recreated due to
     // importing a new set of cluster configuration.
@@ -104,21 +127,21 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
     return this;
   }
 
-  public ServerStarterRule startServer() {
-    return startServer(false);
+  public void startServer() {
+    startServer(false);
   }
 
-  public ServerStarterRule createRegion(RegionShortcut type, String name) {
-    cache.createRegionFactory(type).create(name);
+  public ServerStarterRule withRegion(RegionShortcut type, String name) {
+    this.autoStart = true;
+    regions.put(name, type);
     return this;
   }
 
-  public ServerStarterRule startServer(Properties properties, int locatorPort) {
-    return withProperties(properties).withConnectionToLocator(locatorPort).startServer();
+  public void startServer(Properties properties, int locatorPort) {
+    withProperties(properties).withConnectionToLocator(locatorPort).startServer();
   }
 
-  public ServerStarterRule startServer(boolean pdxPersistent) {
-    normalizeProperties();
+  public void startServer(boolean pdxPersistent) {
     CacheFactory cf = new CacheFactory(this.properties);
     cf.setPdxReadSerialized(pdxPersistent);
     cf.setPdxPersistent(pdxPersistent);
@@ -135,7 +158,6 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
     memberPort = server.getPort();
     jmxPort = config.getJmxManagerPort();
     httpPort = config.getHttpServicePort();
-    return this;
   }
 
   public int getEmbeddedLocatorPort() {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/test/dunit/rules/test/MemberStarterRuleTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/test/MemberStarterRuleTest.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/test/MemberStarterRuleTest.java
new file mode 100644
index 0000000..7dada04
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/test/MemberStarterRuleTest.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 org.apache.geode.test.dunit.rules.test;
+
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.test.dunit.rules.LocatorStarterRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MemberStarterRuleTest {
+
+  @Test
+  public void testSetJMXPortWithProperty() {
+    int port = 2000;
+    LocatorStarterRule locator = new LocatorStarterRule().withProperty(JMX_MANAGER_PORT, port + "");
+    locator.before();
+    assertThat(locator.getJmxPort()).isEqualTo(port);
+  }
+
+  @Test
+  public void testSetJMXPortWithPropertyThenAPI() {
+    int port = 2000;
+    LocatorStarterRule locator = new LocatorStarterRule().withProperty(JMX_MANAGER_PORT, port + "");
+
+    // user call withJMXManager again
+    locator.withJMXManager();
+    locator.before();
+
+    assertThat(locator.getJmxPort()).isEqualTo(port);
+  }
+
+  @Test
+  public void testSetJMXPortWithAPIThenProperty() {
+    // this first one wins
+    LocatorStarterRule locator = new LocatorStarterRule().withJMXManager();
+    int port = locator.getJmxPort();
+
+    locator.withProperty(JMX_MANAGER_PORT, "9999");
+    locator.before();
+
+    assertThat(locator.getJmxPort()).isEqualTo(port);
+  }
+
+  @Test
+  public void testUseRandomPortByDefault() {
+    LocatorStarterRule locator = new LocatorStarterRule();
+    locator.before();
+
+    assertThat(locator.getJmxPort()).isNotEqualTo(1099);
+    assertThat(locator.getJmxPort()).isNotEqualTo(-1);
+
+    assertThat(locator.getHttpPort()).isNotEqualTo(7070);
+    assertThat(locator.getHttpPort()).isNotEqualTo(-1);
+  }
+}


[04/51] [abbrv] geode git commit: GEODE-2730: refactor rules

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
index 49d7c28..f298fae 100644
--- a/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/cache/query/dunit/QueryMonitorDUnitTest.java
@@ -304,22 +304,22 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
         () -> configServer(20, "testQueryMonitorClientServer")); // All the queries taking more than
                                                                  // 20ms should be canceled by Query
                                                                  // monitor.
-    server.invoke("withRegion", () -> createRegion());
+    server.invoke("createRegion", () -> createRegion());
 
     // Initialize server regions.
     server.invoke("populatePortfolioRegions", () -> populatePortfolioRegions(numberOfEntries));
 
     // Initialize Client1 and create client regions.
     client1.invoke("Init client", () -> configClient(serverHostName, serverPort));
-    client1.invoke("withRegion", () -> createRegion());
+    client1.invoke("createRegion", () -> createRegion());
 
     // Initialize Client2 and create client regions.
     client2.invoke("Init client", () -> configClient(serverHostName, serverPort));
-    client2.invoke("withRegion", () -> createRegion());
+    client2.invoke("createRegion", () -> createRegion());
 
     // Initialize Client3 and create client regions.
     client3.invoke("Init client", () -> configClient(serverHostName, serverPort));
-    client3.invoke("withRegion", () -> createRegion());
+    client3.invoke("createRegion", () -> createRegion());
 
     // Execute client queries
 
@@ -395,14 +395,14 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                           // more than 20ms should
                                                                           // be canceled by Query
                                                                           // monitor.
-    server1.invoke("withRegion", () -> createRegion());
+    server1.invoke("createRegion", () -> createRegion());
 
     int serverPort2 = server2.invoke("Create BridgeServer",
         () -> configServer(20, "testQueryMonitorMultiClientMultiServer"));// All the queries taking
                                                                           // more than 20ms should
                                                                           // be canceled by Query
                                                                           // monitor.
-    server2.invoke("withRegion", () -> createRegion());
+    server2.invoke("createRegion", () -> createRegion());
 
     // Initialize server regions.
     server1.invoke("Create Bridge Server", () -> populatePortfolioRegions(numberOfEntries));
@@ -412,11 +412,11 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
 
     // Initialize Client1 and create client regions.
     client1.invoke("Init client", () -> configClient(serverHostName, serverPort1, serverPort2));
-    client1.invoke("withRegion", () -> createRegion());
+    client1.invoke("createRegion", () -> createRegion());
 
     // Initialize Client2 and create client regions.
     client2.invoke("Init client", () -> configClient(serverHostName, serverPort1, serverPort2));
-    client2.invoke("withRegion", () -> createRegion());
+    client2.invoke("createRegion", () -> createRegion());
 
     // Execute client queries
 
@@ -457,7 +457,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                // by
                                                                                                // Query
                                                                                                // monitor.
-    server1.invoke("withRegion", () -> createRegion());
+    server1.invoke("createRegion", () -> createRegion());
 
     server2.invoke("Create BridgeServer", () -> configServer(20, "testQueryExecutionLocally"));// All
                                                                                                // the
@@ -472,7 +472,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                // by
                                                                                                // Query
                                                                                                // monitor.
-    server2.invoke("withRegion", () -> createRegion());
+    server2.invoke("createRegion", () -> createRegion());
 
     // Initialize server regions.
     server1.invoke("Create Bridge Server", () -> populatePortfolioRegions(numberOfEntries));
@@ -518,7 +518,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                // by
                                                                                                // Query
                                                                                                // monitor.
-    server1.invoke("withRegion", () -> createRegion());
+    server1.invoke("createRegion", () -> createRegion());
 
     server2.invoke("Create BridgeServer", () -> configServer(20, "testQueryExecutionLocally"));// All
                                                                                                // the
@@ -533,7 +533,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                // by
                                                                                                // Query
                                                                                                // monitor.
-    server2.invoke("withRegion", () -> createRegion());
+    server2.invoke("createRegion", () -> createRegion());
 
     // Initialize server regions.
     server1.invoke("populatePortfolioRegions", () -> populatePortfolioRegions(numberOfEntries));
@@ -629,11 +629,11 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
 
     // Initialize Client1 and create client regions.
     client1.invoke("Init client", () -> configClient(serverHostName, serverPort1));
-    client1.invoke("withRegion", () -> createRegion());
+    client1.invoke("createRegion", () -> createRegion());
 
     // Initialize Client2 and create client regions.
     client2.invoke("Init client", () -> configClient(serverHostName, serverPort2));
-    client2.invoke("withRegion", () -> createRegion());
+    client2.invoke("createRegion", () -> createRegion());
 
     // Execute client queries
 
@@ -729,14 +729,14 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
         () -> configServer(20, "testQueryMonitorRegionWithEviction"));// All the queries taking more
                                                                       // than 20ms should be
                                                                       // canceled by Query monitor.
-    server1.invoke("withRegion",
+    server1.invoke("createRegion",
         () -> createRegion(true, "server1_testQueryMonitorRegionWithEviction"));
 
     int serverPort2 = server2.invoke("Create BridgeServer",
         () -> configServer(20, "testQueryMonitorRegionWithEviction"));// All the queries taking more
                                                                       // than 20ms should be
                                                                       // canceled by Query monitor.
-    server2.invoke("withRegion",
+    server2.invoke("createRegion",
         () -> createRegion(true, "server2_testQueryMonitorRegionWithEviction"));
 
     // Initialize server regions.
@@ -755,11 +755,11 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
 
     // Initialize Client1 and create client regions.
     client1.invoke("Init client", () -> configClient(serverHostName, serverPort1));
-    client1.invoke("withRegion", () -> createRegion());
+    client1.invoke("createRegion", () -> createRegion());
 
     // Initialize Client2 and create client regions.
     client2.invoke("Init client", () -> configClient(serverHostName, serverPort2));
-    client2.invoke("withRegion", () -> createRegion());
+    client2.invoke("createRegion", () -> createRegion());
 
     // Execute client queries
     client1.invoke("Execute Queries", () -> executeQueriesFromClient(20));
@@ -803,7 +803,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                   // by
                                                                                                   // Query
                                                                                                   // monitor.
-    server1.invoke("withRegion", () -> createRegion());
+    server1.invoke("createRegion", () -> createRegion());
 
     int serverPort2 =
         server2.invoke("configServer", () -> configServer(20, "testQueryMonitorRegionWithIndex"));// All
@@ -819,7 +819,7 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
                                                                                                   // by
                                                                                                   // Query
                                                                                                   // monitor.
-    server2.invoke("withRegion", () -> createRegion());
+    server2.invoke("createRegion", () -> createRegion());
 
     // pause(1000);
 
@@ -831,11 +831,11 @@ public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
 
     // Initialize Client1 and create client regions.
     client1.invoke("Init client", () -> configClient(serverHostName, serverPort1));
-    client1.invoke("withRegion", () -> createRegion());
+    client1.invoke("createRegion", () -> createRegion());
 
     // Initialize Client2 and create client regions.
     client2.invoke("Init client", () -> configClient(serverHostName, serverPort2));
-    client2.invoke("withRegion", () -> createRegion());
+    client2.invoke("createRegion", () -> createRegion());
 
     // Execute client queries
     client1.invoke("executeQueriesFromClient", () -> executeQueriesFromClient(20));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
index 7a10046..659c4a9 100755
--- a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
@@ -186,7 +186,7 @@ public class CQListGIIDUnitTest extends JUnit4DistributedTestCase {
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(DataPolicy.REPLICATE);
     RegionAttributes attrs = factory.create();
-    // cache.withRegion(regionName, attrs);
+    // cache.createRegion(regionName, attrs);
     createRegion(regions[0], "root", attrs);
     createRegion(regions[1], "root", attrs);
     Thread.sleep(2000);
@@ -672,7 +672,7 @@ public class CQListGIIDUnitTest extends JUnit4DistributedTestCase {
         server.start();
       }
     } catch (Exception e) {
-      fail("failed in buildInThisVM()", e);
+      fail("failed in startServer()", e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/management/CacheServerManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/management/CacheServerManagementDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/management/CacheServerManagementDUnitTest.java
index ae5570f..2cd69dd 100644
--- a/geode-cq/src/test/java/org/apache/geode/management/CacheServerManagementDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/management/CacheServerManagementDUnitTest.java
@@ -425,7 +425,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase {
   }
 
   protected void assertCacheServerConfig(CacheServerMXBean bean) {
-    // assertIndexDetailsEquals(ServerInfo.getInstance().getServerPort(), bean.getServerPort());
+    // assertIndexDetailsEquals(ServerInfo.getInstance().getServerPort(), bean.getPort());
     assertEquals(CacheServer.DEFAULT_BIND_ADDRESS, bean.getBindAddress());
     assertEquals(CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS, bean.getHostNameForClients());
     assertEquals(CacheServer.DEFAULT_SOCKET_BUFFER_SIZE, bean.getSocketBufferSize());

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/security/CQClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/CQClientAuthDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/security/CQClientAuthDUnitTest.java
index 68e4c69..8916725 100644
--- a/geode-cq/src/test/java/org/apache/geode/security/CQClientAuthDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/CQClientAuthDUnitTest.java
@@ -37,8 +37,7 @@ import org.apache.geode.security.templates.UserPasswordAuthInit;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -56,11 +55,11 @@ public class CQClientAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client1 = host.getVM(1);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).buildInThisVM();
+          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -82,7 +81,7 @@ public class CQClientAuthDUnitTest extends JUnit4DistributedTestCase {
           UserPasswordAuthInit.class.getName() + ".create");
       ClientCacheFactory factory = new ClientCacheFactory(props);
 
-      factory.addPoolServer("localhost", server.getServerPort());
+      factory.addPoolServer("localhost", server.getPort());
       factory.setPoolThreadLocalConnections(false);
       factory.setPoolMinConnections(5);
       factory.setPoolSubscriptionEnabled(true);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
index 86d4671..2489b95 100644
--- a/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
@@ -39,8 +39,7 @@ import org.apache.geode.pdx.SimpleClass;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
@@ -75,14 +74,13 @@ public class CQPDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   }
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
           .withProperty(SECURITY_POST_PROCESSOR, PDXPostProcessor.class.getName())
           .withProperty("security-pdx", pdxPersistent + "")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
-
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   public CQPDXPostProcessorDUnitTest(boolean pdxPersistent) {
     this.pdxPersistent = pdxPersistent;
@@ -92,7 +90,7 @@ public class CQPDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
   public void testCQ() {
     String query = "select * from /" + REGION_NAME;
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
       Pool pool = PoolManager.find(region);
@@ -121,7 +119,7 @@ public class CQPDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       region.put("key1", new SimpleClass(1, (byte) 1));
       region.put("key2", BYTES);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/security/CQPostProcessorDunitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/CQPostProcessorDunitTest.java b/geode-cq/src/test/java/org/apache/geode/security/CQPostProcessorDunitTest.java
index 935c48c..45f45ab 100644
--- a/geode-cq/src/test/java/org/apache/geode/security/CQPostProcessorDunitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/CQPostProcessorDunitTest.java
@@ -37,8 +37,7 @@ import org.apache.geode.cache.query.internal.cq.CqListenerImpl;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -55,11 +54,11 @@ public class CQPostProcessorDunitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).buildInThisVM();
+          .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName()).withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -74,7 +73,7 @@ public class CQPostProcessorDunitTest extends JUnit4DistributedTestCase {
   public void testPostProcess() {
     String query = "select * from /AuthRegion";
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
 
 
@@ -108,7 +107,7 @@ public class CQPostProcessorDunitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionUser", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       region.put("key6", "value6");
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-cq/src/test/java/org/apache/geode/security/ClientQueryAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/ClientQueryAuthDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/security/ClientQueryAuthDUnitTest.java
index aea543d..cc5dde4 100644
--- a/geode-cq/src/test/java/org/apache/geode/security/ClientQueryAuthDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/ClientQueryAuthDUnitTest.java
@@ -23,8 +23,7 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -52,16 +51,16 @@ public class ClientQueryAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client3 = host.getVM(3);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testQuery() {
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
       final Region region = createProxyRegion(cache, REGION_NAME);
 
       String query = "select * from /AuthRegion";
@@ -77,7 +76,7 @@ public class ClientQueryAuthDUnitTest extends JUnit4DistributedTestCase {
   public void testCQ() {
     String query = "select * from /AuthRegion";
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("stranger", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
@@ -94,7 +93,7 @@ public class ClientQueryAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
@@ -109,7 +108,7 @@ public class ClientQueryAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     client3.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
       Region region = createProxyRegion(cache, REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/QueryNamesOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/QueryNamesOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/QueryNamesOverHttpDUnitTest.java
index 86deb27..dbd29b5 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/QueryNamesOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/QueryNamesOverHttpDUnitTest.java
@@ -23,8 +23,6 @@ import org.apache.geode.management.internal.web.domain.Link;
 import org.apache.geode.management.internal.web.domain.LinkIndex;
 import org.apache.geode.management.internal.web.http.HttpMethod;
 import org.apache.geode.management.internal.web.shell.RestHttpOperationInvoker;
-import org.apache.geode.test.dunit.rules.LocalLocatorStarterRule;
-import org.apache.geode.test.dunit.rules.LocatorStarterBuilder;
 import org.apache.geode.test.dunit.rules.LocatorStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.Rule;
@@ -41,7 +39,7 @@ import javax.management.QueryExp;
 @Category(IntegrationTest.class)
 public class QueryNamesOverHttpDUnitTest {
   @Rule
-  public LocalLocatorStarterRule locatorRule = new LocatorStarterBuilder().buildInThisVM();
+  public LocatorStarterRule locatorRule = new LocatorStarterRule().withAutoStart();
 
   @Test
   public void testQueryNameOverHttp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
index 7fd839c..25068bc 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
@@ -24,7 +24,7 @@ import org.junit.experimental.categories.Category;
 @Category({IntegrationTest.class, SecurityTest.class})
 public class GfshCommandsOverHttpSecurityTest extends GfshCommandsSecurityTest {
   public GfshCommandsOverHttpSecurityTest() {
-    gfshConnection = new GfshShellConnectionRule(serverStarter.getHttpPort(),
+    gfshConnection = new GfshShellConnectionRule(serverStarter::getHttpPort,
         GfshShellConnectionRule.PortType.http);
   }
 }


[39/51] [abbrv] geode git commit: GEODE-728: Rename Execution.withArgs to Execution.setArguments

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionTimeOutDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionTimeOutDUnitTest.java
index 7616abc..fb49918 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionTimeOutDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionTimeOutDUnitTest.java
@@ -116,14 +116,14 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
         }
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs1.getResult()).get(0));
         try {
           rs1.getResult();
@@ -134,7 +134,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
 
 
         ResultCollector rs2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKey).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKey).execute(function.getId());
         assertEquals(new Integer(1), ((List) rs2.getResult()).get(0));
         try {
           rs1.getResult();
@@ -147,7 +147,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         putData.put(testKey + "1", new Integer(2));
         putData.put(testKey + "2", new Integer(3));
         ResultCollector rs3 =
-            dataSet.withFilter(testKeysSet).withArgs(putData).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(putData).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs3.getResult(4000, TimeUnit.MILLISECONDS)).get(0));
         try {
           rs1.getResult();
@@ -161,7 +161,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
 
 
         ResultCollector rst1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         try {
           rst1.getResult(1000, TimeUnit.MILLISECONDS);
           fail("Did not get the expected timeout exception.");
@@ -177,7 +177,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
 
         ResultCollector rst2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKey).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKey).execute(function.getId());
         try {
           rst2.getResult(1000, TimeUnit.MILLISECONDS);
           fail("Did not get the expected timeout exception.");
@@ -196,7 +196,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         putDataTimeOut.put(testKey + "4", new Integer(4));
         putDataTimeOut.put(testKey + "5", new Integer(5));
         ResultCollector rst3 =
-            dataSet.withFilter(testKeysSet).withArgs(putDataTimeOut).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(putDataTimeOut).execute(function.getId());
         try {
           rst3.getResult(1000, TimeUnit.MILLISECONDS);
           fail("Did not get the expected timeout exception.");
@@ -273,7 +273,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         Execution dataSet = FunctionService.onRegion(pr);
 
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           assertTrue(expected.getMessage(),
               expected.getMessage().contains("No target node found for KEY"));
@@ -287,7 +287,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
           pr.put(i.next(), val);
         }
         ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rs.getResult());
         assertEquals(3, l.size());
 
@@ -304,7 +304,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
         ResultCollector rc2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKeysSet).execute(function.getId());
         List l2 = ((List) rc2.getResult());
 
         assertEquals(3, l2.size());
@@ -327,7 +327,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
 
 
         ResultCollector rst =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         try {
           rst.getResult(1000, TimeUnit.MILLISECONDS);
           fail("Did not get the expected exception.");
@@ -344,7 +344,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
 
         ResultCollector rct2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKeysSet).execute(function.getId());
 
         try {
           rct2.getResult(1000, TimeUnit.MILLISECONDS);
@@ -428,7 +428,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
           pr.put(i.next(), val);
         }
         ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         List l = (List) rs.getResult();
         assertEquals(3, l.size());
 
@@ -436,7 +436,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
           assertEquals(Boolean.TRUE, i.next());
         }
         ResultCollector rst =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
 
         try {
           rst.getResult(1000, TimeUnit.MILLISECONDS);
@@ -520,7 +520,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
         ResultCollector rs;
         try {
-          rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           rs.getResult(1000, TimeUnit.MILLISECONDS);
           fail("Did not get the expected exception.");
         } catch (Exception expected) {
@@ -595,13 +595,13 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
           origVals.add(val);
           pr.put(i.next(), val);
         }
-        ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs("TestingTimeOut").execute(function.getId());
+        ResultCollector rs = dataSet.withFilter(testKeysSet).setArguments("TestingTimeOut")
+            .execute(function.getId());
         List l = ((List) rs.getResult(8000, TimeUnit.MILLISECONDS));
         assertEquals(3, l.size()); // this test may fail..but rarely
 
-        ResultCollector rst =
-            dataSet.withFilter(testKeysSet).withArgs("TestingTimeOut").execute(function.getId());
+        ResultCollector rst = dataSet.withFilter(testKeysSet).setArguments("TestingTimeOut")
+            .execute(function.getId());
         rst.getResult(8000, TimeUnit.MILLISECONDS);
         assertEquals(3, l.size());
 
@@ -652,7 +652,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         final HashSet testKeysSet = new HashSet();
         testKeysSet.add(testKey);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           // TODO: expected exception pattern requires fail here
         } catch (Exception expected) {
           // No data should cause exec to throw
@@ -682,7 +682,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
 
         ResultCollector rc1 =
-            dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         assertEquals(1, l.size());
         for (Iterator i = l.iterator(); i.hasNext();) {
@@ -691,7 +691,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
         ResultCollector rc2 =
-            dataSet.withFilter(testKeys).withArgs(testKeys).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(testKeys).execute(function.getId());
         List l2 = ((List) rc2.getResult());
         assertEquals(1, l2.size());
 
@@ -706,7 +706,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         assertEquals(origVals, foundVals);
 
         ResultCollector rct1 =
-            dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function.getId());
 
         try {
           rct1.getResult(1000, TimeUnit.MILLISECONDS);
@@ -734,7 +734,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
 
         ResultCollector rct2 =
-            dataSet.withFilter(testKeys).withArgs(testKeys).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(testKeys).execute(function.getId());
 
         try {
           rct2.getResult(1000, TimeUnit.MILLISECONDS);
@@ -825,7 +825,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         Function function = new TestFunction(true, TEST_FUNCTION_TIMEOUT);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         assertEquals(4, l.size());
 
@@ -834,7 +834,7 @@ public class PRFunctionExecutionTimeOutDUnitTest extends PartitionedRegionDUnitT
         }
 
 
-        ResultCollector rct1 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rct1 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
 
         try {
           rct1.getResult(1000, TimeUnit.MILLISECONDS);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java
index 981b384..a846808 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionWithResultSenderDUnitTest.java
@@ -120,7 +120,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
@@ -132,16 +132,16 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         testKeysSet.add(testKey + "4");
 
         ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs1.getResult()).get(0));
-        ResultCollector rs2 = dataSet.withFilter(testKeysSet).withArgs((Serializable) testKeysSet)
-            .execute(function.getId());
+        ResultCollector rs2 = dataSet.withFilter(testKeysSet)
+            .setArguments((Serializable) testKeysSet).execute(function.getId());
 
         HashMap putData = new HashMap();
         putData.put(testKey + "1", new Integer(2));
         putData.put(testKey + "2", new Integer(3));
         ResultCollector rs3 =
-            dataSet.withFilter(testKeysSet).withArgs(putData).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(putData).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs3.getResult()).get(0));
 
         assertEquals(new Integer(2), pr.get(testKey + "1"));
@@ -209,7 +209,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         testKeysSet.add(testKey + "4");
 
         ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         try {
           assertEquals(Boolean.TRUE, ((List) rs1.getResult()).get(0));
           fail("Expected FunctionException : Function did not send last result");
@@ -279,7 +279,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         Execution dataSet = FunctionService.onRegion(pr);
 
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           assertTrue(expected.getMessage().contains("No target node found for KEY = "));
         }
@@ -292,7 +292,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
           pr.put(i.next(), val);
         }
         ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rs.getResult());
 
         assertEquals(3, l.size());
@@ -302,7 +302,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         }
 
         ResultCollector rc2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKeysSet).execute(function.getId());
         List l2 = ((List) rc2.getResult());
         assertEquals(pr.getTotalNumberOfBuckets() * 2 * 3, l2.size());
 
@@ -341,7 +341,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         final HashSet testKeysSet = new HashSet();
         testKeysSet.add(testKey);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
@@ -361,7 +361,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         }
 
         ResultCollector rc1 =
-            dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         assertEquals(1, l.size());
         for (Iterator i = l.iterator(); i.hasNext();) {
@@ -369,7 +369,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         }
 
         ResultCollector rc2 =
-            dataSet.withFilter(testKeys).withArgs(testKeys).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(testKeys).execute(function.getId());
         List l2 = ((List) rc2.getResult());
         assertEquals(226, l2.size());
 
@@ -419,7 +419,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         }
 
         ResultCollector rc1 =
-            dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function.getId());
         try {
           assertEquals(Boolean.TRUE, ((List) rc1.getResult()).get(0));
           fail("Expected FunctionException : Function did not send last result");
@@ -489,7 +489,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION_NO_LASTRESULT);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         try {
           assertEquals(Boolean.TRUE, ((List) rc1.getResult()).get(0));
           fail("Expected FunctionException : Function did not send last result");
@@ -552,7 +552,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION9);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         LogWriterUtils.getLogWriter()
             .info("PRFunctionExecutionDUnitTest#testExecutionOnAllNodes_byName : Result size :"
@@ -613,7 +613,7 @@ public class PRFunctionExecutionWithResultSenderDUnitTest extends PartitionedReg
 
         Execution dataSet = FunctionService.onRegion(region);
         try {
-          ResultCollector rc = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+          ResultCollector rc = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
           Object o = rc.getResult();
           fail("Expected Function Exception");
         } catch (Exception expected) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
index 249f757..7a56644 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
@@ -184,7 +184,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
         args.add(order);
         filter.add(custId);
         try {
-          e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+          e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
           fail("Expected exception was not thrown");
         } catch (FunctionException fe) {
           LogWriterUtils.getLogWriter().info("Caught Expected exception");
@@ -201,7 +201,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
         LogWriterUtils.getLogWriter().info("VERIFY_TX");
         orderpr.put(orderId, order);
         assertNotNull(orderpr.get(orderId));
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         assertTrue("Unexpected customer value after commit", newCus.equals(pr.get(custId)));
         Order commitedOrder = (Order) orderpr.get(orderId);
         assertTrue(
@@ -209,19 +209,19 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
             order.equals(commitedOrder));
         // verify conflict detection
         args.set(0, new Integer(VERIFY_TXSTATE_CONFLICT));
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         // verify that the transaction is rolled back
         args.set(0, new Integer(VERIFY_ROLLBACK));
         LogWriterUtils.getLogWriter().info("VERIFY_ROLLBACK");
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         // verify destroy
         args.set(0, new Integer(VERIFY_DESTROY));
         LogWriterUtils.getLogWriter().info("VERIFY_DESTROY");
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         // verify invalidate
         args.set(0, new Integer(VERIFY_INVALIDATE));
         LogWriterUtils.getLogWriter().info("VERIFY_INVALIDATE");
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         return Boolean.TRUE;
       }
     });
@@ -933,7 +933,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
         args.add(order);
         filter.add(custId);
         caughtException = false;
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
         return null;
       }
     });
@@ -979,7 +979,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
         args.add(orderId);
         args.add(order);
         filter.add(custId);
-        e.withFilter(filter).withArgs(args).execute(txFunction.getId()).getResult();
+        e.withFilter(filter).setArguments(args).execute(txFunction.getId()).getResult();
 
         return null;
       }
@@ -1036,7 +1036,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
           if (iterations > warmupIterations) {
             startTime = NanoTimer.getTime();
           }
-          e.withFilter(filter).withArgs(args).execute("perfFunction").getResult();
+          e.withFilter(filter).setArguments(args).execute("perfFunction").getResult();
           if (startTime > 0) {
             perfTime += NanoTimer.getTime() - startTime;
           }
@@ -1074,7 +1074,7 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
           if (iterations > warmupIterations) {
             startTime = NanoTimer.getTime();
           }
-          e.withFilter(filter).withArgs(args).execute("perfTxFunction").getResult();
+          e.withFilter(filter).setArguments(args).execute("perfTxFunction").getResult();
           if (startTime > 0) {
             perfTime += NanoTimer.getTime() - startTime;
           }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionResolverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionResolverDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionResolverDUnitTest.java
index 5e8f777..316845e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionResolverDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionResolverDUnitTest.java
@@ -316,7 +316,7 @@ public class PartitionResolverDUnitTest extends JUnit4CacheTestCase {
 
     accessor.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        FunctionService.onRegion(getGemfireCache().getRegion(CUSTOMER)).withArgs(type)
+        FunctionService.onRegion(getGemfireCache().getRegion(CUSTOMER)).setArguments(type)
             .execute(IteratorFunction.id).getResult();
         return null;
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
index efaa2f5..2a1ed9f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
@@ -118,7 +118,7 @@ public class DiskStoreCommandsJUnitTest {
         will(returnValue(null));
         oneOf(mockMember).getId();
         will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(diskStoreName)));
+        oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
         will(returnValue(mockResultCollector));
@@ -185,7 +185,7 @@ public class DiskStoreCommandsJUnitTest {
         will(returnValue(null));
         oneOf(mockMember).getId();
         will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(diskStoreName)));
+        oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
         will(throwException(new DiskStoreNotFoundException("expected")));
@@ -221,7 +221,7 @@ public class DiskStoreCommandsJUnitTest {
         will(returnValue(null));
         oneOf(mockMember).getId();
         will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(diskStoreName)));
+        oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
         will(throwException(new RuntimeException("expected")));
@@ -260,7 +260,7 @@ public class DiskStoreCommandsJUnitTest {
         will(returnValue(null));
         oneOf(mockMember).getId();
         will(returnValue(memberId));
-        oneOf(mockFunctionExecutor).withArgs(with(equal(diskStoreName)));
+        oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
         will(returnValue(mockResultCollector));

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
index 81ed0d1..9f634ca 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
@@ -63,15 +63,15 @@ public class ClientExecuteFunctionAuthDUnitTest extends JUnit4DistributedTestCas
       FunctionService.registerFunction(function);
 
       assertNotAuthorized(() -> FunctionService.onServer(cache.getDefaultPool())
-          .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
+          .setArguments(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
     });
 
     client2.invoke("logging in with super-user", () -> {
       ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
 
       FunctionService.registerFunction(function);
-      ResultCollector rc = FunctionService.onServer(cache.getDefaultPool()).withArgs(Boolean.TRUE)
-          .execute(function.getId());
+      ResultCollector rc = FunctionService.onServer(cache.getDefaultPool())
+          .setArguments(Boolean.TRUE).execute(function.getId());
       rc.getResult();
     });
   }
@@ -83,7 +83,7 @@ public class ClientExecuteFunctionAuthDUnitTest extends JUnit4DistributedTestCas
     client1.invoke("logging in with dataReader", () -> {
       ClientCache cache = createClientCache("dataReader", "1234567", server.getPort());
       assertNotAuthorized(() -> FunctionService.onServer(cache.getDefaultPool())
-          .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
+          .setArguments(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
index 0763407..9c1a28f 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteRegionFunctionAuthDUnitTest.java
@@ -64,9 +64,8 @@ public class ClientExecuteRegionFunctionAuthDUnitTest extends JUnit4DistributedT
 
       Region region = createProxyRegion(cache, REGION_NAME);
       FunctionService.registerFunction(function);
-      assertNotAuthorized(
-          () -> FunctionService.onRegion(region).withArgs(Boolean.TRUE).execute(function.getId()),
-          "DATA:WRITE");
+      assertNotAuthorized(() -> FunctionService.onRegion(region).setArguments(Boolean.TRUE)
+          .execute(function.getId()), "DATA:WRITE");
     });
 
     client2.invoke("logging in with super-user", () -> {
@@ -75,7 +74,7 @@ public class ClientExecuteRegionFunctionAuthDUnitTest extends JUnit4DistributedT
       Region region = createProxyRegion(cache, REGION_NAME);
       FunctionService.registerFunction(function);
       ResultCollector rc =
-          FunctionService.onRegion(region).withArgs(Boolean.TRUE).execute(function.getId());
+          FunctionService.onRegion(region).setArguments(Boolean.TRUE).execute(function.getId());
       rc.getResult();
     });
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-docs/developing/function_exec/function_execution.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/developing/function_exec/function_execution.html.md.erb b/geode-docs/developing/function_exec/function_execution.html.md.erb
index 4d5e0b8..221098b 100644
--- a/geode-docs/developing/function_exec/function_execution.html.md.erb
+++ b/geode-docs/developing/function_exec/function_execution.html.md.erb
@@ -185,7 +185,7 @@ See [Function Execution Commands](../../tools_modules/gfsh/quick_ref_commands_by
 1.  Use one of the `FunctionService` `on*` methods to create an `Execute` object. The `on*` methods, `onRegion`, `onMembers`, etc., define the highest level where the function is run. For colocated partitioned regions, use `onRegion` and specify any one of the colocated regions. The function run using `onRegion` is referred to as a data dependent function - the others as data-independent functions.
 2.  Use the `Execution` object as needed for additional function configuration. You can:
     -   Provide a key `Set` to `withFilters` to narrow the execution scope for `onRegion` `Execution` objects. You can retrieve the key set in your `Function` `execute` method through `RegionFunctionContext.getFilter`.
-    -   Provide function arguments to `withArgs`. You can retrieve these in your `Function` `execute` method through `FunctionContext.getArguments`.
+    -   Provide function arguments to `setArguments`. You can retrieve these in your `Function` `execute` method through `FunctionContext.getArguments`.
     -   Define a custom `ResultCollector`
 
 3.  Call the `Execution` object to `execute` method to run the function.
@@ -209,7 +209,7 @@ keysForGet.add("KEY_7");
 
 Execution execution = FunctionService.onRegion(exampleRegion)
     .withFilter(keysForGet)
-    .withArgs(Boolean.TRUE)
+    .setArguments(Boolean.TRUE)
     .withCollector(new MyArrayListResultCollector());
 
 ResultCollector rc = execution.execute(function);
@@ -245,7 +245,7 @@ To customize results collecting:
     ``` pre
     Execution execution = FunctionService.onRegion(exampleRegion)
         .withFilter(keysForGet)
-        .withArgs(Boolean.TRUE)
+        .setArguments(Boolean.TRUE)
         .withCollector(new MyArrayListResultCollector());
     ```
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-docs/developing/partitioned_regions/join_query_partitioned_regions.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/developing/partitioned_regions/join_query_partitioned_regions.html.md.erb b/geode-docs/developing/partitioned_regions/join_query_partitioned_regions.html.md.erb
index e6beab2..358b1a1 100644
--- a/geode-docs/developing/partitioned_regions/join_query_partitioned_regions.html.md.erb
+++ b/geode-docs/developing/partitioned_regions/join_query_partitioned_regions.html.md.erb
@@ -74,7 +74,7 @@ ArrayList argList = new ArrayList();
 argList.add(queryString);
 Object result = FunctionService.onRegion(CacheFactory.getAnyInstance()
      .getRegion("QueryRegion1" ))
-     .withArgs(argList).execute(function).getResult();
+     .setArguments(argList).execute(function).getResult();
 ArrayList resultList = (ArrayList)result;
 resultList.trimToSize();
 List queryResults = null;
@@ -92,6 +92,6 @@ On the client side, note that you can specify a bucket filter while invoking Fun
 
 **Additional Notes on Using the Query.execute and RegionFunctionContext APIs**
 
-You can also pass multiple parameters (besides the query itself) to the query function by specifying the parameters in the client-side code (`FunctionService.onRegion(..).withArgs()`). Then you can handle the parameters inside the function on the server side using `context.getArguments`. Note that it does not matter which order you specify the parameters as long as you match the parameter handling order on the server with the order specified in the client.
+You can also pass multiple parameters (besides the query itself) to the query function by specifying the parameters in the client-side code (`FunctionService.onRegion(..).setArguments()`). Then you can handle the parameters inside the function on the server side using `context.getArguments`. Note that it does not matter which order you specify the parameters as long as you match the parameter handling order on the server with the order specified in the client.
 
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-docs/developing/query_additional/partitioned_region_key_or_field_value.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/developing/query_additional/partitioned_region_key_or_field_value.html.md.erb b/geode-docs/developing/query_additional/partitioned_region_key_or_field_value.html.md.erb
index 8ee443e..91034d8 100644
--- a/geode-docs/developing/query_additional/partitioned_region_key_or_field_value.html.md.erb
+++ b/geode-docs/developing/query_additional/partitioned_region_key_or_field_value.html.md.erb
@@ -53,7 +53,7 @@ The following is an example how to optimize a query that will be run on data par
           //for ID=1 and query will execute on that bucket.
           rcollector = FunctionService
               .onRegion(region)
-              .withArgs(qStr)
+              .setArguments(qStr)
               .withFilter(filter)
               .execute(func);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-docs/developing/query_additional/query_on_a_single_node.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/developing/query_additional/query_on_a_single_node.html.md.erb b/geode-docs/developing/query_additional/query_on_a_single_node.html.md.erb
index bf83999..f067b14 100644
--- a/geode-docs/developing/query_additional/query_on_a_single_node.html.md.erb
+++ b/geode-docs/developing/query_additional/query_on_a_single_node.html.md.erb
@@ -142,7 +142,7 @@ To direct a query to specific partitioned region node, you can execute the query
           //for ID=1 and query will execute on that bucket.
           rcollector = FunctionService
               .onRegion(region)
-              .withArgs(qStr)
+              .setArguments(qStr)
               .withFilter(filter)
               .execute(func);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index fea4845..c39a4a8 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -171,7 +171,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
   @Override
   public void dumpFiles(final String directory) {
     ResultCollector results = FunctionService.onRegion(getDataRegion())
-        .withArgs(new String[] {directory, indexName}).execute(DumpDirectoryFiles.ID);
+        .setArguments(new String[] {directory, indexName}).execute(DumpDirectoryFiles.ID);
     results.getResult();
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
index bfc561a..328eb3f 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
@@ -114,7 +114,7 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
     try {
       TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
       ResultCollector<TopEntriesCollector, TopEntries<K>> rc =
-          onRegion().withArgs(context).withCollector(collector).execute(LuceneQueryFunction.ID);
+          onRegion().setArguments(context).withCollector(collector).execute(LuceneQueryFunction.ID);
       entries = rc.getResult();
     } catch (FunctionException e) {
       if (e.getCause() instanceof LuceneQueryException) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
index 30952bf..935f37c 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
@@ -406,7 +406,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
     WaitUntilFlushedFunctionContext context =
         new WaitUntilFlushedFunctionContext(indexName, timeout, unit);
     Execution execution = FunctionService.onRegion(dataRegion);
-    ResultCollector rs = execution.withArgs(context).execute(WaitUntilFlushedFunction.ID);
+    ResultCollector rs = execution.setArguments(context).execute(WaitUntilFlushedFunction.ID);
     List<Boolean> results = (List<Boolean>) rs.getResult();
     for (Boolean oneResult : results) {
       if (oneResult == false) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryImplJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryImplJUnitTest.java
index 20f5d1d..03db6c9 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryImplJUnitTest.java
@@ -66,7 +66,7 @@ public class LuceneQueryImplJUnitTest {
     collector = mock(ResultCollector.class);
     provider = mock(LuceneQueryProvider.class);
 
-    when(execution.withArgs(any())).thenReturn(execution);
+    when(execution.setArguments(any())).thenReturn(execution);
     when(execution.withCollector(any())).thenReturn(execution);
     when(execution.execute(anyString())).thenReturn((ResultCollector) collector);
     results = mock(PageableLuceneQueryResults.class);
@@ -145,7 +145,7 @@ public class LuceneQueryImplJUnitTest {
     verify(execution).execute(eq(LuceneQueryFunction.ID));
     ArgumentCaptor<LuceneFunctionContext> captor =
         ArgumentCaptor.forClass(LuceneFunctionContext.class);
-    verify(execution).withArgs(captor.capture());
+    verify(execution).setArguments(captor.capture());
     LuceneFunctionContext context = captor.getValue();
     assertEquals(LIMIT, context.getLimit());
     assertEquals(provider, context.getQueryProvider());

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-spark-connector/geode-spark-connector/src/main/scala/org/apache/geode/spark/connector/internal/DefaultGeodeConnection.scala
----------------------------------------------------------------------
diff --git a/geode-spark-connector/geode-spark-connector/src/main/scala/org/apache/geode/spark/connector/internal/DefaultGeodeConnection.scala b/geode-spark-connector/geode-spark-connector/src/main/scala/org/apache/geode/spark/connector/internal/DefaultGeodeConnection.scala
index 670a3f8..b5dcf1d 100644
--- a/geode-spark-connector/geode-spark-connector/src/main/scala/org/apache/geode/spark/connector/internal/DefaultGeodeConnection.scala
+++ b/geode-spark-connector/geode-spark-connector/src/main/scala/org/apache/geode/spark/connector/internal/DefaultGeodeConnection.scala
@@ -129,7 +129,7 @@ private[connector] class DefaultGeodeConnection (
     val collector = new StructStreamingResultCollector(desc)
         // RetrieveRegionResultCollector[(K, V)]
     import scala.collection.JavaConversions.setAsJavaSet
-    val exec = FunctionService.onRegion(region).withArgs(args).withCollector(collector).asInstanceOf[InternalExecution]
+    val exec = FunctionService.onRegion(region).setArguments(args).withCollector(collector).asInstanceOf[InternalExecution]
       .withBucketFilter(split.bucketSet.map(Integer.valueOf))
     exec.setWaitOnExceptionFlag(true)
     exec.execute(RetrieveRegionFunction.ID)
@@ -144,7 +144,7 @@ private[connector] class DefaultGeodeConnection (
     val args: Array[String] = Array[String](queryString, bucketSet.toString)
     val exec = FunctionService.onRegion(region).withCollector(collector).asInstanceOf[InternalExecution]
       .withBucketFilter(bucketSet.map(Integer.valueOf))
-      .withArgs(args)
+      .setArguments(args)
     exec.execute(QueryFunction.ID)
     collector.getResult
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
index d42e6da..c7aec39 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderDistributedDeadlockDUnitTest.java
@@ -343,7 +343,7 @@ public class SerialGatewaySenderDistributedDeadlockDUnitTest extends WANTestBase
     FunctionService.registerFunction(new TestFunction());
     Execution exe = FunctionService.onRegion(region);
     for (int x = 0; x < num; x++) {
-      exe.withArgs(useThreadOwnedSocket)
+      exe.setArguments(useThreadOwnedSocket)
           .execute("org.apache.geode.internal.cache.wan.serial.TestFunction");
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
index e9b61f4..80996c3 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
@@ -203,9 +203,9 @@ public class FunctionAccessController extends AbstractBaseController {
 
         // execute function with specified arguments
         if (args.length == 1) {
-          results = function.withArgs(args[0]).execute(functionId);
+          results = function.setArguments(args[0]).execute(functionId);
         } else {
-          results = function.withArgs(args).execute(functionId);
+          results = function.setArguments(args).execute(functionId);
         }
       } else {
         // execute function with no args


[21/51] [abbrv] geode git commit: GEODE-2705: Jars undeployed from cluster configuration will not be loaded from disk on member restart

Posted by ds...@apache.org.
GEODE-2705: Jars undeployed from cluster configuration will not be loaded from disk on member restart


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

Branch: refs/heads/feature/GEODE-2097
Commit: ee11b0a43b66a42eb10a16b92993436b2298c042
Parents: 6fd2d12
Author: Jared Stewart <js...@pivotal.io>
Authored: Thu Apr 6 10:22:26 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Sun Apr 16 09:10:01 2017 -0700

----------------------------------------------------------------------
 .../org/apache/geode/internal/DeployedJar.java  |   6 +
 .../org/apache/geode/internal/JarDeployer.java  | 148 +++++++++++--------
 .../cache/ClusterConfigurationLoader.java       |  30 +++-
 .../geode/internal/cache/GemFireCacheImpl.java  |   7 +-
 .../ClassPathLoaderIntegrationTest.java         |  10 +-
 .../geode/internal/ClassPathLoaderTest.java     |  58 --------
 .../internal/JarDeployerIntegrationTest.java    |  63 +++++++-
 .../geode/management/DeployJarTestSuite.java    |   4 +-
 .../internal/configuration/ClusterConfig.java   |  23 ++-
 .../ClusterConfigDeployJarDUnitTest.java        |  76 ++++++++++
 10 files changed, 278 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
index f4f4028..8adec1f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
@@ -85,6 +85,9 @@ public class DeployedJar {
     this(versionedJarFile, jarName, Files.readAllBytes(versionedJarFile.toPath()));
   }
 
+  /**
+   * Writes the given jarBytes to versionedJarFile
+   */
   public DeployedJar(File versionedJarFile, final String jarName, byte[] jarBytes)
       throws IOException {
     Assert.assertTrue(jarBytes != null, "jarBytes cannot be null");
@@ -377,6 +380,9 @@ public class DeployedJar {
     return new byte[0];
   }
 
+  /**
+   * @return the unversioned name of this jar file, e.g. myJar.jar
+   */
   public String getJarName() {
     return this.jarName;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
index ad5c435..669802c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
@@ -18,10 +18,6 @@ import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toSet;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.geode.GemFireException;
-import org.apache.geode.GemFireIOException;
-import org.apache.geode.SystemFailure;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.logging.log4j.Logger;
 
@@ -34,13 +30,9 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Serializable;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -83,11 +75,23 @@ public class JarDeployer implements Serializable {
     return this.deployDirectory;
   }
 
+  /**
+   * Writes the jarBytes for the given jarName to the next version of that jar file (if the bytes do
+   * not match the latest deployed version)
+   * 
+   * @return the DeployedJar that was written from jarBytes, or null if those bytes matched the
+   *         latest deployed version
+   */
   public DeployedJar deployWithoutRegistering(final String jarName, final byte[] jarBytes)
       throws IOException {
     lock.lock();
 
     try {
+      boolean shouldDeployNewVersion = shouldDeployNewVersion(jarName, jarBytes);
+      if (!shouldDeployNewVersion) {
+        return null;
+      }
+
       verifyWritableDeployDirectory();
 
       File newVersionedJarFile = getNextVersionedJarFile(jarName);
@@ -129,6 +133,7 @@ public class JarDeployer implements Serializable {
     lock.unlock();
   }
 
+
   protected File getNextVersionedJarFile(String unversionedJarName) {
     File[] oldVersions = findSortedOldVersionsOfJar(unversionedJarName);
 
@@ -246,21 +251,17 @@ public class JarDeployer implements Serializable {
     }
   }
 
-  protected Set<String> findDistinctDeployedJars() {
+  protected Set<String> findDistinctDeployedJarsOnDisk() {
     // Find all deployed JAR files
-    final File[] oldFiles = this.deployDirectory.listFiles(new FilenameFilter() {
-      @Override
-      public boolean accept(final File file, final String name) {
-        return versionedPattern.matcher(name).matches();
-      }
-    });
+    final File[] oldFiles =
+        this.deployDirectory.listFiles((file, name) -> versionedPattern.matcher(name).matches());
 
     // Now add just the original JAR name to the set
-    final Set<String> jarNames = new HashSet<String>();
+    final Set<String> jarNames = new HashSet<>();
     for (File oldFile : oldFiles) {
       Matcher matcher = versionedPattern.matcher(oldFile.getName());
       matcher.find();
-      jarNames.add(matcher.group(1));
+      jarNames.add(matcher.group(1) + ".jar");
     }
     return jarNames;
   }
@@ -368,60 +369,39 @@ public class JarDeployer implements Serializable {
     String newJarName = unversionedJarNameWithoutExtension + ".v" + jarVersion + ".jar";
 
     File newJar = new File(this.deployDirectory, newJarName);
-    logger.debug("Renaming deployed jar from " + oldJar.getCanonicalPath() + " to "
-        + newJar.getCanonicalPath());
+    logger.debug("Renaming deployed jar from {} to {}", oldJar.getCanonicalPath(),
+        newJar.getCanonicalPath());
 
     FileUtils.moveFile(oldJar, newJar);
-    FileUtils.deleteQuietly(oldJar);
   }
 
   /**
-   * Re-deploy all previously deployed JAR files.
+   * Re-deploy all previously deployed JAR files on disk.
    */
-  public void loadPreviouslyDeployedJars() {
+  public void loadPreviouslyDeployedJarsFromDisk() {
+    logger.info("Loading previously deployed jars");
     lock.lock();
     try {
       verifyWritableDeployDirectory();
       renameJarsWithOldNamingConvention();
 
-      final Set<String> jarNames = findDistinctDeployedJars();
+      final Set<String> jarNames = findDistinctDeployedJarsOnDisk();
       if (jarNames.isEmpty()) {
         return;
       }
 
-      Map<String, DeployedJar> latestVersionOfEachJar = new LinkedHashMap<>();
+      List<DeployedJar> latestVersionOfEachJar = new ArrayList<>();
 
       for (String jarName : jarNames) {
-        final File[] jarFiles = findSortedOldVersionsOfJar(jarName);
-
-        Optional<File> latestValidDeployedJarOptional =
-            Arrays.stream(jarFiles).filter(Objects::nonNull).filter(jarFile -> {
-              try {
-                return DeployedJar.isValidJarContent(FileUtils.readFileToByteArray(jarFile));
-              } catch (IOException e) {
-                return false;
-              }
-            }).findFirst();
-
-        if (!latestValidDeployedJarOptional.isPresent()) {
-          // No valid version of this jar
-          continue;
-        }
+        DeployedJar deployedJar = findLatestValidDeployedJarFromDisk(jarName);
 
-        File latestValidDeployedJar = latestValidDeployedJarOptional.get();
-        latestVersionOfEachJar.put(jarName, new DeployedJar(latestValidDeployedJar, jarName));
-
-        // Remove any old left-behind versions of this JAR file
-        for (File jarFile : jarFiles) {
-          if (!latestValidDeployedJar.equals(jarFile)) {
-            FileUtils.deleteQuietly(jarFile);
-          }
+        if (deployedJar != null) {
+          latestVersionOfEachJar.add(deployedJar);
+          deleteOtherVersionsOfJar(deployedJar);
         }
       }
 
-      registerNewVersions(latestVersionOfEachJar.values().stream().collect(toList()));
-      // ClassPathLoader.getLatest().deploy(latestVersionOfEachJar.keySet().toArray(),
-      // latestVersionOfEachJar.values().toArray())
+      registerNewVersions(latestVersionOfEachJar);
     } catch (Exception e) {
       throw new RuntimeException(e);
     } finally {
@@ -429,6 +409,43 @@ public class JarDeployer implements Serializable {
     }
   }
 
+  /**
+   * Deletes all versions of this jar on disk other than the given version
+   */
+  public void deleteOtherVersionsOfJar(DeployedJar deployedJar) {
+    logger.info("Deleting all versions of " + deployedJar.getJarName() + " other than "
+        + deployedJar.getFileName());
+    final File[] jarFiles = findSortedOldVersionsOfJar(deployedJar.getJarName());
+
+    Stream.of(jarFiles).filter(jarFile -> !jarFile.equals(deployedJar.getFile()))
+        .forEach(jarFile -> {
+          logger.info("Deleting old version of jar: " + jarFile.getAbsolutePath());
+          FileUtils.deleteQuietly(jarFile);
+        });
+  }
+
+  public DeployedJar findLatestValidDeployedJarFromDisk(String unversionedJarName)
+      throws IOException {
+    final File[] jarFiles = findSortedOldVersionsOfJar(unversionedJarName);
+
+    Optional<File> latestValidDeployedJarOptional =
+        Arrays.stream(jarFiles).filter(Objects::nonNull).filter(jarFile -> {
+          try {
+            return DeployedJar.isValidJarContent(FileUtils.readFileToByteArray(jarFile));
+          } catch (IOException e) {
+            return false;
+          }
+        }).findFirst();
+
+    if (!latestValidDeployedJarOptional.isPresent()) {
+      // No valid version of this jar
+      return null;
+    }
+
+    File latestValidDeployedJar = latestValidDeployedJarOptional.get();
+
+    return new DeployedJar(latestValidDeployedJar, unversionedJarName);
+  }
 
   public URL[] getDeployedJarURLs() {
     return this.deployedJars.values().stream().map(DeployedJar::getFileURL).toArray(URL[]::new);
@@ -441,6 +458,7 @@ public class JarDeployer implements Serializable {
     try {
       for (DeployedJar deployedJar : deployedJars) {
         if (deployedJar != null) {
+          logger.info("Registering new version of jar: {}", deployedJar.toString());
           DeployedJar oldJar = this.deployedJars.put(deployedJar.getJarName(), deployedJar);
           if (oldJar != null) {
             oldJar.cleanUp();
@@ -488,13 +506,7 @@ public class JarDeployer implements Serializable {
         String jarName = jarNames[i];
         byte[] newJarBytes = jarBytes[i];
 
-        boolean shouldDeployNewVersion = shouldDeployNewVersion(jarName, newJarBytes);
-
-        if (shouldDeployNewVersion) {
-          deployedJars[i] = deployWithoutRegistering(jarName, newJarBytes);
-        } else {
-          deployedJars[i] = null;
-        }
+        deployedJars[i] = deployWithoutRegistering(jarName, newJarBytes);
       }
 
       return registerNewVersions(Arrays.asList(deployedJars));
@@ -511,7 +523,7 @@ public class JarDeployer implements Serializable {
     }
 
     if (oldDeployedJar.hasSameContentAs(newJarBytes)) {
-      logger.warn("Jar is identical to the latest deployed version: ",
+      logger.warn("Jar is identical to the latest deployed version: {}",
           oldDeployedJar.getFileCanonicalPath());
 
       return false;
@@ -520,6 +532,11 @@ public class JarDeployer implements Serializable {
     return true;
   }
 
+  /**
+   * Returns the latest registered {@link DeployedJar} for the given JarName
+   * 
+   * @param jarName - the unversioned jar name, e.g. myJar.jar
+   */
   public DeployedJar findDeployedJar(String jarName) {
     return this.deployedJars.get(jarName);
   }
@@ -565,9 +582,24 @@ public class JarDeployer implements Serializable {
 
       deployedJar.cleanUp();
 
+      deleteAllVersionsOfJar(jarName);
       return deployedJar.getFileCanonicalPath();
     } finally {
       lock.unlock();
     }
   }
+
+  public void deleteAllVersionsOfJar(String unversionedJarName) {
+    lock.lock();
+    try {
+      File[] jarFiles = findSortedOldVersionsOfJar(unversionedJarName);
+      for (File jarFile : jarFiles) {
+        logger.info("Deleting: {}", jarFile.getAbsolutePath());
+        FileUtils.deleteQuietly(jarFile);
+      }
+    } finally {
+      lock.unlock();
+    }
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
index 2b627b2..55e3542 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
@@ -14,6 +14,9 @@
  */
 package org.apache.geode.internal.cache;
 
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toList;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -27,7 +30,9 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Properties;
 import java.util.Set;
+import java.util.stream.Stream;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.logging.log4j.Logger;
 
@@ -61,21 +66,36 @@ public class ClusterConfigurationLoader {
    */
   public static void deployJarsReceivedFromClusterConfiguration(Cache cache,
       ConfigurationResponse response) throws IOException, ClassNotFoundException {
+    logger.info("Requesting cluster configuration");
     if (response == null) {
       return;
     }
 
     String[] jarFileNames = response.getJarNames();
     byte[][] jarBytes = response.getJars();
+    logger.info("Got response with jars: {}", Stream.of(jarFileNames).collect(joining(",")));
 
     if (jarFileNames != null && jarBytes != null) {
-      List<DeployedJar> deployedJars =
-          ClassPathLoader.getLatest().getJarDeployer().deploy(jarFileNames, jarBytes);
+      JarDeployer jarDeployer = ClassPathLoader.getLatest().getJarDeployer();
+      jarDeployer.suspendAll();
+      try {
+        List<String> extraJarsOnServer =
+            jarDeployer.findDeployedJars().stream().map(DeployedJar::getJarName)
+                .filter(jarName -> !ArrayUtils.contains(jarFileNames, jarName)).collect(toList());
+
+        for (String extraJar : extraJarsOnServer) {
+          logger.info("Removing jar not present in cluster configuration: {}", extraJar);
+          jarDeployer.deleteAllVersionsOfJar(extraJar);
+        }
 
-      deployedJars.stream().filter(Objects::nonNull)
-          .forEach((jar) -> logger.info("Deployed " + (jar.getFile().getAbsolutePath())));
+        List<DeployedJar> deployedJars = jarDeployer.deploy(jarFileNames, jarBytes);
+
+        deployedJars.stream().filter(Objects::nonNull)
+            .forEach((jar) -> logger.info("Deployed: {}", jar.getFile().getAbsolutePath()));
+      } finally {
+        jarDeployer.resumeAll();
+      }
     }
-    // TODO: Jared - Does this need to actually undeploy extra jars like the javadoc says?
   }
 
   /***

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index fb311e7..069b608 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -108,7 +108,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.JarDeployer;
 import org.apache.geode.internal.SystemTimer;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
@@ -1238,8 +1237,10 @@ public class GemFireCacheImpl
     initializeServices();
 
     try {
-      // Deploy all the jars from the deploy working dir.
-      ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJars();
+      if (configurationResponse == null) {
+        // Deploy all the jars from the deploy working dir.
+        ClassPathLoader.getLatest().getJarDeployer().loadPreviouslyDeployedJarsFromDisk();
+      }
       ClusterConfigurationLoader.applyClusterXmlConfiguration(this, configurationResponse,
           system.getConfig());
       initializeDeclarativeCache();

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
index d30feb6..14108c7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderIntegrationTest.java
@@ -91,7 +91,7 @@ public class ClassPathLoaderIntegrationTest {
     fos.write(new byte[TEMP_FILE_BYTES_COUNT]);
     fos.close();
 
-    System.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
+    // System.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
     ClassPathLoader.setLatestToDefault(temporaryFolder.getRoot());
   }
 
@@ -226,9 +226,7 @@ public class ClassPathLoaderIntegrationTest {
     outStream.write(jarBytes);
     outStream.close();
 
-    Properties properties = new Properties();
-    properties.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
-    ServerStarterRule serverStarterRule = new ServerStarterRule();
+    ServerStarterRule serverStarterRule = new ServerStarterRule(temporaryFolder.getRoot());
     serverStarterRule.startServer();
 
     GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
@@ -248,9 +246,7 @@ public class ClassPathLoaderIntegrationTest {
     File jarVersion1 = createVersionOfJar("Version1", "MyFunction", "MyJar.jar");
     File jarVersion2 = createVersionOfJar("Version2", "MyFunction", "MyJar.jar");
 
-    Properties properties = new Properties();
-    properties.setProperty("user.dir", temporaryFolder.getRoot().getAbsolutePath());
-    ServerStarterRule serverStarterRule = new ServerStarterRule();
+    ServerStarterRule serverStarterRule = new ServerStarterRule(temporaryFolder.getRoot());
     serverStarterRule.startServer();
 
     GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
index 0d26caf..0e37075 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/ClassPathLoaderTest.java
@@ -494,39 +494,6 @@ public class ClassPathLoaderTest {
     }
   }
 
-  private static void exploreClassLoader(ClassLoader cl, int indent) {
-    String prefix = "";
-    for (int i = 0; i < indent; i++) {
-      prefix += "\t";
-    }
-    System.out.println(prefix + "ClassLoader toString() = " + cl);
-
-    Class<?> clazz = cl.getClass();
-    System.out.println(prefix + "ClassLoader getClass().getName() = " + clazz.getName());
-    exploreClassLoaderSuperClass(prefix, clazz);
-
-    try {
-      URL[] urls = ((URLClassLoader) cl).getURLs();
-      StringBuilder sb = new StringBuilder(prefix).append("ClassLoader getURLs = [");
-      for (int i = 0; i < urls.length; i++) {
-        if (i > 0) {
-          sb.append(", ");
-        }
-        sb.append(urls[i].toString());
-      }
-      sb.append("]");
-      System.out.println(sb.toString());
-    } catch (Exception e) {
-      System.out.println(prefix + "ClassLoader is not a URLClassLoader");
-    }
-
-    ClassLoader parent = cl.getParent();
-    if (parent != null) {
-      System.out.println(prefix + "ClassLoader has parent...");
-      exploreClassLoader(parent, ++indent);
-    }
-  }
-
   private static void exploreClassLoaderSuperClass(String prefix, Class<?> clazz) {
     Class<?> superClazz = clazz.getSuperclass();
     if (superClazz != null) {
@@ -646,31 +613,6 @@ public class ClassPathLoaderTest {
     }
   }
 
-  static class OneClassClassLoader extends ClassLoader {
-
-    private final GeneratingClassLoader genClassLoader = new GeneratingClassLoader();
-    private String className;
-
-    public OneClassClassLoader(final String className) {
-      super(null); // no parent!!
-      this.className = className;
-    }
-
-    @Override
-    public Class<?> findClass(String name) throws ClassNotFoundException {
-      if (!name.equals(className)) {
-        throw new ClassNotFoundException();
-      } else {
-        return this.genClassLoader.findClass(name);
-      }
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-      return (other instanceof OneClassClassLoader);
-    }
-  }
-
   @SuppressWarnings("serial")
   static class BrokenError extends Error {
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
index 9e42c20..e9af0e7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/JarDeployerIntegrationTest.java
@@ -17,7 +17,6 @@
 package org.apache.geode.internal;
 
 
-import static org.apache.geode.internal.Assert.fail;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
@@ -31,7 +30,6 @@ import org.junit.rules.TemporaryFolder;
 import java.io.File;
 import java.io.IOException;
 import java.util.Set;
-import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
@@ -87,7 +85,7 @@ public class JarDeployerIntegrationTest {
     assertThat(sortedOldJars).hasSize(2);
     assertThat(sortedOldJars[0].getName()).contains(".v2.");
     assertThat(sortedOldJars[1].getName()).contains(".v1.");
-    assertThat(jarDeployer.findDistinctDeployedJars()).hasSize(1);
+    assertThat(jarDeployer.findDistinctDeployedJarsOnDisk()).hasSize(1);
   }
 
   @Test
@@ -208,4 +206,63 @@ public class JarDeployerIntegrationTest {
   }
 
 
+  @Test
+  public void testDeleteAllVersionsOfJar() throws Exception {
+    File deployDir = jarDeployer.getDeployDirectory();
+
+    File jarAVersion1 = new File(deployDir, "myJarA.v1.jar");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion1);
+
+    File jarAVersion2 = new File(deployDir, "myJarA.v2.jar");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion2);
+
+    File jarBVersion2 = new File(deployDir, "myJarB.v2.jar");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion2);
+
+    File jarBVersion3 = new File(deployDir, "myJarB.v3.jar");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion3);
+
+    jarDeployer.deleteAllVersionsOfJar("myJarA.jar");
+
+    assertThat(jarAVersion1).doesNotExist();
+    assertThat(jarAVersion2).doesNotExist();
+    assertThat(jarBVersion2).exists();
+    assertThat(jarBVersion3).exists();
+  }
+
+
+  @Test
+  public void testDeleteOtherVersionsOfJar() throws Exception {
+    File deployDir = jarDeployer.getDeployDirectory();
+
+    File jarAVersion1 = new File(deployDir, "myJarA.v1.jar");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion1);
+
+    File jarAVersion2 = new File(deployDir, "myJarA.v2.jar");
+    this.classBuilder.writeJarFromName("ClassA", jarAVersion2);
+
+    File jarBVersion2 = new File(deployDir, "myJarB.v2.jar");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion2);
+
+    File jarBVersion3 = new File(deployDir, "myJarB.v3.jar");
+    this.classBuilder.writeJarFromName("ClassB", jarBVersion3);
+
+    DeployedJar deployedJarBVersion3 = new DeployedJar(jarBVersion3, "myJarB.jar");
+    jarDeployer.deleteOtherVersionsOfJar(deployedJarBVersion3);
+
+    assertThat(jarAVersion1).exists();
+    assertThat(jarAVersion2).exists();
+    assertThat(jarBVersion2).doesNotExist();
+    assertThat(jarBVersion3).exists();
+
+    DeployedJar deployedJarAVersion1 = new DeployedJar(jarAVersion1, "myJarA.jar");
+    jarDeployer.deleteOtherVersionsOfJar(deployedJarAVersion1);
+
+    assertThat(jarAVersion1).exists();
+    assertThat(jarAVersion2).doesNotExist();
+    assertThat(jarBVersion2).doesNotExist();
+    assertThat(jarBVersion3).exists();
+  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
index 3149432..ee46cbf 100644
--- a/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/management/DeployJarTestSuite.java
@@ -20,12 +20,14 @@ import org.apache.geode.internal.DeployedJarJUnitTest;
 import org.apache.geode.internal.JarDeployerIntegrationTest;
 import org.apache.geode.management.internal.cli.commands.DeployCommandRedeployDUnitTest;
 import org.apache.geode.management.internal.cli.commands.DeployCommandsDUnitTest;
+import org.apache.geode.management.internal.configuration.ClusterConfigDeployJarDUnitTest;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
 @RunWith(Suite.class)
 @Suite.SuiteClasses({DeployedJarJUnitTest.class, DeployCommandsDUnitTest.class,
     JarDeployerIntegrationTest.class, ClassPathLoaderIntegrationTest.class,
-    ClassPathLoaderTest.class, DeployCommandRedeployDUnitTest.class})
+    ClassPathLoaderTest.class, DeployCommandRedeployDUnitTest.class,
+    ClusterConfigDeployJarDUnitTest.class})
 public class DeployJarTestSuite {
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
index b111e45..fc920c4 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
@@ -17,6 +17,7 @@
 package org.apache.geode.management.internal.configuration;
 
 
+import static java.util.stream.Collectors.toSet;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE_SIZE_LIMIT;
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -47,6 +48,7 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 public class ClusterConfig implements Serializable {
   private List<ConfigGroup> groups;
@@ -89,7 +91,7 @@ public class ClusterConfig implements Serializable {
 
   public void verifyLocator(MemberVM<Locator> locatorVM) {
     Set<String> expectedGroupConfigs =
-        this.getGroups().stream().map(ConfigGroup::getName).collect(Collectors.toSet());
+        this.getGroups().stream().map(ConfigGroup::getName).collect(toSet());
 
     // verify info exists in memeory
     locatorVM.invoke(() -> {
@@ -135,10 +137,12 @@ public class ClusterConfig implements Serializable {
 
   public void verifyServer(MemberVM<Server> serverVM) throws ClassNotFoundException {
     // verify files exist in filesystem
-    Set<String> expectedJarNames = this.getJarNames().stream().map(ClusterConfig::getServerJarName)
-        .collect(Collectors.toSet());
-    Set<String> actualJarNames = toSetIgnoringHiddenFiles(
-        serverVM.getWorkingDir().list((dir, filename) -> filename.contains(".jar")));
+    Set<String> expectedJarNames = this.getJarNames().stream().collect(toSet());
+
+    String[] actualJarFiles =
+        serverVM.getWorkingDir().list((dir, filename) -> filename.contains(".jar"));
+    Set<String> actualJarNames = Stream.of(actualJarFiles)
+        .map(jar -> jar.replaceAll("\\.v\\d+\\.jar", ".jar")).collect(toSet());
 
     // We will end up with extra jars on disk if they are deployed and then undeployed
     assertThat(expectedJarNames).isSubsetOf(actualJarNames);
@@ -168,6 +172,7 @@ public class ClusterConfig implements Serializable {
       Set<String> undeployedJarNames = new HashSet<>(actualJarNames);
       undeployedJarNames.removeAll(expectedJarNames);
       for (String jar : undeployedJarNames) {
+        System.out.println("Verifying undeployed jar: " + jar);
         DeployedJar undeployedJar =
             ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jar);
         assertThat(undeployedJar).isNull();
@@ -181,15 +186,9 @@ public class ClusterConfig implements Serializable {
     if (array == null) {
       return new HashSet<>();
     }
-    return Arrays.stream(array).filter((String name) -> !name.startsWith("."))
-        .collect(Collectors.toSet());
-  }
-
-  private static String getServerJarName(String jarName) {
-    return jarName.replace(".jar", "") + ".v1.jar";
+    return Arrays.stream(array).filter((String name) -> !name.startsWith(".")).collect(toSet());
   }
 
-
   private static String nameOfClassContainedInJar(String jarName) {
     switch (jarName) {
       case "cluster.jar":

http://git-wip-us.apache.org/repos/asf/geode/blob/ee11b0a4/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
index 7cc84d6..980f81f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.management.internal.configuration;
 
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
@@ -143,6 +144,7 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
     serverProps.setProperty(GROUPS, "group2");
     MemberVM server2 = lsRule.startServerVM(2, serverProps, locator.getPort());
     serverProps.setProperty(GROUPS, "group1,group2");
+    serverProps.setProperty(LOG_LEVEL, "info");
     MemberVM server3 = lsRule.startServerVM(3, serverProps, locator.getPort());
 
     ConfigGroup cluster = new ConfigGroup("cluster");
@@ -178,6 +180,80 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest {
     // test undeploy cluster
     gfshConnector.executeAndVerifyCommand("undeploy --jar=cluster.jar");
 
+
+    cluster = cluster.removeJar("cluster.jar");
+    server3Config.verify(locator);
+    server1Config.verify(server1);
+    server2Config.verify(server2);
+    server3Config.verify(server3);
+
+    gfshConnector.executeAndVerifyCommand("undeploy --jar=group1.jar --group=group1");
+
+    group1 = group1.removeJar("group1.jar");
+    /*
+     * TODO: This is the current (weird) behavior If you started server4 with group1,group2 after
+     * this undeploy command, it would have group1.jar (brought from
+     * cluster_config/group2/group1.jar on locator) whereas server3 (also in group1,group2) does not
+     * have this jar.
+     */
+    ClusterConfig weirdServer3Config =
+        new ClusterConfig(cluster, group1, new ConfigGroup(group2).removeJar("group1.jar"));
+
+    server3Config.verify(locator);
+    server1Config.verify(server1);
+    server2Config.verify(server2);
+    weirdServer3Config.verify(server3);
+  }
+
+  @Test
+  public void testUndeployWithServerBounce() throws Exception {
+    // set up the locator/servers
+    MemberVM locator = lsRule.startLocatorVM(0, locatorProps);
+    serverProps.setProperty(GROUPS, "group1");
+    MemberVM server1 = lsRule.startServerVM(1, serverProps, locator.getPort());
+    serverProps.setProperty(GROUPS, "group2");
+    MemberVM server2 = lsRule.startServerVM(2, serverProps, locator.getPort());
+    serverProps.setProperty(GROUPS, "group1,group2");
+    serverProps.setProperty(LOG_LEVEL, "info");
+    MemberVM server3 = lsRule.startServerVM(3, serverProps, locator.getPort());
+
+    ConfigGroup cluster = new ConfigGroup("cluster");
+    ConfigGroup group1 = new ConfigGroup("group1");
+    ConfigGroup group2 = new ConfigGroup("group2");
+    ClusterConfig expectedClusterConfig = new ClusterConfig(cluster);
+    ClusterConfig server1Config = new ClusterConfig(cluster, group1);
+    ClusterConfig server2Config = new ClusterConfig(cluster, group2);
+    ClusterConfig server3Config = new ClusterConfig(cluster, group1, group2);
+
+    gfshConnector.connect(locator);
+    assertThat(gfshConnector.isConnected()).isTrue();
+
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + clusterJar);
+
+    // deploy cluster.jar to the cluster
+    cluster.addJar("cluster.jar");
+    expectedClusterConfig.verify(locator);
+    expectedClusterConfig.verify(server1);
+    expectedClusterConfig.verify(server2);
+    expectedClusterConfig.verify(server3);
+
+    // deploy group1.jar to both group1 and group2
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + group1Jar + " --group=group1,group2");
+
+    group1.addJar("group1.jar");
+    group2.addJar("group1.jar");
+    server3Config.verify(locator);
+    server1Config.verify(server1);
+    server2Config.verify(server2);
+    server3Config.verify(server3);
+
+    server3.getVM().bounce();
+
+    // test undeploy cluster
+    gfshConnector.executeAndVerifyCommand("undeploy --jar=cluster.jar");
+    server3 = lsRule.startServerVM(3, serverProps, locator.getPort());
+
+
     cluster = cluster.removeJar("cluster.jar");
     server3Config.verify(locator);
     server1Config.verify(server1);


[20/51] [abbrv] geode git commit: GEODE-2686: Add more logging to JarDeployer

Posted by ds...@apache.org.
GEODE-2686: Add more logging to JarDeployer


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

Branch: refs/heads/feature/GEODE-2097
Commit: 8f9624d05abf6a9dea20a9cf7aee2b6a0b7ccb8b
Parents: ee11b0a
Author: Jared Stewart <js...@pivotal.io>
Authored: Mon Apr 10 14:49:09 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Sun Apr 16 09:10:01 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/geode/internal/JarDeployer.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/8f9624d0/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
index 669802c..da4c136 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/JarDeployer.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.internal;
 
+import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toSet;
 
@@ -89,6 +90,7 @@ public class JarDeployer implements Serializable {
     try {
       boolean shouldDeployNewVersion = shouldDeployNewVersion(jarName, jarBytes);
       if (!shouldDeployNewVersion) {
+        logger.debug("No need to deploy a new version of {}", jarName);
         return null;
       }
 
@@ -146,6 +148,8 @@ public class JarDeployer implements Serializable {
       nextVersionedJarName = removeJarExtension(unversionedJarName) + ".v" + nextVersion + ".jar";
     }
 
+    logger.debug("Next versioned jar name for {} is {}", unversionedJarName, nextVersionedJarName);
+
     return new File(deployDirectory, nextVersionedJarName);
   }
 
@@ -274,6 +278,7 @@ public class JarDeployer implements Serializable {
    * @return Sorted array of files that are older versions of the given JAR
    */
   protected File[] findSortedOldVersionsOfJar(final String unversionedJarName) {
+    logger.debug("Finding sorted old versions of {}", unversionedJarName);
     // Find all matching files
     final Pattern pattern = Pattern.compile(
         JAR_PREFIX_FOR_REGEX + removeJarExtension(unversionedJarName) + "\\.v\\d++\\.jar$");
@@ -287,6 +292,8 @@ public class JarDeployer implements Serializable {
       return file2Version - file1Version;
     });
 
+    logger.debug("Found [{}]",
+        Arrays.stream(oldJarFiles).map(File::getAbsolutePath).collect(joining(",")));
     return oldJarFiles;
   }
 
@@ -458,7 +465,7 @@ public class JarDeployer implements Serializable {
     try {
       for (DeployedJar deployedJar : deployedJars) {
         if (deployedJar != null) {
-          logger.info("Registering new version of jar: {}", deployedJar.toString());
+          logger.info("Registering new version of jar: {}", deployedJar);
           DeployedJar oldJar = this.deployedJars.put(deployedJar.getJarName(), deployedJar);
           if (oldJar != null) {
             oldJar.cleanUp();


[35/51] [abbrv] geode git commit: GEODE-2103 Revise http-service-port defn per review

Posted by ds...@apache.org.
GEODE-2103 Revise http-service-port defn per review


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

Branch: refs/heads/feature/GEODE-2097
Commit: fdb7805292e34b7df998ac391b3ef98bc7778cbc
Parents: 3a4c6fc
Author: Karen Miller <km...@pivotal.io>
Authored: Wed Apr 19 13:45:28 2017 -0700
Committer: Karen Miller <km...@pivotal.io>
Committed: Wed Apr 19 13:45:28 2017 -0700

----------------------------------------------------------------------
 geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/fdb78052/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
index 60ba254..4cdab79 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
@@ -401,7 +401,7 @@ See <a href="../../../configuring/cluster_config/gfsh_persist.html">Overview of
 </tr>
 <tr class="even">
 <td><span class="keyword parmname">\-\-http-service-port</span></td>
-<td>Specifies the port on which the HTTP service will listen.</td>
+<td>Specifies the HTTP service port.</td>
 <td>7070</td>
 </tr>
 <tr class="even">
@@ -768,7 +768,7 @@ See <a href="../../../configuring/cluster_config/gfsh_persist.html">Overview of
 </tr>
 <tr class="even">
 <td><span class="keyword parmname">\-\-http-service-port</span></td>
-<td>Specifies the port on which the HTTP service will listen.</td>
+<td>Specifies the HTTP service port.</td>
 <td>7070</td>
 </tr>
 <tr class="even">


[51/51] [abbrv] geode git commit: fixed flaky unit test

Posted by ds...@apache.org.
fixed flaky unit test


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

Branch: refs/heads/feature/GEODE-2097
Commit: ead905cfebb7ce401f18e0a0477e1509cde5bd94
Parents: 45dc674
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Fri Apr 21 16:36:14 2017 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Fri Apr 21 16:36:14 2017 -0700

----------------------------------------------------------------------
 .../OffHeapLRURecoveryRegressionTest.java       | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/ead905cf/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
index 489c62b..0d22acf 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
@@ -19,7 +19,9 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.junit.Assert.assertEquals;
 
 import java.util.Properties;
+import java.util.concurrent.TimeUnit;
 
+import org.awaitility.Awaitility;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -49,7 +51,6 @@ public class OffHeapLRURecoveryRegressionTest {
   @Test
   public void recoveringTooMuchDataDoesNotRunOutOfOffHeapMemory() {
     final int ENTRY_COUNT = 40;
-    final int expectedObjectCount;
     GemFireCacheImpl gfc = createCache();
     try {
       Region<Object, Object> r = createRegion(gfc);
@@ -57,29 +58,26 @@ public class OffHeapLRURecoveryRegressionTest {
       for (int i = 0; i < ENTRY_COUNT; i++) {
         r.put(i, v);
       }
-      // expect one more during recovery because of the way the LRU limit is
-      // enforced during recover.
-      expectedObjectCount = MemoryAllocatorImpl.getAllocator().getStats().getObjects() + 1;
     } finally {
-      gfc.close();
+      closeCache(gfc);
     }
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      return MemoryAllocatorImpl.getAllocator().getStats().getObjects() == 0;
+    });
     System.setProperty("gemfire.disk.recoverValuesSync", "true");
     System.setProperty("gemfire.disk.recoverLruValues", "true");
     try {
       gfc = createCache();
       try {
-        Region<Object, Object> r = createRegion(gfc);
+        createDiskStore(gfc);
         try {
-          assertEquals(ENTRY_COUNT, r.size());
-          assertEquals(expectedObjectCount,
-              MemoryAllocatorImpl.getAllocator().getStats().getObjects());
+          assertEquals(10, MemoryAllocatorImpl.getAllocator().getStats().getObjects());
         } finally {
-          r.destroyRegion();
           DiskStore ds = gfc.findDiskStore(DS_NAME);
           ds.destroy();
         }
       } finally {
-        gfc.close();
+        closeCache(gfc);
       }
     } finally {
       System.clearProperty("gemfire.disk.recoverValuesSync");
@@ -97,9 +95,12 @@ public class OffHeapLRURecoveryRegressionTest {
     return result;
   }
 
-  private Region<Object, Object> createRegion(GemFireCacheImpl gfc) {
+  private void  createDiskStore(GemFireCacheImpl gfc) {
     DiskStoreFactory dsf = gfc.createDiskStoreFactory();
     dsf.create(DS_NAME);
+  }
+  private Region<Object, Object> createRegion(GemFireCacheImpl gfc) {
+    createDiskStore(gfc);
     RegionFactory<Object, Object> rf =
         gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT_OVERFLOW);
     rf.setOffHeap(true);
@@ -110,6 +111,5 @@ public class OffHeapLRURecoveryRegressionTest {
 
   private void closeCache(GemFireCacheImpl gfc) {
     gfc.close();
-    MemoryAllocatorImpl.freeOffHeapMemory();
   }
 }


[33/51] [abbrv] geode git commit: GEODE-2632: refactor code to use interfaces instead of impls

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
index 3ce1721..fd5d6a4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunction.java
@@ -13,7 +13,6 @@
  * the License.
  *
  */
-
 package org.apache.geode.management.internal.cli.functions;
 
 import org.apache.commons.lang.StringUtils;
@@ -56,17 +55,18 @@ import java.util.Arrays;
  * The function only extracts .log and .gfs files under server's working directory
  */
 public class ExportLogsFunction implements Function, InternalEntity {
+
   public static final String EXPORT_LOGS_REGION = "__exportLogsRegion";
+
   private static final Logger LOGGER = LogService.getLogger();
   private static final long serialVersionUID = 1L;
   private static final int BUFFER_SIZE = 1024;
 
-
   @Override
   public void execute(final FunctionContext context) {
     try {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-      DistributionConfig config = cache.getDistributedSystem().getConfig();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
 
       String memberId = cache.getDistributedSystem().getMemberId();
       LOGGER.info("ExportLogsFunction started for member {}", memberId);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
index 1718898..06af662 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
@@ -44,7 +44,7 @@ public class SizeExportLogsFunction extends ExportLogsFunction implements Functi
   public void execute(final FunctionContext context) {
     try {
       GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
-      DistributionConfig config = cache.getDistributedSystem().getConfig();
+      DistributionConfig config = cache.getInternalDistributedSystem().getConfig();
       Args args = (Args) context.getArguments();
       long diskAvailable = config.getLogFile().getUsableSpace();
       long diskSize = config.getLogFile().getTotalSpace();

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
index b98f759..5b82611 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/LonerTypeRegistration.java
@@ -108,7 +108,7 @@ public class LonerTypeRegistration implements TypeRegistration {
    * @return true if this member is a loner and we can't determine what type of registry they want.
    */
   public static boolean isIndeterminateLoner(GemFireCacheImpl cache) {
-    boolean isLoner = cache.getDistributedSystem().isLoner();
+    boolean isLoner = cache.getInternalDistributedSystem().isLoner();
     boolean pdxConfigured = cache.getPdxPersistent();
     return isLoner && !pdxConfigured/* && !hasGateways */;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
index ed94c0c..b4fa33e 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PeerTypeRegistration.java
@@ -116,7 +116,7 @@ public class PeerTypeRegistration implements TypeRegistration {
 
 
     int distributedSystemId =
-        cache.getDistributedSystem().getDistributionManager().getDistributedSystemId();
+        cache.getInternalDistributedSystem().getDistributionManager().getDistributedSystemId();
     if (distributedSystemId == -1) {
       distributedSystemId = 0;
     }
@@ -226,9 +226,9 @@ public class PeerTypeRegistration implements TypeRegistration {
     synchronized (this.dlsLock) {
       if (this.dls == null) {
         try {
-          this.dls = DLockService.create(LOCK_SERVICE_NAME, this.cache.getDistributedSystem(),
-              true /* distributed */, true /* destroyOnDisconnect */,
-              true /* automateFreeResources */);
+          this.dls = DLockService.create(LOCK_SERVICE_NAME,
+              this.cache.getInternalDistributedSystem(), true /* distributed */,
+              true /* destroyOnDisconnect */, true /* automateFreeResources */);
         } catch (IllegalArgumentException e) {
           this.dls = DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME);
           if (this.dls == null) {
@@ -334,7 +334,7 @@ public class PeerTypeRegistration implements TypeRegistration {
    */
   private boolean useUDPMessagingIfNecessary() {
     boolean result = false;
-    InternalDistributedSystem sys = cache.getDistributedSystem();
+    InternalDistributedSystem sys = cache.getInternalDistributedSystem();
     if (sys != null && !sys.threadOwnsResources()) {
       sys.getDistributionManager().forceUDPMessagingForCurrentThread();
       result = true;
@@ -344,7 +344,7 @@ public class PeerTypeRegistration implements TypeRegistration {
 
   private void releaseUDPMessaging(boolean release) {
     if (release) {
-      InternalDistributedSystem sys = cache.getDistributedSystem();
+      InternalDistributedSystem sys = cache.getInternalDistributedSystem();
       if (sys != null) {
         sys.getDistributionManager().releaseUDPMessagingForCurrentThread();
       }
@@ -551,7 +551,7 @@ public class PeerTypeRegistration implements TypeRegistration {
           "The PDX metadata must be persistent in a member that has persistent data. See CacheFactory.setPdxPersistent.");
     }
     int distributedSystemId =
-        cache.getDistributedSystem().getDistributionManager().getDistributedSystemId();
+        cache.getInternalDistributedSystem().getDistributionManager().getDistributedSystemId();
     if (hasGatewaySender && distributedSystemId == -1) {
       throw new PdxInitializationException(
           "When using PDX with a WAN gateway sender, you must set the distributed-system-id gemfire property for your distributed system. See the javadocs for DistributedSystem.");

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
index 6e9c2d3..1c203bb 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.cache.asyncqueue.internal;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.After;
@@ -29,12 +30,12 @@ import static org.junit.Assert.assertEquals;
 @Category(IntegrationTest.class)
 public class SerialAsyncEventQueueImplJUnitTest {
 
-  private Cache cache;
+  private InternalCache cache;
 
   @Before
   public void setUp() {
     CacheFactory cf = new CacheFactory().set(MCAST_PORT, "0");
-    cache = cf.create();
+    cache = (InternalCache) cf.create();
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/cache30/ReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/ReconnectDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/ReconnectDUnitTest.java
index 68ef7f0..b3f39ee 100755
--- a/geode-core/src/test/java/org/apache/geode/cache30/ReconnectDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/ReconnectDUnitTest.java
@@ -1113,7 +1113,8 @@ public class ReconnectDUnitTest extends JUnit4CacheTestCase {
     final GemFireCacheImpl cache = ReconnectDUnitTest.savedCache;
     Wait.waitForCriterion(new WaitCriterion() {
       public boolean done() {
-        return cache.isReconnecting() || cache.getDistributedSystem().isReconnectCancelled();
+        return cache.isReconnecting()
+            || cache.getInternalDistributedSystem().isReconnectCancelled();
       }
 
       public String description() {
@@ -1125,7 +1126,7 @@ public class ReconnectDUnitTest extends JUnit4CacheTestCase {
     } catch (InterruptedException e) {
       fail("interrupted");
     }
-    assertTrue(cache.getDistributedSystem().isReconnectCancelled());
+    assertTrue(cache.getInternalDistributedSystem().isReconnectCancelled());
     assertNull(cache.getReconnectedCache());
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/cache30/ReconnectedCacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/ReconnectedCacheServerDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/ReconnectedCacheServerDUnitTest.java
index 2a2fe73..6ba098f 100755
--- a/geode-core/src/test/java/org/apache/geode/cache30/ReconnectedCacheServerDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/ReconnectedCacheServerDUnitTest.java
@@ -14,16 +14,10 @@
  */
 package org.apache.geode.cache30;
 
-import org.apache.geode.test.junit.categories.ClientServerTest;
-import org.apache.geode.test.junit.categories.MembershipTest;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.server.CacheServer;
@@ -32,15 +26,15 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.gms.MembershipManagerHelper;
 import org.apache.geode.distributed.internal.membership.gms.mgr.GMSMembershipManager;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
-
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.junit.categories.ClientServerTest;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.MembershipTest;
 
 @Category({DistributedTest.class, MembershipTest.class, ClientServerTest.class})
 public class ReconnectedCacheServerDUnitTest extends JUnit4CacheTestCase {
 
-  public ReconnectedCacheServerDUnitTest() {
-    super();
-  }
-
   private static final long serialVersionUID = 1L;
 
   private boolean addedCacheServer = false;
@@ -72,7 +66,7 @@ public class ReconnectedCacheServerDUnitTest extends JUnit4CacheTestCase {
     assertFalse(
         Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "autoReconnect-useCacheXMLFile"));
 
-    GemFireCacheImpl gc = (GemFireCacheImpl) this.cache;
+    InternalCache gc = (InternalCache) this.cache;
 
     // fool the system into thinking cluster-config is being used
     GMSMembershipManager mgr = (GMSMembershipManager) MembershipManagerHelper
@@ -104,7 +98,7 @@ public class ReconnectedCacheServerDUnitTest extends JUnit4CacheTestCase {
 
     assertNotNull(gc.getCacheConfig().getCacheServerCreation());
 
-    InternalDistributedSystem system = gc.getDistributedSystem();
+    InternalDistributedSystem system = gc.getInternalDistributedSystem();
     system.createAndStartCacheServers(gc.getCacheConfig().getCacheServerCreation(), gc);
 
     assertEquals("found these cache servers:" + gc.getCacheServers(), numServers,

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
index e268c22..c8a629c 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
@@ -1387,7 +1387,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
                 af.setDiskStoreName(diskStoreName);
                 gfc.createVMRegion(rgnName1, af.create(), ira);
                 gfc.createVMRegion(rgnName2, af.create(), ira);
-                gfc.getDistributedSystem().addResourceListener(new ShutdownListener());
+                gfc.getInternalDistributedSystem().addResourceListener(new ShutdownListener());
               } catch (IOException ioe) {
                 fail(ioe.toString());
               } catch (TimeoutException e) {
@@ -1462,7 +1462,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
         public Object call() throws Exception {
           GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
           List<ResourceEventsListener> listeners =
-              cache.getDistributedSystem().getResourceListeners();
+              cache.getInternalDistributedSystem().getResourceListeners();
           for (ResourceEventsListener l : listeners) {
             if (l instanceof ShutdownListener) {
               ShutdownListener shutListener = (ShutdownListener) l;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
index 6d04773..5d81724 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
@@ -201,7 +201,8 @@ public class BackupJUnitTest {
       assertNull(region.get(i));
     }
 
-    BackupManager backup = cache.startBackup(cache.getDistributedSystem().getDistributedMember());
+    BackupManager backup =
+        cache.startBackup(cache.getInternalDistributedSystem().getDistributedMember());
     backup.prepareBackup();
     backup.finishBackup(backupDir, null, false);
 
@@ -249,7 +250,8 @@ public class BackupJUnitTest {
   public void testBackupEmptyDiskStore() throws IOException, InterruptedException {
     DiskStoreImpl ds = createDiskStore();
 
-    BackupManager backup = cache.startBackup(cache.getDistributedSystem().getDistributedMember());
+    BackupManager backup =
+        cache.startBackup(cache.getInternalDistributedSystem().getDistributedMember());
     backup.prepareBackup();
     backup.finishBackup(backupDir, null, false);
     assertEquals("No backup files should have been created", Collections.emptyList(),
@@ -264,7 +266,8 @@ public class BackupJUnitTest {
     // from a backup that doesn't contain this key
     region.put("A", "A");
 
-    BackupManager backup = cache.startBackup(cache.getDistributedSystem().getDistributedMember());
+    BackupManager backup =
+        cache.startBackup(cache.getInternalDistributedSystem().getDistributedMember());
     backup.prepareBackup();
     backup.finishBackup(backupDir, null, false);
 
@@ -303,7 +306,8 @@ public class BackupJUnitTest {
     // from a backup that doesn't contain this key
     region.put("A", "A");
 
-    ds.finishBackup(new BackupManager(cache.getDistributedSystem().getDistributedMember(), cache));
+    ds.finishBackup(
+        new BackupManager(cache.getInternalDistributedSystem().getDistributedMember(), cache));
     script.generate(backupDir);
 
     cache.close();
@@ -322,7 +326,8 @@ public class BackupJUnitTest {
     DiskStoreImpl ds = createDiskStore();
     createRegion();
 
-    BackupManager backup = cache.startBackup(cache.getDistributedSystem().getDistributedMember());
+    BackupManager backup =
+        cache.startBackup(cache.getInternalDistributedSystem().getDistributedMember());
     backup.prepareBackup();
     backup.finishBackup(backupDir, null, false);
     Collection<File> fileCollection = FileUtils.listFiles(backupDir,

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/internal/cache/NetSearchMessagingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/NetSearchMessagingDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/NetSearchMessagingDUnitTest.java
index 26412b2..f293c21 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/NetSearchMessagingDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/NetSearchMessagingDUnitTest.java
@@ -370,7 +370,7 @@ public class NetSearchMessagingDUnitTest extends JUnit4CacheTestCase {
 
       public Object call() {
         GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        return cache.getDistributedSystem().getDMStats().getReceivedMessages();
+        return cache.getInternalDistributedSystem().getDMStats().getReceivedMessages();
       }
     })).intValue();
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessorTest.java
index 91ac16b..f38f2ad 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessorTest.java
@@ -104,6 +104,7 @@ public class SearchLoadAndWriteProcessorTest {
     when(lr.getScope()).thenReturn(Scope.DISTRIBUTED_ACK);
     when(lr.getCancelCriterion()).thenReturn(mock(CancelCriterion.class));
     when(cache.getDistributedSystem()).thenReturn(ds);
+    when(cache.getInternalDistributedSystem()).thenReturn(ds);
     when(cache.getSearchTimeout()).thenReturn(30);
     when(attrs.getScope()).thenReturn(Scope.DISTRIBUTED_ACK);
     when(attrs.getDataPolicy()).thenReturn(DataPolicy.EMPTY);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java
index 66b1994..7f207d0 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntriesMessageJUnitTest.java
@@ -72,7 +72,7 @@ public class FetchEntriesMessageJUnitTest {
   public void testProcessChunk() throws Exception {
     cache = Fakes.cache();
     PartitionedRegion pr = mock(PartitionedRegion.class);
-    InternalDistributedSystem system = cache.getDistributedSystem();
+    InternalDistributedSystem system = cache.getInternalDistributedSystem();
 
     FetchEntriesResponse response = new FetchEntriesResponse(system, pr, null, 0);
     HeapDataOutputStream chunkStream = createDummyChunk();

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java b/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
index 2ab64dd..6a1e26f 100644
--- a/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
+++ b/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
@@ -14,6 +14,12 @@
  */
 package org.apache.geode.test.fake;
 
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.LogWriter;
 import org.apache.geode.Statistics;
@@ -29,13 +35,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.cache.CachePerfStats;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 
-import java.io.File;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.mockito.Mockito.*;
-
 /**
  * Factory methods for fake objects for use in test.
  * 
@@ -74,6 +73,7 @@ public class Fakes {
     when(config.getDeployWorkingDir()).thenReturn(new File("."));
 
     when(cache.getDistributedSystem()).thenReturn(system);
+    when(cache.getInternalDistributedSystem()).thenReturn(system);
     when(cache.getSystem()).thenReturn(system);
     when(cache.getMyId()).thenReturn(member);
     when(cache.getDistributionManager()).thenReturn(distributionManager);
@@ -102,7 +102,7 @@ public class Fakes {
    * A fake distributed system, which contains a fake distribution manager.
    */
   public static InternalDistributedSystem distributedSystem() {
-    return cache().getDistributedSystem();
+    return cache().getInternalDistributedSystem();
   }
 
   /**
@@ -134,5 +134,4 @@ public class Fakes {
   }
 
   private Fakes() {}
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
index fe85efe..fea4845 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
@@ -15,9 +15,10 @@
 
 package org.apache.geode.cache.lucene.internal;
 
+import java.util.Set;
+
 import org.apache.geode.CancelException;
 import org.apache.geode.cache.AttributesFactory;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.FixedPartitionResolver;
 import org.apache.geode.cache.PartitionAttributes;
 import org.apache.geode.cache.PartitionAttributesFactory;
@@ -25,11 +26,9 @@ import org.apache.geode.cache.PartitionResolver;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.cache.lucene.internal.directory.DumpDirectoryFiles;
-import org.apache.geode.cache.lucene.internal.filesystem.File;
 import org.apache.geode.cache.lucene.internal.filesystem.FileSystemStats;
 import org.apache.geode.cache.lucene.internal.partition.BucketTargetingFixedResolver;
 import org.apache.geode.cache.lucene.internal.partition.BucketTargetingResolver;
@@ -40,11 +39,9 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 
-import java.util.Set;
-
 /* wrapper of IndexWriter */
 public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
   protected Region fileAndChunkRegion;
@@ -52,7 +49,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
 
   public static final String FILES_REGION_SUFFIX = ".files";
 
-  public LuceneIndexForPartitionedRegion(String indexName, String regionPath, Cache cache) {
+  public LuceneIndexForPartitionedRegion(String indexName, String regionPath, InternalCache cache) {
     super(indexName, regionPath, cache);
 
     final String statsName = indexName + "-" + regionPath;
@@ -89,7 +86,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
     HeterogeneousLuceneSerializer mapper = new HeterogeneousLuceneSerializer(getFieldNames());
     PartitionedRepositoryManager partitionedRepositoryManager =
         new PartitionedRepositoryManager(this, mapper);
-    DM dm = ((GemFireCacheImpl) getCache()).getDistributedSystem().getDistributionManager();
+    DM dm = this.cache.getInternalDistributedSystem().getDistributionManager();
     LuceneBucketListener lucenePrimaryBucketListener =
         new LuceneBucketListener(partitionedRepositoryManager, dm);
 
@@ -169,10 +166,7 @@ public class LuceneIndexForPartitionedRegion extends LuceneIndexImpl {
     return createRegion(regionName, attributes);
   }
 
-  public void close() {
-    // TODO Auto-generated method stub
-
-  }
+  public void close() {}
 
   @Override
   public void dumpFiles(final String directory) {

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
index d58f856..36f6720 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImpl.java
@@ -12,13 +12,11 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.cache.lucene.internal;
 
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.geode.internal.cache.extension.Extension;
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -33,10 +31,11 @@ import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
 import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
 import org.apache.geode.cache.lucene.internal.xml.LuceneIndexCreation;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.extension.Extension;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 
@@ -45,7 +44,7 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
 
   protected final String indexName;
   protected final String regionPath;
-  protected final Cache cache;
+  protected final InternalCache cache;
   protected final LuceneIndexStats indexStats;
 
   protected boolean hasInitialized = false;
@@ -55,7 +54,7 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
   protected Analyzer analyzer;
   protected LocalRegion dataRegion;
 
-  protected LuceneIndexImpl(String indexName, String regionPath, Cache cache) {
+  protected LuceneIndexImpl(String indexName, String regionPath, InternalCache cache) {
     this.indexName = indexName;
     this.regionPath = regionPath;
     this.cache = cache;
@@ -229,7 +228,7 @@ public abstract class LuceneIndexImpl implements InternalLuceneIndex {
 
     // Create the region
     try {
-      return ((GemFireCacheImpl) this.cache).createVMRegion(regionName, attributes, ira);
+      return this.cache.createVMRegion(regionName, attributes, ira);
     } catch (Exception e) {
       InternalGemFireError ige = new InternalGemFireError(
           LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
index 5da2732..e99f3d9 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplFactory.java
@@ -14,12 +14,13 @@
  */
 package org.apache.geode.cache.lucene.internal;
 
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 
 public class LuceneIndexImplFactory {
+
   public LuceneIndexImplFactory() {}
 
-  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
+  public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache) {
     return new LuceneIndexForPartitionedRegion(indexName, regionPath, cache);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
index f4518aa..75ab5ca 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndex.java
@@ -14,14 +14,13 @@
  */
 package org.apache.geode.cache.lucene.internal;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
 import org.apache.geode.cache.lucene.internal.repository.serializer.HeterogeneousLuceneSerializer;
-import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.InternalCache;
 
 public class LuceneRawIndex extends LuceneIndexImpl {
 
-  protected LuceneRawIndex(String indexName, String regionPath, Cache cache) {
+  protected LuceneRawIndex(String indexName, String regionPath, InternalCache cache) {
     super(indexName, regionPath, cache);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
index cf445c0..d29f00a 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRawIndexFactory.java
@@ -14,10 +14,11 @@
  */
 package org.apache.geode.cache.lucene.internal;
 
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 
 public class LuceneRawIndexFactory extends LuceneIndexImplFactory {
-  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
+  @Override
+  public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache) {
     return new LuceneRawIndex(indexName, regionPath, cache);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
index 326c85c..f4e2a79 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneRegionListener.java
@@ -14,23 +14,24 @@
  */
 package org.apache.geode.cache.lucene.internal;
 
+import java.util.Map;
+
+import org.apache.lucene.analysis.Analyzer;
+
 import org.apache.geode.cache.AttributesFactory;
 import org.apache.geode.cache.EvictionAlgorithm;
 import org.apache.geode.cache.EvictionAttributes;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.RegionListener;
-import org.apache.lucene.analysis.Analyzer;
-
-import java.util.Map;
 
 public class LuceneRegionListener implements RegionListener {
 
   private final LuceneServiceImpl service;
 
-  private final GemFireCacheImpl cache;
+  private final InternalCache cache;
 
   private final String indexName;
 
@@ -42,7 +43,7 @@ public class LuceneRegionListener implements RegionListener {
 
   private final String[] fields;
 
-  public LuceneRegionListener(LuceneServiceImpl service, GemFireCacheImpl cache, String indexName,
+  public LuceneRegionListener(LuceneServiceImpl service, InternalCache cache, String indexName,
       String regionPath, String[] fields, Analyzer analyzer, Map<String, Analyzer> fieldAnalyzers) {
     this.service = service;
     this.cache = cache;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
index dbe24ff..30952bf 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.geode.cache.lucene.internal.management.LuceneServiceMBean;
 import org.apache.geode.cache.lucene.internal.management.ManagementIndexListener;
 import org.apache.geode.cache.lucene.internal.results.LuceneGetPageFunction;
 import org.apache.geode.cache.lucene.internal.results.PageResults;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.management.internal.beans.CacheServiceMBeanBase;
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.analysis.Analyzer;
@@ -55,7 +56,6 @@ import org.apache.geode.internal.DSFIDFactory;
 import org.apache.geode.internal.DataSerializableFixedID;
 import org.apache.geode.internal.cache.extension.Extensible;
 import org.apache.geode.internal.cache.CacheService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.RegionListener;
 import org.apache.geode.internal.cache.xmlcache.XmlGenerator;
@@ -72,14 +72,12 @@ public class LuceneServiceImpl implements InternalLuceneService {
   public static LuceneIndexImplFactory luceneIndexFactory = new LuceneIndexImplFactory();
   private static final Logger logger = LogService.getLogger();
 
-  private GemFireCacheImpl cache;
+  private InternalCache cache;
   private final HashMap<String, LuceneIndex> indexMap = new HashMap<String, LuceneIndex>();
   private final HashMap<String, LuceneIndexCreationProfile> definedIndexMap = new HashMap<>();
   private IndexListener managementListener;
 
-  public LuceneServiceImpl() {
-
-  }
+  public LuceneServiceImpl() {}
 
   @Override
   public org.apache.geode.cache.lucene.LuceneIndexFactory createIndexFactory() {
@@ -95,10 +93,9 @@ public class LuceneServiceImpl implements InternalLuceneService {
     if (cache == null) {
       throw new IllegalStateException(LocalizedStrings.CqService_CACHE_IS_NULL.toLocalizedString());
     }
-    GemFireCacheImpl gfc = (GemFireCacheImpl) cache;
-    gfc.getCancelCriterion().checkCancelInProgress(null);
+    cache.getCancelCriterion().checkCancelInProgress(null);
 
-    this.cache = gfc;
+    this.cache = (InternalCache) cache;
 
     FunctionService.registerFunction(new LuceneQueryFunction());
     FunctionService.registerFunction(new LuceneGetPageFunction());

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationIntegrationTest.java
index 5a86ccb..261b742 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -16,6 +16,7 @@
 package org.apache.geode.cache.lucene;
 
 import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.*;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
@@ -164,7 +165,7 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
       luceneService.createIndexFactory().setFields(analyzers).create(INDEX_NAME, REGION_NAME);
       Region region = createRegion();
       final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);
-      assertTrue(index instanceof LuceneRawIndex);
+      assertThat(index).isInstanceOf(LuceneRawIndex.class);
       region.put("key1", new TestObject());
       verifyIndexFinishFlushing(cache, INDEX_NAME, REGION_NAME);
       assertEquals(analyzers, index.getFieldAnalyzers());

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
index b3db8ec..8b379a5 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactorySpy.java
@@ -15,16 +15,16 @@
 package org.apache.geode.cache.lucene.internal;
 
 import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.*;
+
+import java.util.function.Consumer;
 
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
-import org.apache.geode.internal.cache.BucketNotFoundException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.mockito.Mockito;
 import org.mockito.stubbing.Answer;
 
-import java.util.function.Consumer;
+import org.apache.geode.cache.lucene.internal.repository.RepositoryManager;
+import org.apache.geode.internal.cache.BucketNotFoundException;
+import org.apache.geode.internal.cache.InternalCache;
 
 public class LuceneIndexFactorySpy extends LuceneIndexImplFactory {
 
@@ -38,12 +38,11 @@ public class LuceneIndexFactorySpy extends LuceneIndexImplFactory {
     LuceneServiceImpl.luceneIndexFactory = new LuceneIndexImplFactory();
   }
 
-
   private Consumer<Object> getRepositoryConsumer = key -> {
   };
 
   @Override
-  public LuceneIndexImpl create(String indexName, String regionPath, GemFireCacheImpl cache) {
+  public LuceneIndexImpl create(String indexName, String regionPath, InternalCache cache) {
     LuceneIndexForPartitionedRegion index =
         Mockito.spy(new ExtendedLuceneIndexForPartitionedRegion(indexName, regionPath, cache));
     return index;
@@ -54,10 +53,9 @@ public class LuceneIndexFactorySpy extends LuceneIndexImplFactory {
     this.getRepositoryConsumer = getRepositoryConsumer;
   }
 
-
   private class ExtendedLuceneIndexForPartitionedRegion extends LuceneIndexForPartitionedRegion {
     public ExtendedLuceneIndexForPartitionedRegion(final String indexName, final String regionPath,
-        final Cache cache) {
+        final InternalCache cache) {
       super(indexName, regionPath, cache);
     }
 
@@ -77,4 +75,3 @@ public class LuceneIndexFactorySpy extends LuceneIndexImplFactory {
     }
   }
 }
-

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
index f2bfdd4..8e4c179 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
@@ -33,13 +33,13 @@ import org.apache.geode.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.Scope;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
 import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.cache.lucene.internal.directory.DumpDirectoryFiles;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.extension.ExtensionPoint;
 import org.apache.geode.test.fake.Fakes;
@@ -55,7 +55,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void getIndexNameReturnsCorrectName() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     LuceneIndexForPartitionedRegion index =
         new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     assertEquals(name, index.getName());
@@ -65,7 +65,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void getRegionPathReturnsPath() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     LuceneIndexForPartitionedRegion index =
         new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     assertEquals(regionPath, index.getRegionPath());
@@ -75,7 +75,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void fileRegionExistsWhenFileRegionExistsShouldReturnTrue() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     PartitionedRegion region = mock(PartitionedRegion.class);
     LuceneIndexForPartitionedRegion index =
         new LuceneIndexForPartitionedRegion(name, regionPath, cache);
@@ -89,7 +89,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void fileRegionExistsWhenFileRegionDoesNotExistShouldReturnFalse() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     LuceneIndexForPartitionedRegion index =
         new LuceneIndexForPartitionedRegion(name, regionPath, cache);
     String fileRegionName = index.createFileRegionName();
@@ -102,7 +102,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void createAEQWithPersistenceCallsCreateOnAEQFactory() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     final Region region = Fakes.region(regionPath, cache);
     RegionAttributes attributes = region.getAttributes();
     when(attributes.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_PARTITION);
@@ -121,7 +121,7 @@ public class LuceneIndexForPartitionedRegionTest {
   public void createAEQCallsCreateOnAEQFactory() {
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     final Region region = Fakes.region(regionPath, cache);
     AsyncEventQueueFactoryImpl aeqFactory = mock(AsyncEventQueueFactoryImpl.class);
     when(cache.createAsyncEventQueueFactory()).thenReturn(aeqFactory);
@@ -190,7 +190,7 @@ public class LuceneIndexForPartitionedRegionTest {
     boolean withPersistence = false;
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     Region region = initializeScenario(withPersistence, regionPath, cache, 0);
     LuceneIndexForPartitionedRegion index =
         new LuceneIndexForPartitionedRegion(name, regionPath, cache);
@@ -203,7 +203,7 @@ public class LuceneIndexForPartitionedRegionTest {
     boolean withPersistence = false;
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     Region region = initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index =
@@ -228,7 +228,7 @@ public class LuceneIndexForPartitionedRegionTest {
     boolean withPersistence = false;
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     Region region = initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index =
@@ -264,7 +264,7 @@ public class LuceneIndexForPartitionedRegionTest {
     boolean withPersistence = true;
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index =
@@ -284,7 +284,7 @@ public class LuceneIndexForPartitionedRegionTest {
     boolean withPersistence = true;
     String name = "indexName";
     String regionPath = "regionName";
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     initializeScenario(withPersistence, regionPath, cache);
 
     LuceneIndexForPartitionedRegion index =
@@ -306,7 +306,7 @@ public class LuceneIndexForPartitionedRegionTest {
     String name = "indexName";
     String regionPath = "regionName";
     String[] fields = new String[] {"field1", "field2"};
-    Cache cache = Fakes.cache();
+    InternalCache cache = Fakes.cache();
     initializeScenario(withPersistence, regionPath, cache);
 
     AsyncEventQueue aeq = mock(AsyncEventQueue.class);

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplJUnitTest.java
index 1042661..250b933 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexImplJUnitTest.java
@@ -19,18 +19,20 @@ import org.junit.Rule;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.ExpectedException;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.lucene.LuceneIndex;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.test.fake.Fakes;
 import org.apache.geode.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;
+
+  private InternalCache cache;
+  private LuceneIndex index;
 
   @Rule
   public ExpectedException thrown = ExpectedException.none();

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
----------------------------------------------------------------------
diff --git a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
index 71d2051..ab8b5b0 100644
--- a/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
+++ b/geode-rebalancer/src/main/java/org/apache/geode/cache/util/AutoBalancer.java
@@ -40,6 +40,7 @@ import org.apache.geode.cache.partition.PartitionMemberInfo;
 import org.apache.geode.distributed.DistributedLockService;
 import org.apache.geode.distributed.internal.locks.DLockService;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.partitioned.InternalPRInfo;
 import org.apache.geode.internal.cache.partitioned.LoadProbe;
@@ -65,7 +66,6 @@ import org.apache.geode.internal.logging.LogService;
  * <OL>
  * <LI>{@link AutoBalancer#SCHEDULE}
  * <LI>TBD THRESHOLDS
- * 
  */
 @Experimental("The autobalancer may be removed or the API may change in future releases")
 public class AutoBalancer implements Declarable {
@@ -344,19 +344,19 @@ public class AutoBalancer implements Declarable {
   static class GeodeCacheFacade implements CacheOperationFacade {
     private final AtomicBoolean isLockAcquired = new AtomicBoolean(false);
 
-    private GemFireCacheImpl cache;
+    private InternalCache cache;
 
     public GeodeCacheFacade() {
       this(null);
     }
 
-    public GeodeCacheFacade(GemFireCacheImpl cache) {
+    public GeodeCacheFacade(InternalCache cache) {
       this.cache = cache;
     }
 
     @Override
     public Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails() {
-      GemFireCacheImpl cache = getCache();
+      InternalCache cache = getCache();
       Map<PartitionedRegion, InternalPRInfo> detailsMap = new HashMap<>();
       for (PartitionedRegion region : cache.getPartitionedRegions()) {
         LoadProbe probe = cache.getInternalResourceManager().getLoadProbe();
@@ -411,7 +411,7 @@ public class AutoBalancer implements Declarable {
 
     @Override
     public void incrementAttemptCounter() {
-      GemFireCacheImpl cache = getCache();
+      InternalCache cache = getCache();
       try {
         cache.getInternalResourceManager().getStats().incAutoRebalanceAttempts();
       } catch (Exception e) {
@@ -442,7 +442,7 @@ public class AutoBalancer implements Declarable {
       }
     }
 
-    GemFireCacheImpl getCache() {
+    InternalCache getCache() {
       if (cache == null) {
         synchronized (this) {
           if (cache == null) {
@@ -486,15 +486,15 @@ public class AutoBalancer implements Declarable {
 
     @Override
     public DistributedLockService getDLS() {
-      GemFireCacheImpl cache = getCache();
+      InternalCache cache = getCache();
       DistributedLockService dls =
           DistributedLockService.getServiceNamed(AUTO_BALANCER_LOCK_SERVICE_NAME);
       if (dls == null) {
         if (logger.isDebugEnabled()) {
           logger.debug("Creating DistributeLockService");
         }
-        dls = DLockService.create(AUTO_BALANCER_LOCK_SERVICE_NAME, cache.getDistributedSystem(),
-            true, true, true);
+        dls = DLockService.create(AUTO_BALANCER_LOCK_SERVICE_NAME,
+            cache.getInternalDistributedSystem(), true, true, true);
       }
 
       return dls;

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
index a98510d..43d3871 100644
--- a/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/cache/client/internal/locator/wan/WANFactoryImpl.java
@@ -14,12 +14,12 @@
  */
 package org.apache.geode.cache.client.internal.locator.wan;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.wan.GatewayReceiverFactory;
 import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.distributed.internal.WanLocatorDiscoverer;
 import org.apache.geode.internal.DSFIDFactory;
 import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.GatewayReceiverFactoryImpl;
 import org.apache.geode.internal.cache.wan.GatewaySenderFactoryImpl;
 import org.apache.geode.internal.cache.wan.spi.WANFactory;
@@ -45,12 +45,12 @@ public class WANFactoryImpl implements WANFactory {
   }
 
   @Override
-  public GatewaySenderFactory createGatewaySenderFactory(Cache cache) {
+  public GatewaySenderFactory createGatewaySenderFactory(InternalCache cache) {
     return new GatewaySenderFactoryImpl(cache);
   }
 
   @Override
-  public GatewayReceiverFactory createGatewayReceiverFactory(Cache cache) {
+  public GatewayReceiverFactory createGatewayReceiverFactory(InternalCache cache) {
     return new GatewayReceiverFactoryImpl(cache);
   }
 
@@ -63,6 +63,4 @@ public class WANFactoryImpl implements WANFactory {
   public LocatorMembershipListener createLocatorMembershipListener() {
     return new LocatorMembershipListenerImpl();
   }
-
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
index 68eb56c..dbc2cc6 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/AbstractRemoteGatewaySender.java
@@ -14,7 +14,13 @@
  */
 package org.apache.geode.internal.cache.wan;
 
-import org.apache.geode.cache.Cache;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.apache.logging.log4j.Logger;
+
 import org.apache.geode.cache.client.PoolManager;
 import org.apache.geode.cache.client.internal.PoolImpl;
 import org.apache.geode.cache.client.internal.locator.wan.RemoteLocatorRequest;
@@ -23,32 +29,22 @@ import org.apache.geode.cache.wan.GatewayReceiver;
 import org.apache.geode.distributed.internal.WanLocatorDiscoverer;
 import org.apache.geode.distributed.internal.tcpserver.TcpClient;
 import org.apache.geode.internal.admin.remote.DistributionLocatorId;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PoolFactoryImpl;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.net.ConnectException;
-import java.util.Iterator;
-import java.util.StringTokenizer;
 
 public abstract class AbstractRemoteGatewaySender extends AbstractGatewaySender {
   private static final Logger logger = LogService.getLogger();
 
-  public AbstractRemoteGatewaySender() {
-
-  }
+  /** used to reduce warning logs in case remote locator is down (#47634) */
+  protected int proxyFailureTries = 0;
 
-  public AbstractRemoteGatewaySender(Cache cache, GatewaySenderAttributes attrs) {
+  public AbstractRemoteGatewaySender(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
-  /** used to reduce warning logs in case remote locator is down (#47634) */
-  protected int proxyFailureTries = 0;
-
   public synchronized void initProxy() {
     // return if it is being used for WBCL or proxy is already created
     if (this.remoteDSId == DEFAULT_DISTRIBUTED_SYSTEM_ID
@@ -68,8 +64,7 @@ public abstract class AbstractRemoteGatewaySender extends AbstractGatewaySender
     pf.setServerGroup(GatewayReceiver.RECEIVER_GROUP);
     RemoteLocatorRequest request =
         new RemoteLocatorRequest(this.remoteDSId, pf.getPoolAttributes().getServerGroup());
-    String locators =
-        ((GemFireCacheImpl) this.cache).getDistributedSystem().getConfig().getLocators();
+    String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
     if (logger.isDebugEnabled()) {
       logger
           .debug("Gateway Sender is attempting to configure pool with remote locator information");
@@ -96,7 +91,6 @@ public abstract class AbstractRemoteGatewaySender extends AbstractGatewaySender
             logger.debug("Received the remote site {} location information:", this.remoteDSId,
                 response.getLocators());
           }
-          StringBuffer strBuffer = new StringBuffer();
           Iterator<String> itr = response.getLocators().iterator();
           while (itr.hasNext()) {
             String remoteLocator = itr.next();

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
index 8544636..d953d7f 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewayReceiverImpl.java
@@ -185,7 +185,7 @@ public class GatewayReceiverImpl implements GatewayReceiver {
     logger
         .info(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_STARTED_ON_PORT, this.port));
 
-    InternalDistributedSystem system = this.cache.getDistributedSystem();
+    InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
     system.handleResourceEvent(ResourceEvent.GATEWAYRECEIVER_START, this);
 
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
index 7398d29..2c7925b 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderFactoryImpl.java
@@ -29,6 +29,7 @@ import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.wan.parallel.ParallelGatewaySenderImpl;
 import org.apache.geode.internal.cache.wan.serial.SerialGatewaySenderImpl;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
@@ -39,9 +40,7 @@ import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 
 /**
- * 
  * @since GemFire 7.0
- * 
  */
 public class GatewaySenderFactoryImpl implements InternalGatewaySenderFactory {
 
@@ -53,12 +52,12 @@ public class GatewaySenderFactoryImpl implements InternalGatewaySenderFactory {
    */
   private GatewaySenderAttributes attrs = new GatewaySenderAttributes();
 
-  private Cache cache;
+  private InternalCache cache;
 
   private static final AtomicBoolean GATEWAY_CONNECTION_READ_TIMEOUT_PROPERTY_CHECKED =
       new AtomicBoolean(false);
 
-  public GatewaySenderFactoryImpl(Cache cache) {
+  public GatewaySenderFactoryImpl(InternalCache cache) {
     this.cache = cache;
   }
 
@@ -250,13 +249,6 @@ public class GatewaySenderFactoryImpl implements InternalGatewaySenderFactory {
             LocalizedStrings.SerialGatewaySenderImpl_GATEWAY_0_CANNOT_DEFINE_A_REMOTE_SITE_BECAUSE_AT_LEAST_ONE_LISTENER_IS_ALREADY_ADDED
                 .toLocalizedString(id));
       }
-      // if (this.attrs.getOrderPolicy() != null) {
-      // if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
-      // throw new GatewaySenderException(
-      // LocalizedStrings.SerialGatewaySender_INVALID_GATEWAY_SENDER_ORDER_POLICY_CONCURRENCY_0
-      // .toLocalizedString(id));
-      // }
-      // }
       if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
         this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
       }
@@ -304,13 +296,6 @@ public class GatewaySenderFactoryImpl implements InternalGatewaySenderFactory {
         ((CacheCreation) this.cache).addGatewaySender(sender);
       }
     } else {
-      // if (this.attrs.getOrderPolicy() != null) {
-      // if (this.attrs.getDispatcherThreads() == GatewaySender.DEFAULT_DISPATCHER_THREADS) {
-      // throw new AsyncEventQueueConfigurationException(
-      // LocalizedStrings.AsyncEventQueue_INVALID_ORDER_POLICY_CONCURRENCY_0
-      // .toLocalizedString(id));
-      // }
-      // }
       if (this.attrs.getOrderPolicy() == null && this.attrs.getDispatcherThreads() > 1) {
         this.attrs.policy = GatewaySender.DEFAULT_ORDER_POLICY;
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
index 518966a..c2d4673 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderImpl.java
@@ -16,53 +16,36 @@ package org.apache.geode.internal.cache.wan.parallel;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.EntryOperation;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
-import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
-import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueStats;
-import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
 import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
-import org.apache.geode.distributed.internal.DistributionAdvisor;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.ResourceEvent;
 import org.apache.geode.internal.cache.DistributedRegion;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegionHelper;
 import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
-import org.apache.geode.internal.cache.wan.AbstractRemoteGatewaySender;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor;
-import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor;
-import org.apache.geode.internal.cache.wan.GatewaySenderStats;
+import org.apache.geode.internal.cache.wan.AbstractRemoteGatewaySender;
 import org.apache.geode.internal.cache.wan.GatewaySenderAdvisor.GatewaySenderProfile;
 import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
-import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingThreadGroup;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 
 /**
  * @since GemFire 7.0
- *
  */
 public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
 
   private static final Logger logger = LogService.getLogger();
 
-  final ThreadGroup loggerGroup =
-      LoggingThreadGroup.createThreadGroup("Remote Site Discovery Logger Group", logger);
-
-  public ParallelGatewaySenderImpl() {
-    super();
-    this.isParallel = true;
-  }
-
-  public ParallelGatewaySenderImpl(Cache cache, GatewaySenderAttributes attrs) {
+  public ParallelGatewaySenderImpl(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
@@ -77,8 +60,7 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
       }
 
       if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators =
-            ((GemFireCacheImpl) this.cache).getDistributedSystem().getConfig().getLocators();
+        String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
         if (locators.length() == 0) {
           throw new IllegalStateException(
               LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
@@ -92,22 +74,16 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
        * of Concurrent version of processor and queue.
        */
       eventProcessor = new RemoteConcurrentParallelGatewaySenderEventProcessor(this);
-      /*
-       * if (getDispatcherThreads() > 1) { eventProcessor = new
-       * ConcurrentParallelGatewaySenderEventProcessor(this); } else { eventProcessor = new
-       * ParallelGatewaySenderEventProcessor(this); }
-       */
-
       eventProcessor.start();
       waitForRunningStatus();
+
       // Only notify the type registry if this is a WAN gateway queue
       if (!isAsyncEventQueue()) {
         ((GemFireCacheImpl) getCache()).getPdxRegistry().gatewaySenderStarted(this);
       }
       new UpdateAttributesProcessor(this).distribute(false);
 
-      InternalDistributedSystem system =
-          (InternalDistributedSystem) this.cache.getDistributedSystem();
+      InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
       system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
 
       logger.info(
@@ -119,15 +95,6 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
     }
   }
 
-  // /**
-  // * The sender is not started but only the message queue i.e. shadowPR is created on the node.
-  // * @param targetPr
-  // */
-  // private void createMessageQueueOnAccessorNode(PartitionedRegion targetPr) {
-  // eventProcessor = new ParallelGatewaySenderEventProcessor(this, targetPr);
-  // }
-
-
   @Override
   public void stop() {
     this.getLifeCycleLock().writeLock().lock();
@@ -137,7 +104,6 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
       }
       // Stop the dispatcher
       AbstractGatewaySenderEventProcessor ev = this.eventProcessor;
-      // try {
       if (ev != null && !ev.isStopped()) {
         ev.stopProcessing();
       }
@@ -162,9 +128,6 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
       clearTempEventsAfterSenderStopped();
       // Keep the eventProcessor around so we can ask it for the regionQueues later.
       // Tests expect to be able to do this.
-      // } finally {
-      // this.eventProcessor = null;
-      // }
     } finally {
       this.getLifeCycleLock().writeLock().unlock();
     }
@@ -207,24 +170,11 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
     pf.isDiskSynchronous = isDiskSynchronous();
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(org.apache.geode.
-   * internal.cache.EntryEventImpl)
-   */
   @Override
   protected void setModifiedEventId(EntryEventImpl clonedEvent) {
     int bucketId = -1;
     // merged from 42004
     if (clonedEvent.getRegion() instanceof DistributedRegion) {
-      // if (getOrderPolicy() == OrderPolicy.THREAD) {
-      // bucketId = PartitionedRegionHelper.getHashKey(
-      // ((EntryEventImpl)clonedEvent).getEventId().getThreadID(),
-      // getMaxParallelismForReplicatedRegion());
-      // }
-      // else
       bucketId = PartitionedRegionHelper.getHashKey(clonedEvent.getKey(),
           getMaxParallelismForReplicatedRegion());
     } else {
@@ -240,18 +190,6 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
     // we don't need to generate different threadId for secondary buckets
     // as they will be rejected if seen at PR level itself
 
-    // boolean isPrimary = ((PartitionedRegion)getQueue().getRegion())
-    // .getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
-    // if (isPrimary) {
-    // newThreadId = ThreadIdentifier
-    // .createFakeThreadIDForParallelGSPrimaryBucket(bucketId,
-    // originatingThreadId);
-    // } else {
-    // newThreadId = ThreadIdentifier
-    // .createFakeThreadIDForParallelGSSecondaryBucket(bucketId,
-    // originatingThreadId);
-    // }
-
     EventID newEventId = new EventID(originalEventId.getMembershipID(), newThreadId,
         originalEventId.getSequenceID(), bucketId);
     if (logger.isDebugEnabled()) {
@@ -262,5 +200,4 @@ public class ParallelGatewaySenderImpl extends AbstractRemoteGatewaySender {
     }
     clonedEvent.setEventId(newEventId);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
index 3aa18ce..b300460 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderImpl.java
@@ -18,7 +18,6 @@ import java.util.Set;
 
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.asyncqueue.AsyncEventListener;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
 import org.apache.geode.distributed.DistributedLockService;
@@ -28,6 +27,7 @@ import org.apache.geode.distributed.internal.ResourceEvent;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.cache.EventID;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.RegionQueue;
 import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.ha.ThreadIdentifier;
@@ -38,26 +38,16 @@ import org.apache.geode.internal.cache.wan.GatewaySenderAttributes;
 import org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingThreadGroup;
 import org.apache.geode.internal.logging.log4j.LocalizedMessage;
 
 /**
  * @since GemFire 7.0
- *
  */
 public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
 
   private static final Logger logger = LogService.getLogger();
 
-  final ThreadGroup loggerGroup =
-      LoggingThreadGroup.createThreadGroup("Remote Site Discovery Logger Group", logger);
-
-  public SerialGatewaySenderImpl() {
-    super();
-    this.isParallel = false;
-  }
-
-  public SerialGatewaySenderImpl(Cache cache, GatewaySenderAttributes attrs) {
+  public SerialGatewaySenderImpl(InternalCache cache, GatewaySenderAttributes attrs) {
     super(cache, attrs);
   }
 
@@ -75,8 +65,7 @@ public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
         return;
       }
       if (this.remoteDSId != DEFAULT_DISTRIBUTED_SYSTEM_ID) {
-        String locators =
-            ((GemFireCacheImpl) this.cache).getDistributedSystem().getConfig().getLocators();
+        String locators = this.cache.getInternalDistributedSystem().getConfig().getLocators();
         if (locators.length() == 0) {
           throw new GatewaySenderConfigurationException(
               LocalizedStrings.AbstractGatewaySender_LOCATOR_SHOULD_BE_CONFIGURED_BEFORE_STARTING_GATEWAY_SENDER
@@ -108,9 +97,7 @@ public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
       }
       new UpdateAttributesProcessor(this).distribute(false);
 
-
-      InternalDistributedSystem system =
-          (InternalDistributedSystem) this.cache.getDistributedSystem();
+      InternalDistributedSystem system = this.cache.getInternalDistributedSystem();
       system.handleResourceEvent(ResourceEvent.GATEWAYSENDER_START, this);
 
       logger
@@ -230,13 +217,6 @@ public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
     pf.serverLocation = this.getServerLocation();
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see
-   * org.apache.geode.internal.cache.wan.AbstractGatewaySender#setModifiedEventId(org.apache.geode.
-   * internal.cache.EntryEventImpl)
-   */
   @Override
   protected void setModifiedEventId(EntryEventImpl clonedEvent) {
     EventID originalEventId = clonedEvent.getEventId();
@@ -257,5 +237,4 @@ public class SerialGatewaySenderImpl extends AbstractRemoteGatewaySender {
     }
     clonedEvent.setEventId(newEventId);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/76c49838/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
index 8aa887b..34f0a8b 100644
--- a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
@@ -493,7 +493,7 @@ public class ClusterConfigurationDUnitTest extends CliCommandTestBase {
     VM locatorAndMgr = getHost(0).getVM(3);
     locatorAndMgr.invoke(() -> {
       GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
-      ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
+      ShutdownAllRequest.send(cache.getInternalDistributedSystem().getDistributionManager(), -1);
       return null;
     });
 


[48/51] [abbrv] geode git commit: GEODE-2799: Handle different types of KeyInfo set when creating the KeySet Iterator.

Posted by ds...@apache.org.
GEODE-2799: Handle different types of KeyInfo set when creating the KeySet Iterator.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 60ec931f53ead9a18950fb4b8e441ff3e9993820
Parents: 363e50d
Author: eshu <es...@pivotal.io>
Authored: Fri Apr 21 13:55:49 2017 -0700
Committer: eshu <es...@pivotal.io>
Committed: Fri Apr 21 13:55:49 2017 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/LocalRegion.java       |  2 +-
 .../internal/cache/LocalRegionDataView.java     | 14 ++++-
 .../apache/geode/internal/cache/TXState.java    |  1 +
 .../cache/TXStateProxyImplJUnitTest.java        | 60 ++++++++++++++++++++
 4 files changed, 73 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/60ec931f/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 5d5044b..45035d7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -11177,7 +11177,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     return getRegionMap().keySet();
   }
 
-  public final InternalDataView getSharedDataView() {
+  public InternalDataView getSharedDataView() {
     return this.sharedDataView;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/60ec931f/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
index b4aa20b..8db979b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
@@ -200,11 +200,19 @@ public class LocalRegionDataView implements InternalDataView {
    */
   public Object getKeyForIterator(final KeyInfo keyInfo, final LocalRegion currRgn,
       boolean rememberReads, boolean allowTombstones) {
-    final AbstractRegionEntry re = (AbstractRegionEntry) keyInfo.getKey();
+    final Object key = keyInfo.getKey();
+    if (key == null) {
+      return null;
+    }
     // fix for 42182, before returning a key verify that its value
     // is not a removed token
-    if (re != null && (!re.isDestroyedOrRemoved() || (allowTombstones && re.isTombstone()))) {
-      return re.getKey();
+    if (key instanceof RegionEntry) {
+      RegionEntry re = (RegionEntry) key;
+      if (!re.isDestroyedOrRemoved() || (allowTombstones && re.isTombstone())) {
+        return re.getKey();
+      }
+    } else if (getEntry(keyInfo, currRgn, allowTombstones) != null) {
+      return key;
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/60ec931f/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
index 234baee..0a9d80e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
@@ -1705,6 +1705,7 @@ public class TXState implements TXStateInterface {
    */
   public Object getKeyForIterator(KeyInfo curr, LocalRegion currRgn, boolean rememberReads,
       boolean allowTombstones) {
+    assert !(curr.getKey() instanceof RegionEntry);
     if (!readEntryAndCheckIfDestroyed(curr, currRgn, rememberReads)) {
       return curr.getKey();
     } else {

http://git-wip-us.apache.org/repos/asf/geode/blob/60ec931f/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateProxyImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateProxyImplJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateProxyImplJUnitTest.java
new file mode 100644
index 0000000..9ce76c5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateProxyImplJUnitTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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 org.apache.geode.internal.cache;
+
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.LocalRegion.NonTXEntry;
+import org.apache.geode.internal.cache.region.entry.RegionEntryFactoryBuilder;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class TXStateProxyImplJUnitTest {
+  @Test
+  public void testGetKeyForIterator() {
+    RegionEntryFactory factory = new RegionEntryFactoryBuilder().getRegionEntryFactoryOrNull(false,
+        false, false, false, false);
+    LocalRegion region = mock(LocalRegion.class);
+    String key = "testkey";
+    RegionEntry re = factory.createEntry(region, key, null);
+    TXId txId = new TXId(mock(InternalDistributedMember.class), 1);
+    TXStateProxyImpl tx = new TXStateProxyImpl(mock(TXManagerImpl.class), txId, false);
+    LocalRegionDataView view = mock(LocalRegionDataView.class);
+    boolean allowTombstones = false;
+    boolean rememberReads = true;
+
+    KeyInfo stringKeyInfo = new KeyInfo(key, null, null);
+    KeyInfo regionEntryKeyInfo = new KeyInfo(re, null, null);
+
+    when(region.getSharedDataView()).thenReturn(view);
+    when(view.getEntry(stringKeyInfo, region, allowTombstones)).thenReturn(mock(NonTXEntry.class));
+    when(view.getKeyForIterator(stringKeyInfo, region, rememberReads, allowTombstones))
+        .thenCallRealMethod();
+    when(view.getKeyForIterator(regionEntryKeyInfo, region, rememberReads, allowTombstones))
+        .thenCallRealMethod();
+
+    Object key1 = tx.getKeyForIterator(regionEntryKeyInfo, region, rememberReads, allowTombstones);
+    assertTrue(key1.equals(key));
+    Object key2 = tx.getKeyForIterator(stringKeyInfo, region, rememberReads, allowTombstones);
+    assertTrue(key2.equals(key));
+  }
+
+}


[37/51] [abbrv] geode git commit: GEODE-2605: Modified gfsh search lucene to require DATA:WRITE privilege to match client

Posted by ds...@apache.org.
GEODE-2605: Modified gfsh search lucene to require DATA:WRITE privilege to match client


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

Branch: refs/heads/feature/GEODE-2097
Commit: 9b49bc8fc53cb2520215e90930b2c9a27a918921
Parents: 8ea0f90
Author: Barry Oglesby <bo...@pivotal.io>
Authored: Mon Apr 17 12:45:31 2017 -0700
Committer: Barry Oglesby <bo...@pivotal.io>
Committed: Wed Apr 19 14:26:44 2017 -0700

----------------------------------------------------------------------
 .../internal/cli/LuceneIndexCommands.java       |   7 +-
 .../lucene/LuceneClientSecurityDUnitTest.java   | 128 ++++++++
 .../lucene/LuceneCommandsSecurityDUnitTest.java | 303 +++++++++++++++++++
 3 files changed, 433 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/9b49bc8f/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index 3fa34e7..4bfa868 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -250,7 +250,6 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
 
   @SuppressWarnings("unchecked")
   protected List<LuceneIndexDetails> getIndexDetails(LuceneIndexInfo indexInfo) throws Exception {
-    this.securityService.authorizeRegionManage(indexInfo.getRegionPath());
     final ResultCollector<?, ?> rc =
         executeFunctionOnRegion(describeIndexFunction, indexInfo, true);
     final List<LuceneIndexDetails> funcResults = (List<LuceneIndexDetails>) rc.getResult();
@@ -262,7 +261,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
       help = LuceneCliStrings.LUCENE_SEARCH_INDEX__HELP)
   @CliMetaData(shellOnly = false,
       relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
-  @ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
+  @ResourceOperation(resource = Resource.DATA, operation = Operation.WRITE)
   public Result searchIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
       help = LuceneCliStrings.LUCENE_SEARCH_INDEX__NAME__HELP) final String indexName,
 
@@ -531,8 +530,6 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
 
   private List<LuceneSearchResults> getSearchResults(final LuceneQueryInfo queryInfo)
       throws Exception {
-    securityService.authorizeRegionManage(queryInfo.getRegionPath());
-
     final String[] groups = {};
     final ResultCollector<?, ?> rc = this.executeSearch(queryInfo);
     final List<Set<LuceneSearchResults>> functionResults =
@@ -588,7 +585,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
 
   @CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX,
       LuceneCliStrings.LUCENE_CREATE_INDEX, LuceneCliStrings.LUCENE_DESCRIBE_INDEX,
-      LuceneCliStrings.LUCENE_LIST_INDEX})
+      LuceneCliStrings.LUCENE_LIST_INDEX, LuceneCliStrings.LUCENE_DESTROY_INDEX})
   public boolean indexCommandsAvailable() {
     return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady()));
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/9b49bc8f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneClientSecurityDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneClientSecurityDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneClientSecurityDUnitTest.java
new file mode 100644
index 0000000..67103ff
--- /dev/null
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneClientSecurityDUnitTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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 org.apache.geode.cache.lucene;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.apache.geode.cache.client.ServerOperationException;
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.security.NotAuthorizedException;
+import org.apache.geode.security.SimpleTestSecurityManager;
+import org.apache.geode.security.templates.UserPasswordAuthInit;
+import org.apache.geode.test.dunit.SerializableCallableIF;
+import org.apache.geode.test.dunit.SerializableRunnableIF;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.util.Properties;
+
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTH_INIT;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+@Category({DistributedTest.class, SecurityTest.class})
+@RunWith(JUnitParamsRunner.class)
+public class LuceneClientSecurityDUnitTest extends LuceneQueriesAccessorBase {
+
+  @Test
+  @Parameters(method = "getSearchIndexUserNameAndExpectedResponses")
+  public void verifySearchIndexPermissions(
+      LuceneCommandsSecurityDUnitTest.UserNameAndExpectedResponse user) {
+    // Start server
+    int serverPort = dataStore1.invoke(startCacheServer());
+
+    // Create index and region
+    dataStore1.invoke(() -> createIndexAndRegion());
+
+    // Start client
+    accessor.invoke(() -> startClient(user.getUserName(), serverPort));
+
+    // Attempt query
+    accessor.invoke(
+        () -> executeTextSearch(user.getExpectAuthorizationError(), user.getExpectedResponse()));
+  }
+
+  private SerializableCallableIF<Integer> startCacheServer() {
+    return () -> {
+      Properties props = new Properties();
+      props.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
+      final Cache cache = getCache(props);
+      final CacheServer server = cache.addCacheServer();
+      server.setPort(0);
+      server.start();
+      LuceneService luceneService = LuceneServiceProvider.get(cache);
+      luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
+      cache.createRegionFactory(RegionShortcut.PARTITION).create(REGION_NAME);
+      return server.getPort();
+    };
+  }
+
+  private SerializableRunnableIF createIndexAndRegion() {
+    return () -> {
+      Cache cache = getCache();
+      LuceneService luceneService = LuceneServiceProvider.get(cache);
+      luceneService.createIndexFactory().setFields("field1").create(INDEX_NAME, REGION_NAME);
+      cache.createRegionFactory(RegionShortcut.PARTITION).create(REGION_NAME);
+    };
+  }
+
+  private SerializableRunnableIF startClient(String userName, int serverPort) {
+    return () -> {
+      Properties props = new Properties();
+      props.setProperty("security-username", userName);
+      props.setProperty("security-password", userName);
+      props.setProperty(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName());
+      ClientCacheFactory clientCacheFactory = new ClientCacheFactory(props);
+      clientCacheFactory.addPoolServer("localhost", serverPort);
+      ClientCache clientCache = getClientCache(clientCacheFactory);
+      clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create(REGION_NAME);
+    };
+  }
+
+  private SerializableRunnableIF executeTextSearch(boolean expectAuthorizationError,
+      String expectedResponse) {
+    return () -> {
+      LuceneService service = LuceneServiceProvider.get(getCache());
+      LuceneQuery<Integer, TestObject> query =
+          service.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "test", "text");
+      try {
+        query.findKeys();
+        assertFalse(expectAuthorizationError);
+      } catch (ServerOperationException e) {
+        assertTrue(e.getCause() != null && e.getCause() instanceof NotAuthorizedException);
+        assertTrue(expectAuthorizationError);
+        assertTrue(e.getLocalizedMessage().contains(expectedResponse));
+      }
+    };
+  }
+
+  protected LuceneCommandsSecurityDUnitTest.UserNameAndExpectedResponse[] getSearchIndexUserNameAndExpectedResponses() {
+    return new LuceneCommandsSecurityDUnitTest.UserNameAndExpectedResponse[] {
+        new LuceneCommandsSecurityDUnitTest.UserNameAndExpectedResponse("nopermissions", true,
+            "nopermissions not authorized for DATA:WRITE"),
+        new LuceneCommandsSecurityDUnitTest.UserNameAndExpectedResponse("datawrite", false, null)};
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/9b49bc8f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
new file mode 100644
index 0000000..ad734e8
--- /dev/null
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
@@ -0,0 +1,303 @@
+/*
+ * 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 org.apache.geode.cache.lucene;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.lucene.internal.cli.LuceneCliStrings;
+import org.apache.geode.cache.lucene.internal.cli.LuceneIndexCommands;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.CommandManager;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.ErrorResultData;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
+import org.apache.geode.security.SimpleTestSecurityManager;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@Category({DistributedTest.class, SecurityTest.class})
+@RunWith(JUnitParamsRunner.class)
+public class LuceneCommandsSecurityDUnitTest extends JUnit4CacheTestCase {
+
+  @Rule
+  public LocatorServerStartupRule locatorServer = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshShellConnectionRule gfshShell = new GfshShellConnectionRule();
+
+  private MemberVM locator;
+
+  private MemberVM server;
+
+  @Before
+  public void before() throws Exception {
+    startLocator();
+    startServer();
+  }
+
+  private void startLocator() throws Exception {
+    Properties props = new Properties();
+    props.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
+    this.locator = this.locatorServer.startLocatorVM(0, props);
+  }
+
+  private void startServer() throws Exception {
+    Properties props = new Properties();
+    props.setProperty("security-username", "clustermanage");
+    props.setProperty("security-password", "clustermanage");
+    this.server = this.locatorServer.startServerVM(1, props, this.locator.getPort());
+  }
+
+  @Test
+  @Parameters(method = "getCreateIndexUserNameAndExpectedResponses")
+  public void verifyCreateIndexPermissions(UserNameAndExpectedResponse user) throws Exception {
+    // Connect gfsh
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+
+    // Attempt to create lucene index
+    CommandResult result = this.gfshShell.executeCommand(getCreateIndexCommand());
+
+    // Verify result
+    verifyResult(user, result);
+  }
+
+  @Test
+  @Parameters(method = "getSearchIndexUserNameAndExpectedResponses")
+  public void verifySearchIndexPermissions(UserNameAndExpectedResponse user) throws Exception {
+    // Create index and region
+    createIndexAndRegion();
+
+    // Connect gfsh
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+
+    // Attempt to search lucene index
+    CommandResult result = this.gfshShell.executeCommand(getSearchIndexCommand());
+
+    // Verify result
+    verifyResult(user, result);
+  }
+
+  @Test
+  @Parameters(method = "getListIndexesUserNameAndExpectedResponses")
+  public void verifyListIndexesPermissions(UserNameAndExpectedResponse user) throws Exception {
+    // Create index and region
+    createIndexAndRegion();
+
+    // Connect gfsh
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+
+    // Attempt to search lucene index
+    CommandResult result = this.gfshShell.executeCommand(getListIndexesCommand());
+
+    // Verify result
+    verifyResult(user, result);
+  }
+
+  @Test
+  @Parameters(method = "getDescribeIndexUserNameAndExpectedResponses")
+  public void verifyDescribeIndexPermissions(UserNameAndExpectedResponse user) throws Exception {
+    // Create index and region
+    createIndexAndRegion();
+
+    // Connect gfsh
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+
+    // Attempt to search lucene index
+    CommandResult result = this.gfshShell.executeCommand(getDescribeIndexCommand());
+
+    // Verify result
+    verifyResult(user, result);
+  }
+
+  @Test
+  @Parameters(method = "getDestroyIndexUserNameAndExpectedResponses")
+  public void verifyDestroyIndexPermissions(UserNameAndExpectedResponse user) throws Exception {
+    // Create index and region
+    createIndexAndRegion();
+
+    // Connect gfsh
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+
+    // Attempt to search lucene index
+    CommandResult result = this.gfshShell.executeCommand(getDestroyIndexCommand());
+
+    // Verify result
+    verifyResult(user, result);
+  }
+
+  private void createIndexAndRegion() throws Exception {
+    // Connect gfsh to locator with permissions necessary to create an index and region
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
+        GfshShellConnectionRule.PortType.locator, "datamanage", "datamanage");
+
+    // Create lucene index
+    this.gfshShell.executeAndVerifyCommand(getCreateIndexCommand());
+
+    // Create region
+    this.gfshShell.executeAndVerifyCommand(getCreateRegionCommand());
+
+    // Disconnect gfsh
+    this.gfshShell.disconnect();
+  }
+
+  private void verifyResult(UserNameAndExpectedResponse user, CommandResult result) {
+    if (user.getExpectAuthorizationError()) {
+      assertTrue(result.getResultData() instanceof ErrorResultData);
+      assertEquals(ResultBuilder.ERRORCODE_UNAUTHORIZED,
+          ((ErrorResultData) result.getResultData()).getErrorCode());
+    } else {
+      assertEquals(Result.Status.OK, result.getStatus());
+    }
+    assertTrue(this.gfshShell.getGfshOutput().contains(user.getExpectedResponse()));
+  }
+
+  private String getCreateIndexCommand() throws Exception {
+    CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
+    CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_CREATE_INDEX);
+    csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD, "field1");
+    return csb.toString();
+  }
+
+  private String getCreateRegionCommand() throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
+    csb.addOption(CliStrings.CREATE_REGION__REGION, REGION_NAME);
+    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT,
+        RegionShortcut.PARTITION_REDUNDANT.name());
+    return csb.toString();
+  }
+
+  private String getSearchIndexCommand() throws Exception {
+    CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
+    CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_SEARCH_INDEX);
+    csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING, "field1:value1");
+    csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, "field1");
+    return csb.toString();
+  }
+
+  private String getListIndexesCommand() throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_LIST_INDEX);
+    return csb.toString();
+  }
+
+  private String getDescribeIndexCommand() throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
+    csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
+    return csb.toString();
+  }
+
+  private String getDestroyIndexCommand() throws Exception {
+    CommandManager.getInstance().add(LuceneIndexCommands.class.newInstance());
+    CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESTROY_INDEX);
+    csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
+    csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
+    return csb.toString();
+  }
+
+  protected UserNameAndExpectedResponse[] getCreateIndexUserNameAndExpectedResponses() {
+    return new UserNameAndExpectedResponse[] {
+        new UserNameAndExpectedResponse("nopermissions", true,
+            "Unauthorized. Reason : nopermissions not authorized for DATA:MANAGE:region"),
+        new UserNameAndExpectedResponse("datamanageregion", false,
+            "Successfully created lucene index")};
+  }
+
+  protected UserNameAndExpectedResponse[] getSearchIndexUserNameAndExpectedResponses() {
+    return new UserNameAndExpectedResponse[] {
+        new UserNameAndExpectedResponse("nopermissions", true,
+            "Unauthorized. Reason : nopermissions not authorized for DATA:WRITE"),
+        new UserNameAndExpectedResponse("datawrite", false, "No results")};
+  }
+
+  protected UserNameAndExpectedResponse[] getListIndexesUserNameAndExpectedResponses() {
+    return new UserNameAndExpectedResponse[] {
+        new UserNameAndExpectedResponse("nopermissions", true,
+            "Unauthorized. Reason : nopermissions not authorized for CLUSTER:READ"),
+        new UserNameAndExpectedResponse("clusterread", false, "Index Name")};
+  }
+
+  protected UserNameAndExpectedResponse[] getDescribeIndexUserNameAndExpectedResponses() {
+    return new UserNameAndExpectedResponse[] {
+        new UserNameAndExpectedResponse("nopermissions", true,
+            "Unauthorized. Reason : nopermissions not authorized for CLUSTER:READ"),
+        new UserNameAndExpectedResponse("clusterread", false, "Index Name")};
+  }
+
+  protected UserNameAndExpectedResponse[] getDestroyIndexUserNameAndExpectedResponses() {
+    return new UserNameAndExpectedResponse[] {
+        new UserNameAndExpectedResponse("nopermissions", true,
+            "Unauthorized. Reason : nopermissions not authorized for DATA:MANAGE:region"),
+        new UserNameAndExpectedResponse("datamanageregion", false,
+            "Successfully destroyed lucene index")};
+  }
+
+  public static class UserNameAndExpectedResponse implements Serializable {
+
+    private final String userName;
+
+    private final boolean expectAuthorizationError;
+
+    private final String expectedResponse;
+
+    public UserNameAndExpectedResponse(String userName, boolean expectAuthorizationError,
+        String expectedResponse) {
+      this.userName = userName;
+      this.expectAuthorizationError = expectAuthorizationError;
+      this.expectedResponse = expectedResponse;
+    }
+
+    public String getUserName() {
+      return this.userName;
+    }
+
+    public boolean getExpectAuthorizationError() {
+      return this.expectAuthorizationError;
+    }
+
+    public String getExpectedResponse() {
+      return this.expectedResponse;
+    }
+  }
+}


[06/51] [abbrv] geode git commit: GEODE-2730: refactor rules

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
index 694fc61..5f1c7fe 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/RebalanceOperationDUnitTest.java
@@ -128,7 +128,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -244,7 +244,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -289,7 +289,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     // make sure we can tell that the buckets have low redundancy
     vm0.invoke(checkLowRedundancy);
 
-    SerializableRunnable closePrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable closePrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         disconnectFromDS();
         // Cache cache = getCache();
@@ -346,7 +346,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
       VM vm0 = host.getVM(0);
       VM vm1 = host.getVM(1);
 
-      SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
         public void run() {
           Cache cache = getCache();
           AttributesFactory attr = new AttributesFactory();
@@ -467,7 +467,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
       setRedundancyZone(vm1, "A");
       final DistributedMember zoneBMember = setRedundancyZone(vm2, "B");
 
-      SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
         public void run() {
           Cache cache = getCache();
           AttributesFactory attr = new AttributesFactory();
@@ -667,7 +667,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
         }
       };
 
-      SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
         public void run() {
           ParallelRecoveryObserver ob =
               (ParallelRecoveryObserver) InternalResourceManager.getResourceObserver();
@@ -958,7 +958,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
 
   private DistributedMember createPrRegion(VM vm, final String region, final int localMaxMemory,
       final String colocatedWith) {
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
       public Object call() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -1399,7 +1399,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
   }
 
   private DistributedMember createPRRegionWithAsyncQueue(VM vm0, final int localMaxMemory) {
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
       public Object call() {
         Cache cache = getCache();
 
@@ -1446,7 +1446,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -1559,7 +1559,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     final VM vm2 = host.getVM(2);
 
-    final SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    final SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -1669,7 +1669,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -1812,7 +1812,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     EXPECTED_REBALANCED.add("/region0");
     EXPECTED_REBALANCED.add("/region1");
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -1943,7 +1943,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -2058,7 +2058,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -2268,7 +2268,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Region parent;
         Cache cache = getCache();
@@ -2575,7 +2575,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -2741,7 +2741,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -3009,7 +3009,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
 
     LoadProbe oldProbe = setLoadProbe(vm0, new BucketCountLoadProbe());
     try {
-      SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
         public void run() {
           Cache cache = getCache();
           AttributesFactory attr = new AttributesFactory();
@@ -3131,7 +3131,7 @@ public class RebalanceOperationDUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         System.setProperty(DiskStoreImpl.RECOVER_VALUE_PROPERTY_NAME, "false");
         try {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
index 83f3b3f..12e5819 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQueueNewImplDUnitTest.java
@@ -1036,7 +1036,7 @@ public class HARQueueNewImplDUnitTest extends JUnit4DistributedTestCase {
         server.start();
       }
     } catch (Exception e) {
-      fail("failed in buildInThisVM()" + e);
+      fail("failed in startServer()" + e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/Bug39356DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/Bug39356DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/Bug39356DUnitTest.java
index 1d41291..5705c09 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/Bug39356DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/Bug39356DUnitTest.java
@@ -181,7 +181,7 @@ public class Bug39356DUnitTest extends JUnit4CacheTestCase {
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
index 2cdd23b..11254e7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ShutdownAllDUnitTest.java
@@ -416,15 +416,15 @@ public class ShutdownAllDUnitTest extends JUnit4CacheTestCase {
 
   /*
    * @Test public void testStopNonPersistRegions() throws Throwable { Host host = Host.getHost(0);
-   * VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); withRegion(vm0,
-   * "region", null, true, 1); withRegion(vm1, "region", "disk", true, 1);
+   * VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); createRegion(vm0,
+   * "region", null, true, 1); createRegion(vm1, "region", "disk", true, 1);
    * 
    * createData(vm0, 0, 1, "a", "region");
    * 
    * shutDownAllMembers(vm2, 2);
    * 
-   * // restart vms, and let vm0 to do GII from vm0 withRegion(vm1, "region", "disk", true, 1);
-   * withRegion(vm0, "region", null, true, 1);
+   * // restart vms, and let vm0 to do GII from vm0 createRegion(vm1, "region", "disk", true, 1);
+   * createRegion(vm0, "region", null, true, 1);
    * 
    * checkData(vm0, 0, 1, "a", "region"); checkData(vm1, 0, 1, "a", "region");
    * 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java
index 6d96471..beb3a9a 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgrade2DUnitTest.java
@@ -1456,12 +1456,12 @@ public class RollingUpgrade2DUnitTest extends JUnit4DistributedTestCase {
 
   private CacheSerializableRunnable invokeCreateRegion(final String regionName,
       final RegionShortcut shortcut) {
-    return new CacheSerializableRunnable("execute: withRegion") {
+    return new CacheSerializableRunnable("execute: createRegion") {
       public void run2() {
         try {
           createRegion(RollingUpgrade2DUnitTest.cache, regionName, shortcut);
         } catch (Exception e) {
-          fail("Error withRegion", e);
+          fail("Error createRegion", e);
         }
       }
     };

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeDUnitTest.java
index 0fffb13..0940ea6 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeDUnitTest.java
@@ -555,7 +555,7 @@ public class RollingUpgradeDUnitTest extends JUnit4DistributedTestCase {
 
   private CacheSerializableRunnable invokeCreateRegion(final String regionName,
       final String shortcutName) {
-    return new CacheSerializableRunnable("execute: withRegion") {
+    return new CacheSerializableRunnable("execute: createRegion") {
       public void run2() {
         try {
           createRegion(RollingUpgradeDUnitTest.cache, regionName, shortcutName);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/Bug36829DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/Bug36829DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/Bug36829DUnitTest.java
index d90d41d..69b8a79 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/Bug36829DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/Bug36829DUnitTest.java
@@ -87,7 +87,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
 
     // creating Region on the Server
     /*
-     * this.serverVM.invoke(() -> CacheServerTestUtil.withRegion( REGION_NAME )); // should be
+     * this.serverVM.invoke(() -> CacheServerTestUtil.createRegion( REGION_NAME )); // should be
      * successful. this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKeyAfterRegionCreation(
      * "Key1" ));
      */

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
index 4a67e38..f86b39f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/DataSerializerPropogationDUnitTest.java
@@ -366,7 +366,7 @@ public class DataSerializerPropogationDUnitTest extends JUnit4DistributedTestCas
       assertNotNull(bs);
       bs.start();
     } catch (Exception ex) {
-      fail("while buildInThisVM()  " + ex);
+      fail("while startServer()  " + ex);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
index 6aea509..98cb309 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
@@ -361,7 +361,7 @@ public class HAStartupAndFailoverDUnitTest extends JUnit4DistributedTestCase {
   }
 
   // public static void processException() {
-  // assertIndexDetailsEquals(conn.getServer().getServerPort(), PORT1.intValue());
+  // assertIndexDetailsEquals(conn.getServer().getPort(), PORT1.intValue());
   // try {
   // pool.processException(new Exception("dummy"), conn);
   // //Thread.sleep(10000); // why sleep?
@@ -402,7 +402,7 @@ public class HAStartupAndFailoverDUnitTest extends JUnit4DistributedTestCase {
       assertNotNull(bs);
       bs.start();
     } catch (Exception ex) {
-      fail("while buildInThisVM()  " + ex);
+      fail("while startServer()  " + ex);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
index 698f795..1fcb06a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
@@ -408,7 +408,7 @@ public class InstantiatorPropagationDUnitTest extends JUnit4DistributedTestCase
       assertNotNull(bs);
       bs.start();
     } catch (Exception ex) {
-      fail("while buildInThisVM()  " + ex);
+      fail("while startServer()  " + ex);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelTestBase.java
index 4a98298..52a041b 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RedundancyLevelTestBase.java
@@ -478,7 +478,7 @@ public class RedundancyLevelTestBase extends JUnit4DistributedTestCase {
       assertNotNull(bs);
       bs.start();
     } catch (Exception ex) {
-      Assert.fail("while buildInThisVM()", ex);
+      Assert.fail("while startServer()", ex);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
index 3c53dfe..0b012c9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
@@ -22,19 +22,19 @@ import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
 import org.apache.geode.test.dunit.rules.LocatorStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.nio.file.Path;
-
 import java.io.File;
+import java.nio.file.Path;
 
 @Category(IntegrationTest.class)
 public class ExportLogsIntegrationTest {
 
-  @Rule
-  public LocatorStarterRule locator = new LocatorStarterRule().withJMXManager().startLocator();
+  @ClassRule
+  public static LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
 
   @Rule
   public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunctionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunctionIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunctionIntegrationTest.java
index af9a1e6..e47cefb 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunctionIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportLogsFunctionIntegrationTest.java
@@ -25,8 +25,6 @@ import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.execute.FunctionContextImpl;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.logging.log4j.Level;
@@ -42,7 +40,7 @@ import java.io.IOException;
 public class ExportLogsFunctionIntegrationTest {
 
   @Rule
-  public LocalServerStarterRule serverStarterRule = new ServerStarterBuilder().buildInThisVM();
+  public ServerStarterRule serverStarterRule = new ServerStarterRule().withAutoStart();
   private File serverWorkingDir;
 
   @Before

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
index 0d33058..7b11444 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
@@ -21,8 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.Rule;
 import org.junit.Test;
@@ -33,8 +32,7 @@ import org.junit.experimental.categories.Category;
 public class GfshMultilineCommandTest {
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withJMXManager().buildInThisVM();
+  public ServerStarterRule server = new ServerStarterRule().withJMXManager().withAutoStart();
 
 
   @Rule

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
index a831ac1..dc24a57 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
@@ -22,13 +22,9 @@ import static org.assertj.core.api.Assertions.assertThat;
 import com.google.common.collect.Sets;
 
 import org.apache.geode.management.internal.cli.functions.ExportLogsFunctionIntegrationTest;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.Server;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.logging.log4j.Level;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -44,34 +40,27 @@ import java.util.Set;
 
 @Category(IntegrationTest.class)
 public class LogExporterIntegrationTest {
+
+  @Rule
+  public ServerStarterRule server = new ServerStarterRule();
+
   private LogExporter logExporter;
 
   private Properties properties;
 
   private LogFilter filter = new LogFilter(Level.INFO, null, null);
 
-  LocalServerStarterRule serverStarterRule;
-
   @Before
   public void before() throws Exception {
     properties = new Properties();
   }
 
-  @After
-  public void after() {
-    if (serverStarterRule != null) {
-      serverStarterRule.after();
-    }
-  }
-
   @Test
-  public void serverStartedWithWrongSuffix() throws Throwable {
-    serverStarterRule =
-        new ServerStarterBuilder().withProperty(LOG_FILE, new File("test.txt").getAbsolutePath())
-            .withProperty(STATISTIC_ARCHIVE_FILE, "archive.archive").buildInThisVM();
-    serverStarterRule.before();
-
-    File serverWorkingDir = serverStarterRule.getWorkingDir();
+  public void serverStartedWithWrongSuffix() throws Exception {
+    properties.setProperty(LOG_FILE, new File("test.txt").getAbsolutePath());
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, "archive.archive");
+    server.withProperties(properties).startServer();
+    File serverWorkingDir = server.getWorkingDir();
 
     logExporter = new LogExporter(filter, new File(serverWorkingDir, "test.log"),
         new File(serverWorkingDir, "stats.gfs"));
@@ -83,18 +72,15 @@ public class LogExporterIntegrationTest {
   }
 
   @Test
-  @Ignore // This test assume that new File() ends up in the workingDir, which is not true
-  public void serverStartedWithCorrectSuffix() throws Throwable {
-
-    serverStarterRule =
-        new ServerStarterBuilder().withProperty(LOG_FILE, new File("test.log").getAbsolutePath())
-            .withProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs").buildInThisVM();
-    serverStarterRule.before();
-
+  public void serverStartedWithCorrectSuffix() throws Exception {
     // ("relative log file is problematic in the test environment")
-    File serverWorkingDir = serverStarterRule.getWorkingDir();
+    properties.setProperty(LOG_FILE, new File("test.log").getAbsolutePath());
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs");
+    server.withProperties(properties).startServer();
+    File serverWorkingDir = server.getWorkingDir();
 
-    logExporter = new LogExporter(filter, new File("test.log"), new File("archive.gfs"));
+    logExporter = new LogExporter(filter, new File(serverWorkingDir, "test.log"),
+        new File(serverWorkingDir, "archive.gfs"));
     List<Path> logFiles = logExporter.findLogFiles(serverWorkingDir.toPath());
     assertThat(logFiles).hasSize(1);
     assertThat(logFiles.get(0)).hasFileName("test.log");
@@ -106,12 +92,11 @@ public class LogExporterIntegrationTest {
 
   @Test
   @Ignore("fix .gz suffix")
-  public void serverStartedWithGZSuffix() throws Throwable {
-    serverStarterRule = new ServerStarterBuilder().withProperty(LOG_FILE, "test.log.gz")
-        .withProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs.gz").buildInThisVM();
-    serverStarterRule.before();
-
-    File serverWorkingDir = serverStarterRule.getWorkingDir();
+  public void serverStartedWithGZSuffix() throws Exception {
+    properties.setProperty(LOG_FILE, "test.log.gz");
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs.gz");
+    server.withProperties(properties).startServer();
+    File serverWorkingDir = server.getWorkingDir();
 
     logExporter = new LogExporter(filter, new File(serverWorkingDir, "test.log"),
         new File(serverWorkingDir, "stats.gfs"));
@@ -125,10 +110,8 @@ public class LogExporterIntegrationTest {
   @Test
   public void testNoStatsFile() throws Throwable {
     Path logsFile = Files.createTempFile("server", ".log");
-
-    serverStarterRule =
-        new ServerStarterBuilder().withProperty(LOG_FILE, logsFile.toString()).buildInThisVM();
-    serverStarterRule.before();
+    properties.setProperty(LOG_FILE, logsFile.toString());
+    server.withProperties(properties).startServer();
 
     ExportLogsFunctionIntegrationTest.verifyExportLogsFunctionDoesNotBlowUp();
   }
@@ -136,10 +119,10 @@ public class LogExporterIntegrationTest {
   @Test
   public void testWithRelativeStatsFile() throws Throwable {
     Path logsFile = Files.createTempFile("server", ".log");
-
-    serverStarterRule = new ServerStarterBuilder().withProperty(LOG_FILE, logsFile.toString())
-        .withProperty(STATISTIC_ARCHIVE_FILE, "stats.gfs").buildInThisVM();
-    serverStarterRule.before();
+    // Path statsFile = Files.createTempFile("stats", ".gfs");
+    properties.setProperty(LOG_FILE, logsFile.toString());
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, "stats.gfs");
+    server.withProperties(properties).startServer();
 
     ExportLogsFunctionIntegrationTest.verifyExportLogsFunctionDoesNotBlowUp();
   }
@@ -147,25 +130,25 @@ public class LogExporterIntegrationTest {
   @Test
   public void testWithRelativeLogsFile() throws Throwable {
     Path statsFile = Files.createTempFile("stats", ".gfs");
-
-    serverStarterRule = new ServerStarterBuilder().withProperty(LOG_FILE, "sever.log")
-        .withProperty(STATISTIC_ARCHIVE_FILE, statsFile.toString()).buildInThisVM();
-    serverStarterRule.before();
+    properties.setProperty(LOG_FILE, "sever.log");
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, statsFile.toString());
+    server.withProperties(properties).startServer();
 
     ExportLogsFunctionIntegrationTest.verifyExportLogsFunctionDoesNotBlowUp();
   }
 
   @Test
-  public void testWithAbsoluteLogsStatsFile() throws Throwable {
+  public void testWithAbsoluteLogsStatsFile() throws Exception {
     File logsDir = Files.createTempDirectory("logs").toFile();
     File statsDir = Files.createTempDirectory("stats").toFile();
 
     File logFile = new File(logsDir, "server.log");
     File statsFile = new File(statsDir, "stats.gfs");
 
-    serverStarterRule = new ServerStarterBuilder().withProperty(LOG_FILE, logFile.getAbsolutePath())
-        .withProperty(STATISTIC_ARCHIVE_FILE, statsFile.getAbsolutePath()).buildInThisVM();
-    serverStarterRule.before();
+    properties.setProperty(LOG_FILE, logFile.getAbsolutePath());
+    properties.setProperty(STATISTIC_ARCHIVE_FILE, statsFile.getAbsolutePath());
+
+    server.withProperties(properties).startServer();
 
     logExporter = new LogExporter(filter, logFile, statsFile);
     Path exportedZip = logExporter.export();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/AccessControlMBeanJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/AccessControlMBeanJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/AccessControlMBeanJUnitTest.java
index d992e93..626ca45 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/AccessControlMBeanJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/AccessControlMBeanJUnitTest.java
@@ -19,9 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -36,15 +34,15 @@ public class AccessControlMBeanJUnitTest {
   private AccessControlMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
index 97436e0..9a1605a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
@@ -19,9 +19,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANA
 import org.apache.geode.management.CacheServerMXBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.Before;
@@ -35,15 +33,15 @@ public class CacheServerMBeanAuthenticationJUnitTest {
   private CacheServerMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
index c9e3553..c7c76f6 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
@@ -20,9 +20,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import org.apache.geode.management.CacheServerMXBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -37,15 +35,15 @@ public class CacheServerMBeanAuthorizationJUnitTest {
   private CacheServerMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
index 91efeac..d0ea209 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
@@ -19,9 +19,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.geode.management.CacheServerMXBean;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -36,12 +34,12 @@ public class CacheServerMBeanShiroJUnitTest {
   private CacheServerMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
-      .withProperty(SECURITY_SHIRO_INIT, "shiro.ini").withJMXManager().buildInThisVM();
+  public static ServerStarterRule server = new ServerStarterRule()
+      .withProperty(SECURITY_SHIRO_INIT, "shiro.ini").withJMXManager().withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/CliCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CliCommandsSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CliCommandsSecurityTest.java
index f132163..a66f05b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/CliCommandsSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/CliCommandsSecurityTest.java
@@ -23,9 +23,8 @@ import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.security.NotAuthorizedException;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -43,15 +42,15 @@ public class CliCommandsSecurityTest {
   private List<TestCommand> commands = TestCommand.getCommands();
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java
index f6b5a2e..f746aaf 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java
@@ -22,9 +22,8 @@ import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.security.GemFireSecurityException;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -39,11 +38,11 @@ public class DataCommandsSecurityTest {
   private MemberMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @BeforeClass
   public static void beforeClass() throws Exception {
@@ -55,7 +54,7 @@ public class DataCommandsSecurityTest {
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/DeployCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/DeployCommandsSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/DeployCommandsSecurityTest.java
index b619032..a4b8c67 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/DeployCommandsSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/DeployCommandsSecurityTest.java
@@ -22,9 +22,8 @@ import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.security.NotAuthorizedException;
 import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -43,9 +42,9 @@ public class DeployCommandsSecurityTest {
   private MemberMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule()
       .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName()).withJMXManager()
-      .buildInThisVM();
+      .withAutoStart();
 
   @ClassRule
   public static TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -60,7 +59,7 @@ public class DeployCommandsSecurityTest {
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
index feb00d4..e6502c0 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
@@ -20,9 +20,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import org.apache.geode.management.DiskStoreMXBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -37,11 +36,11 @@ public class DiskStoreMXBeanSecurityJUnitTest {
   private DiskStoreMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @BeforeClass
   public static void beforeClass() throws Exception {
@@ -50,7 +49,7 @@ public class DiskStoreMXBeanSecurityJUnitTest {
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewayReceiverMBeanSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewayReceiverMBeanSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewayReceiverMBeanSecurityTest.java
index e7fe1d6..73783d5 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewayReceiverMBeanSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewayReceiverMBeanSecurityTest.java
@@ -22,9 +22,8 @@ import org.apache.geode.management.GatewayReceiverMXBean;
 import org.apache.geode.management.ManagementService;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.AfterClass;
@@ -47,15 +46,15 @@ public class GatewayReceiverMBeanSecurityTest {
   private GatewayReceiverMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @BeforeClass
   public static void beforeClass() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewaySenderMBeanSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewaySenderMBeanSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewaySenderMBeanSecurityTest.java
index 67cb1cc..887d0dc 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewaySenderMBeanSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GatewaySenderMBeanSecurityTest.java
@@ -23,9 +23,8 @@ import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.internal.beans.GatewaySenderMBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.AfterClass;
@@ -47,15 +46,15 @@ public class GatewaySenderMBeanSecurityTest {
   private GatewaySenderMXBean bean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @BeforeClass
   public static void beforeClass() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
index 6f2754f..1486866 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
@@ -23,8 +23,7 @@ import org.apache.geode.security.TestPostProcessor;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.BeforeClass;
@@ -37,20 +36,20 @@ import org.junit.experimental.categories.Category;
 public class GfshCommandsPostProcessorTest {
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule serverStarter = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_POST_PROCESSOR, TestPostProcessor.class.getName())
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty("security-json",
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfshConnection =
-      new GfshShellConnectionRule(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
+  public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(
+      serverStarter::getJmxPort, GfshShellConnectionRule.PortType.jmxManger);
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    server.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("region1");
+    serverStarter.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("region1");
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
index 3fe8314..84ef3fc 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
@@ -30,8 +30,7 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.shiro.authz.permission.WildcardPermission;
@@ -46,15 +45,15 @@ import java.util.List;
 @Category({IntegrationTest.class, SecurityTest.class})
 public class GfshCommandsSecurityTest {
   @ClassRule
-  public static LocalServerStarterRule serverStarter = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule serverStarter = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty("security-json",
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(
-      serverStarter.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
+      serverStarter::getJmxPort, GfshShellConnectionRule.PortType.jmxManger);
 
   @BeforeClass
   public static void beforeClass() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/JavaRmiServerNameTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/JavaRmiServerNameTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/JavaRmiServerNameTest.java
index 66e2702..6d20a69 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/JavaRmiServerNameTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/JavaRmiServerNameTest.java
@@ -18,8 +18,7 @@ package org.apache.geode.management.internal.security;
 
 import static org.junit.Assert.assertEquals;
 
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.ClassRule;
@@ -32,8 +31,8 @@ public class JavaRmiServerNameTest {
   private static final String JMX_HOST = "myHostname";
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder()
-      .withProperty("jmx-manager-hostname-for-clients", JMX_HOST).withJMXManager().buildInThisVM();
+  public static ServerStarterRule serverStarter = new ServerStarterRule()
+      .withProperty("jmx-manager-hostname-for-clients", JMX_HOST).withJMXManager().withAutoStart();
 
   /**
    * this is for GEODE-1548

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
index d2f0cae..dad2e9c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
@@ -23,9 +23,8 @@ import org.apache.geode.distributed.internal.locks.DLockService;
 import org.apache.geode.management.LockServiceMXBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.AfterClass;
@@ -41,15 +40,15 @@ public class LockServiceMBeanAuthorizationJUnitTest {
   private LockServiceMXBean lockServiceMBean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @BeforeClass
   public static void beforeClassSetUp() {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java
index 9dcba94..30ed267 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/MBeanSecurityJUnitTest.java
@@ -25,9 +25,8 @@ import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.ClassRule;
@@ -48,15 +47,15 @@ import javax.management.ReflectionException;
 @Category({IntegrationTest.class, SecurityTest.class})
 public class MBeanSecurityJUnitTest {
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   /**
    * No user can call createBean or unregisterBean of GemFire Domain

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
index b7447c9..77f68c3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
@@ -22,9 +22,8 @@ import org.apache.geode.management.ManagerMXBean;
 import org.apache.geode.management.internal.beans.ManagerMBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -42,15 +41,15 @@ public class ManagerMBeanAuthorizationJUnitTest {
   private ManagerMXBean managerMXBean;
 
   @ClassRule
-  public static LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @BeforeClass
   public static void beforeClassSetup() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/management/internal/security/MemberMBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/MemberMBeanSecurityJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/MemberMBeanSecurityJUnitTest.java
index 11e2026..65fd528 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/MemberMBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/MemberMBeanSecurityJUnitTest.java
@@ -20,9 +20,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
 import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -35,15 +34,15 @@ public class MemberMBeanSecurityJUnitTest {
   private MemberMXBean bean;
 
   @Rule // do not use a ClassRule since some test will do a shutdownMember
-  public LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
+  public ServerStarterRule server = new ServerStarterRule().withJMXManager()
       .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
       .withProperty(TestSecurityManager.SECURITY_JSON,
           "org/apache/geode/management/internal/security/cacheServer.json")
-      .buildInThisVM();
+      .withAutoStart();
 
   @Rule
   public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server.getJmxPort());
+      new MBeanServerConnectionRule(server::getJmxPort);
 
   @Before
   public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientAuthDUnitTest.java
index 76efae5..d7acf79 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientAuthDUnitTest.java
@@ -21,11 +21,9 @@ import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -37,21 +35,14 @@ public class ClientAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client1 = host.getVM(1);
   final VM client2 = host.getVM(2);
 
-  int serverPort;
-
-  @Before
-  public void setup() {
-    serverPort = server.getServerPort();
-  }
-
   @Rule
-  public transient LocalServerStarterRule server = new ServerStarterBuilder()
-      .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName()).buildInThisVM();
+  public ServerStarterRule server = new ServerStarterRule()
+      .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName()).withAutoStart();
 
   @Test
   public void authWithCorrectPasswordShouldPass() {
     client1.invoke("logging in super-user with correct password", () -> {
-      SecurityTestUtil.createClientCache("test", "test", serverPort);
+      SecurityTestUtil.createClientCache("test", "test", server.getPort());
     });
   }
 
@@ -59,8 +50,9 @@ public class ClientAuthDUnitTest extends JUnit4DistributedTestCase {
   public void authWithIncorrectPasswordShouldFail() {
     IgnoredException.addIgnoredException(AuthenticationFailedException.class.getName());
     client2.invoke("logging in super-user with wrong password", () -> {
-      assertThatThrownBy(() -> SecurityTestUtil.createClientCache("test", "wrong", serverPort))
-          .isInstanceOf(AuthenticationFailedException.class);
+      assertThatThrownBy(
+          () -> SecurityTestUtil.createClientCache("test", "wrong", server.getPort()))
+              .isInstanceOf(AuthenticationFailedException.class);
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientContainsKeyAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientContainsKeyAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientContainsKeyAuthDUnitTest.java
index 0366673..47525f9 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientContainsKeyAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientContainsKeyAuthDUnitTest.java
@@ -26,8 +26,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.junit.Before;
@@ -44,11 +43,11 @@ public class ClientContainsKeyAuthDUnitTest extends JUnit4DistributedTestCase {
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .buildInThisVM();
+          .withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -62,7 +61,7 @@ public class ClientContainsKeyAuthDUnitTest extends JUnit4DistributedTestCase {
   @Test
   public void testContainsKey() throws Exception {
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("key1User", "1234567", server.getPort());
       final Region region = createProxyRegion(cache, REGION_NAME);
       assertTrue(region.containsKeyOnServer("key1"));
       SecurityTestUtil.assertNotAuthorized(() -> region.containsKeyOnServer("key3"),
@@ -70,7 +69,7 @@ public class ClientContainsKeyAuthDUnitTest extends JUnit4DistributedTestCase {
     });
 
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("authRegionReader", "1234567", server.getPort());
       final Region region = createProxyRegion(cache, REGION_NAME);
       region.containsKeyOnServer("key3");
       assertTrue(region.containsKeyOnServer("key1"));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientDestroyInvalidateAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientDestroyInvalidateAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientDestroyInvalidateAuthDUnitTest.java
index 841d98e..f60488b 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientDestroyInvalidateAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientDestroyInvalidateAuthDUnitTest.java
@@ -21,8 +21,7 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -44,11 +43,11 @@ public class ClientDestroyInvalidateAuthDUnitTest extends JUnit4DistributedTestC
   final VM client2 = host.getVM(2);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .buildInThisVM();
+          .withAutoStart();
 
   @Before
   public void before() throws Exception {
@@ -65,7 +64,7 @@ public class ClientDestroyInvalidateAuthDUnitTest extends JUnit4DistributedTestC
     // Delete one key and invalidate another key with an authorized user.
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
       ClientCache cache =
-          SecurityTestUtil.createClientCache("dataUser", "1234567", server.getServerPort());
+          SecurityTestUtil.createClientCache("dataUser", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -85,7 +84,7 @@ public class ClientDestroyInvalidateAuthDUnitTest extends JUnit4DistributedTestC
     // Delete one key and invalidate another key with an unauthorized user.
     AsyncInvocation ai2 = client2.invokeAsync(() -> {
       ClientCache cache =
-          SecurityTestUtil.createClientCache("authRegionReader", "1234567", server.getServerPort());
+          SecurityTestUtil.createClientCache("authRegionReader", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientDestroyRegionAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientDestroyRegionAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientDestroyRegionAuthDUnitTest.java
index 5ea65d8..19960fb 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientDestroyRegionAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientDestroyRegionAuthDUnitTest.java
@@ -24,11 +24,9 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -36,7 +34,6 @@ import org.junit.experimental.categories.Category;
 @Category({DistributedTest.class, SecurityTest.class})
 public class ClientDestroyRegionAuthDUnitTest extends JUnit4DistributedTestCase {
   private static String REGION_NAME = "testRegion";
-  private int serverPort;
 
   final Host host = Host.getHost(0);
   final VM client1 = host.getVM(1);
@@ -44,22 +41,17 @@ public class ClientDestroyRegionAuthDUnitTest extends JUnit4DistributedTestCase
   final VM client3 = host.getVM(3);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
-
-  @Before
-  public void setup() {
-    serverPort = server.getServerPort();
-  }
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testDestroyRegion() throws InterruptedException {
     client1.invoke(() -> {
       ClientCache cache =
-          SecurityTestUtil.createClientCache("dataWriter", "1234567", server.getServerPort());
+          SecurityTestUtil.createClientCache("dataWriter", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -67,8 +59,8 @@ public class ClientDestroyRegionAuthDUnitTest extends JUnit4DistributedTestCase
     });
 
     client2.invoke(() -> {
-      ClientCache cache = SecurityTestUtil.createClientCache("authRegionManager", "1234567",
-          server.getServerPort());
+      ClientCache cache =
+          SecurityTestUtil.createClientCache("authRegionManager", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
@@ -77,7 +69,7 @@ public class ClientDestroyRegionAuthDUnitTest extends JUnit4DistributedTestCase
 
     client3.invoke(() -> {
       ClientCache cache =
-          SecurityTestUtil.createClientCache("super-user", "1234567", server.getServerPort());
+          SecurityTestUtil.createClientCache("super-user", "1234567", server.getPort());
 
       Region region =
           cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
index 2b4c27c..81ed0d1 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientExecuteFunctionAuthDUnitTest.java
@@ -22,9 +22,7 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
-import org.junit.Before;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -49,23 +47,18 @@ public class ClientExecuteFunctionAuthDUnitTest extends JUnit4DistributedTestCas
   private final static Function function = new TestFunction(true, TestFunction.TEST_FUNCTION1);
 
   @Rule
-  public LocalServerStarterRule server =
-      new ServerStarterBuilder().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
           .withProperty(TestSecurityManager.SECURITY_JSON,
               "org/apache/geode/management/internal/security/clientServer.json")
-          .withRegion(RegionShortcut.REPLICATE, REGION_NAME).buildInThisVM();
-
-  @Before
-  public void setup() {
-
-  }
+          .withRegion(RegionShortcut.REPLICATE, REGION_NAME);
 
   @Test
   public void testExecuteRegionFunctionWithClientRegistration() {
 
     FunctionService.registerFunction(function);
     client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("dataReader", "1234567", server.getPort());
 
       FunctionService.registerFunction(function);
 
@@ -74,7 +67,7 @@ public class ClientExecuteFunctionAuthDUnitTest extends JUnit4DistributedTestCas
     });
 
     client2.invoke("logging in with super-user", () -> {
-      ClientCache cache = createClientCache("super-user", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("super-user", "1234567", server.getPort());
 
       FunctionService.registerFunction(function);
       ResultCollector rc = FunctionService.onServer(cache.getDefaultPool()).withArgs(Boolean.TRUE)
@@ -88,7 +81,7 @@ public class ClientExecuteFunctionAuthDUnitTest extends JUnit4DistributedTestCas
   public void testExecuteRegionFunctionWithOutClientRegistration() {
     FunctionService.registerFunction(function);
     client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", server.getServerPort());
+      ClientCache cache = createClientCache("dataReader", "1234567", server.getPort());
       assertNotAuthorized(() -> FunctionService.onServer(cache.getDefaultPool())
           .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
     });


[26/51] [abbrv] geode git commit: GEODE-2290: Fix DeployCommandRedeployDUnitTest

Posted by ds...@apache.org.
GEODE-2290: Fix DeployCommandRedeployDUnitTest


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

Branch: refs/heads/feature/GEODE-2097
Commit: 510049845cddff4ab63c9482dff7519f26300b39
Parents: 2c5e519
Author: Jared Stewart <js...@pivotal.io>
Authored: Mon Apr 17 10:04:38 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Mon Apr 17 10:04:38 2017 -0700

----------------------------------------------------------------------
 .../internal/cli/commands/DeployCommandRedeployDUnitTest.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/51004984/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
index 7780c0e..d47b343 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -123,7 +123,7 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
 
   private File createJarWithFunctionB(String version) throws Exception {
     URL classTemplateUrl = DeployCommandRedeployDUnitTest.class
-        .getResource("DeployCommandRedeployDUnitTest_FunctionATemplate");
+        .getResource("DeployCommandRedeployDUnitTest_FunctionBTemplate");
     assertThat(classTemplateUrl).isNotNull();
 
     String classContents = FileUtils.readFileToString(new File(classTemplateUrl.toURI()), "UTF-8");


[31/51] [abbrv] geode git commit: GEODE-2653: Fix testRemoveMember and remove FlakyTest. This closes #437

Posted by ds...@apache.org.
GEODE-2653: Fix testRemoveMember and remove FlakyTest. This closes #437

Test removed self instead of the other member, and used the `any`
matcher instead of `isA`.

Cleanup GMSJoinLeaveJUnitTest.

* Change Mockito's `any` to `isA`.
* Replace some `Thread.sleep()` calls with Awaitility calls.
* Remove our `MethodExecuted` class -- this can be done with Mockito's
  `verify()`.

Remove a redundant assert.


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

Branch: refs/heads/feature/GEODE-2097
Commit: c5ee7cd4338a91ab40ee355612057b05b299b6d6
Parents: 1077097
Author: Galen OSullivan <go...@pivotal.io>
Authored: Fri Mar 31 11:44:54 2017 -0700
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Tue Apr 18 16:12:31 2017 -0700

----------------------------------------------------------------------
 .../gms/membership/GMSJoinLeaveJUnitTest.java   | 122 +++++++------------
 1 file changed, 41 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/c5ee7cd4/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java
index 05ab6f7..49b09ca 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeaveJUnitTest.java
@@ -14,15 +14,16 @@
  */
 package org.apache.geode.distributed.internal.membership.gms.membership;
 
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.atLeast;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -55,7 +56,6 @@ import org.apache.geode.distributed.internal.membership.gms.messages.RemoveMembe
 import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
 import org.apache.geode.internal.Version;
 import org.apache.geode.security.AuthenticationFailedException;
-import org.apache.geode.test.junit.categories.FlakyTest;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.MembershipTest;
 import org.junit.After;
@@ -79,7 +79,6 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Set;
 import java.util.Timer;
-import java.util.concurrent.TimeUnit;
 
 @Category({IntegrationTest.class, MembershipTest.class})
 public class GMSJoinLeaveJUnitTest {
@@ -221,7 +220,7 @@ public class GMSJoinLeaveJUnitTest {
     gmsJoinLeave.processMessage(new JoinRequestMessage(mockOldMember, mockOldMember, null, -1, 0));
     assertTrue("JoinRequest should not have been added to view request",
         gmsJoinLeave.getViewRequests().size() == 0);
-    verify(messenger).send(any(JoinResponseMessage.class));
+    verify(messenger).send(isA(JoinResponseMessage.class));
   }
 
   @Test
@@ -232,7 +231,7 @@ public class GMSJoinLeaveJUnitTest {
     NetView v = new NetView(mockMembers[0], 2, members);
     InstallViewMessage message = getInstallViewMessage(v, null, false);
     gmsJoinLeave.processMessage(message);
-    verify(manager).forceDisconnect(any(String.class));
+    verify(manager).forceDisconnect(isA(String.class));
   }
 
 
@@ -248,7 +247,7 @@ public class GMSJoinLeaveJUnitTest {
         .processMessage(new JoinRequestMessage(mockMembers[0], mockMembers[0], credentials, -1, 0));
     assertTrue("JoinRequest should not have been added to view request",
         gmsJoinLeave.getViewRequests().size() == 0);
-    verify(messenger).send(any(JoinResponseMessage.class));
+    verify(messenger).send(isA(JoinResponseMessage.class));
   }
 
   @Test
@@ -263,7 +262,7 @@ public class GMSJoinLeaveJUnitTest {
         .processMessage(new JoinRequestMessage(mockMembers[0], mockMembers[0], null, -1, 0));
     assertTrue("JoinRequest should not have been added to view request",
         gmsJoinLeave.getViewRequests().size() == 0);
-    verify(messenger).send(any(JoinResponseMessage.class));
+    verify(messenger).send(isA(JoinResponseMessage.class));
   }
 
   // This test does not test the actual join process but rather that the join response gets logged�
@@ -310,7 +309,7 @@ public class GMSJoinLeaveJUnitTest {
     NetView netView = new NetView(coordinator, viewId, members);
     InstallViewMessage installViewMessage = getInstallViewMessage(netView, credentials, true);
     gmsJoinLeave.processMessage(installViewMessage);
-    verify(messenger).send(any(ViewAckMessage.class));
+    verify(messenger).send(isA(ViewAckMessage.class));
 
     // install the view
     installViewMessage = getInstallViewMessage(netView, credentials, false);
@@ -327,16 +326,12 @@ public class GMSJoinLeaveJUnitTest {
     return memberList;
   }
 
-  @Category(FlakyTest.class) // GEODE-2653: flaky due to Thread.sleep
   @Test
   public void testRemoveMember() throws Exception {
     initMocks();
     prepareAndInstallView(mockMembers[0], createMemberList(mockMembers[0], gmsJoinLeaveMemberId));
-    MethodExecuted removeMessageSent = new MethodExecuted();
-    when(messenger.send(any(RemoveMemberMessage.class))).thenAnswer(removeMessageSent);
-    gmsJoinLeave.remove(mockMembers[0], "removing for test");
-    Thread.sleep(ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL * 2);
-    assertTrue(removeMessageSent.methodExecuted);
+    gmsJoinLeave.remove(gmsJoinLeaveMemberId, "removing for test");
+    verify(messenger, timeout(2000).atLeastOnce()).send(isA(RemoveMemberMessage.class));
   }
 
   @Test
@@ -344,11 +339,10 @@ public class GMSJoinLeaveJUnitTest {
     initMocks();
     prepareAndInstallView(mockMembers[0],
         createMemberList(mockMembers[0], mockMembers[1], gmsJoinLeaveMemberId));
-    MethodExecuted removeMessageSent = new MethodExecuted();
-    when(messenger.send(any(RemoveMemberMessage.class))).thenAnswer(removeMessageSent);
     assertFalse(gmsJoinLeave.isMemberLeaving(mockMembers[0]));
     assertFalse(gmsJoinLeave.isMemberLeaving(mockMembers[1]));
     gmsJoinLeave.remove(mockMembers[0], "removing for test");
+    verify(messenger, timeout(2000).atLeastOnce()).send(isA(RemoveMemberMessage.class));
     assertTrue(gmsJoinLeave.isMemberLeaving(mockMembers[0]));
     LeaveRequestMessage msg =
         new LeaveRequestMessage(gmsJoinLeave.getMemberID(), mockMembers[1], "leaving for test");
@@ -364,20 +358,17 @@ public class GMSJoinLeaveJUnitTest {
     initMocks();
     final int viewInstallationTime = 15000;
 
-    when(healthMonitor.checkIfAvailable(any(InternalDistributedMember.class), any(String.class),
-        any(Boolean.class))).thenReturn(true);
+    when(healthMonitor.checkIfAvailable(isA(InternalDistributedMember.class), isA(String.class),
+        isA(Boolean.class))).thenReturn(true);
 
     gmsJoinLeave.delayViewCreationForTest(5000); // ensures multiple requests are queued for a view
                                                  // change
     GMSJoinLeaveTestHelper.becomeCoordinatorForTest(gmsJoinLeave);
 
-    NetView oldView = null;
-    long giveup = System.currentTimeMillis() + viewInstallationTime;
-    while (System.currentTimeMillis() < giveup && oldView == null) {
-      Thread.sleep(500);
-      oldView = gmsJoinLeave.getView();
-    }
-    assertTrue(oldView != null); // it should have become coordinator and installed a view
+    Awaitility.await().atMost(viewInstallationTime, MILLISECONDS)
+        .until(() -> gmsJoinLeave.getView() != null);
+
+    NetView oldView = gmsJoinLeave.getView();
 
     NetView newView = new NetView(oldView, oldView.getViewId() + 1);
     newView.add(mockMembers[1]);
@@ -387,12 +378,8 @@ public class GMSJoinLeaveJUnitTest {
     gmsJoinLeave.memberShutdown(mockMembers[1], "shutting down for test");
     gmsJoinLeave.remove(mockMembers[1], "removing for test");
 
-    giveup = System.currentTimeMillis() + viewInstallationTime;
-    while (System.currentTimeMillis() < giveup
-        && gmsJoinLeave.getView().getViewId() == newView.getViewId()) {
-      Thread.sleep(500);
-    }
-    assertTrue(gmsJoinLeave.getView().getViewId() > newView.getViewId());
+    Awaitility.await().atMost(viewInstallationTime, MILLISECONDS)
+        .until(() -> gmsJoinLeave.getView().getViewId() > newView.getViewId());
     assertFalse(gmsJoinLeave.getView().getCrashedMembers().contains(mockMembers[1]));
   }
 
@@ -432,19 +419,7 @@ public class GMSJoinLeaveJUnitTest {
     gmsJoinLeave.processMessage(installViewMessage);
 
     Assert.assertNotEquals(netView, gmsJoinLeave.getView());
-    verify(mockManager).forceDisconnect(any(String.class));
-  }
-
-  @SuppressWarnings("rawtypes")
-  private class MethodExecuted implements Answer {
-    private boolean methodExecuted = false;
-
-    @Override
-    public Object answer(InvocationOnMock invocation) {
-      // do we only expect a join response on a failure?
-      methodExecuted = true;
-      return null;
-    }
+    verify(mockManager).forceDisconnect(isA(String.class));
   }
 
   @Test
@@ -517,8 +492,8 @@ public class GMSJoinLeaveJUnitTest {
   @Test
   public void testDuplicateJoinRequestDoesNotCauseNewView() throws Exception {
     initMocks();
-    when(healthMonitor.checkIfAvailable(any(InternalDistributedMember.class), any(String.class),
-        any(Boolean.class))).thenReturn(true);
+    when(healthMonitor.checkIfAvailable(isA(InternalDistributedMember.class), isA(String.class),
+        isA(Boolean.class))).thenReturn(true);
     gmsJoinLeave.unitTesting.add("noRandomViewChange");
     prepareAndInstallView(gmsJoinLeaveMemberId,
         createMemberList(gmsJoinLeaveMemberId, mockMembers[0]));
@@ -546,8 +521,8 @@ public class GMSJoinLeaveJUnitTest {
     }
     assertTrue("expected member to only be in the view once: " + mockMembers[2] + "; view: " + view,
         occurrences == 1);
-    verify(healthMonitor, times(5)).checkIfAvailable(any(InternalDistributedMember.class),
-        any(String.class), any(Boolean.class));
+    verify(healthMonitor, times(5)).checkIfAvailable(isA(InternalDistributedMember.class),
+        isA(String.class), isA(Boolean.class));
   }
 
 
@@ -610,11 +585,7 @@ public class GMSJoinLeaveJUnitTest {
   public void testBecomeCoordinatorOnStartup() throws Exception {
     initMocks();
     GMSJoinLeaveTestHelper.becomeCoordinatorForTest(gmsJoinLeave);
-    long giveup = System.currentTimeMillis() + 20000;
-    while (System.currentTimeMillis() < giveup && !gmsJoinLeave.isCoordinator()) {
-      Thread.sleep(1000);
-    }
-    assertTrue(gmsJoinLeave.isCoordinator());
+    Awaitility.await().atMost(20, SECONDS).until(() -> gmsJoinLeave.isCoordinator());
   }
 
   @Test
@@ -727,7 +698,7 @@ public class GMSJoinLeaveJUnitTest {
     GMSJoinLeaveTestHelper.becomeCoordinatorForTest(gmsJoinLeave);
     NetworkPartitionMessage message = new NetworkPartitionMessage();
     gmsJoinLeave.processMessage(message);
-    verify(manager).forceDisconnect(any(String.class));
+    verify(manager).forceDisconnect(isA(String.class));
   }
 
 
@@ -765,7 +736,7 @@ public class GMSJoinLeaveJUnitTest {
     installViewMessage = getInstallViewMessage(partitionView, credentials, false);
     gmsJoinLeave.processMessage(installViewMessage);
 
-    verify(manager, never()).forceDisconnect(any(String.class));
+    verify(manager, never()).forceDisconnect(isA(String.class));
     verify(manager).quorumLost(crashes, newView);
   }
 
@@ -789,8 +760,8 @@ public class GMSJoinLeaveJUnitTest {
   @Test
   public void testNoViewAckCausesRemovalMessage() throws Exception {
     initMocks(true);
-    when(healthMonitor.checkIfAvailable(any(InternalDistributedMember.class), any(String.class),
-        any(Boolean.class))).thenReturn(false);
+    when(healthMonitor.checkIfAvailable(isA(InternalDistributedMember.class), isA(String.class),
+        isA(Boolean.class))).thenReturn(false);
     prepareAndInstallView(mockMembers[0], createMemberList(mockMembers[0], gmsJoinLeaveMemberId));
     NetView oldView = gmsJoinLeave.getView();
     NetView newView = new NetView(oldView, oldView.getViewId() + 1);
@@ -804,15 +775,13 @@ public class GMSJoinLeaveJUnitTest {
     InstallViewMessage installViewMessage = getInstallViewMessage(newView, credentials, false);
     gmsJoinLeave.processMessage(installViewMessage);
 
-    long giveup = System.currentTimeMillis() + (2000 * 3); // this test's member-timeout * 3
-    while (System.currentTimeMillis() < giveup
-        && gmsJoinLeave.getView().getViewId() == oldView.getViewId()) {
-      Thread.sleep(1000);
-    }
+    // this test's member-timeout * 3
+    Awaitility.await().atMost(6, SECONDS)
+        .until(() -> gmsJoinLeave.getView().getViewId() != oldView.getViewId());
     assertTrue(gmsJoinLeave.isCoordinator());
     // wait for suspect processing
-    Thread.sleep(10000);
-    verify(healthMonitor, atLeast(1)).checkIfAvailable(isA(DistributedMember.class),
+
+    verify(healthMonitor, timeout(10000).atLeast(1)).checkIfAvailable(isA(DistributedMember.class),
         isA(String.class), isA(Boolean.class));
     // verify(messenger, atLeast(1)).send(isA(RemoveMemberMessage.class));
   }
@@ -920,7 +889,7 @@ public class GMSJoinLeaveJUnitTest {
     NetView netView = new NetView(coordinator, viewId, members);
     InstallViewMessage installViewMessage = getInstallViewMessage(netView, credentials, false);
     gmsJoinLeave.processMessage(installViewMessage);
-    // verify(messenger).send(any(ViewAckMessage.class));
+    // verify(messenger).send(isA(ViewAckMessage.class));
   }
 
   @Test
@@ -946,11 +915,9 @@ public class GMSJoinLeaveJUnitTest {
           new JoinRequestMessage(mockMembers[0], mockMembers[0], credentials, -1, 0));
       int viewRequests = gmsJoinLeave.getViewRequests().size();
 
-      assertTrue("There should be 1 viewRequest but found " + viewRequests, viewRequests == 1);
-      Thread.sleep(2 * ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL);
-
-      viewRequests = gmsJoinLeave.getViewRequests().size();
-      assertEquals("Found view requests: " + gmsJoinLeave.getViewRequests(), 0, viewRequests);
+      assertEquals("There should be 1 viewRequest", 1, viewRequests);
+      Awaitility.await().atMost(2 * ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL, MILLISECONDS)
+          .until(() -> gmsJoinLeave.getViewRequests().size(), equalTo(0));
     } finally {
       System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
     }
@@ -1105,7 +1072,7 @@ public class GMSJoinLeaveJUnitTest {
         gmsJoinLeave.processMessage(msg);
       }
 
-      Awaitility.await("waiting for view creator to stop").atMost(5000, TimeUnit.MILLISECONDS)
+      Awaitility.await("waiting for view creator to stop").atMost(5000, MILLISECONDS)
           .until(() -> !gmsJoinLeave.getViewCreator().isAlive());
       assertEquals(1, gmsJoinLeave.getView().getViewId());
 
@@ -1148,14 +1115,7 @@ public class GMSJoinLeaveJUnitTest {
     vack.setSender(gmsJoinLeaveMemberId);
     gmsJoinLeave.processMessage(vack);
 
-    int tries = 0;
-    while (!vc.waiting) {
-      if (tries > 30) {
-        Assert.fail("view creator never finished");
-      }
-      tries++;
-      Thread.sleep(1000);
-    }
+    Awaitility.await("view creator finishes").atMost(30, SECONDS).until(() -> vc.waiting);
     NetView newView = gmsJoinLeave.getView();
     System.out.println("new view is " + newView);
     assertTrue(newView.contains(mockMembers[1]));


[29/51] [abbrv] geode git commit: GEODE-2632: refactor code to use InternalCache and InternalResourceManager

Posted by ds...@apache.org.
GEODE-2632: refactor code to use InternalCache and InternalResourceManager

* add operations to InternalCache interface
* rename getter for InternalResourceManager getInternalResourceManager
* add @Override annotations
* fixup TODO comments
* delete superfluous comments and dead-code
* filed GEODE-2789 and will follow-up with fix for that ticket


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

Branch: refs/heads/feature/GEODE-2097
Commit: 1156011729834f9e4bcb3329112d622f04656be7
Parents: 43a4de8
Author: Kirk Lund <kl...@apache.org>
Authored: Fri Apr 14 12:22:04 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Mon Apr 17 13:45:34 2017 -0700

----------------------------------------------------------------------
 .../cache/partition/PartitionRegionHelper.java  |   4 +-
 .../internal/cache/AbstractLRURegionMap.java    |   2 +-
 .../geode/internal/cache/DistributedRegion.java |   2 +-
 .../geode/internal/cache/GemFireCacheImpl.java  | 251 +++++++++++------
 .../geode/internal/cache/InternalCache.java     | 140 +++++++++-
 .../geode/internal/cache/LocalRegion.java       |  22 +-
 .../internal/cache/PRHARedundancyProvider.java  |   5 +-
 .../geode/internal/cache/PartitionedRegion.java |  10 +-
 .../cache/control/RebalanceOperationImpl.java   |   8 +-
 .../internal/cache/control/ResourceAdvisor.java |   7 +-
 .../cache/execute/MemberFunctionExecutor.java   |   2 +-
 .../execute/MultiRegionFunctionExecutor.java    |   6 +-
 .../PartitionedRegionFunctionExecutor.java      |   4 +-
 .../cache/lru/HeapLRUCapacityController.java    |   4 +-
 .../PartitionedRegionRebalanceOp.java           |   2 +-
 .../internal/cache/xmlcache/CacheCreation.java  | 274 ++++++++++++++++++-
 .../internal/beans/MemberMBeanBridge.java       |   2 +-
 .../management/MemoryThresholdsDUnitTest.java   |  40 +--
 .../MemoryThresholdsOffHeapDUnitTest.java       |  16 +-
 .../management/ResourceManagerDUnitTest.java    |   2 +-
 ...esourceManagerWithQueryMonitorDUnitTest.java |   2 +-
 .../geode/internal/cache/EvictionTestBase.java  |   2 +-
 .../cache/OffHeapEvictionDUnitTest.java         |   5 +-
 .../PartitionedRegionEvictionDUnitTest.java     |   3 +-
 ...rtitionedRegionOffHeapEvictionDUnitTest.java |   2 +-
 .../cache/control/MemoryMonitorJUnitTest.java   |  68 +++--
 .../control/MemoryMonitorOffHeapJUnitTest.java  |  19 +-
 .../control/RebalanceOperationDUnitTest.java    |   8 +-
 .../bean/stats/MemberLevelStatsJUnitTest.java   |   4 +-
 .../geode/cache/lucene/EvictionDUnitTest.java   |   2 +-
 .../apache/geode/cache/util/AutoBalancer.java   |   4 +-
 .../util/AutoBalancerIntegrationJUnitTest.java  |  12 +-
 .../geode/cache/util/AutoBalancerJUnitTest.java |   6 +
 33 files changed, 709 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
index 6b52e1c..bf79edb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/partition/PartitionRegionHelper.java
@@ -175,7 +175,7 @@ public final class PartitionRegionHelper {
       PartitionedRegion pr = isPartitionedCheck(region);
       GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache();
       return pr.getRedundancyProvider().buildPartitionedRegionInfo(false,
-          cache.getResourceManager().getLoadProbe()); // may return null
+          cache.getInternalResourceManager().getLoadProbe()); // may return null
     } catch (ClassCastException e) {
       // not a PR so return null
     }
@@ -192,7 +192,7 @@ public final class PartitionRegionHelper {
     for (Iterator<PartitionedRegion> iter = prSet.iterator(); iter.hasNext();) {
       PartitionedRegion pr = iter.next();
       PartitionRegionInfo prDetails = pr.getRedundancyProvider()
-          .buildPartitionedRegionInfo(internal, cache.getResourceManager().getLoadProbe());
+          .buildPartitionedRegionInfo(internal, cache.getInternalResourceManager().getLoadProbe());
       if (prDetails != null) {
         prDetailsSet.add(prDetails);
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
index 4d5bb87..a0e360f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
@@ -572,7 +572,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
 
   private boolean mustEvict() {
     LocalRegion owner = _getOwner();
-    InternalResourceManager resourceManager = owner.getCache().getResourceManager();
+    InternalResourceManager resourceManager = owner.getCache().getInternalResourceManager();
     boolean offheap = owner.getAttributes().getOffHeap();
     return resourceManager.getMemoryMonitor(offheap).getState().isEviction() && this.sizeInVM() > 0;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 926f36d..68fdbeb 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -1193,7 +1193,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     // remote members
     if (!isInternalRegion()) {
       if (!this.isDestroyed) {
-        cache.getResourceManager().addResourceListener(ResourceType.MEMORY, this);
+        cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 59aeac4..8691814 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -67,6 +67,7 @@ import org.apache.geode.cache.client.PoolManager;
 import org.apache.geode.cache.client.internal.ClientMetadataService;
 import org.apache.geode.cache.client.internal.ClientRegionFactoryImpl;
 import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.cache.control.ResourceManager;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.internal.DefaultQuery;
@@ -228,10 +229,9 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.naming.Context;
 
-// @todo somebody Come up with more reasonable values for {@link #DEFAULT_LOCK_TIMEOUT}, etc.
+// TODO: somebody Come up with more reasonable values for {@link #DEFAULT_LOCK_TIMEOUT}, etc.
 /**
  * GemFire's implementation of a distributed {@link org.apache.geode.cache.Cache}.
- *
  */
 @SuppressWarnings("deprecation")
 public class GemFireCacheImpl
@@ -671,10 +671,6 @@ public class GemFireCacheImpl
     sb.append("; copyOnRead = " + this.copyOnRead);
     sb.append("; lockLease = " + this.lockLease);
     sb.append("; lockTimeout = " + this.lockTimeout);
-    // sb.append("; rootRegions = (" + this.rootRegions + ")");
-    // sb.append("; cacheServers = (" + this.cacheServers + ")");
-    // sb.append("; regionAttributes = (" + this.listRegionAttributes());
-    // sb.append("; gatewayHub = " + gatewayHub);
     if (this.creationStack != null) {
       sb.append("\nCreation context:\n");
       OutputStream os = new OutputStream() {
@@ -690,8 +686,6 @@ public class GemFireCacheImpl
     return sb.toString();
   }
 
-  // ////////////////////// Constructors /////////////////////////
-
   /** Map of Futures used to track Regions that are being reinitialized */
   private final ConcurrentMap reinitializingRegions = new ConcurrentHashMap();
 
@@ -892,8 +886,10 @@ public class GemFireCacheImpl
         final ThreadGroup group =
             LoggingThreadGroup.createThreadGroup("Message Event Threads", logger);
         ThreadFactory tf = new ThreadFactory() {
+          @Override
           public Thread newThread(final Runnable command) {
             final Runnable r = new Runnable() {
+              @Override
               public void run() {
                 ConnectionTable.threadWantsSharedResources();
                 command.run();
@@ -919,13 +915,14 @@ public class GemFireCacheImpl
       resourceManager = InternalResourceManager.createResourceManager(this);
       this.serialNumber = DistributionAdvisor.createSerialNumber();
 
-      getResourceManager().addResourceListener(ResourceType.HEAP_MEMORY, getHeapEvictor());
+      getInternalResourceManager().addResourceListener(ResourceType.HEAP_MEMORY, getHeapEvictor());
 
       /*
        * Only bother creating an off-heap evictor if we have off-heap memory enabled.
        */
       if (null != getOffHeapStore()) {
-        getResourceManager().addResourceListener(ResourceType.OFFHEAP_MEMORY, getOffHeapEvictor());
+        getInternalResourceManager().addResourceListener(ResourceType.OFFHEAP_MEMORY,
+            getOffHeapEvictor());
       }
 
       recordedEventSweeper = EventTracker.startTrackerServices(this);
@@ -1137,6 +1134,7 @@ public class GemFireCacheImpl
    * @return true if cache is created using a ClientCacheFactory
    * @see #hasPool()
    */
+  @Override
   public boolean isClient() {
     return this.isClient;
   }
@@ -1165,6 +1163,7 @@ public class GemFireCacheImpl
   /**
    * May return null (even on a client).
    */
+  @Override
   public Pool getDefaultPool() {
     return this.defaultPool;
   }
@@ -1348,6 +1347,7 @@ public class GemFireCacheImpl
   }
 
 
+  @Override
   public URL getCacheXmlURL() {
     if (this.getMyId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE) {
       return null;
@@ -1520,6 +1520,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire prPersistSprint2
    */
+  @Override
   public DiskStoreFactory createDiskStoreFactory() {
     return new DiskStoreFactoryImpl(this);
   }
@@ -1600,16 +1601,19 @@ public class GemFireCacheImpl
 
   private final Stopper stopper = new Stopper();
 
+  @Override
   public CancelCriterion getCancelCriterion() {
     return stopper;
   }
 
   /** return true if the cache was closed due to being shunned by other members */
+  @Override
   public boolean forcedDisconnect() {
     return this.forcedDisconnect || this.system.forcedDisconnect();
   }
 
   /** return a CacheClosedException with the given reason */
+  @Override
   public CacheClosedException getCacheClosedException(String reason, Throwable cause) {
     CacheClosedException result;
     if (cause != null) {
@@ -1639,6 +1643,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire 5.7
    */
+  @Override
   public boolean keepDurableSubscriptionsAlive() {
     return this.keepAlive;
   }
@@ -1653,7 +1658,7 @@ public class GemFireCacheImpl
    *
    * @see SystemFailure#loadEmergencyClasses()
    */
-  static public void loadEmergencyClasses() {
+  public static void loadEmergencyClasses() {
     if (emergencyClassesLoaded)
       return;
     emergencyClassesLoaded = true;
@@ -1668,7 +1673,7 @@ public class GemFireCacheImpl
    *
    * @see SystemFailure#emergencyClose()
    */
-  static public void emergencyClose() {
+  public static void emergencyClose() {
     final boolean DEBUG = SystemFailure.TRACE_CLOSE;
 
     GemFireCacheImpl inst = GemFireCacheImpl.instance;
@@ -1735,6 +1740,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public boolean isCacheAtShutdownAll() {
     return isShutDownAll.get();
   }
@@ -1792,6 +1798,7 @@ public class GemFireCacheImpl
           ExecutorService es = getShutdownAllExecutorService(prTrees.size());
           for (final Map<String, PartitionedRegion> prSubMap : prTrees.values()) {
             es.execute(new Runnable() {
+              @Override
               public void run() {
                 ConnectionTable.threadWantsSharedResources();
                 shutdownSubTreeGracefully(prSubMap);
@@ -1824,6 +1831,7 @@ public class GemFireCacheImpl
     ThreadFactory thrFactory = new ThreadFactory() {
       private final AtomicInteger threadCount = new AtomicInteger(1);
 
+      @Override
       public Thread newThread(Runnable r) {
         Thread t = new Thread(thrGrp, r, "ShutdownAll-" + threadCount.getAndIncrement());
         t.setDaemon(true);
@@ -1979,6 +1987,7 @@ public class GemFireCacheImpl
     return persistMap;
   }
 
+  @Override
   public void close() {
     close(false);
   }
@@ -1987,6 +1996,7 @@ public class GemFireCacheImpl
     close(reason, null, keepalive, keepDS);
   }
 
+  @Override
   public void close(boolean keepalive) {
     close("Normal disconnect", null, keepalive, false);
   }
@@ -2001,7 +2011,8 @@ public class GemFireCacheImpl
    *
    * @return the PartitionedRegion distributed lock service
    */
-  protected DistributedLockService getPartitionedRegionLockService() {
+  @Override
+  public DistributedLockService getPartitionedRegionLockService() {
     synchronized (this.prLockServiceLock) {
       stopper.checkCancelInProgress(null);
       if (this.prLockService == null) {
@@ -2095,10 +2106,12 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public PersistentMemberManager getPersistentMemberManager() {
     return persistentMemberManager;
   }
 
+  @Override
   public ClientMetadataService getClientMetadataService() {
     synchronized (this.clientMetaDatServiceLock) {
       stopper.checkCancelInProgress(null);
@@ -2470,11 +2483,13 @@ public class GemFireCacheImpl
   }
 
   // see Cache.isReconnecting()
+  @Override
   public boolean isReconnecting() {
     return this.system.isReconnecting();
   }
 
   // see Cache.waitUntilReconnected(long, TimeUnit)
+  @Override
   public boolean waitUntilReconnected(long time, TimeUnit units) throws InterruptedException {
     boolean systemReconnected = this.system.waitUntilReconnected(time, units);
     if (!systemReconnected) {
@@ -2487,12 +2502,12 @@ public class GemFireCacheImpl
     return true;
   }
 
-  // see Cache.stopReconnecting()
+  @Override
   public void stopReconnecting() {
     this.system.stopReconnecting();
   }
 
-  // see Cache.getReconnectedCache()
+  @Override
   public Cache getReconnectedCache() {
     GemFireCacheImpl c = GemFireCacheImpl.getInstance();
     if (c == null) {
@@ -2633,6 +2648,7 @@ public class GemFireCacheImpl
 
   public static String DEFAULT_DS_NAME = DiskStoreFactory.DEFAULT_DISK_STORE_NAME;
 
+  @Override
   public DiskStoreImpl getOrCreateDefaultDiskStore() {
     DiskStoreImpl result = (DiskStoreImpl) findDiskStore(null);
     if (result == null) {
@@ -2651,6 +2667,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire prPersistSprint2
    */
+  @Override
   public DiskStore findDiskStore(String name) {
     if (name == null) {
       name = DEFAULT_DS_NAME;
@@ -2663,14 +2680,12 @@ public class GemFireCacheImpl
    *
    * @since GemFire prPersistSprint2
    */
+  @Override
   public Collection<DiskStoreImpl> listDiskStores() {
     return Collections.unmodifiableCollection(this.diskStores.values());
   }
 
-  public Collection<DiskStoreImpl> listDiskStoresIncludingDefault() {
-    return Collections.unmodifiableCollection(listDiskStores());
-  }
-
+  @Override
   public Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned() {
     HashSet<DiskStoreImpl> allDiskStores = new HashSet<DiskStoreImpl>();
     allDiskStores.addAll(this.diskStores.values());
@@ -2697,17 +2712,6 @@ public class GemFireCacheImpl
     return false;
   }
 
-  /*
-   * private static class DiskStoreFuture extends FutureTask { private DiskStoreTask task;
-   * 
-   * public DiskStoreFuture(DiskStoreTask r) { super(r, null); this.task = r; }
-   * 
-   * @Override public boolean cancel(boolean mayInterruptIfRunning) { boolean result =
-   * super.cancel(mayInterruptIfRunning); if (result) { task.taskCancelled(); } return result; }
-   * 
-   * }
-   */
-
   private void stopDiskStoreTaskPool() {
     synchronized (this.diskStoreTaskSync) {
       this.diskStoreTaskSync.set(true);
@@ -2853,6 +2857,7 @@ public class GemFireCacheImpl
 
   }
 
+  @Override
   public InternalDistributedSystem getDistributedSystem() {
     return this.system;
   }
@@ -2862,33 +2867,22 @@ public class GemFireCacheImpl
    *
    * @since GemFire 5.0
    */
+  @Override
   public InternalDistributedMember getMyId() {
     return this.system.getDistributedMember();
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.geode.cache.Cache#getMembers()
-   */
+  @Override
   public Set<DistributedMember> getMembers() {
     return Collections.unmodifiableSet(this.dm.getOtherNormalDistributionManagerIds());
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.geode.cache.Cache#getAdminMembers()
-   */
+  @Override
   public Set<DistributedMember> getAdminMembers() {
     return this.dm.getAdminMemberSet();
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.geode.cache.Cache#getMembers(org.apache.geode.cache.Region)
-   */
+  @Override
   public Set<DistributedMember> getMembers(Region r) {
     if (r instanceof DistributedRegion) {
       DistributedRegion d = (DistributedRegion) r;
@@ -2901,11 +2895,7 @@ public class GemFireCacheImpl
     }
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see org.apache.geode.cache.client.ClientCache#getCurrentServers()
-   */
+  @Override
   public Set<InetSocketAddress> getCurrentServers() {
     Map<String, Pool> pools = PoolManager.getAll();
     Set result = null;
@@ -2926,18 +2916,22 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public LogWriter getLogger() {
     return this.system.getLogWriter();
   }
 
+  @Override
   public LogWriter getSecurityLogger() {
     return this.system.getSecurityLogWriter();
   }
 
+  @Override
   public LogWriterI18n getLoggerI18n() {
     return this.system.getInternalLogWriter();
   }
 
+  @Override
   public LogWriterI18n getSecurityLoggerI18n() {
     return this.system.getSecurityInternalLogWriter();
   }
@@ -2959,10 +2953,12 @@ public class GemFireCacheImpl
     return this.recordedEventSweeper;
   }
 
+  @Override
   public CachePerfStats getCachePerfStats() {
     return this.cachePerfStats;
   }
 
+  @Override
   public String getName() {
     return this.system.getName();
   }
@@ -3029,6 +3025,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public Region createVMRegion(String name, RegionAttributes attrs)
       throws RegionExistsException, TimeoutException {
     return createRegion(name, attrs);
@@ -3172,6 +3169,7 @@ public class GemFireCacheImpl
     return pool;
   }
 
+  @Override
   public Region createRegion(String name, RegionAttributes attrs)
       throws RegionExistsException, TimeoutException {
     if (isClient()) {
@@ -3199,6 +3197,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> p_attrs,
       InternalRegionArguments internalRegionArgs)
       throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException {
@@ -3359,6 +3358,7 @@ public class GemFireCacheImpl
     return rgn;
   }
 
+  @Override
   public RegionAttributes invokeRegionBefore(LocalRegion parent, String name,
       RegionAttributes attrs, InternalRegionArguments internalRegionArgs) {
     for (RegionListener listener : regionListeners) {
@@ -3367,12 +3367,14 @@ public class GemFireCacheImpl
     return attrs;
   }
 
+  @Override
   public void invokeRegionAfter(LocalRegion region) {
     for (RegionListener listener : regionListeners) {
       listener.afterCreate(region);
     }
   }
 
+  @Override
   public final Region getRegion(String path) {
     return getRegion(path, false);
   }
@@ -3422,7 +3424,8 @@ public class GemFireCacheImpl
     return result;
   }
 
-  void setRegionByPath(String path, LocalRegion r) {
+  @Override
+  public void setRegionByPath(String path, LocalRegion r) {
     if (r == null) {
       this.pathToRegion.remove(path);
     } else {
@@ -3448,6 +3451,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public LocalRegion getRegionByPath(String path) {
     validatePath(path); // fix for bug 34892
 
@@ -3490,6 +3494,7 @@ public class GemFireCacheImpl
   /**
    * @param returnDestroyedRegion if true, okay to return a destroyed region
    */
+  @Override
   public Region getRegion(String path, boolean returnDestroyedRegion) {
     stopper.checkCancelInProgress(null);
     {
@@ -3600,6 +3605,7 @@ public class GemFireCacheImpl
     return result;
   }
 
+  @Override
   public Set rootRegions() {
     return rootRegions(false);
   }
@@ -3640,6 +3646,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire 5.7
    */
+  @Override
   public void cleanupForClient(CacheClientNotifier ccn, ClientProxyMembershipID client) {
     try {
       if (isClosed())
@@ -3657,14 +3664,17 @@ public class GemFireCacheImpl
     return this.isInitialized;
   }
 
+  @Override
   public boolean isClosed() {
     return this.isClosing;
   }
 
+  @Override
   public int getLockTimeout() {
     return this.lockTimeout;
   }
 
+  @Override
   public void setLockTimeout(int seconds) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3673,10 +3683,12 @@ public class GemFireCacheImpl
     this.lockTimeout = seconds;
   }
 
+  @Override
   public int getLockLease() {
     return this.lockLease;
   }
 
+  @Override
   public void setLockLease(int seconds) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3685,10 +3697,12 @@ public class GemFireCacheImpl
     this.lockLease = seconds;
   }
 
+  @Override
   public int getSearchTimeout() {
     return this.searchTimeout;
   }
 
+  @Override
   public void setSearchTimeout(int seconds) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3697,10 +3711,12 @@ public class GemFireCacheImpl
     this.searchTimeout = seconds;
   }
 
+  @Override
   public int getMessageSyncInterval() {
     return HARegionQueue.getMessageSyncInterval();
   }
 
+  @Override
   public void setMessageSyncInterval(int seconds) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -3719,7 +3735,8 @@ public class GemFireCacheImpl
    * reinitializing or this thread is interrupted. If a reinitializing region is found, then this
    * method blocks until reinitialization is complete and then returns the region.
    */
-  LocalRegion getReinitializingRegion(String fullPath) {
+  @Override
+  public LocalRegion getReinitializingRegion(String fullPath) {
     Future future = (Future) this.reinitializingRegions.get(fullPath);
     if (future == null) {
       return null;
@@ -3749,7 +3766,8 @@ public class GemFireCacheImpl
    *
    * @throws IllegalStateException if there is already a region by that name registered.
    */
-  void regionReinitializing(String fullPath) {
+  @Override
+  public void regionReinitializing(String fullPath) {
     Object old = this.reinitializingRegions.putIfAbsent(fullPath, new FutureResult(this.stopper));
     if (old != null) {
       throw new IllegalStateException(
@@ -3763,7 +3781,8 @@ public class GemFireCacheImpl
    *
    * @throws IllegalStateException if there is no region by that name registered as reinitializing.
    */
-  void regionReinitialized(Region region) {
+  @Override
+  public void regionReinitialized(Region region) {
     String regionName = region.getFullPath();
     FutureResult future = (FutureResult) this.reinitializingRegions.get(regionName);
     if (future == null) {
@@ -3780,23 +3799,18 @@ public class GemFireCacheImpl
    *
    * @throws IllegalStateException if cannot find reinitializing region registered by that name.
    */
-  void unregisterReinitializingRegion(String fullPath) {
-    /* Object previous = */this.reinitializingRegions.remove(fullPath);
-    // if (previous == null) {
-    // throw new IllegalStateException("Could not find a reinitializing region
-    // named " +
-    // fullPath);
-    // }
+  @Override
+  public void unregisterReinitializingRegion(String fullPath) {
+    this.reinitializingRegions.remove(fullPath);
   }
 
-  // /////////////////////////////////////////////////////////////
-
   /**
    * Returns true if get should give a copy; false if a reference.
    *
    * @since GemFire 4.0
    */
-  final boolean isCopyOnRead() {
+  @Override
+  public boolean isCopyOnRead() {
     return this.copyOnRead;
   }
 
@@ -3805,6 +3819,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire 4.0
    */
+  @Override
   public void setCopyOnRead(boolean copyOnRead) {
     this.copyOnRead = copyOnRead;
   }
@@ -3814,7 +3829,8 @@ public class GemFireCacheImpl
    *
    * @since GemFire 4.0
    */
-  final public boolean getCopyOnRead() {
+  @Override
+  public boolean getCopyOnRead() {
     return this.copyOnRead;
   }
 
@@ -3824,7 +3840,8 @@ public class GemFireCacheImpl
    * @param rootRgn the region to be removed
    * @return true if root region was removed, false if not found
    */
-  boolean removeRoot(LocalRegion rootRgn) {
+  @Override
+  public boolean removeRoot(LocalRegion rootRgn) {
     synchronized (this.rootRegions) {
       String rgnName = rootRgn.getName();
       LocalRegion found = (LocalRegion) this.rootRegions.get(rgnName);
@@ -3893,6 +3910,7 @@ public class GemFireCacheImpl
   }
 
   @SuppressWarnings("unchecked")
+  @Override
   public <T extends CacheService> T getService(Class<T> clazz) {
     return (T) services.get(clazz);
   }
@@ -3905,6 +3923,7 @@ public class GemFireCacheImpl
    *
    * @since GemFire 4.0
    */
+  @Override
   public CacheTransactionManager getCacheTransactionManager() {
     return this.txMgr;
   }
@@ -3925,6 +3944,7 @@ public class GemFireCacheImpl
    *
    * @return the timer, lazily created
    */
+  @Override
   public SystemTimer getCCPTimer() {
     synchronized (ccpTimerMutex) {
       if (ccpTimer != null) {
@@ -3952,6 +3972,7 @@ public class GemFireCacheImpl
    * Does a periodic purge of the CCPTimer to prevent a large number of cancelled tasks from
    * building up in it. See GEODE-2485.
    */
+  @Override
   public void purgeCCPTimer() {
     synchronized (ccpTimerMutex) {
       if (ccpTimer != null) {
@@ -3974,11 +3995,13 @@ public class GemFireCacheImpl
    *
    * @return the scheduler, lazily created
    */
+  @Override
   public ExpirationScheduler getExpirationScheduler() {
     return this.expirationScheduler;
   }
 
-  TXManagerImpl getTXMgr() {
+  @Override
+  public TXManagerImpl getTXMgr() {
     return this.txMgr;
   }
 
@@ -3988,10 +4011,12 @@ public class GemFireCacheImpl
    *
    * @since GemFire 3.5
    */
-  Executor getEventThreadPool() {
+  @Override
+  public Executor getEventThreadPool() {
     return this.eventThreadPool;
   }
 
+  @Override
   public CacheServer addCacheServer() {
     return addCacheServer(false);
   }
@@ -4105,6 +4130,7 @@ public class GemFireCacheImpl
    * 
    * @return List List of GatewaySender objects
    */
+  @Override
   public Set<GatewaySender> getGatewaySenders() {
     Set<GatewaySender> tempSet = new HashSet<GatewaySender>();
     for (GatewaySender sender : allGatewaySenders) {
@@ -4120,10 +4146,12 @@ public class GemFireCacheImpl
    * 
    * @return List List of GatewaySender objects
    */
+  @Override
   public Set<GatewaySender> getAllGatewaySenders() {
     return this.allGatewaySenders;
   }
 
+  @Override
   public GatewaySender getGatewaySender(String Id) {
     for (GatewaySender sender : this.allGatewaySenders) {
       if (sender.getId().equals(Id)) {
@@ -4133,14 +4161,17 @@ public class GemFireCacheImpl
     return null;
   }
 
+  @Override
   public Set<GatewayReceiver> getGatewayReceivers() {
     return this.allGatewayReceivers;
   }
 
+  @Override
   public Set<AsyncEventQueue> getAsyncEventQueues() {
     return this.allVisibleAsyncEventQueues;
   }
 
+  @Override
   public AsyncEventQueue getAsyncEventQueue(String id) {
     for (AsyncEventQueue asyncEventQueue : this.allAsyncEventQueues) {
       if (asyncEventQueue.getId().equals(id)) {
@@ -4167,6 +4198,7 @@ public class GemFireCacheImpl
   }
 
   /* Cache API - get the conflict resolver for WAN */
+  @Override
   public GatewayConflictResolver getGatewayConflictResolver() {
     synchronized (this.allGatewayHubsLock) {
       return this.gatewayConflictResolver;
@@ -4174,12 +4206,14 @@ public class GemFireCacheImpl
   }
 
   /* Cache API - set the conflict resolver for WAN */
+  @Override
   public void setGatewayConflictResolver(GatewayConflictResolver resolver) {
     synchronized (this.allGatewayHubsLock) {
       this.gatewayConflictResolver = resolver;
     }
   }
 
+  @Override
   public List<CacheServer> getCacheServers() {
     List cacheServersWithoutReceiver = null;
     if (!allCacheServers.isEmpty()) {
@@ -4326,7 +4360,8 @@ public class GemFireCacheImpl
    * @param r the partitioned region
    * @return true if the region should deliver all of its events to this cache
    */
-  protected boolean requiresNotificationFromPR(PartitionedRegion r) {
+  @Override
+  public boolean requiresNotificationFromPR(PartitionedRegion r) {
     boolean hasSerialSenders = hasSerialSenders(r);
     boolean result = hasSerialSenders;
     if (!result) {
@@ -4369,6 +4404,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public void setIsServer(boolean isServer) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -4378,6 +4414,7 @@ public class GemFireCacheImpl
     this.isServer = isServer;
   }
 
+  @Override
   public boolean isServer() {
     if (isClient()) {
       return false;
@@ -4391,6 +4428,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public QueryService getQueryService() {
     if (isClient()) {
       Pool p = getDefaultPool();
@@ -4405,6 +4443,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public QueryService getLocalQueryService() {
     return new DefaultQueryService(this);
   }
@@ -4413,10 +4452,8 @@ public class GemFireCacheImpl
    * @return Context jndi context associated with the Cache.
    * @since GemFire 4.0
    */
+  @Override
   public Context getJNDIContext() {
-    // if (isClient()) {
-    // throw new UnsupportedOperationException("operation is not supported on a client cache");
-    // }
     return JNDIInvoker.getJNDIContext();
   }
 
@@ -4424,16 +4461,15 @@ public class GemFireCacheImpl
    * @return JTA TransactionManager associated with the Cache.
    * @since GemFire 4.0
    */
+  @Override
   public javax.transaction.TransactionManager getJTATransactionManager() {
-    // if (isClient()) {
-    // throw new UnsupportedOperationException("operation is not supported on a client cache");
-    // }
     return JNDIInvoker.getTransactionManager();
   }
 
   /**
    * return the cq/interest information for a given region name, creating one if it doesn't exist
    */
+  @Override
   public FilterProfile getFilterProfile(String regionName) {
     LocalRegion r = (LocalRegion) getRegion(regionName, true);
     if (r != null) {
@@ -4442,10 +4478,12 @@ public class GemFireCacheImpl
     return null;
   }
 
+  @Override
   public RegionAttributes getRegionAttributes(String id) {
     return (RegionAttributes) this.namedRegionAttributes.get(id);
   }
 
+  @Override
   public void setRegionAttributes(String id, RegionAttributes attrs) {
     if (attrs == null) {
       this.namedRegionAttributes.remove(id);
@@ -4454,6 +4492,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public Map listRegionAttributes() {
     return Collections.unmodifiableMap(this.namedRegionAttributes);
   }
@@ -4468,6 +4507,7 @@ public class GemFireCacheImpl
     return (GemFireCacheImpl) xmlCache.get();
   }
 
+  @Override
   public void loadCacheXml(InputStream stream)
       throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
     // make this cache available to callbacks being initialized during xml create
@@ -4513,17 +4553,25 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public void readyForEvents() {
     PoolManagerImpl.readyForEvents(this.system, false);
   }
 
   private List<File> backupFiles = Collections.emptyList();
 
-  public InternalResourceManager getResourceManager() {
-    return getResourceManager(true);
+  @Override
+  public ResourceManager getResourceManager() {
+    return getInternalResourceManager(true);
+  }
+
+  @Override
+  public InternalResourceManager getInternalResourceManager() {
+    return getInternalResourceManager(true);
   }
 
-  public InternalResourceManager getResourceManager(boolean checkCancellationInProgress) {
+  @Override
+  public InternalResourceManager getInternalResourceManager(boolean checkCancellationInProgress) {
     if (checkCancellationInProgress) {
       stopper.checkCancelInProgress(null);
     }
@@ -4534,6 +4582,7 @@ public class GemFireCacheImpl
     this.backupFiles = backups;
   }
 
+  @Override
   public List<File> getBackupFiles() {
     return Collections.unmodifiableList(this.backupFiles);
   }
@@ -4548,6 +4597,7 @@ public class GemFireCacheImpl
     return manager;
   }
 
+  @Override
   public void clearBackupManager() {
     this.backupManager.set(null);
   }
@@ -4556,8 +4606,6 @@ public class GemFireCacheImpl
     return this.backupManager.get();
   }
 
-  // //////////////////// Inner Classes //////////////////////
-
   // TODO make this a simple int guarded by riWaiters and get rid of the double-check
   private final AtomicInteger registerInterestsInProgress = new AtomicInteger();
 
@@ -4569,6 +4617,7 @@ public class GemFireCacheImpl
   /**
    * update stats for completion of a registerInterest operation
    */
+  @Override
   public void registerInterestCompleted() {
     // Don't do a cancellation check, it's just a moot point, that's all
     // GemFireCache.this.getCancelCriterion().checkCancelInProgress(null);
@@ -4598,6 +4647,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public void registerInterestStarted() {
     // Don't do a cancellation check, it's just a moot point, that's all
     // GemFireCache.this.getCancelCriterion().checkCancelInProgress(null);
@@ -4608,9 +4658,6 @@ public class GemFireCacheImpl
   }
 
   /**
-   * update stats for initiation of a registerInterest operation
-   */
-  /**
    * Blocks until no register interests are in progress.
    */
   public void waitForRegisterInterestsInProgress() {
@@ -4811,6 +4858,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public TXManagerImpl getTxManager() {
     return this.txMgr;
   }
@@ -4818,6 +4866,7 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut atts) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -4829,6 +4878,7 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public <K, V> RegionFactory<K, V> createRegionFactory() {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -4839,6 +4889,7 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public <K, V> RegionFactory<K, V> createRegionFactory(String regionAttributesId) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -4849,6 +4900,7 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public <K, V> RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes) {
     if (isClient()) {
       throw new UnsupportedOperationException("operation is not supported on a client cache");
@@ -4859,10 +4911,12 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(ClientRegionShortcut atts) {
     return new ClientRegionFactoryImpl<K, V>(this, atts);
   }
 
+  @Override
   public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(String refid) {
     return new ClientRegionFactoryImpl<K, V>(this, refid);
   }
@@ -4870,6 +4924,7 @@ public class GemFireCacheImpl
   /**
    * @since GemFire 6.5
    */
+  @Override
   public QueryService getQueryService(String poolName) {
     Pool p = PoolManager.find(poolName);
     if (p == null) {
@@ -4879,6 +4934,7 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public RegionService createAuthenticatedView(Properties properties) {
     Pool pool = getDefaultPool();
     if (pool == null) {
@@ -4887,6 +4943,7 @@ public class GemFireCacheImpl
     return createAuthenticatedCacheView(pool, properties);
   }
 
+  @Override
   public RegionService createAuthenticatedView(Properties properties, String poolName) {
     Pool pool = PoolManager.find(poolName);
     if (pool == null) {
@@ -5193,10 +5250,12 @@ public class GemFireCacheImpl
     }
   }
 
+  @Override
   public void beginDestroy(String path, DistributedRegion region) {
     this.regionsInDestroy.putIfAbsent(path, region);
   }
 
+  @Override
   public void endDestroy(String path, DistributedRegion region) {
     this.regionsInDestroy.remove(path, region);
   }
@@ -5205,30 +5264,37 @@ public class GemFireCacheImpl
     return this.regionsInDestroy.get(path);
   }
 
+  @Override
   public TombstoneService getTombstoneService() {
     return this.tombstoneService;
   }
 
+  @Override
   public TypeRegistry getPdxRegistry() {
     return this.pdxRegistry;
   }
 
+  @Override
   public boolean getPdxReadSerialized() {
     return this.cacheConfig.pdxReadSerialized;
   }
 
+  @Override
   public PdxSerializer getPdxSerializer() {
     return this.cacheConfig.pdxSerializer;
   }
 
+  @Override
   public String getPdxDiskStore() {
     return this.cacheConfig.pdxDiskStore;
   }
 
+  @Override
   public boolean getPdxPersistent() {
     return this.cacheConfig.pdxPersistent;
   }
 
+  @Override
   public boolean getPdxIgnoreUnreadFields() {
     return this.cacheConfig.pdxIgnoreUnreadFields;
   }
@@ -5250,51 +5316,63 @@ public class GemFireCacheImpl
     return this.cacheConfig;
   }
 
+  @Override
   public DM getDistributionManager() {
     return this.dm;
   }
 
 
+  @Override
   public GatewaySenderFactory createGatewaySenderFactory() {
     return WANServiceProvider.createGatewaySenderFactory(this);
   }
 
+  @Override
   public GatewayReceiverFactory createGatewayReceiverFactory() {
     return WANServiceProvider.createGatewayReceiverFactory(this);
   }
 
+  @Override
   public AsyncEventQueueFactory createAsyncEventQueueFactory() {
     return new AsyncEventQueueFactoryImpl(this);
   }
 
+  @Override
   public DistributionAdvisor getDistributionAdvisor() {
     return getResourceAdvisor();
   }
 
+  @Override
   public ResourceAdvisor getResourceAdvisor() {
     return resourceAdvisor;
   }
 
+  @Override
   public Profile getProfile() {
     return resourceAdvisor.createProfile();
   }
 
+  @Override
   public DistributionAdvisee getParentAdvisee() {
     return null;
   }
 
+  @Override
   public InternalDistributedSystem getSystem() {
     return this.system;
   }
 
+  @Override
   public String getFullPath() {
     return "ResourceManager";
   }
 
+  @Override
   public void fillInProfile(Profile profile) {
     resourceManager.fillInProfile(profile);
   }
 
+  @Override
   public int getSerialNumber() {
     return this.serialNumber;
   }
@@ -5378,10 +5456,12 @@ public class GemFireCacheImpl
    */
   private TemporaryResultSetFactory resultSetFactory;
 
+  @Override
   public Declarable getInitializer() {
     return this.initializer;
   }
 
+  @Override
   public Properties getInitializerProps() {
     return this.initializerProps;
   }
@@ -5391,6 +5471,7 @@ public class GemFireCacheImpl
     this.initializerProps = initializerProps;
   }
 
+  @Override
   public PdxInstanceFactory createPdxInstanceFactory(String className) {
     return PdxInstanceFactoryImpl.newCreator(className, true);
   }
@@ -5399,6 +5480,7 @@ public class GemFireCacheImpl
     return PdxInstanceFactoryImpl.newCreator(className, b);
   }
 
+  @Override
   public PdxInstance createPdxEnum(String className, String enumName, int enumOrdinal) {
     return PdxInstanceFactoryImpl.createPdxEnum(className, enumName, enumOrdinal, this);
   }
@@ -5407,6 +5489,7 @@ public class GemFireCacheImpl
     return this.jmxAdvisor;
   }
 
+  @Override
   public CacheSnapshotService getSnapshotService() {
     return new CacheSnapshotServiceImpl(this);
   }
@@ -5422,6 +5505,7 @@ public class GemFireCacheImpl
     return this.resultSetFactory;
   }
 
+  @Override
   public MemoryAllocator getOffHeapStore() {
     return this.getSystem().getOffHeapStore();
   }
@@ -5443,6 +5527,7 @@ public class GemFireCacheImpl
     return clientFunctionTimeout;
   }
 
+  @Override
   public CqService getCqService() {
     return this.cqService;
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
index bcb3814..ee80014 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
@@ -15,32 +15,156 @@
 
 package org.apache.geode.internal.cache;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
 import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Executor;
+
+import javax.transaction.TransactionManager;
 
 import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionExistsException;
+import org.apache.geode.cache.TimeoutException;
+import org.apache.geode.cache.client.internal.ClientMetadataService;
+import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.internal.cq.CqService;
+import org.apache.geode.cache.wan.GatewaySender;
+import org.apache.geode.distributed.DistributedLockService;
 import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.cache.control.InternalResourceManager;
+import org.apache.geode.internal.cache.control.ResourceAdvisor;
 import org.apache.geode.internal.cache.extension.Extensible;
+import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.internal.offheap.MemoryAllocator;
+import org.apache.geode.pdx.internal.TypeRegistry;
 
 /**
  * The InternalCache interface is contract for implementing classes for defining internal cache
  * operations that should not be part of the "public" API of the implementing class.
- * </p>
- * 
+ *
  * @see org.apache.geode.cache.Cache
  * @since GemFire 7.0
  */
 public interface InternalCache extends Cache, Extensible<Cache> {
 
-  public DistributedMember getMyId();
+  DistributedMember getMyId();
+
+  Collection<DiskStoreImpl> listDiskStores();
+
+  Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned();
+
+  CqService getCqService();
+
+  <T extends CacheService> T getService(Class<T> clazz);
+
+  SystemTimer getCCPTimer();
+
+  void cleanupForClient(CacheClientNotifier ccn, ClientProxyMembershipID client);
+
+  void purgeCCPTimer();
+
+  FilterProfile getFilterProfile(String regionName);
+
+  Region getRegion(String path, boolean returnDestroyedRegion);
+
+  MemoryAllocator getOffHeapStore();
+
+  <K, V> Region<K, V> createVMRegion(String name, RegionAttributes<K, V> p_attrs,
+      InternalRegionArguments internalRegionArgs)
+      throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException;
+
+  DistributedLockService getPartitionedRegionLockService();
+
+  PersistentMemberManager getPersistentMemberManager();
+
+  Set<GatewaySender> getAllGatewaySenders();
+
+  CachePerfStats getCachePerfStats();
+
+  DM getDistributionManager();
+
+  void regionReinitialized(Region region);
+
+  void setRegionByPath(String path, LocalRegion r);
+
+  InternalResourceManager getInternalResourceManager();
+
+  ResourceAdvisor getResourceAdvisor();
+
+  boolean isCacheAtShutdownAll();
+
+  boolean requiresNotificationFromPR(PartitionedRegion r);
+
+  RegionAttributes invokeRegionBefore(LocalRegion parent, String name, RegionAttributes attrs,
+      InternalRegionArguments internalRegionArgs);
+
+  void invokeRegionAfter(LocalRegion region);
+
+  TXManagerImpl getTXMgr();
+
+  boolean forcedDisconnect();
+
+  InternalResourceManager getInternalResourceManager(boolean checkCancellationInProgress);
+
+  boolean isCopyOnRead();
+
+  TombstoneService getTombstoneService();
+
+  QueryService getLocalQueryService();
+
+  void registerInterestStarted();
+
+  void registerInterestCompleted();
+
+  void regionReinitializing(String fullPath);
+
+  void unregisterReinitializingRegion(String fullPath);
+
+  boolean removeRoot(LocalRegion rootRgn);
+
+  Executor getEventThreadPool();
+
+  LocalRegion getReinitializingRegion(String fullPath);
+
+  boolean keepDurableSubscriptionsAlive();
+
+  CacheClosedException getCacheClosedException(String reason, Throwable cause);
+
+  TypeRegistry getPdxRegistry();
+
+  DiskStoreImpl getOrCreateDefaultDiskStore();
+
+  ExpirationScheduler getExpirationScheduler();
+
+  TransactionManager getJTATransactionManager();
+
+  TXManagerImpl getTxManager();
+
+  void beginDestroy(String path, DistributedRegion region);
+
+  void endDestroy(String path, DistributedRegion region);
+
+  ClientMetadataService getClientMetadataService();
+
+  long cacheTimeMillis();
 
-  public Collection<DiskStoreImpl> listDiskStores();
+  void clearBackupManager();
 
-  public Collection<DiskStoreImpl> listDiskStoresIncludingDefault();
+  URL getCacheXmlURL();
 
-  public Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned();
+  List<File> getBackupFiles();
 
-  public CqService getCqService();
+  LocalRegion getRegionByPath(String path);
 
-  public <T extends CacheService> T getService(Class<T> clazz);
+  boolean isClient();
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 4b1786f..55ee6a8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -963,16 +963,16 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
         // register the region with resource manager to get memory events
         if (!newRegion.isInternalRegion()) {
           if (!newRegion.isDestroyed) {
-            cache.getResourceManager().addResourceListener(ResourceType.MEMORY, newRegion);
+            cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, newRegion);
 
             if (!newRegion.getOffHeap()) {
               newRegion.initialCriticalMembers(
-                  cache.getResourceManager().getHeapMonitor().getState().isCritical(),
+                  cache.getInternalResourceManager().getHeapMonitor().getState().isCritical(),
                   cache.getResourceAdvisor().adviseCritialMembers());
             } else {
-              newRegion.initialCriticalMembers(
-                  cache.getResourceManager().getHeapMonitor().getState().isCritical()
-                      || cache.getResourceManager().getOffHeapMonitor().getState().isCritical(),
+              newRegion.initialCriticalMembers(cache.getInternalResourceManager().getHeapMonitor()
+                  .getState().isCritical()
+                  || cache.getInternalResourceManager().getOffHeapMonitor().getState().isCritical(),
                   cache.getResourceAdvisor().adviseCritialMembers());
             }
 
@@ -999,7 +999,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
         if (!success) {
           this.cache.setRegionByPath(newRegion.getFullPath(), null);
           initializationFailed(newRegion);
-          cache.getResourceManager(false).removeResourceListener(newRegion);
+          cache.getInternalResourceManager(false).removeResourceListener(newRegion);
         }
       }
 
@@ -2348,7 +2348,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
       // Subclasses may have already called this method, but this is
       // acceptable because addResourceListener won't add it twice
       if (!this.isDestroyed) {
-        cache.getResourceManager().addResourceListener(ResourceType.MEMORY, this);
+        cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
       }
     }
 
@@ -2633,7 +2633,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     if (!isInternalRegion()) {
       getCachePerfStats().incRegions(-1);
     }
-    cache.getResourceManager(false).removeResourceListener(this);
+    cache.getInternalResourceManager(false).removeResourceListener(this);
     if (getMembershipAttributes().hasRequiredRoles()) {
       if (!isInternalRegion()) {
         getCachePerfStats().incReliableRegions(-1);
@@ -2734,7 +2734,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
 
       this.isDestroyed = true;
       // after isDestroyed is set to true call removeResourceListener to fix bug 49555
-      this.cache.getResourceManager(false).removeResourceListener(this);
+      this.cache.getInternalResourceManager(false).removeResourceListener(this);
       closeEntries();
       if (logger.isDebugEnabled()) {
         logger.debug("recursiveDestroyRegion: Region Destroyed: {}", getFullPath());
@@ -6581,7 +6581,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
       float evictionPercentage = DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE;
       // This is new to 6.5. If a heap lru region is created
       // we make sure that the eviction percentage is enabled.
-      InternalResourceManager rm = this.cache.getResourceManager();
+      InternalResourceManager rm = this.cache.getInternalResourceManager();
       if (!getOffHeap()) {
         if (!rm.getHeapMonitor().hasEvictionThreshold()) {
           float criticalPercentage = rm.getCriticalHeapPercentage();
@@ -7342,7 +7342,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     // mark as destroyed fixes 49555.
     this.isDestroyed = true;
     // after isDestroyed is set to true call removeResourceListener to fix bug 49555
-    this.cache.getResourceManager(false).removeResourceListener(this);
+    this.cache.getInternalResourceManager(false).removeResourceListener(this);
     closeEntries(); // fixes bug 41333
     this.destroyedSubregionSerialNumbers = collectSubregionSerialNumbers();
     try {

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
index 258a82e..d2f44e8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PRHARedundancyProvider.java
@@ -126,7 +126,8 @@ public class PRHARedundancyProvider {
    */
   public PRHARedundancyProvider(final PartitionedRegion region) {
     this.prRegion = region;
-    final InternalResourceManager resourceManager = region.getGemFireCache().getResourceManager();
+    final InternalResourceManager resourceManager =
+        region.getGemFireCache().getInternalResourceManager();
     recoveryExecutor = new OneTaskOnlyExecutor(resourceManager.getExecutor(),
         new OneTaskOnlyExecutor.ConflatedTaskListener() {
           public void taskDropped() {
@@ -1800,7 +1801,7 @@ public class PRHARedundancyProvider {
         && ColocationHelper.isColocationComplete(this.prRegion)) {
       Runnable task = new CreateMissingBucketsTask(this);
       final InternalResourceManager resourceManager =
-          this.prRegion.getGemFireCache().getResourceManager();
+          this.prRegion.getGemFireCache().getInternalResourceManager();
       resourceManager.getExecutor().execute(task);
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 614de4d..8db8969 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -910,7 +910,7 @@ public class PartitionedRegion extends LocalRegion
 
     if (!this.isDestroyed && !this.isLocallyDestroyed) {
       // Register at this point so that other members are known
-      this.cache.getResourceManager().addResourceListener(ResourceType.MEMORY, this);
+      this.cache.getInternalResourceManager().addResourceListener(ResourceType.MEMORY, this);
     }
 
     // Create OQL indexes before starting GII.
@@ -3722,7 +3722,7 @@ public class PartitionedRegion extends LocalRegion
 
     Set<InternalDistributedMember> dest = memberToBuckets.keySet();
     if (function.optimizeForWrite()
-        && cache.getResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
+        && cache.getInternalResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
         && !MemoryThresholds.isLowMemoryExceptionDisabled()) {
       Set<InternalDistributedMember> hcm = cache.getResourceAdvisor().adviseCritialMembers();
       Set<DistributedMember> sm = SetUtils.intersection(hcm, dest);
@@ -5653,7 +5653,7 @@ public class PartitionedRegion extends LocalRegion
     // destroy region message.
     this.redundancyProvider.waitForPersistentBucketRecovery();
     this.cache.removePartitionedRegion(this);
-    this.cache.getResourceManager(false).removeResourceListener(this);
+    this.cache.getInternalResourceManager(false).removeResourceListener(this);
     this.redundancyProvider.shutdown(); // see bug 41094
     int serials[] = getRegionAdvisor().getBucketSerials();
     RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_CLOSE, null, false,
@@ -7779,7 +7779,7 @@ public class PartitionedRegion extends LocalRegion
     } finally {
       this.getRegionAdvisor().close();
       getPrStats().close();
-      this.cache.getResourceManager(false).removeResourceListener(this);
+      this.cache.getInternalResourceManager(false).removeResourceListener(this);
       this.locallyDestroyingThread = null;
       if (logger.isDebugEnabled()) {
         logger.debug("destroyPartitionedRegionLocally: Ending destroy for PR = {}", this);
@@ -7815,7 +7815,7 @@ public class PartitionedRegion extends LocalRegion
     this.redundancyProvider.waitForPersistentBucketRecovery();
     // fix #39196 OOME caused by leak in GemFireCache.partitionedRegions
     this.cache.removePartitionedRegion(this);
-    this.cache.getResourceManager(false).removeResourceListener(this);
+    this.cache.getInternalResourceManager(false).removeResourceListener(this);
 
     final Operation op = event.getOperation();
     stopMissingColocatedRegionLogger();

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
index 42622d5..cd9eab3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/RebalanceOperationImpl.java
@@ -60,7 +60,7 @@ public class RebalanceOperationImpl implements RebalanceOperation {
   }
 
   public void start() {
-    final InternalResourceManager manager = this.cache.getResourceManager();
+    final InternalResourceManager manager = this.cache.getInternalResourceManager();
     synchronized (this.futureLock) {
       manager.addInProgressRebalance(this);
       this.scheduleRebalance();
@@ -68,7 +68,7 @@ public class RebalanceOperationImpl implements RebalanceOperation {
   }
 
   private void scheduleRebalance() {
-    ResourceManagerStats stats = cache.getResourceManager().getStats();
+    ResourceManagerStats stats = cache.getInternalResourceManager().getStats();
 
     long start = stats.startRebalance();
     try {
@@ -111,7 +111,7 @@ public class RebalanceOperationImpl implements RebalanceOperation {
 
   private Future<RebalanceResults> submitRebalanceTask(
       final PartitionedRegionRebalanceOp rebalanceOp, final long rebalanceStartTime) {
-    final InternalResourceManager manager = this.cache.getResourceManager();
+    final InternalResourceManager manager = this.cache.getInternalResourceManager();
     ScheduledExecutorService ex = manager.getExecutor();
 
     synchronized (futureLock) {
@@ -173,7 +173,7 @@ public class RebalanceOperationImpl implements RebalanceOperation {
         }
       }
       if (pendingTasks == 0) {
-        cache.getResourceManager().removeInProgressRebalance(this);
+        cache.getInternalResourceManager().removeInProgressRebalance(this);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
index f79a729..0151f00 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
@@ -26,7 +26,6 @@ import java.util.Set;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.CancelException;
-import org.apache.geode.DataSerializer;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.control.ResourceManager;
 import org.apache.geode.distributed.internal.DM;
@@ -36,9 +35,7 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.DSCODE;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
@@ -98,7 +95,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
       try {
         final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
         if (cache != null && !cache.isClosed()) {
-          final ResourceAdvisor ra = cache.getResourceManager().getResourceAdvisor();
+          final ResourceAdvisor ra = cache.getInternalResourceManager().getResourceAdvisor();
           if (this.profiles != null) {
             // Early reply to avoid waiting for the following putProfile call
             // to fire (remote) listeners so that the origin member can proceed with
@@ -238,7 +235,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
   }
 
   private InternalResourceManager getResourceManager() {
-    return ((GemFireCacheImpl) getAdvisee()).getResourceManager(false);
+    return ((GemFireCacheImpl) getAdvisee()).getInternalResourceManager(false);
   }
 
   @SuppressWarnings("synthetic-access")

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
index 1952c2a..6bb00fb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
@@ -182,7 +182,7 @@ public class MemberFunctionExecutor extends AbstractExecution {
       }
     }
     if (function.optimizeForWrite() && cache != null
-        && cache.getResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
+        && cache.getInternalResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
         && !MemoryThresholds.isLowMemoryExceptionDisabled()) {
       Set<InternalDistributedMember> hcm = cache.getResourceAdvisor().adviseCritialMembers();
       Set<DistributedMember> sm = SetUtils.intersection(hcm, dest);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
index 16baf46..c4c3a1a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
@@ -207,7 +207,7 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
     }
     final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
     if (function.optimizeForWrite() && cache != null
-        && cache.getResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
+        && cache.getInternalResourceManager().getHeapMonitor().containsHeapCriticalMembers(dest)
         && !MemoryThresholds.isLowMemoryExceptionDisabled()) {
       Set<InternalDistributedMember> hcm = cache.getResourceAdvisor().adviseCritialMembers();
       Set<DistributedMember> sm = SetUtils.intersection(hcm, dest);
@@ -384,8 +384,8 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
         }
       }
     }
-    if (function.optimizeForWrite()
-        && cache.getResourceManager().getHeapMonitor().containsHeapCriticalMembers(targetMembers)
+    if (function.optimizeForWrite() && cache.getInternalResourceManager().getHeapMonitor()
+        .containsHeapCriticalMembers(targetMembers)
         && !MemoryThresholds.isLowMemoryExceptionDisabled()) {
       Set<InternalDistributedMember> hcm = cache.getResourceAdvisor().adviseCritialMembers();
       Set<DistributedMember> sm = SetUtils.intersection(hcm, targetMembers);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
index 1f65569..6e0840a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
@@ -355,8 +355,8 @@ public class PartitionedRegionFunctionExecutor extends AbstractExecution {
         }
       }
     }
-    if (function.optimizeForWrite()
-        && cache.getResourceManager().getHeapMonitor().containsHeapCriticalMembers(targetMembers)
+    if (function.optimizeForWrite() && cache.getInternalResourceManager().getHeapMonitor()
+        .containsHeapCriticalMembers(targetMembers)
         && !MemoryThresholds.isLowMemoryExceptionDisabled()) {
       Set<InternalDistributedMember> hcm = cache.getResourceAdvisor().adviseCritialMembers();
       Set<DistributedMember> sm = SetUtils.intersection(hcm, targetMembers);

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
index cc2cd7e..2fd42f5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
@@ -269,7 +269,7 @@ public class HeapLRUCapacityController extends LRUAlgorithm {
        */
       public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
         final GemFireCacheImpl cache = (GemFireCacheImpl) region.getRegionService();
-        InternalResourceManager resourceManager = cache.getResourceManager();
+        InternalResourceManager resourceManager = cache.getInternalResourceManager();
         boolean offheap = region.getAttributes().getOffHeap();
         final boolean monitorStateIsEviction =
             resourceManager.getMemoryMonitor(offheap).getState().isEviction();
@@ -283,7 +283,7 @@ public class HeapLRUCapacityController extends LRUAlgorithm {
       @Override
       public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv) {
         InternalResourceManager resourceManager =
-            drv.getDiskStore().getCache().getResourceManager();
+            drv.getDiskStore().getCache().getInternalResourceManager();
         return resourceManager.getMemoryMonitor(drv.getOffHeap()).getState().isEviction();
       }
     };

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
index 51be10f..38f9b45 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionedRegionRebalanceOp.java
@@ -388,7 +388,7 @@ public class PartitionedRegionRebalanceOp {
   }
 
   private Map<PartitionedRegion, InternalPRInfo> fetchDetails(GemFireCacheImpl cache) {
-    LoadProbe probe = cache.getResourceManager().getLoadProbe();
+    LoadProbe probe = cache.getInternalResourceManager().getLoadProbe();
     Map<PartitionedRegion, InternalPRInfo> detailsMap =
         new LinkedHashMap<PartitionedRegion, InternalPRInfo>(colocatedRegions.size());
     for (PartitionedRegion colocatedRegion : colocatedRegions) {

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index a0810d9..b0b7d1b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache.xmlcache;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -31,15 +32,18 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
 import javax.naming.Context;
+import javax.transaction.TransactionManager;
 
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.GemFireIOException;
 import org.apache.geode.LogWriter;
 import org.apache.geode.cache.AttributesFactory;
 import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.CacheTransactionManager;
 import org.apache.geode.cache.CacheWriterException;
 import org.apache.geode.cache.Declarable;
@@ -59,6 +63,7 @@ import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
 import org.apache.geode.cache.client.Pool;
 import org.apache.geode.cache.client.PoolFactory;
 import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.ClientMetadataService;
 import org.apache.geode.cache.client.internal.PoolImpl;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.query.CqAttributes;
@@ -85,24 +90,42 @@ import org.apache.geode.cache.wan.GatewayReceiverFactory;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.cache.wan.GatewaySenderFactory;
 import org.apache.geode.cache.wan.GatewayTransportFilter;
+import org.apache.geode.distributed.DistributedLockService;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.cache.CachePerfStats;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.CacheConfig;
 import org.apache.geode.internal.cache.CacheServerLauncher;
 import org.apache.geode.internal.cache.CacheService;
 import org.apache.geode.internal.cache.DiskStoreFactoryImpl;
 import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.DistributedRegion;
+import org.apache.geode.internal.cache.ExpirationScheduler;
+import org.apache.geode.internal.cache.FilterProfile;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.InternalRegionArguments;
+import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PoolFactoryImpl;
 import org.apache.geode.internal.cache.PoolManagerImpl;
+import org.apache.geode.internal.cache.TXManagerImpl;
+import org.apache.geode.internal.cache.TombstoneService;
+import org.apache.geode.internal.cache.control.InternalResourceManager;
+import org.apache.geode.internal.cache.control.ResourceAdvisor;
 import org.apache.geode.internal.cache.extension.Extensible;
 import org.apache.geode.internal.cache.extension.ExtensionPoint;
 import org.apache.geode.internal.cache.extension.SimpleExtensionPoint;
 import org.apache.geode.internal.cache.ha.HARegionQueue;
+import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.cache.wan.AbstractGatewaySender;
 import org.apache.geode.internal.cache.wan.WANServiceProvider;
 import org.apache.geode.internal.cache.wan.InternalGatewaySenderFactory;
@@ -111,6 +134,7 @@ import org.apache.geode.internal.jndi.JNDIInvoker;
 import org.apache.geode.internal.logging.InternalLogWriter;
 import org.apache.geode.internal.logging.LocalLogWriter;
 import org.apache.geode.internal.logging.LogWriterFactory;
+import org.apache.geode.internal.offheap.MemoryAllocator;
 import org.apache.geode.pdx.PdxInstance;
 import org.apache.geode.pdx.PdxInstanceFactory;
 import org.apache.geode.pdx.PdxSerializer;
@@ -1262,6 +1286,16 @@ public class CacheCreation implements InternalCache {
     return Collections.unmodifiableList(this.backups);
   }
 
+  @Override
+  public LocalRegion getRegionByPath(final String path) {
+    return null;
+  }
+
+  @Override
+  public boolean isClient() {
+    return false;
+  }
+
   public GatewaySenderFactory createGatewaySenderFactory() {
     return WANServiceProvider.createGatewaySenderFactory(this);
   }
@@ -1414,11 +1448,6 @@ public class CacheCreation implements InternalCache {
   }
 
   @Override
-  public Collection<DiskStoreImpl> listDiskStoresIncludingDefault() {
-    return null;
-  }
-
-  @Override
   public Collection<DiskStoreImpl> listDiskStoresIncludingRegionOwned() {
     return null;
   }
@@ -1657,4 +1686,239 @@ public class CacheCreation implements InternalCache {
   public <T extends CacheService> T getService(Class<T> clazz) {
     throw new UnsupportedOperationException();
   }
+
+  @Override
+  public SystemTimer getCCPTimer() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void cleanupForClient(final CacheClientNotifier ccn,
+      final ClientProxyMembershipID client) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void purgeCCPTimer() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public FilterProfile getFilterProfile(final String regionName) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public Region getRegion(final String path, final boolean returnDestroyedRegion) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public MemoryAllocator getOffHeapStore() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public <K, V> Region<K, V> createVMRegion(final String name, final RegionAttributes<K, V> p_attrs,
+      final InternalRegionArguments internalRegionArgs)
+      throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public DistributedLockService getPartitionedRegionLockService() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public PersistentMemberManager getPersistentMemberManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public Set<GatewaySender> getAllGatewaySenders() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public CachePerfStats getCachePerfStats() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public DM getDistributionManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void regionReinitialized(final Region region) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void setRegionByPath(final String path, final LocalRegion r) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public InternalResourceManager getInternalResourceManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public ResourceAdvisor getResourceAdvisor() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean isCacheAtShutdownAll() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean requiresNotificationFromPR(final PartitionedRegion r) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public RegionAttributes invokeRegionBefore(final LocalRegion parent, final String name,
+      final RegionAttributes attrs, final InternalRegionArguments internalRegionArgs) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void invokeRegionAfter(final LocalRegion region) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public TXManagerImpl getTXMgr() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean forcedDisconnect() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public InternalResourceManager getInternalResourceManager(
+      final boolean checkCancellationInProgress) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean isCopyOnRead() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public TombstoneService getTombstoneService() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public QueryService getLocalQueryService() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void registerInterestStarted() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void registerInterestCompleted() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void regionReinitializing(final String fullPath) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void unregisterReinitializingRegion(final String fullPath) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean removeRoot(final LocalRegion rootRgn) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public Executor getEventThreadPool() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public LocalRegion getReinitializingRegion(final String fullPath) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public boolean keepDurableSubscriptionsAlive() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public CacheClosedException getCacheClosedException(final String reason, final Throwable cause) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public TypeRegistry getPdxRegistry() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public DiskStoreImpl getOrCreateDefaultDiskStore() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public ExpirationScheduler getExpirationScheduler() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public TransactionManager getJTATransactionManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public TXManagerImpl getTxManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void beginDestroy(final String path, final DistributedRegion region) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void endDestroy(final String path, final DistributedRegion region) {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public ClientMetadataService getClientMetadataService() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public long cacheTimeMillis() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public void clearBackupManager() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
+
+  @Override
+  public URL getCacheXmlURL() {
+    throw new UnsupportedOperationException(LocalizedStrings.SHOULDNT_INVOKE.toLocalizedString());
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/11560117/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index d7bf9d0..1559aad 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -391,7 +391,7 @@ public class MemberMBeanBridge {
     QueryDataFunction qDataFunction = new QueryDataFunction();
     FunctionService.registerFunction(qDataFunction);
 
-    this.resourceManagerStats = cache.getResourceManager().getStats();
+    this.resourceManagerStats = cache.getInternalResourceManager().getStats();
   }
 
 


[11/51] [abbrv] geode git commit: GEODE-2764: Addition checks on region name

Posted by ds...@apache.org.
GEODE-2764: Addition checks on region name

	* If a region name contains function calls like entrySet()
	* The from clause is substring-ed at '.' from the right
	* Each substing is checked to see if the region name is valid.

	This closes #449


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

Branch: refs/heads/feature/GEODE-2097
Commit: 0714c27c9c9262d29baead9c594ee44f740eb122
Parents: ed300c5
Author: nabarun <nn...@pivotal.io>
Authored: Thu Apr 13 15:38:16 2017 -0700
Committer: nabarun <nn...@pivotal.io>
Committed: Fri Apr 14 10:14:52 2017 -0700

----------------------------------------------------------------------
 .../cli/functions/CreateIndexFunction.java      |  31 ++++-
 ...nfigurationIndexWithFromClauseDUnitTest.java | 120 +++++++++++++++++++
 2 files changed, 147 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/0714c27c/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
index ca164ac..8a65f7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
@@ -25,7 +25,6 @@ import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.RegionNotFoundException;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.domain.IndexInfo;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
@@ -69,9 +68,8 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
           queryService.createIndex(indexName, indexedExpression, fromClause);
       }
 
-      XmlEntity xmlEntity =
-          new XmlEntity(CacheXml.REGION, "name", cache.getRegion(regionPath).getName());
-      context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity));
+      regionPath = getValidRegionName(cache, regionPath);
+      setResultInSender(context, indexInfo, memberId, cache, regionPath);
     } catch (IndexExistsException e) {
       String message =
           CliStrings.format(CliStrings.CREATE_INDEX__INDEX__EXISTS, indexInfo.getIndexName());
@@ -93,6 +91,31 @@ public class CreateIndexFunction extends FunctionAdapter implements InternalEnti
     }
   }
 
+  private void setResultInSender(FunctionContext context, IndexInfo indexInfo, String memberId,
+      Cache cache, String regionPath) {
+    if (regionPath == null) {
+      String message = CliStrings.format(CliStrings.CREATE_INDEX__INVALID__REGIONPATH,
+          indexInfo.getRegionPath());
+      context.getResultSender().lastResult(new CliFunctionResult(memberId, false, message));
+    } else {
+      XmlEntity xmlEntity =
+          new XmlEntity(CacheXml.REGION, "name", cache.getRegion(regionPath).getName());
+      context.getResultSender().lastResult(new CliFunctionResult(memberId, xmlEntity));
+    }
+  }
+
+  private String getValidRegionName(Cache cache, String regionPath) {
+    while (regionPath != null && cache.getRegion(regionPath) == null) {
+      int dotPosition;
+      if (regionPath.contains(".") && ((dotPosition = regionPath.lastIndexOf('.')) != -1)) {
+        regionPath = regionPath.substring(0, dotPosition);
+      } else {
+        regionPath = null;
+      }
+    }
+    return regionPath;
+  }
+
   @Override
   public String getId() {
     return CreateIndexFunction.class.getName();

http://git-wip-us.apache.org/repos/asf/geode/blob/0714c27c/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
new file mode 100644
index 0000000..5a15506
--- /dev/null
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.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 org.apache.geode.management.internal.configuration;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.util.Properties;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+@Category(DistributedTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class ClusterConfigurationIndexWithFromClauseDUnitTest {
+
+  final String REGION_NAME = "region";
+  final String INDEX_NAME = "index";
+
+  protected RegionShortcut[] getRegionTypes() {
+    return new RegionShortcut[] {RegionShortcut.PARTITION, RegionShortcut.PARTITION_PERSISTENT,
+        RegionShortcut.PARTITION_REDUNDANT, RegionShortcut.PARTITION_REDUNDANT_PERSISTENT,
+        RegionShortcut.REPLICATE, RegionShortcut.REPLICATE_PERSISTENT};
+
+  }
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshShellConnectionRule gfshShellConnectionRule = new GfshShellConnectionRule();
+
+  private MemberVM locator = null;
+
+  @Before
+  public void before() throws Exception {
+    locator = lsRule.startLocatorVM(0);
+  }
+
+  @Test
+  @Parameters(method = "getRegionTypes")
+  public void indexCreatedWithEntrySetInFromClauseMustPersist(RegionShortcut regionShortcut)
+      throws Exception {
+    MemberVM vm1 = lsRule.startServerVM(1, locator.getPort());
+    gfshShellConnectionRule.connectAndVerify(locator);
+    createRegionUsingGfsh(REGION_NAME, regionShortcut, null);
+    createIndexUsingGfsh("\"" + REGION_NAME + ".entrySet() z\"", "z.key", INDEX_NAME);
+    String serverName = vm1.getName();
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
+    gfshShellConnectionRule.executeAndVerifyCommand(csb.toString());
+    lsRule.stopMember(1);
+    lsRule.startServerVM(1, lsRule.getMember(0).getPort());;
+    verifyIndexRecreated(INDEX_NAME);
+  }
+
+  private void verifyIndexRecreated(String indexName) throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
+    CommandResult commandResult = gfshShellConnectionRule.executeAndVerifyCommand(csb.toString());
+    String resultAsString = commandResultToString(commandResult);
+    assertEquals(Result.Status.OK, commandResult.getStatus());
+    assertTrue(resultAsString.contains(indexName));
+  }
+
+  private String commandResultToString(final CommandResult commandResult) {
+    assertNotNull(commandResult);
+    commandResult.resetToFirstLine();
+    StringBuilder buffer = new StringBuilder(commandResult.getHeader());
+    while (commandResult.hasNextLine()) {
+      buffer.append(commandResult.nextLine());
+    }
+    buffer.append(commandResult.getFooter());
+    return buffer.toString();
+  }
+
+  private void createIndexUsingGfsh(String regionName, String expression, String indexName)
+      throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_INDEX);
+    csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
+    csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
+    csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
+    gfshShellConnectionRule.executeAndVerifyCommand(csb.toString());
+  }
+
+  private void createRegionUsingGfsh(String regionName, RegionShortcut regionShortCut, String group)
+      throws Exception {
+    CommandStringBuilder csb = new CommandStringBuilder(CliStrings.CREATE_REGION);
+    csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
+    csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
+    csb.addOptionWithValueCheck(CliStrings.CREATE_REGION__GROUP, group);
+    gfshShellConnectionRule.executeAndVerifyCommand(csb.toString());
+  }
+}


[44/51] [abbrv] geode git commit: GEODE-576 & GEODE-516: GemFireDeadlockDetectorDUnitTest failures

Posted by ds...@apache.org.
GEODE-576 & GEODE-516: GemFireDeadlockDetectorDUnitTest failures

Replaced pauses with Awaitility.  Modified asyncs to use the DUnit
blackboard to synchronize their actions for repeatable behavior.
Cleaned up static locks to allow their reuse in other tests or in
repeating the same test.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 50686b0b44024d2bcbb4bea8a36ce3a40ac158c2
Parents: 5891ed7
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Fri Apr 21 09:05:07 2017 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Fri Apr 21 09:06:14 2017 -0700

----------------------------------------------------------------------
 .../GemFireDeadlockDetectorDUnitTest.java       | 116 +++++++++++--------
 .../geode/test/dunit/DUnitBlackboard.java       |  13 +++
 .../test/dunit/internal/InternalBlackboard.java |   5 +
 .../dunit/internal/InternalBlackboardImpl.java  |   5 +
 4 files changed, 91 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/50686b0b/geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
index e0bbde0..4a03c2d 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
@@ -14,34 +14,14 @@
  */
 package org.apache.geode.distributed.internal.deadlock;
 
-import org.apache.geode.test.dunit.ThreadUtils;
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import org.awaitility.Awaitility;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.FunctionService;
 import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.cache30.CacheTestCase;
 import org.apache.geode.distributed.DistributedLockService;
 import org.apache.geode.distributed.DistributedSystemDisconnectedException;
 import org.apache.geode.distributed.LockServiceDestroyedException;
@@ -54,7 +34,20 @@ import org.apache.geode.test.dunit.LogWriterUtils;
 import org.apache.geode.test.dunit.SerializableCallable;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.junit.categories.FlakyTest;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 @Category(DistributedTest.class)
 public class GemFireDeadlockDetectorDUnitTest extends JUnit4CacheTestCase {
@@ -108,7 +101,8 @@ public class GemFireDeadlockDetectorDUnitTest extends JUnit4CacheTestCase {
 
   private static final Lock lock = new ReentrantLock();
 
-  @Category(FlakyTest.class) // GEODE-516 & GEODE-576: async actions, thread sleeps, time sensitive
+  // @Category(FlakyTest.class) // GEODE-516 & GEODE-576: async actions, thread sleeps, time
+  // sensitive
   @Test
   public void testDistributedDeadlockWithFunction() throws Throwable {
     Host host = Host.getHost(0);
@@ -117,41 +111,62 @@ public class GemFireDeadlockDetectorDUnitTest extends JUnit4CacheTestCase {
     getSystem();
     InternalDistributedMember member1 = createCache(vm0);
     final InternalDistributedMember member2 = createCache(vm1);
+    getBlackboard().initBlackboard();
 
     // Have two threads lock locks on different members in different orders.
 
+    String gateOnMember1 = "gateOnMember1";
+    String gateOnMember2 = "gateOnMember2";
 
     // This thread locks the lock member1 first, then member2.
-    AsyncInvocation async1 = lockTheLocks(vm0, member2);
-    // This thread locks the lock member2 first, then member1.
-    AsyncInvocation async2 = lockTheLocks(vm1, member1);
+    AsyncInvocation async1 = lockTheLocks(vm0, member2, gateOnMember1, gateOnMember2);
 
-    Thread.sleep(5000);
-    GemFireDeadlockDetector detect = new GemFireDeadlockDetector();
-    LinkedList<Dependency> deadlock = detect.find().findCycle();
-    LogWriterUtils.getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
-    assertEquals(8, deadlock.size());
-    stopStuckThreads();
-    async1.getResult(30000);
-    async2.getResult(30000);
+    // This thread locks the lock member2 first, then member1.
+    AsyncInvocation async2 = lockTheLocks(vm1, member1, gateOnMember2, gateOnMember1);
+    try {
+      final LinkedList<Dependency> deadlockHolder[] = new LinkedList[1];
+      Awaitility.await("waiting for deadlock").atMost(20, TimeUnit.SECONDS).until(() -> {
+        GemFireDeadlockDetector detect = new GemFireDeadlockDetector();
+        LinkedList<Dependency> deadlock = detect.find().findCycle();
+        if (deadlock != null) {
+          deadlockHolder[0] = deadlock;
+        }
+        return deadlock != null;
+      });
+      LinkedList<Dependency> deadlock = deadlockHolder[0];
+      LogWriterUtils.getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
+      assertEquals(8, deadlock.size());
+      stopStuckThreads();
+    } finally {
+      try {
+        waitForAsyncInvocation(async1, 45, TimeUnit.SECONDS);
+      } finally {
+        waitForAsyncInvocation(async2, 45, TimeUnit.SECONDS);
+      }
+    }
   }
 
 
 
-  private AsyncInvocation lockTheLocks(VM vm0, final InternalDistributedMember member) {
+  private AsyncInvocation lockTheLocks(VM vm0, final InternalDistributedMember member,
+      final String gateToSignal, final String gateToWaitOn) {
     return vm0.invokeAsync(new SerializableRunnable() {
 
       public void run() {
         lock.lock();
         try {
-          Thread.sleep(1000);
-        } catch (InterruptedException e) {
-          Assert.fail("interrupted", e);
+          try {
+            getBlackboard().signalGate(gateToSignal);
+            getBlackboard().waitForGate(gateToWaitOn, 10, TimeUnit.SECONDS);
+          } catch (TimeoutException | InterruptedException e) {
+            throw new RuntimeException("failed", e);
+          }
+          ResultCollector collector = FunctionService.onMember(member).execute(new TestFunction());
+          // wait the function to lock the lock on member.
+          collector.getResult();
+        } finally {
+          lock.unlock();
         }
-        ResultCollector collector = FunctionService.onMember(member).execute(new TestFunction());
-        // wait the function to lock the lock on member.
-        collector.getResult();
-        lock.unlock();
       }
     });
   }
@@ -244,14 +259,19 @@ public class GemFireDeadlockDetectorDUnitTest extends JUnit4CacheTestCase {
 
 
     public void execute(FunctionContext context) {
+      boolean acquired = false;
       try {
         stuckThreads.add(Thread.currentThread());
-        lock.tryLock(LOCK_WAIT_TIME, TimeUnit.SECONDS);
+        acquired = lock.tryLock(LOCK_WAIT_TIME, TimeUnit.SECONDS);
       } catch (InterruptedException e) {
-        // ingore
+        // ignore
+      } finally {
+        if (acquired) {
+          lock.unlock();
+        }
+        stuckThreads.remove(Thread.currentThread());
+        context.getResultSender().lastResult(null);
       }
-      stuckThreads.remove(Thread.currentThread());
-      context.getResultSender().lastResult(null);
     }
 
     public String getId() {

http://git-wip-us.apache.org/repos/asf/geode/blob/50686b0b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitBlackboard.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitBlackboard.java b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitBlackboard.java
index a097cd4e..62c92bd 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitBlackboard.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitBlackboard.java
@@ -56,6 +56,7 @@ public class DUnitBlackboard {
    * signals a boolean gate
    */
   public void signalGate(String gateName) {
+    // System.out.println(Thread.currentThread().getName()+": signaling gate " + gateName);
     try {
       blackboard.signalGate(gateName);
     } catch (RemoteException e) {
@@ -68,6 +69,7 @@ public class DUnitBlackboard {
    */
   public void waitForGate(String gateName, long timeout, TimeUnit units)
       throws TimeoutException, InterruptedException {
+    // System.out.println(Thread.currentThread().getName()+": waiting for gate " + gateName);
     try {
       blackboard.waitForGate(gateName, timeout, units);
     } catch (RemoteException e) {
@@ -77,6 +79,17 @@ public class DUnitBlackboard {
   }
 
   /**
+   * clear a gate
+   */
+  public void clearGate(String gateName) {
+    try {
+      blackboard.clearGate(gateName);
+    } catch (RemoteException e) {
+      throw new RuntimeException("remote call failed", e);
+    }
+  }
+
+  /**
    * test to see if a gate has been signeled
    */
   public boolean isGateSignaled(String gateName) {

http://git-wip-us.apache.org/repos/asf/geode/blob/50686b0b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboard.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboard.java b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboard.java
index 63f833b..bc5b9b7 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboard.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboard.java
@@ -50,6 +50,11 @@ public interface InternalBlackboard extends Remote, Serializable {
       throws RemoteException, TimeoutException, InterruptedException;
 
   /**
+   * clears a gate
+   */
+  void clearGate(String gateName) throws RemoteException;
+
+  /**
    * test to see if a gate has been signeled
    */
   boolean isGateSignaled(String gateName) throws RemoteException;

http://git-wip-us.apache.org/repos/asf/geode/blob/50686b0b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboardImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboardImpl.java b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboardImpl.java
index e7657ed..feeae15 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboardImpl.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/internal/InternalBlackboardImpl.java
@@ -79,6 +79,11 @@ public class InternalBlackboardImpl extends UnicastRemoteObject implements Inter
   }
 
   @Override
+  public void clearGate(final String gateName) throws RemoteException {
+    gates.remove(gateName);
+  }
+
+  @Override
   public void signalGate(final String gateName) throws RemoteException {
     gates.put(gateName, Boolean.TRUE);
   }


[40/51] [abbrv] geode git commit: GEODE-728: Rename Execution.withArgs to Execution.setArguments

Posted by ds...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index d85b810..3592ec0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -217,8 +217,8 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
                 origVals.add(val);
                 region.put(i.next(), val);
               }
-              ResultCollector rc =
-                  dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+              ResultCollector rc = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
+                  .execute(function.getId());
               int resultSize = ((List) rc.getResult()).size();
               resultReceived_Aggregate += resultSize;
               resultReceived_TESTFUNCTION2 += resultSize;
@@ -227,7 +227,8 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
               noOfExecutionsCompleted_Aggregate++;
               noOfExecutionsCompleted_TESTFUNCTION2++;
 
-              rc = dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function.getId());
+              rc = dataSet.withFilter(testKeysSet).setArguments(testKeysSet)
+                  .execute(function.getId());
               resultSize = ((List) rc.getResult()).size();
               resultReceived_Aggregate += resultSize;
               resultReceived_TESTFUNCTION2 += resultSize;
@@ -238,7 +239,8 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
 
               function = new TestFunction(true, TestFunction.TEST_FUNCTION3);
               FunctionService.registerFunction(function);
-              rc = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+              rc = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
+                  .execute(function.getId());
               resultSize = ((List) rc.getResult()).size();
               resultReceived_Aggregate += resultSize;
               resultReceived_TESTFUNCTION3 += resultSize;
@@ -548,7 +550,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
         Execution member = FunctionService.onServers(pool);
 
         try {
-          ResultCollector rs = member.withArgs(Boolean.TRUE).execute(function.getId());
+          ResultCollector rs = member.setArguments(Boolean.TRUE).execute(function.getId());
           int size = ((List) rs.getResult()).size();
           resultReceived_Aggregate += size;
           noOfExecutionCalls_Aggregate++;
@@ -568,7 +570,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
           for (int i = 0; i < 20; i++) {
             testKeysSet.add("execKey-" + i);
           }
-          ResultCollector rs = member.withArgs("Success").execute(function.getId());
+          ResultCollector rs = member.setArguments("Success").execute(function.getId());
           int size = ((List) rs.getResult()).size();
           resultReceived_Aggregate += size;
           noOfExecutionCalls_Aggregate++;
@@ -771,19 +773,19 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION2);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function);
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function);
         int size = ((List) rc1.getResult()).size();
         resultReceived_Aggregate += size;
         resultReceived_TESTFUNCTION2 += size;
 
-        rc1 = dataSet.withArgs(testKeys).execute(function);
+        rc1 = dataSet.setArguments(testKeys).execute(function);
         size = ((List) rc1.getResult()).size();
         resultReceived_Aggregate += size;
         resultReceived_TESTFUNCTION2 += size;
 
         function = new TestFunction(true, TestFunction.TEST_FUNCTION3);
         FunctionService.registerFunction(function);
-        rc1 = dataSet.withArgs(Boolean.TRUE).execute(function);
+        rc1 = dataSet.setArguments(Boolean.TRUE).execute(function);
         size = ((List) rc1.getResult()).size();
         resultReceived_Aggregate += size;
         resultReceived_TESTFUNCTION3 += size;
@@ -942,7 +944,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
           public Object call() throws Exception {
             Region region = getCache().getRegion(rName);
             try {
-              List list = (List) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+              List list = (List) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
                   .execute(TestFunction.TEST_FUNCTION2).getResult();
               // this is the Distributed Region with Empty Data policy.
               // therefore no function execution takes place here. it only receives the results.
@@ -1057,7 +1059,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
         DistributedMember localmember = ds.getDistributedMember();
         memberExecution = FunctionService.onMember(ds, localmember);
 
-        memberExecution.withArgs("Key");
+        memberExecution.setArguments("Key");
         try {
           ResultCollector rc = memberExecution.execute(inlineFunction);
           int size = ((List) rc.getResult()).size();
@@ -1198,7 +1200,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase {
           Function function = new TestFunction(true, "TestFunctionException");
           FunctionService.registerFunction(function);
           Execution dataSet = FunctionService.onRegion(pr);
-          ResultCollector rc = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+          ResultCollector rc = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
           // Wait Criterion is added to make sure that the function execution
           // happens on all nodes and all nodes get the FunctionException so that the stats will get
           // incremented,

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
index a0ed90d..5b6f065 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
@@ -143,7 +143,7 @@ public class LocalFunctionExecutionDUnitTest extends JUnit4DistributedTestCase {
       Function function1 = new TestFunction(true, TestFunction.TEST_FUNCTION_EXCEPTION);
       FunctionService.registerFunction(function1);
       ResultCollector rc =
-          FunctionService.onRegion(region).withArgs(Boolean.TRUE).execute(function1.getId());
+          FunctionService.onRegion(region).setArguments(Boolean.TRUE).execute(function1.getId());
       rc.getResult();
       Assert.fail("Exception should occur", new Exception("Test Failed"));
     } catch (Exception e) {
@@ -157,7 +157,7 @@ public class LocalFunctionExecutionDUnitTest extends JUnit4DistributedTestCase {
       FunctionService.registerFunction(function1);
       DistributedMember localmember = getSystemStatic().getDistributedMember();
       ResultCollector rc = FunctionService.onMember(getSystemStatic(), localmember)
-          .withArgs(Boolean.TRUE).execute(function1.getId());
+          .setArguments(Boolean.TRUE).execute(function1.getId());
       rc.getResult();
       Assert.fail("Exception should occur", new Exception("Test Failed"));
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
index 3fa944a..1bc00a8 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
@@ -379,7 +379,7 @@ public class MemberFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
     DistributedMember localmember = ds.getDistributedMember();
     Execution memberExcution = null;
     memberExcution = FunctionService.onMember(ds, localmember);
-    Execution executor = memberExcution.withArgs("Key");
+    Execution executor = memberExcution.setArguments("Key");
     try {
       ResultCollector rc = executor.execute(new FunctionAdapter() {
         @Override
@@ -492,7 +492,7 @@ public class MemberFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
       memberExcution = (InternalExecution) FunctionService.onMembers(ds, memberSet);
     }
     try {
-      ResultCollector rc = memberExcution.withArgs(Boolean.TRUE).execute(function);
+      ResultCollector rc = memberExcution.setArguments(Boolean.TRUE).execute(function);
       List li = (ArrayList) rc.getResult();
       LogWriterUtils.getLogWriter()
           .info("MemberFunctionExecutionDUnitTest#excuteOnMembers: Result : " + li);
@@ -569,7 +569,7 @@ public class MemberFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
       memberSet.remove(localVM);
       memberExcution = FunctionService.onMembers(ds, memberSet);
     }
-    Execution executor = memberExcution.withArgs("Key");
+    Execution executor = memberExcution.setArguments("Key");
     try {
       ResultCollector rc = executor.execute(new FunctionAdapter() {
         @Override
@@ -612,7 +612,7 @@ public class MemberFunctionExecutionDUnitTest extends JUnit4CacheTestCase {
     assertNotNull(ds);
     Function function = new TestFunction(false, TEST_FUNCTION6);
     Execution memberExcution = FunctionService.onMembers(ds);
-    Execution executor = memberExcution.withArgs("Key");
+    Execution executor = memberExcution.setArguments("Key");
     try {
       ResultCollector rc = executor.execute(function.getId());
       rc.getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
index 1d85c58..6be9980 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
@@ -237,7 +237,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = FunctionService.onMembers("gm");
         ArrayList<String> args = new ArrayList<String>();
         args.add("gm");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         if (registerFunction) {
           e.execute(OnGroupsFunction.Id).getResult();
         } else {
@@ -258,7 +258,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = FunctionService.onMembers("g0");
         ArrayList<String> args = new ArrayList<String>();
         args.add("g0");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         if (registerFunction) {
           e.execute(OnGroupsFunction.Id).getResult();
         } else {
@@ -278,7 +278,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = FunctionService.onMembers("g1");
         ArrayList<String> args = new ArrayList<String>();
         args.add("g1");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         if (registerFunction) {
           e.execute(OnGroupsFunction.Id).getResult();
         } else {
@@ -300,7 +300,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         ArrayList<String> args = new ArrayList<String>();
         args.add("g0");
         args.add("g1");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         if (registerFunction) {
           e.execute(OnGroupsFunction.Id).getResult();
         } else {
@@ -511,7 +511,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = FunctionService.onMembers("mg");
         ArrayList<String> args = new ArrayList<String>();
         args.add("runtime");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         try {
           e.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -520,7 +520,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         }
 
         Execution e1 = FunctionService.onMembers("g1");
-        e1 = e1.withArgs(args);
+        e1 = e1.setArguments(args);
         try {
           e1.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -531,7 +531,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         // fail on only one member
         Execution e2 = FunctionService.onMembers("g1");
         args.add("g2");
-        e2 = e2.withArgs(args);
+        e2 = e2.setArguments(args);
         try {
           e2.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -562,7 +562,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e1 = FunctionService.onMembers("g1");
         ArrayList<String> args = new ArrayList<String>();
         args.add("shutdown");
-        e1 = e1.withArgs(args);
+        e1 = e1.setArguments(args);
         try {
           e1.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -594,7 +594,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         ArrayList<String> args = new ArrayList<String>();
         args.add("shutdown");
         args.add("g2");
-        e1 = e1.withArgs(args);
+        e1 = e1.setArguments(args);
         try {
           e1.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -626,7 +626,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         ArrayList<String> args = new ArrayList<String>();
         args.add("shutdown");
         args.add("g2");
-        e1 = e1.withArgs(args);
+        e1 = e1.setArguments(args);
         ((AbstractExecution) e1).setIgnoreDepartedMembers(true);
         ArrayList l = (ArrayList) e1.execute(new OnGroupsExceptionFunction()).getResult();
         assertEquals(2, l.size());
@@ -705,7 +705,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         if (withArgs) {
           ArrayList<String> args = new ArrayList<String>();
           args.add("g0");
-          e = e.withArgs(args);
+          e = e.setArguments(args);
         }
         if (register) {
           e.execute(OnGroupsFunction.Id).getResult();
@@ -728,7 +728,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         if (withArgs) {
           ArrayList<String> args = new ArrayList<String>();
           args.add("mg");
-          e = e.withArgs(args);
+          e = e.setArguments(args);
         }
         if (register) {
           e.execute(OnGroupsFunction.Id).getResult();
@@ -752,7 +752,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
           ArrayList<String> args = new ArrayList<String>();
           args.add("g0");
           args.add("g1");
-          e = e.withArgs(args);
+          e = e.setArguments(args);
         }
         if (register) {
           e.execute(OnGroupsFunction.Id).getResult();
@@ -977,7 +977,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = InternalFunctionService.onServers(c, "mg");
         ArrayList<String> args = new ArrayList<String>();
         args.add("runtime");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         try {
           e.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -986,7 +986,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         }
 
         Execution e1 = InternalFunctionService.onServers(c, "g1");
-        e1 = e1.withArgs(args);
+        e1 = e1.setArguments(args);
         try {
           e1.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -997,7 +997,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         // only one member
         Execution e2 = InternalFunctionService.onServers(c, "g1");
         args.add("g2");
-        e2 = e2.withArgs(args);
+        e2 = e2.setArguments(args);
         try {
           e2.execute(new OnGroupsExceptionFunction()).getResult();
           fail("expected exception not thrown");
@@ -1045,7 +1045,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         Execution e = InternalFunctionService.onServers(c, "g1");
         ArrayList<String> args = new ArrayList<String>();
         args.add("disconnect");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
 
         IgnoredException.addIgnoredException("FunctionInvocationTargetException");
         try {
@@ -1096,7 +1096,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         ArrayList<String> args = new ArrayList<String>();
         args.add("disconnect");
         args.add("g2");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         IgnoredException.addIgnoredException("FunctionInvocationTargetException");
         try {
           e.execute(new OnGroupsExceptionFunction()).getResult();
@@ -1146,7 +1146,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends JUnit4DistributedTestCas
         ArrayList<String> args = new ArrayList<String>();
         args.add("disconnect");
         args.add("g2");
-        e = e.withArgs(args);
+        e = e.setArguments(args);
         ((AbstractExecution) e).setIgnoreDepartedMembers(true);
         ArrayList l = (ArrayList) e.execute(new OnGroupsExceptionFunction()).getResult();
         LogWriterUtils.getLogWriter().info("SWAP:result:" + l);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
index e5464bb..4aa36a4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
@@ -235,19 +235,19 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
     if (isByName.booleanValue()) {// by name
       if (toRegister.booleanValue()) {
         LogWriterUtils.getLogWriter().info("The function name to execute : " + function.getId());
-        Execution me = member.withArgs(args);
+        Execution me = member.setArguments(args);
         LogWriterUtils.getLogWriter().info("The args passed  : " + args);
         return me.execute(function.getId());
       } else {
         LogWriterUtils.getLogWriter()
             .info("The function name to execute : (without Register) " + function.getId());
-        Execution me = member.withArgs(args);
+        Execution me = member.setArguments(args);
         LogWriterUtils.getLogWriter().info("The args passed  : " + args);
         return me.execute(function.getId(), function.hasResult(), function.isHA(),
             function.optimizeForWrite());
       }
     } else { // By Instance
-      return member.withArgs(args).execute(function);
+      return member.setArguments(args).execute(function);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
index e4a85b0..3d18067 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
@@ -606,7 +606,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
       Integer val = new Integer(j++);
       region.put(i.next(), val);
     }
-    List list = (List) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+    List list = (List) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
         .execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
@@ -672,7 +672,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
     try {
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
       List l = ((List) rc1.getResult());
       LogWriterUtils.getLogWriter().info("Result size : " + l.size());
       assertEquals(3, l.size());
@@ -696,7 +696,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     FunctionService.registerFunction(function);
     Execution dataSet = FunctionService.onRegion(region);
     ResultCollector rc1 =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
     List l = ((List) rc1.getResult());
     LogWriterUtils.getLogWriter().info("Result size : " + l.size());
     return l;
@@ -993,7 +993,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
       }
       List l = null;
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             @Override
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
@@ -1045,28 +1045,29 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     }
     ResultCollector rc1 = null;
     try {
-      rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
-        @Override
-        public void execute(FunctionContext context) {
-          if (((RegionFunctionContext) context).isPossibleDuplicate()) {
-            context.getResultSender().lastResult(new Integer(retryCount));
-            return;
-          }
-          if (context.getArguments() instanceof Boolean) {
-            throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
-          }
-        }
+      rc1 =
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
+            @Override
+            public void execute(FunctionContext context) {
+              if (((RegionFunctionContext) context).isPossibleDuplicate()) {
+                context.getResultSender().lastResult(new Integer(retryCount));
+                return;
+              }
+              if (context.getArguments() instanceof Boolean) {
+                throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
+              }
+            }
 
-        @Override
-        public String getId() {
-          return getClass().getName();
-        }
+            @Override
+            public String getId() {
+              return getClass().getName();
+            }
 
-        @Override
-        public boolean hasResult() {
-          return true;
-        }
-      });
+            @Override
+            public boolean hasResult() {
+              return true;
+            }
+          });
 
       List list = (ArrayList) rc1.getResult();
       assertEquals(list.get(0), 0);
@@ -1120,7 +1121,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     }
     Function function = new TestFunction(false, TEST_FUNCTION2);
     Execution dataSet = FunctionService.onRegion(region);
-    dataSet.withArgs(Boolean.TRUE).execute(function);
+    dataSet.setArguments(Boolean.TRUE).execute(function);
     region.put(new Integer(2), "KB_2");
     assertEquals("KB_2", region.get(new Integer(2)));
   }
@@ -1130,7 +1131,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     assertNotNull(region);
     Function function = new TestFunction(false, TEST_FUNCTION2);
     Execution dataSet = FunctionService.onServer(pool);
-    dataSet.withArgs(Boolean.TRUE).execute(function);
+    dataSet.setArguments(Boolean.TRUE).execute(function);
     region.put(new Integer(1), "KB_1");
     assertEquals("KB_1", region.get(new Integer(1)));
   }
@@ -1190,14 +1191,14 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     Execution dataSet = FunctionService.onRegion(region);
     region.put(testKey, new Integer(1));
     ((AbstractExecution) dataSet).removeFunctionAttributes(TestFunction.TEST_FUNCTION2);
-    ResultCollector rs =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(TestFunction.TEST_FUNCTION2);
+    ResultCollector rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
+        .execute(TestFunction.TEST_FUNCTION2);
     assertEquals(Boolean.TRUE, ((List) rs.getResult()).get(0));
     byte[] functionAttributes =
         ((AbstractExecution) dataSet).getFunctionAttributes(TestFunction.TEST_FUNCTION2);
     assertNotNull(functionAttributes);
 
-    rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE)
+    rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
         .execute(TestFunction.TEST_FUNCTION2);
     assertEquals(Boolean.TRUE, ((List) rs.getResult()).get(0));
     assertNotNull(functionAttributes);
@@ -1371,7 +1372,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
           .info("<ExpectedException action=add>" + "No target node found for KEY = "
               + "|Server could not send the reply" + "|Unexpected exception during"
               + "</ExpectedException>");
-      dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         @Override
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
@@ -1406,7 +1407,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     region.put(testKey, new Integer(1));
 
     ResultCollector rs =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -1429,7 +1430,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
     assertEquals("Failure", ((List) rs.getResult()).get(0));
 
     ResultCollector rs2 =
-        dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new FunctionAdapter() {
+        dataSet.withFilter(testKeysSet).setArguments(testKey).execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -1483,7 +1484,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
           .info("<ExpectedException action=add>"
               + "Could not create an instance of  org.apache.geode.internal.cache.execute.PRClientServerRegionFunctionExecutionDUnitTest$UnDeserializable"
               + "</ExpectedException>");
-      dataSet.withFilter(testKeysSet).withArgs(new UnDeserializable())
+      dataSet.withFilter(testKeysSet).setArguments(new UnDeserializable())
           .execute(new FunctionAdapter() {
             @Override
             public void execute(FunctionContext context) {
@@ -1519,9 +1520,9 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
   private static ResultCollector execute(Execution dataSet, Set testKeysSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function.getId());
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function);
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
index bc7e061..e61ce84 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
@@ -483,7 +483,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends PRCl
 
   public static Object executeFunction() {
     Execution execute = FunctionService.onRegion(region);
-    ResultCollector rc = execute.withArgs(Boolean.TRUE)
+    ResultCollector rc = execute.setArguments(Boolean.TRUE)
         .execute(new TestFunction(true, TestFunction.TEST_FUNCTION_LASTRESULT));
     LogWriterUtils.getLogWriter().info("Exeuction Result :" + rc.getResult());
     List l = ((List) rc.getResult());

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
index 0925bc5..ff4ca42 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
@@ -436,7 +436,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
       Integer val = new Integer(j++);
       region.put(i.next(), val);
     }
-    HashMap resultMap = (HashMap) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+    HashMap resultMap = (HashMap) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
         .execute(new FunctionAdapter() {
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -511,7 +511,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
     Execution dataSet = FunctionService.onRegion(region);
     try {
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
 
       HashMap resultMap = ((HashMap) rc1.getResult());
       assertEquals(3, resultMap.size());
@@ -549,7 +549,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
     FunctionService.registerFunction(function);
     Execution dataSet = FunctionService.onRegion(region);
     ResultCollector rc1 =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
     List l = ((List) rc1.getResult());
     LogWriterUtils.getLogWriter().info("Result size : " + l.size());
     return l;
@@ -880,7 +880,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
       }
       List l = null;
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -929,25 +929,26 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
     }
     ResultCollector rc1 = null;
     try {
-      rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
-        public void execute(FunctionContext context) {
-          if (((RegionFunctionContext) context).isPossibleDuplicate()) {
-            context.getResultSender().lastResult(new Integer(retryCount));
-            return;
-          }
-          if (context.getArguments() instanceof Boolean) {
-            throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
-          }
-        }
+      rc1 =
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
+            public void execute(FunctionContext context) {
+              if (((RegionFunctionContext) context).isPossibleDuplicate()) {
+                context.getResultSender().lastResult(new Integer(retryCount));
+                return;
+              }
+              if (context.getArguments() instanceof Boolean) {
+                throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
+              }
+            }
 
-        public String getId() {
-          return getClass().getName();
-        }
+            public String getId() {
+              return getClass().getName();
+            }
 
-        public boolean hasResult() {
-          return true;
-        }
-      });
+            public boolean hasResult() {
+              return true;
+            }
+          });
 
       List list = (ArrayList) rc1.getResult();
       assertEquals(list.get(0), 0);
@@ -1078,7 +1079,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
           .info("<ExpectedException action=add>" + "No target node found for KEY = "
               + "|Server could not send the reply" + "|Unexpected exception during"
               + "</ExpectedException>");
-      dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -1109,7 +1110,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
     region.put(testKey, new Integer(1));
     try {
       ResultCollector rs =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -1129,7 +1130,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
       assertEquals("Failure", ((List) rs.getResult()).get(0));
 
       ResultCollector rs2 =
-          dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(testKey).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -1158,18 +1159,18 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest
   private static ResultCollector execute(Execution dataSet, Set testKeysSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function.getId());
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function);
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function);
     }
   }
 
   private static ResultCollector executeOnAll(Execution dataSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withArgs(args).execute(function.getId());
+      return dataSet.setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withArgs(args).execute(function);
+      return dataSet.setArguments(args).execute(function);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
index 43540a8..a06d7e6 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
@@ -414,7 +414,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
       Integer val = new Integer(j++);
       region.put(i.next(), val);
     }
-    HashMap resultMap = (HashMap) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+    HashMap resultMap = (HashMap) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
         .execute(new FunctionAdapter() {
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -489,7 +489,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
     Execution dataSet = FunctionService.onRegion(region);
     try {
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
 
       HashMap resultMap = ((HashMap) rc1.getResult());
       assertEquals(3, resultMap.size());
@@ -527,7 +527,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
     FunctionService.registerFunction(function);
     Execution dataSet = FunctionService.onRegion(region);
     ResultCollector rc1 =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
     List l = ((List) rc1.getResult());
     LogWriterUtils.getLogWriter().info("Result size : " + l.size());
     return l;
@@ -851,7 +851,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
       }
       List l = null;
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -900,25 +900,26 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
     }
     ResultCollector rc1 = null;
     try {
-      rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
-        public void execute(FunctionContext context) {
-          if (((RegionFunctionContext) context).isPossibleDuplicate()) {
-            context.getResultSender().lastResult(new Integer(retryCount));
-            return;
-          }
-          if (context.getArguments() instanceof Boolean) {
-            throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
-          }
-        }
+      rc1 =
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
+            public void execute(FunctionContext context) {
+              if (((RegionFunctionContext) context).isPossibleDuplicate()) {
+                context.getResultSender().lastResult(new Integer(retryCount));
+                return;
+              }
+              if (context.getArguments() instanceof Boolean) {
+                throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
+              }
+            }
 
-        public String getId() {
-          return getClass().getName();
-        }
+            public String getId() {
+              return getClass().getName();
+            }
 
-        public boolean hasResult() {
-          return true;
-        }
-      });
+            public boolean hasResult() {
+              return true;
+            }
+          });
 
       List list = (ArrayList) rc1.getResult();
       assertEquals(list.get(0), 0);
@@ -1049,7 +1050,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
           .info("<ExpectedException action=add>" + "No target node found for KEY = "
               + "|Server could not send the reply" + "|Unexpected exception during"
               + "</ExpectedException>");
-      dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -1080,7 +1081,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
     region.put(testKey, new Integer(1));
     try {
       ResultCollector rs =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -1100,7 +1101,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
       assertEquals("Failure", ((List) rs.getResult()).get(0));
 
       ResultCollector rs2 =
-          dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(testKey).execute(new FunctionAdapter() {
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
                 context.getResultSender().lastResult("Success");
@@ -1129,18 +1130,18 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest
   private static ResultCollector execute(Execution dataSet, Set testKeysSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function.getId());
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function);
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function);
     }
   }
 
   private static ResultCollector executeOnAll(Execution dataSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withArgs(args).execute(function.getId());
+      return dataSet.setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withArgs(args).execute(function);
+      return dataSet.setArguments(args).execute(function);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
index d5d3d64..40b653c 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
@@ -449,7 +449,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
       Integer val = new Integer(j++);
       region.put(i.next(), val);
     }
-    HashMap resultMap = (HashMap) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+    HashMap resultMap = (HashMap) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
         .execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
@@ -525,7 +525,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
     Execution dataSet = FunctionService.onRegion(region);
     try {
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
 
       HashMap resultMap = ((HashMap) rc1.getResult());
       assertEquals(3, resultMap.size());
@@ -561,7 +561,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
     FunctionService.registerFunction(function);
     Execution dataSet = FunctionService.onRegion(region);
     ResultCollector rc1 =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
     List l = ((List) rc1.getResult());
     LogWriterUtils.getLogWriter().info("Result size : " + l.size());
     return l;
@@ -889,7 +889,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
       }
       List l = null;
       ResultCollector rc1 =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             @Override
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
@@ -941,28 +941,29 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
     }
     ResultCollector rc1 = null;
     try {
-      rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
-        @Override
-        public void execute(FunctionContext context) {
-          if (((RegionFunctionContext) context).isPossibleDuplicate()) {
-            context.getResultSender().lastResult(new Integer(retryCount));
-            return;
-          }
-          if (context.getArguments() instanceof Boolean) {
-            throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
-          }
-        }
+      rc1 =
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
+            @Override
+            public void execute(FunctionContext context) {
+              if (((RegionFunctionContext) context).isPossibleDuplicate()) {
+                context.getResultSender().lastResult(new Integer(retryCount));
+                return;
+              }
+              if (context.getArguments() instanceof Boolean) {
+                throw new FunctionInvocationTargetException("I have been thrown from TestFunction");
+              }
+            }
 
-        @Override
-        public String getId() {
-          return getClass().getName();
-        }
+            @Override
+            public String getId() {
+              return getClass().getName();
+            }
 
-        @Override
-        public boolean hasResult() {
-          return true;
-        }
-      });
+            @Override
+            public boolean hasResult() {
+              return true;
+            }
+          });
 
       List list = (ArrayList) rc1.getResult();
       assertEquals(list.get(0), 0);
@@ -1093,7 +1094,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
           .info("<ExpectedException action=add>" + "No target node found for KEY = "
               + "|Server could not send the reply" + "|Unexpected exception during"
               + "</ExpectedException>");
-      dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         @Override
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
@@ -1127,7 +1128,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
     region.put(testKey, new Integer(1));
     try {
       ResultCollector rs =
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
             @Override
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
@@ -1150,7 +1151,7 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
       assertEquals("Failure", ((List) rs.getResult()).get(0));
 
       ResultCollector rs2 =
-          dataSet.withFilter(testKeysSet).withArgs(testKey).execute(new FunctionAdapter() {
+          dataSet.withFilter(testKeysSet).setArguments(testKey).execute(new FunctionAdapter() {
             @Override
             public void execute(FunctionContext context) {
               if (context.getArguments() instanceof String) {
@@ -1182,18 +1183,18 @@ public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest
   private static ResultCollector execute(Execution dataSet, Set testKeysSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function.getId());
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withFilter(testKeysSet).withArgs(args).execute(function);
+      return dataSet.withFilter(testKeysSet).setArguments(args).execute(function);
     }
   }
 
   private static ResultCollector executeOnAll(Execution dataSet, Serializable args,
       Function function, Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
-      return dataSet.withArgs(args).execute(function.getId());
+      return dataSet.setArguments(args).execute(function.getId());
     } else { // By Instance
-      return dataSet.withArgs(args).execute(function);
+      return dataSet.setArguments(args).execute(function);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
index 9576330..b9674dd 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java
@@ -139,7 +139,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         Execution dataSet = FunctionService.onRegion(pr);
         ResultCollector result =
-            dataSet.withArgs(Boolean.TRUE).withFilter(testKeysSet).execute(function);
+            dataSet.setArguments(Boolean.TRUE).withFilter(testKeysSet).execute(function);
         System.out.println("KBKBKB : Result I got : " + result.getResult());
         return Boolean.TRUE;
       }
@@ -179,7 +179,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         try {
           Execution dataSet = FunctionService.onRegion(pr);
-          dataSet.withFilter(testKeysSet).withArgs(testKey).execute(function);
+          dataSet.withFilter(testKeysSet).setArguments(testKey).execute(function);
           fail("It should have failed with Function attributes don't match");
         } catch (Exception expected) {
           expected.printStackTrace();
@@ -239,24 +239,24 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
         }
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs1.getResult()).get(0));
         ResultCollector rs2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKey).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKey).execute(function.getId());
         assertEquals(new Integer(1), ((List) rs2.getResult()).get(0));
 
         HashMap putData = new HashMap();
         putData.put(testKey + "1", new Integer(2));
         putData.put(testKey + "2", new Integer(3));
         ResultCollector rs3 =
-            dataSet.withFilter(testKeysSet).withArgs(putData).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(putData).execute(function.getId());
         assertEquals(Boolean.TRUE, ((List) rs3.getResult()).get(0));
 
         assertEquals(new Integer(2), pr.get(testKey + "1"));
@@ -299,7 +299,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         pr.put(testKey, new Integer(1));
         try {
           ResultCollector rs1 =
-              dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+              dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           List list = (ArrayList) rs1.getResult();
           assertEquals(list.get(0), 5);
         } catch (Throwable e) {
@@ -364,7 +364,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         pr.put(testKey, new Integer(1));
         try {
           ResultCollector rs1 =
-              dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+              dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           List list = (ArrayList) rs1.getResult();
           assertEquals(list.get(0), 5);
         } catch (Throwable e) {
@@ -425,7 +425,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Execution dataSet = FunctionService.onRegion(pr); // withCollector(rs);
 
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
 
         } catch (Exception expected) {
           // No data should cause exec to throw
@@ -434,15 +434,17 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         assertEquals(Boolean.TRUE, ((List) rs1.getResult()).get(0));
-        ResultCollector rs2 = dataSet.withFilter(testKeysSet).withArgs(testKey).execute(function);
+        ResultCollector rs2 =
+            dataSet.withFilter(testKeysSet).setArguments(testKey).execute(function);
         assertEquals(new Integer(1), ((List) rs2.getResult()).get(0));
 
         HashMap putData = new HashMap();
         putData.put(testKey + "1", new Integer(2));
         putData.put(testKey + "2", new Integer(3));
-        ResultCollector rs3 = dataSet.withFilter(testKeysSet).withArgs(putData).execute(function);
+        ResultCollector rs3 =
+            dataSet.withFilter(testKeysSet).setArguments(putData).execute(function);
         assertEquals(Boolean.TRUE, ((List) rs3.getResult()).get(0));
 
         assertEquals(new Integer(2), pr.get(testKey + "1"));
@@ -496,8 +498,8 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         DistributedSystem.setThreadsSocketPolicy(false);
         Execution dataSet = FunctionService.onRegion(pr);
         pr.put(testKey, new Integer(1));
-        ResultCollector rs1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+        ResultCollector rs1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
+            .execute(new FunctionAdapter() {
               @Override
               public void execute(FunctionContext context) {
                 if (context.getArguments() instanceof String) {
@@ -577,7 +579,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Execution dataSet = FunctionService.onRegion(pr);
 
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           assertTrue(expected.getMessage(),
               expected.getMessage().contains("No target node found for KEY"));
@@ -591,7 +593,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           pr.put(i.next(), val);
         }
         ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rs.getResult());
         assertEquals(3, l.size());
 
@@ -601,7 +603,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
         ResultCollector rc2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(testKeysSet).execute(function.getId());
         List l2 = ((List) rc2.getResult());
         assertEquals(3, l2.size());
         HashSet foundVals = new HashSet();
@@ -688,7 +690,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION_LASTRESULT);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc2 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc2 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc2.getResult());
         return l;
       }
@@ -749,7 +751,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION_LASTRESULT);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc2 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc2 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc2.getResult());
         return l;
       }
@@ -825,7 +827,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
         try {
           ResultCollector rs =
-              dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+              dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           List list = (ArrayList) rs.getResult();
           assertEquals(list.get(0), 5);
         } catch (Throwable e) {
@@ -1036,7 +1038,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
     FunctionService.registerFunction(function);
     Execution dataSet = FunctionService.onRegion(pr);
     ResultCollector rs =
-        dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+        dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
     List l = ((List) rs.getResult());
     return l;
   }
@@ -1095,8 +1097,8 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           origVals.add(val);
           pr.put(i.next(), val);
         }
-        ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+        ResultCollector rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE)
+            .execute(new FunctionAdapter() {
               @Override
               public void execute(FunctionContext context) {
                 if (context.getArguments() instanceof String) {
@@ -1184,7 +1186,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           pr.put(i.next(), val);
         }
         ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rs.getResult());
         assertEquals(3, l.size());
 
@@ -1256,7 +1258,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
         ResultCollector rs;
         try {
-          rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           rs.getResult();
         } catch (Exception expected) {
           expected.printStackTrace();
@@ -1332,8 +1334,8 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           pr.put(i.next(), val);
         }
         // long startTime = System.currentTimeMillis();
-        ResultCollector rs =
-            dataSet.withFilter(testKeysSet).withArgs("TestingTimeOut").execute(function.getId());
+        ResultCollector rs = dataSet.withFilter(testKeysSet).setArguments("TestingTimeOut")
+            .execute(function.getId());
         // long endTime = System.currentTimeMillis();
         List l = ((List) rs.getResult(10000, TimeUnit.MILLISECONDS));
         assertEquals(3, l.size()); // this test may fail..but rarely
@@ -1404,7 +1406,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
         ResultCollector rs;
         try {
-          rs = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          rs = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
           rs.getResult();
         } catch (Exception expected) {
           assertTrue(expected.getMessage()
@@ -1470,7 +1472,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         } catch (Exception expected) {
           // No data should cause exec to throw
           LogWriterUtils.getLogWriter().warning("Exception Occured : " + expected.getMessage());
@@ -1488,7 +1490,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
         // DefaultResultCollector rc1 = new DefaultResultCollector();
         ResultCollector rc1 =
-            dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+            dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         List l = ((List) rc1.getResult());
         assertEquals(3, l.size());
 
@@ -1498,7 +1500,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
         ResultCollector rc2 =
-            dataSet.withFilter(testKeysSet).withArgs(testKeysSet).execute(function);
+            dataSet.withFilter(testKeysSet).setArguments(testKeysSet).execute(function);
         List l2 = ((List) rc2.getResult());
         // assertIndexDetailsEquals(pr.getTotalNumberOfBuckets(), l2.size());
         assertEquals(3, l2.size());
@@ -1753,7 +1755,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         final HashSet testKeysSet = new HashSet();
         testKeysSet.add(testKey);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function.getId());
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
@@ -1773,7 +1775,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
 
         ResultCollector rc1 =
-            dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         // assertIndexDetailsEquals(pr.getTotalNumberOfBuckets(), l.size());
         assertEquals(1, l.size());
@@ -1783,7 +1785,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
         ResultCollector rc2 =
-            dataSet.withFilter(testKeys).withArgs(testKeys).execute(function.getId());
+            dataSet.withFilter(testKeys).setArguments(testKeys).execute(function.getId());
         List l2 = ((List) rc2.getResult());
         assertEquals(1, l2.size());
 
@@ -1829,7 +1831,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         final HashSet testKeysSet = new HashSet();
         testKeysSet.add(testKey);
         try {
-          dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+          dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         } catch (Exception expected) {
           // No data should cause exec to throw
           assertTrue(expected.getMessage().contains("No target node found for KEY = " + testKey));
@@ -1849,7 +1851,8 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
 
         // DefaultResultCollector rc1 = new DefaultResultCollector();
-        ResultCollector rc1 = dataSet.withFilter(testKeys).withArgs(Boolean.TRUE).execute(function);
+        ResultCollector rc1 =
+            dataSet.withFilter(testKeys).setArguments(Boolean.TRUE).execute(function);
         List l = ((List) rc1.getResult());
         assertEquals(1, l.size());
         for (Iterator i = l.iterator(); i.hasNext();) {
@@ -1857,7 +1860,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         }
 
         // DefaultResultCollector rc2 = new DefaultResultCollector();
-        ResultCollector rc2 = dataSet.withFilter(testKeys).withArgs(testKeys).execute(function);
+        ResultCollector rc2 = dataSet.withFilter(testKeys).setArguments(testKeys).execute(function);
         List l2 = ((List) rc2.getResult());
         assertEquals(1, l2.size());
 
@@ -1932,14 +1935,14 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           FunctionService.registerFunction(function);
           Execution dataSet = FunctionService.onRegion(pr);
           ResultCollector rc1 =
-              dataSet.withFilter(singleKeySet).withArgs(Boolean.TRUE).execute(function.getId());
+              dataSet.withFilter(singleKeySet).setArguments(Boolean.TRUE).execute(function.getId());
           List l = ((List) rc1.getResult());
           assertEquals(1, l.size());
           assertEquals(Boolean.TRUE, l.iterator().next());
 
           // DefaultResultCollector rc2 = new DefaultResultCollector();
-          ResultCollector rc2 = dataSet.withFilter(singleKeySet).withArgs(new HashSet(singleKeySet))
-              .execute(function.getId());
+          ResultCollector rc2 = dataSet.withFilter(singleKeySet)
+              .setArguments(new HashSet(singleKeySet)).execute(function.getId());
           List l2 = ((List) rc2.getResult());
 
           assertEquals(1, l2.size());
@@ -2009,14 +2012,14 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           FunctionService.registerFunction(function);
           Execution dataSet = FunctionService.onRegion(pr);
           ResultCollector rc1 =
-              dataSet.withFilter(singleKeySet).withArgs(Boolean.TRUE).execute(function);
+              dataSet.withFilter(singleKeySet).setArguments(Boolean.TRUE).execute(function);
           List l = ((List) rc1.getResult());
           assertEquals(1, l.size());
           assertEquals(Boolean.TRUE, l.iterator().next());
 
           // DefaultResultCollector rc2 = new DefaultResultCollector();
-          ResultCollector rc2 = dataSet.withFilter(singleKeySet).withArgs(new HashSet(singleKeySet))
-              .execute(function);
+          ResultCollector rc2 = dataSet.withFilter(singleKeySet)
+              .setArguments(new HashSet(singleKeySet)).execute(function);
           List l2 = ((List) rc2.getResult());
 
           assertEquals(1, l2.size());
@@ -2083,7 +2086,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION2);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function.getId());
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function.getId());
         List l = ((List) rc1.getResult());
         LogWriterUtils.getLogWriter()
             .info("PRFunctionExecutionDUnitTest#testExecutionOnAllNodes_byName : Result size :"
@@ -2166,7 +2169,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION2);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(function);
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(function);
 
         List l = ((List) rc1.getResult());
         assertEquals(3, l.size());
@@ -2228,7 +2231,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           assertTrue(pr.getBucketKeys(bid).size() > 0);
         }
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -2328,7 +2331,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
           assertTrue(pr.getBucketKeys(bid).size() > 0);
         }
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+        ResultCollector rc1 = dataSet.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
             if (context.getArguments() instanceof String) {
@@ -2425,7 +2428,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
         Function function = new TestFunction(true, TestFunction.TEST_FUNCTION3);
         FunctionService.registerFunction(function);
         Execution dataSet = FunctionService.onRegion(pr);
-        ResultCollector rc1 = dataSet.withArgs(testKeys).execute(function.getId());
+        ResultCollector rc1 = dataSet.setArguments(testKeys).execute(function.getId());
 
         List l = ((List) rc1.getResult());
         assertEquals(4, l.size());
@@ -2824,7 +2827,7 @@ public class PRFunctionExecutionDUnitTest extends PartitionedRegionDUnitTestCase
     keysForGet.add("KEY_7");
     try {
       Execution execution =
-          FunctionService.onRegion(region).withFilter(keysForGet).withArgs(Boolean.TRUE);
+          FunctionService.onRegion(region).withFilter(keysForGet).setArguments(Boolean.TRUE);
       ResultCollector rc = execution.execute(new FunctionAdapter() {
         @Override
         public void execute(FunctionContext fc) {


[38/51] [abbrv] geode git commit: GEODE-510 Bug48571DUnitTest.testStatsMatchWithSize failed

Posted by ds...@apache.org.
GEODE-510 Bug48571DUnitTest.testStatsMatchWithSize failed

This ticket was marked fixed in early 2016 but the Flaky annotation was
never removed and it was reopened by Anthony with no comment.  I'm removing
the Flaky annotation and closing the ticket.


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

Branch: refs/heads/feature/GEODE-2097
Commit: f038c2d9a57fcead8ace21ba81f2b357dcf81d34
Parents: 9b49bc8
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Wed Apr 19 16:10:34 2017 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Wed Apr 19 16:13:27 2017 -0700

----------------------------------------------------------------------
 .../internal/cache/ha/Bug48571DUnitTest.java      | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/f038c2d9/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
index c776984..516275a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
@@ -24,14 +24,6 @@ import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_ARC
 import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_SAMPLING_ENABLED;
 import static org.junit.Assert.assertEquals;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.Region;
@@ -55,8 +47,14 @@ import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.Wait;
 import org.apache.geode.test.dunit.WaitCriterion;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
 
 @Category({DistributedTest.class, ClientSubscriptionTest.class})
 public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
@@ -122,7 +120,7 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     Wait.waitForCriterion(criterion, 15 * 1000, 200, true);
   }
 
-  @Category(FlakyTest.class) // GEODE-510
+  // @Category(FlakyTest.class) // GEODE-510
   @Test
   public void testStatsMatchWithSize() throws Exception {
     IgnoredException.addIgnoredException("Unexpected IOException||Connection reset");


[10/51] [abbrv] geode git commit: GEODE-2647: remove unnecessary client puts from ClientHealthStatsDUnitTest

Posted by ds...@apache.org.
GEODE-2647: remove unnecessary client puts from ClientHealthStatsDUnitTest

This removes the puts from the clients which was unnecessary for the
tests. By removing the puts, the race condition caused by async puts
and clears for the subscription enabled test is gone.


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

Branch: refs/heads/feature/GEODE-2097
Commit: ed300c5d282f90434ea37d1dc7a09eace3557879
Parents: d939ceb
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Apr 13 15:21:30 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Apr 14 09:33:18 2017 -0700

----------------------------------------------------------------------
 .../management/ClientHealthStatsDUnitTest.java  | 59 +-------------------
 1 file changed, 2 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/ed300c5d/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
index 5142571..760a47a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/ClientHealthStatsDUnitTest.java
@@ -73,13 +73,8 @@ public class ClientHealthStatsDUnitTest implements Serializable {
       ClientHealthStatsDUnitTest.class.getSimpleName() + "_Region";
 
   // client1VM and client2VM VM fields
-  private static ClientCache clientCache;
-
-  // TODO: assert following values in each client VM
-  private static int numOfCreates;
-  private static int numOfUpdates;
-  private static int numOfInvalidates;
-  private static boolean lastKeyReceived;
+  private static volatile ClientCache clientCache;
+  private static volatile boolean lastKeyReceived;
 
   private VM managerVM;
   private VM serverVM;
@@ -107,9 +102,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
   public void after() throws Exception {
     invokeInEveryVM(() -> {
       lastKeyReceived = false;
-      numOfCreates = 0;
-      numOfUpdates = 0;
-      numOfInvalidates = 0;
       clientCache = null;
     });
   }
@@ -124,9 +116,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, true));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     DistributedMember serverMember = this.managementTestRule.getDistributedMember(this.serverVM);
     this.managerVM.invoke(() -> verifyClientStats(serverMember, port, 2));
 
@@ -143,9 +132,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, false));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, false));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     DistributedMember serverMember = this.managementTestRule.getDistributedMember(this.serverVM);
     this.managerVM.invoke(() -> verifyClientStats(serverMember, port, 0));
     this.managementTestRule.stopManager(this.managerVM);
@@ -161,9 +147,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
     this.client1VM.invoke(() -> createClientCache(this.hostName, port, 1, true));
     this.client2VM.invoke(() -> createClientCache(this.hostName, port, 2, true));
 
-    this.client1VM.invoke(() -> put());
-    this.client2VM.invoke(() -> put());
-
     this.client1VM.invoke(() -> clientCache.close(true));
     this.client2VM.invoke(() -> clientCache.close(true));
 
@@ -206,9 +189,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
    */
   private boolean cacheClientProxyHasBeenPause() {
     CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance();
-    // TODO: CacheClientNotifier clientNotifier =
-    // ((CacheServerImpl)this.managementTestRule.getCache().getCacheServers().get(0)).getAcceptor().getCacheClientNotifier();
-
     Collection<CacheClientProxy> clientProxies = clientNotifier.getClientProxies();
 
     for (CacheClientProxy clientProxy : clientProxies) {
@@ -263,21 +243,10 @@ public class ClientHealthStatsDUnitTest implements Serializable {
 
     regionFactory.addCacheListener(new CacheListenerAdapter<String, String>() {
       @Override
-      public void afterInvalidate(final EntryEvent<String, String> event) {
-        numOfInvalidates++;
-      }
-
-      @Override
       public void afterCreate(final EntryEvent<String, String> event) {
         if ("last_key".equals(event.getKey())) {
           lastKeyReceived = true;
         }
-        numOfCreates++;
-      }
-
-      @Override
-      public void afterUpdate(final EntryEvent<String, String> event) {
-        numOfUpdates++;
       }
     });
 
@@ -359,30 +328,6 @@ public class ClientHealthStatsDUnitTest implements Serializable {
   }
 
   /**
-   * Invoked in client1VM and client2VM
-   */
-  private void put() {
-    Cache cache = (Cache) clientCache;
-    Region<String, String> region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
-
-    region.put(KEY1, VALUE1);
-    assertThat(region.getEntry(KEY1).getValue()).isEqualTo(VALUE1);
-
-    region.put(KEY2, VALUE2);
-    assertThat(region.getEntry(KEY2).getValue()).isEqualTo(VALUE2);
-
-    region.clear();
-
-    region.put(KEY1, VALUE1);
-    assertThat(region.getEntry(KEY1).getValue()).isEqualTo(VALUE1);
-
-    region.put(KEY2, VALUE2);
-    assertThat(region.getEntry(KEY2).getValue()).isEqualTo(VALUE2);
-
-    region.clear();
-  }
-
-  /**
    * Invoked in serverVM
    */
   private void verifyStats(final int serverPort) throws Exception {


[24/51] [abbrv] geode git commit: GEODE-2775: Corrected setting of Pulse SSL Manager flag from System properties instead of pulse.properties when running in embedded mode.

Posted by ds...@apache.org.
GEODE-2775: Corrected setting of Pulse SSL Manager flag from System properties instead of pulse.properties when running in embedded mode.

* this closes #454


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

Branch: refs/heads/feature/GEODE-2097
Commit: 3423f6f5a9102859fdae8a95c7715dfd64dacc75
Parents: 3a30770
Author: Patrick Rhomberg <pr...@pivotal.io>
Authored: Wed Apr 12 11:39:11 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Apr 17 08:06:01 2017 -0700

----------------------------------------------------------------------
 .../tools/pulse/PulseSecurityWithSSLTest.java   | 83 ++++++++++++++++++++
 .../management/internal/ManagementAgent.java    | 16 ++--
 .../tools/pulse/internal/PulseAppListener.java  |  4 +
 3 files changed, 95 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/3423f6f5/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
new file mode 100644
index 0000000..3b9cd72
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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 org.apache.geode.tools.pulse;
+
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
+import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
+import static org.apache.geode.util.test.TestUtil.getResourcePath;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.security.SecurableCommunicationChannels;
+import org.apache.geode.security.SimpleTestSecurityManager;
+import org.apache.geode.test.dunit.rules.HttpClientRule;
+import org.apache.geode.test.dunit.rules.LocatorStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.http.HttpResponse;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.util.Properties;
+
+
+@Category(IntegrationTest.class)
+public class PulseSecurityWithSSLTest {
+
+  private static File jks =
+      new File(getResourcePath(PulseSecurityWithSSLTest.class, "/ssl/trusted.keystore"));
+
+  @ClassRule
+  public static LocatorStarterRule locator = new LocatorStarterRule();
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    Properties securityProps = new Properties();
+    securityProps.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannels.JMX);
+    securityProps.setProperty(SSL_KEYSTORE, jks.getCanonicalPath());
+    securityProps.setProperty(SSL_KEYSTORE_PASSWORD, "password");
+    // securityProps.setProperty(SSL_KEYSTORE_TYPE, "JKS");
+    securityProps.setProperty(SSL_TRUSTSTORE, jks.getCanonicalPath());
+    securityProps.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
+    securityProps.setProperty(SSL_PROTOCOLS, "TLSv1.2");
+    securityProps.setProperty(SSL_CIPHERS, "any");
+
+    locator.withSecurityManager(SimpleTestSecurityManager.class).withProperties(securityProps)
+        .startLocator();
+  }
+
+  @Rule
+  public HttpClientRule client = new HttpClientRule(locator::getHttpPort);
+
+
+  @Test
+  public void loginWithIncorrectPassword() throws Exception {
+    HttpResponse response = client.loginToPulse("data", "wrongPassword");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(302);
+    assertThat(response.getFirstHeader("Location").getValue())
+        .contains("/pulse/login.html?error=BAD_CREDS");
+
+    client.loginToPulseAndVerify("data", "data");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/3423f6f5/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 025e5e5..5cbb990 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -100,6 +100,7 @@ public class ManagementAgent {
    */
   private static final String PULSE_EMBEDDED_PROP = "pulse.embedded";
   private static final String PULSE_PORT_PROP = "pulse.port";
+  private static final String PULSE_USESSL_MANAGER = "pulse.useSSL.manager";
 
   public ManagementAgent(DistributionConfig config) {
     this.config = config;
@@ -269,6 +270,10 @@ public class ManagementAgent {
           System.setProperty(PULSE_EMBEDDED_PROP, "true");
           System.setProperty(PULSE_PORT_PROP, "" + config.getJmxManagerPort());
 
+          final SocketCreator socketCreator =
+              SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX);
+          System.setProperty(PULSE_USESSL_MANAGER, socketCreator.useSSL() + "");
+
           this.httpServer = JettyHelper.startJetty(this.httpServer);
 
           // now, that Tomcat has been started, we can set the URL used by web
@@ -504,14 +509,9 @@ public class ManagementAgent {
       if (names.isEmpty()) {
         try {
           platformMBeanServer.registerMBean(acc, accessControlMBeanON);
-          logger.info("Registered AccessContorlMBean on " + accessControlMBeanON);
-        } catch (InstanceAlreadyExistsException e) {
-          throw new GemFireConfigException("Error while configuring accesscontrol for jmx resource",
-              e);
-        } catch (MBeanRegistrationException e) {
-          throw new GemFireConfigException("Error while configuring accesscontrol for jmx resource",
-              e);
-        } catch (NotCompliantMBeanException e) {
+          logger.info("Registered AccessControlMBean on " + accessControlMBeanON);
+        } catch (InstanceAlreadyExistsException | MBeanRegistrationException
+            | NotCompliantMBeanException e) {
           throw new GemFireConfigException("Error while configuring accesscontrol for jmx resource",
               e);
         }

http://git-wip-us.apache.org/repos/asf/geode/blob/3423f6f5/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
index 75bcc98..35f494b 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
@@ -169,6 +169,10 @@ public class PulseAppListener implements ServletContextListener {
 
     // set SSL info
     initializeSSL();
+    if (sysIsEmbedded) {
+      sysPulseUseSSLManager = Boolean
+          .parseBoolean(System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER));
+    }
     repository.setUseSSLLocator(sysPulseUseSSLLocator);
     repository.setUseSSLManager(sysPulseUseSSLManager);
 


[07/51] [abbrv] geode git commit: GEODE-2730: refactor rules

Posted by ds...@apache.org.
GEODE-2730: refactor rules

* consolidate the two sets of server/locator starter rules
* do not allow member start up at test initialization time.
* validate properties in @Before
* use provider in the chained rules to get the appropriate ports in @Before


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

Branch: refs/heads/feature/GEODE-2097
Commit: 6a88f1bcce2ef09a814a6f7545896cc4f0c26da7
Parents: 796c15e
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Wed Mar 22 19:45:19 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Apr 13 10:23:26 2017 -0700

----------------------------------------------------------------------
 .../web/RestSecurityIntegrationTest.java        |  14 +-
 .../web/RestSecurityPostProcessorTest.java      |  14 +-
 .../internal/web/RestSecurityWithSSLTest.java   |  39 ++--
 .../rest/internal/web/RestServersJUnitTest.java |  11 +-
 .../internal/web/SwaggerVerificationTest.java   |   9 +-
 .../test/dunit/rules/EmbeddedPulseRule.java     |  53 ++++++
 .../geode/test/dunit/rules/HttpClientRule.java  |  40 ++--
 .../geode/tools/pulse/PulseDataExportTest.java  |   9 +-
 .../geode/tools/pulse/PulseSecurityTest.java    |  91 +++++++++
 .../tools/pulse/PulseVerificationTest.java      |  90 ---------
 .../geode/cache/ConnectionPoolDUnitTest.java    |   4 +-
 .../org/apache/geode/cache/ProxyJUnitTest.java  |   4 +-
 .../PartitionRegionHelperDUnitTest.java         |  16 +-
 .../BaseLineAndCompareQueryPerfJUnitTest.java   |   4 +-
 .../cache/query/dunit/QueryIndexDUnitTest.java  |   2 +-
 .../cache/query/dunit/RemoteQueryDUnitTest.java |   4 +-
 ...ndexWithSngleFrmAndMultCondQryJUnitTest.java |   6 +-
 .../query/functional/LimitClauseJUnitTest.java  |   6 +-
 .../query/internal/QueryUtilsJUnitTest.java     |   4 +-
 .../index/IndexMaintenanceJUnitTest.java        |   2 +-
 .../query/partitioned/PRQueryDUnitHelper.java   |   2 +-
 .../geode/cache30/CacheLoaderTestCase.java      |   4 +-
 .../geode/cache30/CacheXml66DUnitTest.java      |   4 +-
 .../geode/cache30/DiskRegionDUnitTest.java      |   8 +-
 .../geode/cache30/DiskRegionTestImpl.java       |   2 +-
 .../DistributedAckRegionCCEDUnitTest.java       |   2 +-
 .../DistributedMulticastRegionDUnitTest.java    |   4 +-
 .../geode/cache30/GlobalRegionCCEDUnitTest.java |   2 +-
 .../geode/cache30/MultiVMRegionTestCase.java    |  17 +-
 .../apache/geode/cache30/RegionTestCase.java    |   4 +-
 .../distributed/internal/Bug40751DUnitTest.java |   4 +-
 .../geode/disttx/DistTXDebugDUnitTest.java      |   4 +-
 .../internal/cache/CacheAdvisorDUnitTest.java   |   6 +-
 .../internal/cache/DeltaSizingDUnitTest.java    |   4 +-
 .../internal/cache/EventTrackerDUnitTest.java   |   2 +-
 .../geode/internal/cache/PRTXJUnitTest.java     |   4 +-
 .../cache/PartitionListenerDUnitTest.java       |   2 +-
 .../cache/PartitionedRegionHADUnitTest.java     |   2 +-
 ...artitionedRegionRedundancyZoneDUnitTest.java |   2 +-
 .../cache/PartitionedRegionStatsDUnitTest.java  |   8 +-
 .../PartitionedRegionTestUtilsDUnitTest.java    |   2 +-
 .../control/RebalanceOperationDUnitTest.java    |  38 ++--
 .../cache/ha/HARQueueNewImplDUnitTest.java      |   2 +-
 .../cache/partitioned/Bug39356DUnitTest.java    |   2 +-
 .../cache/partitioned/ShutdownAllDUnitTest.java |   8 +-
 .../RollingUpgrade2DUnitTest.java               |   4 +-
 .../rollingupgrade/RollingUpgradeDUnitTest.java |   2 +-
 .../cache/tier/sockets/Bug36829DUnitTest.java   |   2 +-
 .../DataSerializerPropogationDUnitTest.java     |   2 +-
 .../sockets/HAStartupAndFailoverDUnitTest.java  |   4 +-
 .../InstantiatorPropagationDUnitTest.java       |   2 +-
 .../tier/sockets/RedundancyLevelTestBase.java   |   2 +-
 .../cli/commands/ExportLogsIntegrationTest.java |   8 +-
 .../ExportLogsFunctionIntegrationTest.java      |   4 +-
 .../cli/shell/GfshMultilineCommandTest.java     |   6 +-
 .../cli/util/LogExporterIntegrationTest.java    |  87 ++++-----
 .../security/AccessControlMBeanJUnitTest.java   |   8 +-
 ...CacheServerMBeanAuthenticationJUnitTest.java |   8 +-
 .../CacheServerMBeanAuthorizationJUnitTest.java |   8 +-
 .../CacheServerMBeanShiroJUnitTest.java         |   8 +-
 .../security/CliCommandsSecurityTest.java       |   9 +-
 .../security/DataCommandsSecurityTest.java      |   9 +-
 .../security/DeployCommandsSecurityTest.java    |   9 +-
 .../DiskStoreMXBeanSecurityJUnitTest.java       |   9 +-
 .../GatewayReceiverMBeanSecurityTest.java       |   9 +-
 .../GatewaySenderMBeanSecurityTest.java         |   9 +-
 .../security/GfshCommandsPostProcessorTest.java |  13 +-
 .../security/GfshCommandsSecurityTest.java      |   9 +-
 .../security/JavaRmiServerNameTest.java         |   7 +-
 .../LockServiceMBeanAuthorizationJUnitTest.java |   9 +-
 .../security/MBeanSecurityJUnitTest.java        |   9 +-
 .../ManagerMBeanAuthorizationJUnitTest.java     |   9 +-
 .../security/MemberMBeanSecurityJUnitTest.java  |   9 +-
 .../geode/security/ClientAuthDUnitTest.java     |  22 +--
 .../ClientContainsKeyAuthDUnitTest.java         |  13 +-
 .../ClientDestroyInvalidateAuthDUnitTest.java   |  13 +-
 .../ClientDestroyRegionAuthDUnitTest.java       |  24 +--
 .../ClientExecuteFunctionAuthDUnitTest.java     |  21 +--
 ...lientExecuteRegionFunctionAuthDUnitTest.java |  13 +-
 .../security/ClientGetAllAuthDUnitTest.java     |  13 +-
 .../security/ClientGetEntryAuthDUnitTest.java   |  17 +-
 .../security/ClientGetPutAuthDUnitTest.java     |  15 +-
 .../ClientRegionClearAuthDUnitTest.java         |  13 +-
 .../ClientRegisterInterestAuthDUnitTest.java    |  27 ++-
 .../security/ClientRemoveAllAuthDUnitTest.java  |  13 +-
 .../ClientUnregisterInterestAuthDUnitTest.java  |  11 +-
 .../NoShowValue1PostProcessorDUnitTest.java     |  11 +-
 .../security/PDXPostProcessorDUnitTest.java     |  23 ++-
 .../geode/security/PostProcessorDUnitTest.java  |  17 +-
 .../SecurityClusterConfigDUnitTest.java         |   4 -
 .../dunit/rules/GfshShellConnectionRule.java    |  12 +-
 .../dunit/rules/LocalLocatorStarterRule.java    |  99 ----------
 .../dunit/rules/LocalServerStarterRule.java     | 159 ----------------
 .../dunit/rules/LocatorServerStartupRule.java   |  13 +-
 .../test/dunit/rules/LocatorStarterBuilder.java | 121 ------------
 .../test/dunit/rules/LocatorStarterRule.java    |  26 ++-
 .../dunit/rules/MBeanServerConnectionRule.java  |  13 +-
 .../test/dunit/rules/MemberStarterRule.java     |  31 +++-
 .../test/dunit/rules/ServerStarterBuilder.java  | 185 -------------------
 .../test/dunit/rules/ServerStarterRule.java     |  42 ++++-
 .../dunit/rules/test/MemberStarterRuleTest.java |  72 ++++++++
 .../query/dunit/QueryMonitorDUnitTest.java      |  44 ++---
 .../internal/cache/ha/CQListGIIDUnitTest.java   |   4 +-
 .../CacheServerManagementDUnitTest.java         |   2 +-
 .../geode/security/CQClientAuthDUnitTest.java   |  11 +-
 .../security/CQPDXPostProcessorDUnitTest.java   |  14 +-
 .../security/CQPostProcessorDunitTest.java      |  13 +-
 .../security/ClientQueryAuthDUnitTest.java      |  17 +-
 .../commands/QueryNamesOverHttpDUnitTest.java   |   4 +-
 .../GfshCommandsOverHttpSecurityTest.java       |   2 +-
 110 files changed, 760 insertions(+), 1229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
index cbd83e3..0f1be57 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityIntegrationTest.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.rest.internal.web;
 
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -21,8 +22,7 @@ import static org.junit.Assert.assertTrue;
 
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.security.TestSecurityManager;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.http.HttpResponse;
@@ -41,11 +41,11 @@ public class RestSecurityIntegrationTest {
   protected static final String REGION_NAME = "AuthRegion";
 
   @ClassRule
-  public static LocalServerStarterRule serverStarter =
-      new ServerStarterBuilder().withSecurityManager(TestSecurityManager.class)
-          .withProperty(TestSecurityManager.SECURITY_JSON,
-              "org/apache/geode/management/internal/security/clientServer.json")
-          .withRestService().buildInThisVM();
+  public static ServerStarterRule serverStarter = new ServerStarterRule()
+      .withProperty(TestSecurityManager.SECURITY_JSON,
+          "org/apache/geode/management/internal/security/clientServer.json")
+      .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName()).withRestService()
+      .withAutoStart();
 
   private final GeodeRestClient restClient =
       new GeodeRestClient("localhost", serverStarter.getHttpPort());

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityPostProcessorTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityPostProcessorTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityPostProcessorTest.java
index e93561c..652c3a1 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityPostProcessorTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityPostProcessorTest.java
@@ -28,8 +28,6 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.rest.internal.web.controllers.Customer;
 import org.apache.geode.rest.internal.web.controllers.RedactingPostProcessor;
 import org.apache.geode.security.TestSecurityManager;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -49,12 +47,12 @@ import java.net.URLEncoder;
 public class RestSecurityPostProcessorTest {
 
   @ClassRule
-  public static LocalServerStarterRule serverStarter =
-      new ServerStarterBuilder().withSecurityManager(TestSecurityManager.class)
-          .withProperty(TestSecurityManager.SECURITY_JSON,
-              "org/apache/geode/management/internal/security/clientServer.json")
-          .withProperty(SECURITY_POST_PROCESSOR, RedactingPostProcessor.class.getName())
-          .withRestService().buildInThisVM();
+  public static ServerStarterRule serverStarter = new ServerStarterRule()
+      .withProperty(TestSecurityManager.SECURITY_JSON,
+          "org/apache/geode/management/internal/security/clientServer.json")
+      .withProperty(SECURITY_MANAGER, TestSecurityManager.class.getName())
+      .withProperty(SECURITY_POST_PROCESSOR, RedactingPostProcessor.class.getName())
+      .withRestService().withAutoStart();
 
   private final GeodeRestClient restClient =
       new GeodeRestClient("localhost", serverStarter.getHttpPort());

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
index 14113c0..4d142bd 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
@@ -16,6 +16,7 @@
 package org.apache.geode.rest.internal.web;
 
 import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
@@ -27,10 +28,10 @@ import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTOR
 import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
 import static org.junit.Assert.assertEquals;
 
+import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.security.SimpleTestSecurityManager;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.http.HttpResponse;
@@ -39,26 +40,36 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.net.URL;
+import java.util.Properties;
 
 @Category({IntegrationTest.class, SecurityTest.class})
 public class RestSecurityWithSSLTest {
-  private static URL KEYSTORE_URL =
-      RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
 
+  private static int restPort = AvailablePortHelper.getRandomAvailableTCPPort();
   @Rule
-  public LocalServerStarterRule serverStarter = new ServerStarterBuilder().withRestService()
-      .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName())
-      .withProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant())
-      .withProperty(SSL_KEYSTORE, KEYSTORE_URL.getPath())
-      .withProperty(SSL_KEYSTORE_PASSWORD, "password").withProperty(SSL_KEYSTORE_TYPE, "JKS")
-      .withProperty(SSL_TRUSTSTORE, KEYSTORE_URL.getPath())
-      .withProperty(SSL_TRUSTSTORE_PASSWORD, "password")
-      .withProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1").buildInThisVM();
+  public ServerStarterRule serverStarter = new ServerStarterRule();
 
   @Test
   public void testRestSecurityWithSSL() throws Exception {
-    GeodeRestClient restClient =
-        new GeodeRestClient("localhost", serverStarter.getHttpPort(), true);
+    URL keystoreUrl =
+        RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
+
+    Properties properties = new Properties();
+    properties.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
+    properties.setProperty(START_DEV_REST_API, "true");
+    properties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
+    properties.setProperty(HTTP_SERVICE_PORT, restPort + "");
+    properties.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant());
+    properties.setProperty(SSL_KEYSTORE, keystoreUrl.getPath());
+    properties.setProperty(SSL_KEYSTORE_PASSWORD, "password");
+    properties.setProperty(SSL_KEYSTORE_TYPE, "JKS");
+    properties.setProperty(SSL_TRUSTSTORE, keystoreUrl.getPath());
+    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
+    properties.setProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1");
+
+    serverStarter.withProperties(properties).startServer();
+
+    GeodeRestClient restClient = new GeodeRestClient("localhost", restPort, true);
     HttpResponse response = restClient.doGet("/servers", "cluster", "cluster");
 
     assertEquals(200, GeodeRestClient.getCode(response));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestServersJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestServersJUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestServersJUnitTest.java
index 2a3a036..172a840 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestServersJUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestServersJUnitTest.java
@@ -17,8 +17,7 @@ package org.apache.geode.rest.internal.web;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.RestAPITest;
@@ -33,13 +32,14 @@ import org.junit.experimental.categories.Category;
 public class RestServersJUnitTest {
 
   @ClassRule
-  public static LocalServerStarterRule serverStarter =
-      new ServerStarterBuilder().withRestService().buildInThisVM();
+  public static ServerStarterRule serverStarter =
+      new ServerStarterRule().withRestService(true).withAutoStart();
 
   private static GeodeRestClient restClient;
 
   @BeforeClass
   public static void before() throws Exception {
+    assertThat(serverStarter.getHttpPort()).isEqualTo(DistributionConfig.DEFAULT_HTTP_SERVICE_PORT);
     restClient = new GeodeRestClient("localhost", serverStarter.getHttpPort());
   }
 
@@ -54,6 +54,7 @@ public class RestServersJUnitTest {
     HttpResponse response = restClient.doGet("/servers", null, null);
     JSONArray body = GeodeRestClient.getJsonArray(response);
     assertThat(body.length()).isEqualTo(1);
-    assertThat(body.getString(0)).isEqualTo("http://localhost:" + serverStarter.getHttpPort());
+    assertThat(body.getString(0))
+        .isEqualTo("http://localhost:" + DistributionConfig.DEFAULT_HTTP_SERVICE_PORT);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
index a8ab19c..559d15d 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/SwaggerVerificationTest.java
@@ -15,14 +15,11 @@
 package org.apache.geode.rest.internal.web;
 
 
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.security.SimpleTestSecurityManager;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.RestAPITest;
@@ -36,10 +33,8 @@ import org.junit.experimental.categories.Category;
 public class SwaggerVerificationTest {
 
   @ClassRule
-  public static LocalServerStarterRule serverStarter = new ServerStarterBuilder()
-      .withSecurityManager(SimpleTestSecurityManager.class).withRestService().buildInThisVM();
-
-  private GeodeRestClient restClient;
+  public static ServerStarterRule serverStarter = new ServerStarterRule()
+      .withSecurityManager(SimpleTestSecurityManager.class).withRestService().withAutoStart();
 
   @Test
   public void isSwaggerRunning() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
new file mode 100644
index 0000000..e41d0fe
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.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 org.apache.geode.test.dunit.rules;
+
+import org.apache.geode.tools.pulse.internal.data.Repository;
+import org.junit.rules.ExternalResource;
+
+import java.util.function.Supplier;
+
+/**
+ * This is used to test embedded pulse. If your test needs to check pulse's repository object for
+ * assertions, use this rules to properly initialize and cleanup the repository
+ *
+ */
+public class EmbeddedPulseRule extends ExternalResource {
+  private Supplier<Integer> portSupplier;
+  private Repository repository;
+
+  public EmbeddedPulseRule(Supplier<Integer> portSupplier) {
+    this.portSupplier = portSupplier;
+  }
+
+  public Repository getRepository() {
+    return repository;
+  }
+
+  protected void before() throws Throwable {
+    repository = Repository.get();
+    repository.setJmxHost("localhost");
+    repository.setJmxPort(portSupplier.get() + "");
+    repository.setJmxUseLocator(false);
+  }
+
+  /**
+   * Override to tear down your specific external resource.
+   */
+  protected void after() {
+    repository.removeAllClusters();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/HttpClientRule.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/HttpClientRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/HttpClientRule.java
index 49351d9..7b0fab1 100644
--- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/HttpClientRule.java
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/HttpClientRule.java
@@ -27,44 +27,41 @@ import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HttpContext;
-import org.junit.Before;
 import org.junit.rules.ExternalResource;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.function.Supplier;
 
+/**
+ * this rules simplifies creating a httpClient for verification of pulse behaviors or any http
+ * client behaviors. Usually after you start up a server/locator with http service, you would want
+ * to connect to it through http client and verify some behavior, you would need to use this rule.
+ *
+ * See @PulseSecuriyTest for examples
+ *
+ */
 public class HttpClientRule extends ExternalResource {
   private String hostName;
-  private int port;
+  private Supplier<Integer> portSupplier;
   private HttpHost host;
   private HttpClient httpClient;
-  private HttpContext context;
-  private LocalLocatorStarterRule locatorStarterRule;
 
-  public HttpClientRule(LocalLocatorStarterRule locatorStarterRule) {
-    this.locatorStarterRule = locatorStarterRule;
-  }
 
-  public HttpClientRule(int port) {
-    this("localhost", port);
+  public HttpClientRule(String hostName, Supplier<Integer> portSupplier) {
+    this.hostName = hostName;
+    this.portSupplier = portSupplier;
   }
 
-  public HttpClientRule(String hostName, int port) {
-    this.hostName = hostName;
-    this.port = port;
+  public HttpClientRule(Supplier<Integer> portSupplier) {
+    this("localhost", portSupplier);
   }
 
-  @Before
+
+  @Override
   protected void before() {
-    if (locatorStarterRule != null) {
-      this.hostName = "localhost";
-      this.port = locatorStarterRule.getHttpPort();
-    }
-    host = new HttpHost(hostName, port);
+    host = new HttpHost(hostName, portSupplier.get());
     httpClient = HttpClients.createDefault();
-    context = new BasicHttpContext();
   }
 
   public HttpResponse loginToPulse(String username, String password) throws Exception {
@@ -107,5 +104,4 @@ public class HttpClientRule extends ExternalResource {
   }
 
 
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseDataExportTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
index 10ca43b..60f1005 100644
--- a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
@@ -21,8 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.dunit.rules.HttpClientRule;
-import org.apache.geode.test.dunit.rules.LocalServerStarterRule;
-import org.apache.geode.test.dunit.rules.ServerStarterBuilder;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.http.HttpResponse;
 import org.apache.http.util.EntityUtils;
@@ -35,11 +34,11 @@ import org.junit.experimental.categories.Category;
 public class PulseDataExportTest {
 
   @Rule
-  public LocalServerStarterRule server = new ServerStarterBuilder().withJMXManager()
-      .withRegion(RegionShortcut.REPLICATE, "regionA").buildInThisVM();
+  public ServerStarterRule server =
+      new ServerStarterRule().withJMXManager().withRegion(RegionShortcut.REPLICATE, "regionA");
 
   @Rule
-  public HttpClientRule client = new HttpClientRule(server.getHttpPort());
+  public HttpClientRule client = new HttpClientRule(server::getHttpPort);
 
   @Before
   public void before() throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
new file mode 100644
index 0000000..7278c84
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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 org.apache.geode.tools.pulse;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.security.SimpleTestSecurityManager;
+import org.apache.geode.test.dunit.rules.HttpClientRule;
+import org.apache.geode.test.dunit.rules.LocatorStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.http.HttpResponse;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.RuleChain;
+
+
+@Category(IntegrationTest.class)
+public class PulseSecurityTest {
+
+  private LocatorStarterRule locator =
+      new LocatorStarterRule().withSecurityManager(SimpleTestSecurityManager.class).withAutoStart();
+
+  private HttpClientRule client = new HttpClientRule(locator::getHttpPort);
+
+  @Rule
+  public RuleChain ruleChain = RuleChain.outerRule(locator).around(client);
+
+
+
+  @Test
+  public void loginWithIncorrectPassword() throws Exception {
+    HttpResponse response = client.loginToPulse("data", "wrongPassword");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(302);
+    assertThat(response.getFirstHeader("Location").getValue())
+        .contains("/pulse/login.html?error=BAD_CREDS");
+
+    client.loginToPulseAndVerify("data", "data");
+  }
+
+  @Test
+  public void loginWithDataOnly() throws Exception {
+    client.loginToPulseAndVerify("data", "data");
+
+    // this would request cluster permission
+    HttpResponse response = client.get("/pulse/clusterDetail.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
+
+    // this would require both cluster and data permission
+    response = client.get("/pulse/dataBrowser.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
+  }
+
+
+  @Test
+  public void loginAllAccess() throws Exception {
+    client.loginToPulseAndVerify("CLUSTER,DATA", "CLUSTER,DATA");
+
+    HttpResponse response = client.get("/pulse/clusterDetail.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+
+    response = client.get("/pulse/dataBrowser.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+  }
+
+  @Test
+  public void loginWithClusterOnly() throws Exception {
+    client.loginToPulseAndVerify("cluster", "cluster");
+
+    HttpResponse response = client.get("/pulse/clusterDetail.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
+
+    // accessing data browser will be denied
+    response = client.get("/pulse/dataBrowser.html");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
deleted file mode 100644
index 5a300a1..0000000
--- a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
+++ /dev/null
@@ -1,90 +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 org.apache.geode.tools.pulse;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.geode.security.SimpleTestSecurityManager;
-import org.apache.geode.test.dunit.rules.HttpClientRule;
-import org.apache.geode.test.dunit.rules.LocatorStarterBuilder;
-import org.apache.geode.test.dunit.rules.LocalLocatorStarterRule;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.http.HttpResponse;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-
-@Category(IntegrationTest.class)
-public class PulseVerificationTest {
-
-  @ClassRule
-  public static LocalLocatorStarterRule locator = new LocatorStarterBuilder()
-      .withSecurityManager(SimpleTestSecurityManager.class).buildInThisVM();
-
-  @Rule
-  public HttpClientRule client = new HttpClientRule(locator);
-
-  @Test
-  public void loginWithIncorrectPassword() throws Exception {
-    HttpResponse response = client.loginToPulse("data", "wrongPassword");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(302);
-    assertThat(response.getFirstHeader("Location").getValue())
-        .contains("/pulse/login.html?error=BAD_CREDS");
-
-    client.loginToPulseAndVerify("data", "data");
-  }
-
-  @Test
-  public void loginWithDataOnly() throws Exception {
-    client.loginToPulseAndVerify("data", "data");
-
-    // this would request cluster permission
-    HttpResponse response = client.get("/pulse/clusterDetail.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
-
-    // this would require both cluster and data permission
-    response = client.get("/pulse/dataBrowser.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
-  }
-
-
-  @Test
-  public void loginAllAccess() throws Exception {
-    client.loginToPulseAndVerify("CLUSTER,DATA", "CLUSTER,DATA");
-
-    HttpResponse response = client.get("/pulse/clusterDetail.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
-
-    response = client.get("/pulse/dataBrowser.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
-  }
-
-  @Test
-  public void loginWithClusterOnly() throws Exception {
-    client.loginToPulseAndVerify("cluster", "cluster");
-
-    HttpResponse response = client.get("/pulse/clusterDetail.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
-
-    // accessing data browser will be denied
-    response = client.get("/pulse/dataBrowser.html");
-    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java
index 2ac5120..2d5a71b 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolDUnitTest.java
@@ -5040,7 +5040,7 @@ public class ConnectionPoolDUnitTest extends JUnit4CacheTestCase {
   // vm0.invoke(new CacheSerializableRunnable("Create Cache Server") {
   // public void run2() throws CacheException {
   // AttributesFactory factory = getBridgeServerRegionAttributes(null,null);
-  // Region region = withRegion(name, factory.create());
+  // Region region = createRegion(name, factory.create());
   // pause(1000);
   // try {
   // startBridgeServer(0);
@@ -5064,7 +5064,7 @@ public class ConnectionPoolDUnitTest extends JUnit4CacheTestCase {
 
   // ClientServerTestCase.configureConnectionPool(factory,host0,port,-1,true,-1,-1, null);
 
-  // withRegion(name, factory.create());
+  // createRegion(name, factory.create());
   // }
   // };
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/ProxyJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/ProxyJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/ProxyJUnitTest.java
index 05228ad..8cd68dc 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/ProxyJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/ProxyJUnitTest.java
@@ -1031,7 +1031,7 @@ public class ProxyJUnitTest {
     // // on a non-proxy lru
     // {
     // af.setDataPolicy(DataPolicy.NORMAL);
-    // Region r = this.c.withRegion("rLRU", af.create());
+    // Region r = this.c.createRegion("rLRU", af.create());
     // clearCallbackState();
     // assertTrue(clInvokeCount == 0);
     // for (int i=0; i < 10; i++) {
@@ -1048,7 +1048,7 @@ public class ProxyJUnitTest {
         fail("expected IllegalStateException");
       } catch (IllegalStateException expected) {
       }
-      // Region r = this.c.withRegion("rEMPTY", af.create());
+      // Region r = this.c.createRegion("rEMPTY", af.create());
       // clearCallbackState();
       // assertTrue(clInvokeCount == 0);
       // for (int i=0; i < 10; i++) {

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/partition/PartitionRegionHelperDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/partition/PartitionRegionHelperDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/partition/PartitionRegionHelperDUnitTest.java
index c57ce5b..4236799 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/partition/PartitionRegionHelperDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/partition/PartitionRegionHelperDUnitTest.java
@@ -74,7 +74,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -143,7 +143,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
 
-    SerializableRunnable createPrRegion1 = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion1 = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         FixedPartitionAttributes fpa1 =
@@ -163,7 +163,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
       }
     };
     vm0.invoke(createPrRegion1);
-    SerializableRunnable createPrRegion2 = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion2 = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         FixedPartitionAttributes fpa1 =
@@ -183,7 +183,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
       }
     };
     vm1.invoke(createPrRegion2);
-    SerializableRunnable createPrRegion3 = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion3 = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         FixedPartitionAttributes fpa1 =
@@ -240,7 +240,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     vm0.invoke(checkAssignment);
 
 
-    SerializableRunnable createPrRegion4 = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion4 = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -269,7 +269,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     };
     vm3.invoke(createPrRegion4);
 
-    SerializableRunnable checkMembers = new SerializableRunnable("withRegion") {
+    SerializableRunnable checkMembers = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         Region region = cache.getRegion("region1");
@@ -550,7 +550,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
       public Object call() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -647,7 +647,7 @@ public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
       public Object call() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java
index de2f8d3..a46e1c4 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/BaseLineAndCompareQueryPerfJUnitTest.java
@@ -318,7 +318,7 @@ public class BaseLineAndCompareQueryPerfJUnitTest {
       /*
        * ds = DistributedSystem.connect(props); cache = CacheFactory.create(ds); AttributesFactory
        * factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK);
-       * factory.setValueConstraint(Country.class); region = cache.withRegion("Countries",
+       * factory.setValueConstraint(Country.class); region = cache.createRegion("Countries",
        * factory.create());
        */
       region = CacheUtils.createRegion("Countries", Country.class);
@@ -331,7 +331,7 @@ public class BaseLineAndCompareQueryPerfJUnitTest {
       e.printStackTrace();
     }
 
-  }// end of withRegion
+  }// end of createRegion
 
   public static void populateData() throws Exception {
     /*

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryIndexDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryIndexDUnitTest.java
index d121fe9..2938800 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryIndexDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryIndexDUnitTest.java
@@ -70,7 +70,7 @@ public class QueryIndexDUnitTest extends JUnit4CacheTestCase {
   @Override
   public final void postSetUp() throws Exception {
     int hostCount = Host.getHostCount();
-    SerializableRunnable createRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         Region region = cache.getRegion("portfolios");

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/dunit/RemoteQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/RemoteQueryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/RemoteQueryDUnitTest.java
index 5f48dae..7d0b469 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/RemoteQueryDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/RemoteQueryDUnitTest.java
@@ -521,7 +521,7 @@ public class RemoteQueryDUnitTest extends JUnit4CacheTestCase {
      * void run2() throws CacheException { Properties config = new Properties();
      * config.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() +
      * "]"); getSystem(config); AttributesFactory factory = new AttributesFactory();
-     * factory.setScope(Scope.LOCAL); withRegion(name, factory.create()); Wait.pause(1000); try {
+     * factory.setScope(Scope.LOCAL); createRegion(name, factory.create()); Wait.pause(1000); try {
      * startBridgeServer(0, false); } catch (Exception ex) {
      * Assert.fail("While starting CacheServer", ex); } } });
      * 
@@ -602,7 +602,7 @@ public class RemoteQueryDUnitTest extends JUnit4CacheTestCase {
      * Properties config = new Properties(); config.setProperty(MCAST_PORT, "0"); getSystem(config);
      * getCache(); AttributesFactory factory = new AttributesFactory();
      * factory.setScope(Scope.LOCAL); ClientServerTestCase.configureConnectionPool(factory, host0,
-     * port,-1, true, -1, -1, null); withRegion(name, factory.create()); } });
+     * port,-1, true, -1, -1, null); createRegion(name, factory.create()); } });
      * 
      * // Execute client queries vm1.invoke(new CacheSerializableRunnable("Execute queries") {
      * public void run2() throws CacheException { Region region =

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
index d5195a6..2da970f 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java
@@ -638,7 +638,7 @@ public class IndexWithSngleFrmAndMultCondQryJUnitTest {
 
 
   private void executeQuery_1(Region region, boolean checkReferentialIntegrity) throws Exception {
-    // Region region = CacheUtils.withRegion("pos", Portfolio.class);
+    // Region region = CacheUtils.createRegion("pos", Portfolio.class);
 
     QueryService qs;
     qs = CacheUtils.getQueryService();
@@ -861,7 +861,7 @@ public class IndexWithSngleFrmAndMultCondQryJUnitTest {
   }
 
   private void executeQuery_2(Region region, boolean checkReferentialIntegrity) throws Exception {
-    // Region region = CacheUtils.withRegion("pos", Portfolio.class);
+    // Region region = CacheUtils.createRegion("pos", Portfolio.class);
 
     QueryService qs;
     qs = CacheUtils.getQueryService();
@@ -1073,7 +1073,7 @@ public class IndexWithSngleFrmAndMultCondQryJUnitTest {
   }
 
   private void executeQuery_3(Region region, boolean checkReferentialIntegrity) throws Exception {
-    // Region region = CacheUtils.withRegion("pos", Portfolio.class);
+    // Region region = CacheUtils.createRegion("pos", Portfolio.class);
 
     QueryService qs;
     qs = CacheUtils.getQueryService();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/functional/LimitClauseJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/functional/LimitClauseJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/functional/LimitClauseJUnitTest.java
index 1661cc8..ef2aa3e 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/functional/LimitClauseJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/functional/LimitClauseJUnitTest.java
@@ -1205,9 +1205,9 @@ public class LimitClauseJUnitTest {
    * 
    * @Test public void testNotApplyingLimitAtIndexLevelForMultiIndexAndClauseUsageWithOrderBy()
    * throws Exception { //try { Query query; SelectResults result; int limit = 25; Region region =
-   * CacheUtils.withRegion("portfolios1", Portfolio.class); for (int i = 30; i > 0; i--) { Portfolio
-   * p = new Portfolio(i); p.positions.clear(); p.positions.put("IBM", new Position("IBM", i));
-   * region.put("KEY" + i, p); }
+   * CacheUtils.createRegion("portfolios1", Portfolio.class); for (int i = 30; i > 0; i--) {
+   * Portfolio p = new Portfolio(i); p.positions.clear(); p.positions.put("IBM", new Position("IBM",
+   * i)); region.put("KEY" + i, p); }
    * 
    * String queryString =
    * "<trace>SELECT distinct P FROM /portfolios1 P, P.positions.values POS WHERE P.ID > 5 AND POS.secId = 'IBM' ORDER BY P.ID"

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
index 8530556..bb13665 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/QueryUtilsJUnitTest.java
@@ -212,12 +212,12 @@ public class QueryUtilsJUnitTest {
 
   /*
    * @Test public void testCutDownAndExpandIndexResultsWithManyFinalIters() { region =
-   * CacheUtils.withRegion("portfolio", Portfolio.class); Portfolio[] po = new Portfolio[] { new
+   * CacheUtils.createRegion("portfolio", Portfolio.class); Portfolio[] po = new Portfolio[] { new
    * Portfolio(0), new Portfolio(1), new Portfolio(2), new Portfolio(3)}; region.put("0", new
    * Portfolio(0)); region.put("1", new Portfolio(1)); region.put("2", new Portfolio(2));
    * region.put("3", new Portfolio(3));
    * 
-   * Region r3 = CacheUtils.withRegion("employees", Employee.class); Set add1 = new HashSet();
+   * Region r3 = CacheUtils.createRegion("employees", Employee.class); Set add1 = new HashSet();
    * add1.add(new Address("411045", "Baner")); add1.add(new Address("411001", "DholePatilRd"));
    * for(int i=0;i<4;i++){ r3.put(i+"", new Employee("empName",(20+i),i,"Mr.",(5000+i),add1)); } //
    * compileFromClause returns a List<CompiledIteratorDef> QCompiler compiler = new

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java
index b7b590a..3f4b304 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java
@@ -1005,7 +1005,7 @@ public class IndexMaintenanceJUnitTest {
   //
   // QueryService qs;
   // qs = CacheUtils.getQueryService();
-  // LocalRegion testRgn = (LocalRegion)CacheUtils.withRegion("testRgn", null);
+  // LocalRegion testRgn = (LocalRegion)CacheUtils.createRegion("testRgn", null);
   // int ID = 1;
   // // Add some test data now
   // // Add 5 main objects. 1 will contain key1, 2 will contain key1 & key2

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
index e07990d..0f63df5 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
@@ -414,7 +414,7 @@ public class PRQueryDUnitHelper implements Serializable {
         attr.setPartitionAttributes(paf.create());
 
         // skip parent region creation
-        // partitionedregion = cache.withRegion(regionName, attr.create());
+        // partitionedregion = cache.createRegion(regionName, attr.create());
 
         // child region
         attr.setValueConstraint(constraint);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/CacheLoaderTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheLoaderTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheLoaderTestCase.java
index 1642217..6822c89 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheLoaderTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheLoaderTestCase.java
@@ -142,7 +142,7 @@ public abstract class CacheLoaderTestCase extends CacheWriterTestCase {
   // };
   //
   // Region region =
-  // withRegion(name);
+  // createRegion(name);
   // loader.wasInvoked();
   //
   // Region.Entry entry = region.getEntry(key);
@@ -170,7 +170,7 @@ public abstract class CacheLoaderTestCase extends CacheWriterTestCase {
   //// AttributesFactory factory =
   //// new AttributesFactory(getRegionAttributes());
   //// factory.setCacheLoader(remoteloader);
-  // Region rgn = withRegion(name);
+  // Region rgn = createRegion(name);
   // rgn.put(key, value);
   // flushIfNecessary(rgn);
   // }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/CacheXml66DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml66DUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml66DUnitTest.java
index 738ef3f..01143ff 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheXml66DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXml66DUnitTest.java
@@ -3766,7 +3766,7 @@ public abstract class CacheXml66DUnitTest extends CacheXmlTestCase {
   // factory.setScope(Scope.LOCAL);
   // factory.setCapacityController(new HeapLRUCapacityController(42, 32,
   // LRUAlgorithm.OVERFLOW_TO_DISK));
-  // withRegion(name, factory.create());
+  // createRegion(name, factory.create());
   // finishCacheXml(getUniqueName());
   //
   // Region r = getRootRegion().getSubregion(name);
@@ -3795,7 +3795,7 @@ public abstract class CacheXml66DUnitTest extends CacheXmlTestCase {
     // CacheCreation cache = new CacheCreation();
     // RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
     // attrs.setPublisher(true);
-    // cache.withRegion("root", attrs);
+    // cache.createRegion("root", attrs);
     // testXml(cache);
     // assertIndexDetailsEquals(true, cache.getRegion("root").getAttributes().getPublisher());
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionDUnitTest.java
index c3553b7..81f3c78 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionDUnitTest.java
@@ -1473,7 +1473,7 @@ public class DiskRegionDUnitTest extends JUnit4CacheTestCase {
   // DiskStoreFactory dsf = getCache().createDiskStoreFactory();
   // factory.setDiskSynchronous(true);
   // factory.setDiskWriteAttributes(dwaf.create());
-  // Region rgn = withRegion(name, factory.create());
+  // Region rgn = createRegion(name, factory.create());
   // for (int i = 0; i < NB1_NUM_ENTRIES; i++) {
   // rgn.put(new Integer(i), values[i]);
   // }
@@ -1481,7 +1481,7 @@ public class DiskRegionDUnitTest extends JUnit4CacheTestCase {
   // //close and create to ensure that all data will go to htree
   // //TODO: Mitul : remove this later to fine tune test to also take oplogs recovery into account
   // rgn.close();
-  // rgn = withRegion(name, factory.createRegionAttributes());
+  // rgn = createRegion(name, factory.createRegionAttributes());
   // closeCache();
   // getCache();
   // getLogWriter().info("DEBUG nbput: finished phase one");
@@ -1498,7 +1498,7 @@ public class DiskRegionDUnitTest extends JUnit4CacheTestCase {
   // factory.setScope(Scope.DISTRIBUTED_ACK);
   // factory.setEarlyAck(false);
   // factory.setPersistBackup(false);
-  // Region region = withRegion(name, factory.create());
+  // Region region = createRegion(name, factory.create());
   // // keep putting until told to stop
   // getLogWriter().info("DEBUG nbput: started async putter");
   // int putCount = 0;
@@ -1557,7 +1557,7 @@ public class DiskRegionDUnitTest extends JUnit4CacheTestCase {
   // DiskRegion.recoverDelay = 10; // artificially slow down recovery
   // getLogWriter().info("DEBUG nbput: started recovery");
   // try {
-  // withRegion(name, factory.create());
+  // createRegion(name, factory.create());
   // }
   // finally {
   // DiskRegion.recoverDelay = 0;

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionTestImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionTestImpl.java b/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionTestImpl.java
index 301c232..6fefb55 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionTestImpl.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/DiskRegionTestImpl.java
@@ -144,7 +144,7 @@ public class DiskRegionTestImpl implements Serializable {
     // // set mirror KEYS
     // factory.setMirrorType(MirrorType.KEYS);
     // RegionAttributes attrs2 = factory.create();
-    // Region rgn = DiskRegionTestImpl.this.rtc.withRegion(name, attrs2);
+    // Region rgn = DiskRegionTestImpl.this.rtc.createRegion(name, attrs2);
     // }
     // });
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/DistributedAckRegionCCEDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/DistributedAckRegionCCEDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/DistributedAckRegionCCEDUnitTest.java
index dcb6cf3..2687f34 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/DistributedAckRegionCCEDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/DistributedAckRegionCCEDUnitTest.java
@@ -325,7 +325,7 @@ public class DistributedAckRegionCCEDUnitTest extends DistributedAckRegionDUnitT
     };
     vm0.invoke(createRegion);
     vm1.invoke(createRegion);
-    // vm2.invoke(withRegion);
+    // vm2.invoke(createRegion);
     vm1.invoke(new SerializableRunnable("Create local tombstone and adjust time") {
       public void run() {
         // make the entry for cckey0 a tombstone in this VM and set its modification time to be

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/DistributedMulticastRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/DistributedMulticastRegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/DistributedMulticastRegionDUnitTest.java
index f22886b..6b425f3 100755
--- a/geode-core/src/test/java/org/apache/geode/cache30/DistributedMulticastRegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/DistributedMulticastRegionDUnitTest.java
@@ -154,11 +154,11 @@ public class DistributedMulticastRegionDUnitTest extends JUnit4CacheTestCase {
       vm1.invoke("setSysProps", () -> setSysProps());
 
       // 1. start locator with mcast port
-      vm0.invoke("withRegion", () -> {
+      vm0.invoke("createRegion", () -> {
         createRegion(name, getRegionAttributes());
         return "";
       });
-      vm1.invoke("withRegion", () -> {
+      vm1.invoke("createRegion", () -> {
         createRegion(name, getRegionAttributes());
         return "";
       });

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/GlobalRegionCCEDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/GlobalRegionCCEDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/GlobalRegionCCEDUnitTest.java
index 6c3f952..a5b3cf6 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/GlobalRegionCCEDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/GlobalRegionCCEDUnitTest.java
@@ -180,7 +180,7 @@ public class GlobalRegionCCEDUnitTest extends GlobalRegionDUnitTest {
     };
     vm0.invoke(createRegion);
     vm1.invoke(createRegion);
-    // vm2.invoke(withRegion);
+    // vm2.invoke(createRegion);
     vm1.invoke(new SerializableRunnable("Create local tombstone and adjust time") {
       public void run() {
         // make the entry for cckey0 a tombstone in this VM and set its

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/MultiVMRegionTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
index f57bc96..e3fb897 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
@@ -160,7 +160,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
    */
   @Test
   public void testConcurrentOperations() throws Exception {
-    SerializableRunnable createRegion = new CacheSerializableRunnable("withRegion") {
+    SerializableRunnable createRegion = new CacheSerializableRunnable("createRegion") {
 
       @Override
       public void run2() throws CacheException {
@@ -2696,7 +2696,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
 
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("testDistributedPut: Caused exception in withRegion");
+      getSystem().getLogWriter().fine("testDistributedPut: Caused exception in createRegion");
       throw e;
     }
 
@@ -2736,7 +2736,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
   // new AttributesFactory(getRegionAttributes());
   // factory.setMirrorType(MirrorType.KEYS);
   // try {
-  // withRegion(name, factory.create());
+  // createRegion(name, factory.create());
   // if (persistBackup) fail("Should have thrown an IllegalStateException");
   // }
   // catch (IllegalStateException e) {
@@ -6252,7 +6252,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
 
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("testTXSimpleOps: Caused exception in withRegion");
+      getSystem().getLogWriter().fine("testTXSimpleOps: Caused exception in createRegion");
       throw e;
     }
 
@@ -6509,7 +6509,8 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
       assertSame(localCmtValue, rgn.getEntry("key").getValue());
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("testTXUpdateLoadNoConflict: Caused exception in withRegion");
+      getSystem().getLogWriter()
+          .fine("testTXUpdateLoadNoConflict: Caused exception in createRegion");
       throw e;
     }
   }
@@ -7267,7 +7268,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
       rgn3.destroyRegion();
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("testTXMultiRegion: Caused exception in withRegion");
+      getSystem().getLogWriter().fine("testTXMultiRegion: Caused exception in createRegion");
       throw e;
     }
   }
@@ -7405,7 +7406,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
       // done in a tx is dropped in a remote mirror that does not have the entry.
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("textTXRmtMirror: Caused exception in withRegion");
+      getSystem().getLogWriter().fine("textTXRmtMirror: Caused exception in createRegion");
       throw e;
     }
   }
@@ -7878,7 +7879,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
 
     } catch (Exception e) {
       CacheFactory.getInstance(getSystem()).close();
-      getSystem().getLogWriter().fine("testTXAlgebra: Caused exception in withRegion");
+      getSystem().getLogWriter().fine("testTXAlgebra: Caused exception in createRegion");
       throw e;
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
index c4cca34..d87cbd8 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
@@ -2477,7 +2477,7 @@ public abstract class RegionTestCase extends JUnit4CacheTestCase {
   // Region region = null;
   // System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY", "true");
   // try {
-  // region = withRegion(name, attrs);
+  // region = createRegion(name, attrs);
   // } finally {
   // System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY);
   // }
@@ -3197,7 +3197,7 @@ public abstract class RegionTestCase extends JUnit4CacheTestCase {
   // Region region = null;
   // System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
   // try {
-  // region = withRegion(name, attrs);
+  // region = createRegion(name, attrs);
   // } finally {
   // System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY);
   // }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
index 008c03e..b9a601d 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
@@ -57,7 +57,7 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
       VM vm0 = host.getVM(1);
       VM vm1 = host.getVM(2);
 
-      SerializableRunnable createDataRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createDataRegion = new SerializableRunnable("createRegion") {
         public void run() {
           Cache cache = getCache();
           AttributesFactory attr = new AttributesFactory();
@@ -70,7 +70,7 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
 
       vm0.invoke(createDataRegion);
 
-      SerializableRunnable createEmptyRegion = new SerializableRunnable("withRegion") {
+      SerializableRunnable createEmptyRegion = new SerializableRunnable("createRegion") {
         public void run() {
           Cache cache = getCache();
           AttributesFactory attr = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
index 7415f40..0d2f2b6 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/DistTXDebugDUnitTest.java
@@ -126,7 +126,7 @@ public class DistTXDebugDUnitTest extends JUnit4CacheTestCase {
     attr.setPartitionAttributes(prAttr);
     attr.setConcurrencyChecksEnabled(concurrencyChecks);
     // assertNotNull(basicGetCache());
-    // Region pr = basicGetCache().withRegion(partitionedRegionName,
+    // Region pr = basicGetCache().createRegion(partitionedRegionName,
     // attr.create());
     assertNotNull(basicGetCache());
     Region pr = basicGetCache().createRegion(partitionedRegionName, attr.create());
@@ -163,7 +163,7 @@ public class DistTXDebugDUnitTest extends JUnit4CacheTestCase {
     } else {
       af.setDataPolicy(DataPolicy.REPLICATE);
     }
-    // Region rr = basicGetCache().withRegion(replicatedRegionName,
+    // Region rr = basicGetCache().createRegion(replicatedRegionName,
     // af.create());
     Region rr = basicGetCache().createRegion(replicatedRegionName, af.create());
     assertNotNull(rr);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java
index 6ac85d9..2dcf8e9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java
@@ -99,7 +99,7 @@ public class CacheAdvisorDUnitTest extends JUnit4CacheTestCase {
     final String rgnName = getUniqueName();
     for (int i = 0; i < vms.length; i++) {
       vms[i].invoke(
-          new CacheSerializableRunnable("CacheAdvisorDUnitTest.testGenericAdvice;withRegion") {
+          new CacheSerializableRunnable("CacheAdvisorDUnitTest.testGenericAdvice;createRegion") {
             public void run2() throws CacheException {
               createRegion(rgnName, attrs);
             }
@@ -189,7 +189,7 @@ public class CacheAdvisorDUnitTest extends JUnit4CacheTestCase {
     DistributedRegion rgn = (DistributedRegion) createRegion(rgnName, attrs);
 
     Invoke.invokeInEveryVM(new CacheSerializableRunnable(
-        "CachAdvisorTest.testNetLoadAdviceWithAttributesMutator;withRegion") {
+        "CachAdvisorTest.testNetLoadAdviceWithAttributesMutator;createRegion") {
       public void run2() throws CacheException {
         AttributesFactory f = new AttributesFactory();
         f.setScope(Scope.DISTRIBUTED_ACK);
@@ -233,7 +233,7 @@ public class CacheAdvisorDUnitTest extends JUnit4CacheTestCase {
     final String rgnName = getUniqueName();
     for (int i = 0; i < vms.length; i++) {
       vms[i].invoke(
-          new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose; withRegion") {
+          new CacheSerializableRunnable("CacheAdvisorDUnitTest.basicTestClose; createRegion") {
             public void run2() throws CacheException {
               createRegion(rgnName, attrs);
             }

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/DeltaSizingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DeltaSizingDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DeltaSizingDUnitTest.java
index a879b77..be21fa3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DeltaSizingDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DeltaSizingDUnitTest.java
@@ -146,7 +146,7 @@ public class DeltaSizingDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableCallable createDataRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createDataRegion = new SerializableCallable("createRegion") {
       public Object call() throws Exception {
         Cache cache = getCache();
         cache.setCopyOnRead(copyOnRead);
@@ -186,7 +186,7 @@ public class DeltaSizingDUnitTest extends JUnit4CacheTestCase {
     final Integer port1 = (Integer) vm0.invoke(createDataRegion);
     final Integer port2 = (Integer) vm1.invoke(createDataRegion);
 
-    SerializableRunnable createEmptyRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createEmptyRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         cache.setCopyOnRead(copyOnRead);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/EventTrackerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EventTrackerDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EventTrackerDUnitTest.java
index 219949b..3faf41f 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/EventTrackerDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EventTrackerDUnitTest.java
@@ -273,7 +273,7 @@ public class EventTrackerDUnitTest extends JUnit4CacheTestCase {
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
 
-    SerializableRunnable createRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createRegion = new SerializableRunnable("createRegion") {
 
       public void run() {
         Cache cache = getCache();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
index 1bca936..d2bad64 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PRTXJUnitTest.java
@@ -45,14 +45,14 @@ public class PRTXJUnitTest extends TXJUnitTest {
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.geode.TXTest#withRegion()
+   * @see org.apache.geode.TXTest#createRegion()
    */
   @Override
   protected void createRegion() throws Exception {
     AttributesFactory af = new AttributesFactory();
     af.setConcurrencyChecksEnabled(false); // test validation expects this behavior
     af.setPartitionAttributes(new PartitionAttributesFactory().setTotalNumBuckets(3).create());
-    // this.region = this.cache.withRegion("PRTXJUnitTest", af.create());
+    // this.region = this.cache.createRegion("PRTXJUnitTest", af.create());
     this.region = new PRWithLocalOps("PRTXJUnitTest", af.create(), null, this.cache,
         new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)
             .setSnapshotInputStream(null).setImageTarget(null));

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionListenerDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionListenerDUnitTest.java
index 9c38948..7fd470f 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionListenerDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionListenerDUnitTest.java
@@ -162,7 +162,7 @@ public class PartitionListenerDUnitTest extends JUnit4CacheTestCase {
 
   protected DistributedMember createPR(VM vm, final String regionName, final boolean isAccessor)
       throws Throwable {
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
 
       public Object call() {
         Cache cache = getCache();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java
index 2b3a5a9..304861b 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionHADUnitTest.java
@@ -90,7 +90,7 @@ public class PartitionedRegionHADUnitTest extends PartitionedRegionDUnitTestCase
     VM vm1 = host.getVM(1);
     VM vm2 = host.getVM(2);
     VM vm3 = host.getVM(3);
-    CacheSerializableRunnable createPR = new CacheSerializableRunnable("withRegion") {
+    CacheSerializableRunnable createPR = new CacheSerializableRunnable("createRegion") {
       public void run2() throws CacheException {
         Cache cache = getCache();
         final CountDownLatch rebalancingFinished = new CountDownLatch(1);

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
index 404bf27..11ecae5 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyZoneDUnitTest.java
@@ -109,7 +109,7 @@ public class PartitionedRegionRedundancyZoneDUnitTest extends JUnit4CacheTestCas
   }
 
   protected DistributedMember createPR(VM vm, int redundancy) throws Exception {
-    SerializableCallable createPrRegion = new SerializableCallable("withRegion") {
+    SerializableCallable createPrRegion = new SerializableCallable("createRegion") {
       public Object call() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
index ce09d11..e2328a4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
@@ -333,7 +333,7 @@ public class PartitionedRegionStatsDUnitTest extends PartitionedRegionDUnitTestC
     final VM vm0 = host.getVM(0);
     final VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -379,7 +379,7 @@ public class PartitionedRegionStatsDUnitTest extends PartitionedRegionDUnitTestC
     final VM vm0 = host.getVM(0);
     final VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -435,7 +435,7 @@ public class PartitionedRegionStatsDUnitTest extends PartitionedRegionDUnitTestC
     final VM vm1 = host.getVM(1);
     final VM vm2 = host.getVM(2);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();
@@ -545,7 +545,7 @@ public class PartitionedRegionStatsDUnitTest extends PartitionedRegionDUnitTestC
     final VM vm0 = host.getVM(0);
     final VM vm1 = host.getVM(1);
 
-    SerializableRunnable createPrRegion = new SerializableRunnable("withRegion") {
+    SerializableRunnable createPrRegion = new SerializableRunnable("createRegion") {
       public void run() {
         Cache cache = getCache();
         AttributesFactory attr = new AttributesFactory();

http://git-wip-us.apache.org/repos/asf/geode/blob/6a88f1bc/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestUtilsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
index 358bece..e769b4c 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
@@ -272,7 +272,7 @@ public class PartitionedRegionTestUtilsDUnitTest extends PartitionedRegionDUnitT
     // .setLocalProperties(lp)
     // .createPartitionAttributes());
     //
-    // PartitionedRegion p = (PartitionedRegion) cache.withRegion(r, attr.create());
+    // PartitionedRegion p = (PartitionedRegion) cache.createRegion(r, attr.create());
     // assertNotNull(p);
     //
     // final String key1 = "lcKey1"; final String val1 = "lcVal1";


[25/51] [abbrv] geode git commit: GEODE-2290: Add license headers to rest resources

Posted by ds...@apache.org.
GEODE-2290: Add license headers to rest resources


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

Branch: refs/heads/feature/GEODE-2097
Commit: 2c5e519c80a3beb79425af523d9014ee37c70cdc
Parents: 3423f6f
Author: Jared Stewart <js...@pivotal.io>
Authored: Mon Apr 17 09:18:05 2017 -0700
Committer: Jared Stewart <js...@pivotal.io>
Committed: Mon Apr 17 09:18:05 2017 -0700

----------------------------------------------------------------------
 .../DeployCommandRedeployDUnitTest_FunctionATemplate  | 14 ++++++++++++++
 .../DeployCommandRedeployDUnitTest_FunctionBTemplate  | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/2c5e519c/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
index 766963a..502a15f 100644
--- a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionATemplate
@@ -1,3 +1,17 @@
+/*
+ * 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.
+ */
 import java.util.Properties;
 
 import org.apache.geode.cache.Declarable;

http://git-wip-us.apache.org/repos/asf/geode/blob/2c5e519c/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
index b37a6cf..8abc418 100644
--- a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest_FunctionBTemplate
@@ -1,3 +1,17 @@
+/*
+ * 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 PACKAGE_B;
 
 import org.apache.geode.cache.execute.Function;


[14/51] [abbrv] geode git commit: GEODE-2730: refactor rules - review changes

Posted by ds...@apache.org.
GEODE-2730: refactor rules - review changes


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

Branch: refs/heads/feature/GEODE-2097
Commit: f272762f8b061f9380128c83e3aacbf2a97a58f7
Parents: 7e607de
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Apr 13 15:11:27 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri Apr 14 16:35:18 2017 -0700

----------------------------------------------------------------------
 .../internal/web/RestSecurityWithSSLTest.java   | 38 +++++++-------------
 .../test/dunit/rules/EmbeddedPulseRule.java     |  4 ++-
 .../cli/util/LogExporterIntegrationTest.java    |  2 +-
 3 files changed, 16 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
index 4d142bd..ac50716 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestSecurityWithSSLTest.java
@@ -15,8 +15,6 @@
 
 package org.apache.geode.rest.internal.web;
 
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE;
@@ -25,10 +23,8 @@ import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE;
 import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD;
-import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
 import static org.junit.Assert.assertEquals;
 
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
@@ -40,36 +36,26 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.net.URL;
-import java.util.Properties;
 
 @Category({IntegrationTest.class, SecurityTest.class})
 public class RestSecurityWithSSLTest {
+  private static URL KEYSTORE_URL =
+      RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
 
-  private static int restPort = AvailablePortHelper.getRandomAvailableTCPPort();
   @Rule
-  public ServerStarterRule serverStarter = new ServerStarterRule();
+  public ServerStarterRule serverStarter = new ServerStarterRule().withRestService()
+      .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName())
+      .withProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant())
+      .withProperty(SSL_KEYSTORE, KEYSTORE_URL.getPath())
+      .withProperty(SSL_KEYSTORE_PASSWORD, "password").withProperty(SSL_KEYSTORE_TYPE, "JKS")
+      .withProperty(SSL_TRUSTSTORE, KEYSTORE_URL.getPath())
+      .withProperty(SSL_TRUSTSTORE_PASSWORD, "password")
+      .withProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1").withAutoStart();
 
   @Test
   public void testRestSecurityWithSSL() throws Exception {
-    URL keystoreUrl =
-        RestSecurityWithSSLTest.class.getClassLoader().getResource("ssl/trusted.keystore");
-
-    Properties properties = new Properties();
-    properties.setProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName());
-    properties.setProperty(START_DEV_REST_API, "true");
-    properties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-    properties.setProperty(HTTP_SERVICE_PORT, restPort + "");
-    properties.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant());
-    properties.setProperty(SSL_KEYSTORE, keystoreUrl.getPath());
-    properties.setProperty(SSL_KEYSTORE_PASSWORD, "password");
-    properties.setProperty(SSL_KEYSTORE_TYPE, "JKS");
-    properties.setProperty(SSL_TRUSTSTORE, keystoreUrl.getPath());
-    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
-    properties.setProperty(SSL_PROTOCOLS, "TLSv1.2,TLSv1.1");
-
-    serverStarter.withProperties(properties).startServer();
-
-    GeodeRestClient restClient = new GeodeRestClient("localhost", restPort, true);
+    GeodeRestClient restClient =
+        new GeodeRestClient("localhost", serverStarter.getHttpPort(), true);
     HttpResponse response = restClient.doGet("/servers", "cluster", "cluster");
 
     assertEquals(200, GeodeRestClient.getCode(response));

http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
index e41d0fe..0ed5403 100644
--- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
@@ -48,6 +48,8 @@ public class EmbeddedPulseRule extends ExternalResource {
    * Override to tear down your specific external resource.
    */
   protected void after() {
-    repository.removeAllClusters();
+    if (repository != null) {
+      repository.removeAllClusters();
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/f272762f/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
index dc24a57..c694523 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogExporterIntegrationTest.java
@@ -91,7 +91,7 @@ public class LogExporterIntegrationTest {
   }
 
   @Test
-  @Ignore("fix .gz suffix")
+  @Ignore("GEODE-2574: fix .gz suffix")
   public void serverStartedWithGZSuffix() throws Exception {
     properties.setProperty(LOG_FILE, "test.log.gz");
     properties.setProperty(STATISTIC_ARCHIVE_FILE, "archive.gfs.gz");


[43/51] [abbrv] geode git commit: GEODE-728: Using the correct parameter in withArgs

Posted by ds...@apache.org.
GEODE-728: Using the correct parameter in withArgs

ServerRegionFunctionExecutor.withArgs was not using it's argument, it
was just passing the (null) field named args to setArguments.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 5891ed7c4306e761c1f12edf85401ab140429d04
Parents: 48d662a
Author: Dan Smith <up...@apache.org>
Authored: Thu Apr 20 10:45:55 2017 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Thu Apr 20 10:47:23 2017 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/execute/ServerRegionFunctionExecutor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/5891ed7c/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
index 6543daf..3a20dc3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
@@ -318,7 +318,7 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
     return new ServerRegionFunctionExecutor(this, args);
   }
 
-  public Execution withArgs(Object params) {
+  public Execution withArgs(Object args) {
     return setArguments(args);
   }
 


[41/51] [abbrv] geode git commit: GEODE-728: Rename Execution.withArgs to Execution.setArguments

Posted by ds...@apache.org.
GEODE-728: Rename Execution.withArgs to Execution.setArguments

 * created setArguments
 * deprecated withArgs
 * implemented setArguments of all Execution implementations in Geode project
 * replaced all of withArgs with setArguments

This closes #457


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

Branch: refs/heads/feature/GEODE-2097
Commit: aaef124e3d4d7b46c82ddb4d2af65ee48b73ba53
Parents: f038c2d
Author: Alyssa Kim <mi...@gmail.com>
Authored: Sat Apr 15 17:48:00 2017 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Wed Apr 19 16:14:07 2017 -0700

----------------------------------------------------------------------
 .../common/ClientServerSessionCache.java        |   2 +-
 .../catalina/ClientServerSessionCache.java      |   4 +-
 .../catalina/PeerToPeerSessionCache.java        |   2 +-
 .../apache/geode/cache/execute/Execution.java   |  13 +++
 .../geode/cache/execute/FunctionContext.java    |   2 +-
 .../geode/cache/execute/ResultCollector.java    |   2 +-
 .../org/apache/geode/cache/execute/package.html |   6 +-
 .../geode/internal/cache/PartitionedRegion.java |  12 +--
 .../DistributedRegionFunctionExecutor.java      |   9 +-
 .../cache/execute/FunctionContextImpl.java      |   2 +-
 .../cache/execute/MemberFunctionExecutor.java   |  13 ++-
 .../execute/MultiRegionFunctionExecutor.java    |   7 +-
 .../PartitionedRegionFunctionExecutor.java      |   7 +-
 .../cache/execute/ServerFunctionExecutor.java   |   7 +-
 .../execute/ServerRegionFunctionExecutor.java   |  11 +-
 .../internal/cache/snapshot/ClientExporter.java |   2 +-
 .../snapshot/RegionSnapshotServiceImpl.java     |   2 +-
 .../cache/snapshot/WindowedExporter.java        |   4 +-
 .../tier/sockets/command/ExecuteFunction70.java |   2 +-
 .../internal/MBeanProxyInvocationHandler.java   |   2 +-
 .../internal/beans/QueryDataFunction.java       |   8 +-
 .../geode/management/internal/cli/CliUtil.java  |   4 +-
 .../internal/cli/commands/DataCommands.java     |   5 +-
 .../cli/commands/DiskStoreCommands.java         |   2 +-
 .../internal/cli/commands/FunctionCommands.java |   6 +-
 .../cli/commands/MiscellaneousCommands.java     |   2 +-
 .../cli/functions/UserFunctionExecution.java    |   2 +-
 .../management/MemoryThresholdsDUnitTest.java   |   6 +-
 .../QueryUsingFunctionContextDUnitTest.java     |  12 +--
 ...artitionedRegionEquiJoinIntegrationTest.java |   4 +-
 .../PRColocatedEquiJoinDUnitTest.java           |   4 +-
 .../query/partitioned/PRQueryDUnitHelper.java   |  23 +++--
 .../cache/ClientServerTransactionDUnitTest.java |  38 +++----
 .../geode/internal/cache/CommitFunction.java    |   5 +-
 ...eAndForgetFunctionOnAllServersDUnitTest.java |   6 +-
 .../cache/NestedTransactionFunction.java        |   2 +-
 .../geode/internal/cache/RollbackFunction.java  |   5 +-
 .../cache/execute/Bug51193DUnitTest.java        |   6 +-
 .../ClientServerFunctionExecutionDUnitTest.java |  14 +--
 ...ributedRegionFunctionExecutionDUnitTest.java |  20 ++--
 .../FunctionExecution_ExceptionDUnitTest.java   |  26 ++---
 .../execute/FunctionServiceStatsDUnitTest.java  |  26 ++---
 .../LocalFunctionExecutionDUnitTest.java        |   4 +-
 .../MemberFunctionExecutionDUnitTest.java       |   8 +-
 .../OnGroupsFunctionExecutionDUnitTest.java     |  38 +++----
 ...ntServerFunctionExecutionNoAckDUnitTest.java |   6 +-
 ...tServerRegionFunctionExecutionDUnitTest.java |  71 ++++++-------
 ...egionFunctionExecutionFailoverDUnitTest.java |   2 +-
 ...onFunctionExecutionNoSingleHopDUnitTest.java |  57 ++++++-----
 ...onExecutionSelectorNoSingleHopDUnitTest.java |  57 ++++++-----
 ...gionFunctionExecutionSingleHopDUnitTest.java |  63 ++++++------
 .../execute/PRFunctionExecutionDUnitTest.java   | 101 ++++++++++---------
 .../PRFunctionExecutionTimeOutDUnitTest.java    |  52 +++++-----
 ...ctionExecutionWithResultSenderDUnitTest.java |  32 +++---
 .../cache/execute/PRTransactionDUnitTest.java   |  20 ++--
 .../partitioned/PartitionResolverDUnitTest.java |   2 +-
 .../commands/DiskStoreCommandsJUnitTest.java    |   8 +-
 .../ClientExecuteFunctionAuthDUnitTest.java     |   8 +-
 ...lientExecuteRegionFunctionAuthDUnitTest.java |   7 +-
 .../function_execution.html.md.erb              |   6 +-
 .../join_query_partitioned_regions.html.md.erb  |   4 +-
 ...tioned_region_key_or_field_value.html.md.erb |   2 +-
 .../query_on_a_single_node.html.md.erb          |   2 +-
 .../LuceneIndexForPartitionedRegion.java        |   2 +-
 .../cache/lucene/internal/LuceneQueryImpl.java  |   2 +-
 .../lucene/internal/LuceneServiceImpl.java      |   2 +-
 .../internal/LuceneQueryImplJUnitTest.java      |   4 +-
 .../internal/DefaultGeodeConnection.scala       |   4 +-
 ...tewaySenderDistributedDeadlockDUnitTest.java |   2 +-
 .../controllers/FunctionAccessController.java   |   4 +-
 70 files changed, 482 insertions(+), 425 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/ClientServerSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/ClientServerSessionCache.java b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/ClientServerSessionCache.java
index a1ed5e7..51a2a6e 100644
--- a/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/ClientServerSessionCache.java
+++ b/extensions/geode-modules-session-internal/src/main/java/org/apache/geode/modules/session/internal/common/ClientServerSessionCache.java
@@ -132,7 +132,7 @@ public class ClientServerSessionCache extends AbstractSessionCache {
     RegionConfiguration configuration = createRegionConfiguration();
 
     // Send it to the server tier
-    Execution execution = FunctionService.onServer(this.cache).withArgs(configuration);
+    Execution execution = FunctionService.onServer(this.cache).setArguments(configuration);
     ResultCollector collector = execution.execute(CreateRegionFunction.ID);
 
     // Verify the region was successfully created on the servers

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java
index 2d4a8cd..af2a2a3 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/ClientServerSessionCache.java
@@ -109,7 +109,7 @@ public class ClientServerSessionCache extends AbstractSessionCache {
     } else {
       // Execute the member touch function on all the server(s)
       Execution execution = FunctionService.onServers(getCache())
-          .withArgs(new Object[] {this.sessionRegion.getFullPath(), sessionIds});
+          .setArguments(new Object[] {this.sessionRegion.getFullPath(), sessionIds});
       try {
         ResultCollector collector =
             execution.execute(TouchReplicatedRegionEntriesFunction.ID, true, false, false);
@@ -202,7 +202,7 @@ public class ClientServerSessionCache extends AbstractSessionCache {
     RegionConfiguration configuration = createRegionConfiguration();
 
     // Send it to the server tier
-    Execution execution = FunctionService.onServer(this.cache).withArgs(configuration);
+    Execution execution = FunctionService.onServer(this.cache).setArguments(configuration);
     ResultCollector collector = execution.execute(CreateRegionFunction.ID);
 
     // Verify the region was successfully created on the servers

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/PeerToPeerSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/PeerToPeerSessionCache.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/PeerToPeerSessionCache.java
index 0e1097b..69d6ec0 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/PeerToPeerSessionCache.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/PeerToPeerSessionCache.java
@@ -91,7 +91,7 @@ public class PeerToPeerSessionCache extends AbstractSessionCache {
     } else {
       // Execute the member touch function on all the server(s)
       Execution execution = FunctionService.onMembers(getCache().getDistributedSystem())
-          .withArgs(new Object[] {this.sessionRegion.getFullPath(), sessionIds});
+          .setArguments(new Object[] {this.sessionRegion.getFullPath(), sessionIds});
       collector = execution.execute(TouchReplicatedRegionEntriesFunction.ID, true, false, false);
     }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java b/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
index c3fdb6e..90ee1ec 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java
@@ -60,7 +60,20 @@ public interface Execution<IN, OUT, AGG> {
    * @param args user data passed to the function execution
    * @return an Execution with args
    * @throws IllegalArgumentException if the input parameter is null
+   * @since Geode 1.2
+   * 
+   */
+  public Execution<IN, OUT, AGG> setArguments(IN args);
+
+  /**
+   * Specifies the user data passed to the function when it is executed. The function can retrieve
+   * these arguments using {@link FunctionContext#getArguments()}
+   * 
+   * @param args user data passed to the function execution
+   * @return an Execution with args
+   * @throws IllegalArgumentException if the input parameter is null
    * @since GemFire 6.0
+   * @deprecated use {@link #setArguments(Object)} instead
    * 
    */
   public Execution<IN, OUT, AGG> withArgs(IN args);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
index 392eea9..74f05c5 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionContext.java
@@ -35,7 +35,7 @@ package org.apache.geode.cache.execute;
 public interface FunctionContext<T1> {
   /**
    * Returns the arguments provided to this function execution. These are the arguments specified by
-   * the caller using {@link Execution#withArgs(Object)}
+   * the caller using {@link Execution#setArguments(Object)}
    * 
    * @return the arguments or null if there are no arguments
    * @since GemFire 6.0

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/cache/execute/ResultCollector.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/ResultCollector.java b/geode-core/src/main/java/org/apache/geode/cache/execute/ResultCollector.java
index 9c9bdeb..605d4f1 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/ResultCollector.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/ResultCollector.java
@@ -37,7 +37,7 @@ import org.apache.geode.distributed.DistributedMember;
  *  Function multiGetFunction ;
  *  Object args ;
  *  ResultCollector rc = FunctionService.onRegion(region)
- *                                      .withArgs(args)
+ *                                      .setArguments(args)
  *                                      .withFilter(keySet)
  *                                      .withCollector(new MyCustomResultCollector())
  *                                      .execute(multiGetFunction.getId());

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/cache/execute/package.html
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/package.html b/geode-core/src/main/java/org/apache/geode/cache/execute/package.html
index ce3046e..f1565e2 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/package.html
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/package.html
@@ -73,7 +73,7 @@ limitations under the License.
     Function multiGetFunction;
     Object args;
     ResultCollector rc = FunctionService.onRegion(region)
-                                        .withArgs(args)
+                                        .setArguments(args)
                                         .withFilter(keySet)
                                         .withCollector(new MyCustomResultCollector())
                                         .execute(multiGetFunction.getId());
@@ -96,7 +96,7 @@ limitations under the License.
     Function multiGetFunction;
     Object args;
     ResultCollector rc = FunctionService.onRegions(s)
-                                        .withArgs(args)
+                                        .setArguments(args)
                                         .withCollector(new MyCustomResultCollector())
                                         .execute(multiGetFunction.getId());
     // Application can get the handle of all the regions at the node it is executing on.
@@ -114,7 +114,7 @@ limitations under the License.
     Function memberSetupFunction;
     Object args;
     ResultCollector rc = FunctionService.onMembers(ds)
-                                        .withArgs(args)
+                                        .setArguments(args)
                                         .execute(memberSetupFunction.getId());
     //Application can do something else here before retrieving the result
     Object functionResult = rc.getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 774ad0c..e15eb2a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -3349,20 +3349,20 @@ public class PartitionedRegion extends LocalRegion
       switch (execution.getFilter().size()) {
         case 0:
           if (logger.isDebugEnabled()) {
-            logger.debug("Executing Function: {} withArgs={} on all buckets.", function.getId(),
+            logger.debug("Executing Function: {} setArguments={} on all buckets.", function.getId(),
                 execution.getArguments());
           }
           return executeOnAllBuckets(function, execution, rc, false);
         case 1:
           if (logger.isDebugEnabled()) {
-            logger.debug("Executing Function: {} withArgs={} on single node.", function.getId(),
+            logger.debug("Executing Function: {} setArguments={} on single node.", function.getId(),
                 execution.getArguments());
           }
           return executeOnSingleNode(function, execution, rc, false, executeOnBucketSet);
         default:
           if (logger.isDebugEnabled()) {
-            logger.debug("Executing Function: {} withArgs={} on multiple nodes.", function.getId(),
-                execution.getArguments());
+            logger.debug("Executing Function: {} setArguments={} on multiple nodes.",
+                function.getId(), execution.getArguments());
           }
           return executeOnMultipleNodes(function, execution, rc, false, executeOnBucketSet);
       }
@@ -3578,7 +3578,7 @@ public class PartitionedRegion extends LocalRegion
     }
 
     if (logger.isDebugEnabled()) {
-      logger.debug("Executing Function: {} withArgs={} on {}", function.getId(),
+      logger.debug("Executing Function: {} setArguments={} on {}", function.getId(),
           execution.getArguments(), targetNode);
     }
     while (!execution.getFailedNodes().isEmpty()) {
@@ -6447,7 +6447,7 @@ public class PartitionedRegion extends LocalRegion
 
     ResultCollector rc = null;
     try {
-      rc = FunctionService.onRegion(this).withArgs((Serializable) value)
+      rc = FunctionService.onRegion(this).setArguments((Serializable) value)
           .execute(PRContainsValueFunction.class.getName());
       List<Boolean> results = ((List<Boolean>) rc.getResult());
       for (Boolean r : results) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
index 8a4b571..dcadab0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutor.java
@@ -344,7 +344,10 @@ public class DistributedRegionFunctionExecutor extends AbstractExecution {
     return this.sender;
   }
 
-  public Execution withArgs(Object args) {
+
+
+  @Override
+  public Execution setArguments(Object args) {
     if (args == null) {
       throw new IllegalArgumentException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
@@ -353,6 +356,10 @@ public class DistributedRegionFunctionExecutor extends AbstractExecution {
     return new DistributedRegionFunctionExecutor(this, args);
   }
 
+  public Execution withArgs(Object args) {
+    return setArguments(args);
+  }
+
   public Execution withCollector(ResultCollector rs) {
     if (rs == null) {
       throw new IllegalArgumentException(

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java
index e2185c4..c616cbd 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/FunctionContextImpl.java
@@ -59,7 +59,7 @@ public class FunctionContextImpl implements FunctionContext {
 
   /**
    * Returns the arguments provided to this function execution. These are the arguments specified by
-   * caller using {@link Execution#withArgs(Object)}
+   * caller using {@link Execution#setArguments(Object)}
    * 
    * @return the arguments or null if there are no arguments
    */

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
index 6bb00fb..74034e4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MemberFunctionExecutor.java
@@ -207,14 +207,19 @@ public class MemberFunctionExecutor extends AbstractExecution {
     }
   }
 
-  // Changing the object!!
-  public Execution withArgs(Object arguments) {
-    if (arguments == null) {
+  @Override
+  public Execution setArguments(Object args) {
+    if (args == null) {
       throw new IllegalArgumentException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
               .toLocalizedString("args"));
     }
-    return new MemberFunctionExecutor(this, arguments);
+    return new MemberFunctionExecutor(this, args);
+  }
+
+  // Changing the object!!
+  public Execution withArgs(Object args) {
+    return setArguments(args);
   }
 
   // Changing the object!!

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
index c4c3a1a..a3ae2c0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/MultiRegionFunctionExecutor.java
@@ -142,7 +142,8 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
     return this.sender;
   }
 
-  public Execution withArgs(Object args) {
+  @Override
+  public Execution setArguments(Object args) {
     if (args == null) {
       throw new IllegalArgumentException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
@@ -151,6 +152,10 @@ public class MultiRegionFunctionExecutor extends AbstractExecution {
     return new MultiRegionFunctionExecutor(this, args);
   }
 
+  public Execution withArgs(Object args) {
+    return setArguments(args);
+  }
+
   public Execution withCollector(ResultCollector rc) {
     if (rc == null) {
       throw new IllegalArgumentException(

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
index 6e0840a..c7a7d36 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/PartitionedRegionFunctionExecutor.java
@@ -278,7 +278,8 @@ public class PartitionedRegionFunctionExecutor extends AbstractExecution {
     return this.sender;
   }
 
-  public Execution withArgs(Object args) {
+  @Override
+  public Execution setArguments(Object args) {
     if (args == null) {
       throw new FunctionException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
@@ -287,6 +288,10 @@ public class PartitionedRegionFunctionExecutor extends AbstractExecution {
     return new PartitionedRegionFunctionExecutor(this, args);
   }
 
+  public Execution withArgs(Object args) {
+    return setArguments(args);
+  }
+
   public Execution withCollector(ResultCollector rs) {
     if (rs == null) {
       throw new FunctionException(

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerFunctionExecutor.java
index a310fa5..d11358e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerFunctionExecutor.java
@@ -250,7 +250,8 @@ public class ServerFunctionExecutor extends AbstractExecution {
             .toLocalizedString("buckets as filter"));
   }
 
-  public Execution withArgs(Object args) {
+  @Override
+  public Execution setArguments(Object args) {
     if (args == null) {
       throw new FunctionException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
@@ -259,6 +260,10 @@ public class ServerFunctionExecutor extends AbstractExecution {
     return new ServerFunctionExecutor(this, args);
   }
 
+  public Execution withArgs(Object args) {
+    return setArguments(args);
+  }
+
   public Execution withCollector(ResultCollector rs) {
     if (rs == null) {
       throw new FunctionException(

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
index 1d18fed..6543daf 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/execute/ServerRegionFunctionExecutor.java
@@ -308,13 +308,18 @@ public class ServerRegionFunctionExecutor extends AbstractExecution {
         .append("]").toString();
   }
 
-  public Execution withArgs(Object params) {
-    if (params == null) {
+  @Override
+  public Execution setArguments(Object args) {
+    if (args == null) {
       throw new FunctionException(
           LocalizedStrings.ExecuteRegionFunction_THE_INPUT_0_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
               .toLocalizedString("args"));
     }
-    return new ServerRegionFunctionExecutor(this, params);
+    return new ServerRegionFunctionExecutor(this, args);
+  }
+
+  public Execution withArgs(Object params) {
+    return setArguments(args);
   }
 
   public Execution withCollector(ResultCollector rs) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/ClientExporter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/ClientExporter.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/ClientExporter.java
index c18dcd5..95bde41 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/ClientExporter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/ClientExporter.java
@@ -69,7 +69,7 @@ public class ClientExporter<K, V> implements Exporter<K, V> {
           : FunctionService.onServer(pool);
 
       ResultCollector<?, ?> rc =
-          exec.withArgs(args).withCollector(results).execute(new ProxyExportFunction<K, V>());
+          exec.setArguments(args).withCollector(results).execute(new ProxyExportFunction<K, V>());
 
       // Our custom result collector is writing the data, but this will
       // check for errors.

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
index bfdef05..73b8ba9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
@@ -180,7 +180,7 @@ public class RegionSnapshotServiceImpl<K, V> implements RegionSnapshotService<K,
   private void snapshotInParallel(ParallelArgs<K, V> args, Function fn) throws IOException {
     try {
 
-      ResultCollector rc = FunctionService.onRegion(region).withArgs(args).execute(fn);
+      ResultCollector rc = FunctionService.onRegion(region).setArguments(args).execute(fn);
       List result = (List) rc.getResult();
       for (Object obj : result) {
         if (obj instanceof Exception) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/WindowedExporter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/WindowedExporter.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/WindowedExporter.java
index c515c7a..6ba94a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/WindowedExporter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/WindowedExporter.java
@@ -77,8 +77,8 @@ public class WindowedExporter<K, V> implements Exporter<K, V> {
       // to keep the reference to the ResultsCollector returned from execute().
       // Normally discarding the reference can cause issues if GC causes the
       // weak ref in ProcessorKeeper21 to be collected!!
-      InternalExecution exec = (InternalExecution) FunctionService.onRegion(region).withArgs(args)
-          .withCollector(results);
+      InternalExecution exec = (InternalExecution) FunctionService.onRegion(region)
+          .setArguments(args).withCollector(results);
 
       // Ensure that our collector gets all exceptions so we can shut down the
       // queue properly.

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
index d1fc2ab..957b423 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
@@ -124,7 +124,7 @@ public class ExecuteFunction70 extends ExecuteFunction66 {
     }
     Execution execution = new MemberFunctionExecutor(ds, members, resultSender);
     if (args != null) {
-      execution = execution.withArgs(args);
+      execution = execution.setArguments(args);
     }
     if (ignoreFailedMembers) {
       if (logger.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyInvocationHandler.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyInvocationHandler.java b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyInvocationHandler.java
index 15ce122..e8f2521 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyInvocationHandler.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/MBeanProxyInvocationHandler.java
@@ -281,7 +281,7 @@ public class MBeanProxyInvocationHandler implements InvocationHandler {
     List<Object> result = null;
     try {
 
-      ResultCollector rc = FunctionService.onMember(member).withArgs(functionArgs)
+      ResultCollector rc = FunctionService.onMember(member).setArguments(functionArgs)
           .execute(ManagementConstants.MGMT_FUNCTION_ID);
       result = (List<Object>) rc.getResult();
       // Exceptions of ManagementFunctions

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
index 56064d0..efd7436 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
@@ -174,8 +174,8 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
             results = selectResults;
           }
         } else {
-          rcollector = FunctionService.onRegion(cache.getRegion(regionName)).withArgs(queryString)
-              .execute(loclQueryFunc);
+          rcollector = FunctionService.onRegion(cache.getRegion(regionName))
+              .setArguments(queryString).execute(loclQueryFunc);
           results = rcollector.getResult();
         }
       }
@@ -250,7 +250,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
     try {
       if (members.size() == 1) {
         DistributedMember member = members.iterator().next();
-        ResultCollector collector = FunctionService.onMember(member).withArgs(functionArgs)
+        ResultCollector collector = FunctionService.onMember(member).setArguments(functionArgs)
             .execute(ManagementConstants.QUERY_DATA_FUNCTION);
         List list = (List) collector.getResult();
         Object object = null;
@@ -280,7 +280,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
         }
 
       } else { // More than 1 Member
-        ResultCollector coll = FunctionService.onMembers(members).withArgs(functionArgs)
+        ResultCollector coll = FunctionService.onMembers(members).setArguments(functionArgs)
             .execute(ManagementConstants.QUERY_DATA_FUNCTION);
 
         List list = (List) coll.getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
index ad3f3df..d125e53 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
@@ -614,7 +614,7 @@ public class CliUtil {
     Execution execution = null;
 
     if (args != null) {
-      execution = FunctionService.onMembers(targetMembers).withArgs(args);
+      execution = FunctionService.onMembers(targetMembers).setArguments(args);
     } else {
       execution = FunctionService.onMembers(targetMembers);
     }
@@ -637,7 +637,7 @@ public class CliUtil {
     Execution execution = null;
 
     if (args != null) {
-      execution = FunctionService.onMember(targetMember).withArgs(args);
+      execution = FunctionService.onMember(targetMember).setArguments(args);
     } else {
       execution = FunctionService.onMember(targetMember);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
index 484bbf2..6324b5c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
@@ -1198,7 +1198,8 @@ public class DataCommands implements CommandMarker {
 
     if (members.size() == 1) {
       DistributedMember member = members.iterator().next();
-      ResultCollector collector = FunctionService.onMember(member).withArgs(request).execute(putfn);
+      ResultCollector collector =
+          FunctionService.onMember(member).setArguments(request).execute(putfn);
       List list = (List) collector.getResult();
       Object object = list.get(0);
       if (object instanceof Throwable) {
@@ -1213,7 +1214,7 @@ public class DataCommands implements CommandMarker {
       return result;
     } else {
       ResultCollector collector =
-          FunctionService.onMembers(members).withArgs(request).execute(putfn);
+          FunctionService.onMembers(members).setArguments(request).execute(putfn);
       List list = (List) collector.getResult();
       DataCommandResult result = null;
       for (int i = 0; i < list.size(); i++) {

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
index 9116ba3..9ad2060 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
@@ -911,7 +911,7 @@ public class DiskStoreCommands extends AbstractCommandsSupport {
                                                                         // MemberNotFoundException
 
     final ResultCollector<?, ?> resultCollector =
-        getMembersFunctionExecutor(Collections.singleton(member)).withArgs(diskStoreName)
+        getMembersFunctionExecutor(Collections.singleton(member)).setArguments(diskStoreName)
             .execute(new DescribeDiskStoreFunction());
 
     final Object result = ((List<?>) resultCollector.getResult()).get(0);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
index c2fb88f..752ca2a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
@@ -257,7 +257,7 @@ public class FunctionCommands implements CommandMarker {
               execution = execution.withFilter(filters);
             }
             if (arguments != null && arguments.length > 0) {
-              execution = execution.withArgs(arguments);
+              execution = execution.setArguments(arguments);
             }
 
             try {
@@ -389,7 +389,7 @@ public class FunctionCommands implements CommandMarker {
       }
       args[4] = onRegion;
 
-      Execution execution = FunctionService.onMember(member).withArgs(args);
+      Execution execution = FunctionService.onMember(member).setArguments(args);
       if (execution != null) {
         List<Object> results = (List<Object>) execution.execute(function).getResult();
         if (results != null) {
@@ -522,7 +522,7 @@ public class FunctionCommands implements CommandMarker {
     Object[] obj = new Object[1];
     obj[0] = functionId;
 
-    Execution execution = FunctionService.onMembers(DsMembers).withArgs(obj);
+    Execution execution = FunctionService.onMembers(DsMembers).setArguments(obj);
 
     if (execution == null) {
       cache.getLogger().error("executeUnregister execution is null");

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
index 2a356d8..22981e7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
@@ -1951,7 +1951,7 @@ public class MiscellaneousCommands implements CommandMarker {
       TabularResultData resultTable = section.addTable("ChangeLogLevel");
       resultTable = resultTable.setHeader("Summary");
 
-      Execution execution = FunctionService.onMembers(dsMembers).withArgs(functionArgs);
+      Execution execution = FunctionService.onMembers(dsMembers).setArguments(functionArgs);
       if (execution == null) {
         return ResultBuilder.createUserErrorResult(CliStrings.CHANGE_LOGLEVEL__MSG__CANNOT_EXECUTE);
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
index 855a329..630c2bc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/UserFunctionExecution.java
@@ -92,7 +92,7 @@ public class UserFunctionExecution implements Function, InternalEntity {
               }
 
               if (functionArgs != null && functionArgs.length > 0) {
-                execution = execution.withArgs(functionArgs);
+                execution = execution.setArguments(functionArgs);
               }
               if (filters != null && filters.size() > 0) {
                 execution = execution.withFilter(filters);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
index 118fb4b..5db1559 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/management/MemoryThresholdsDUnitTest.java
@@ -1126,7 +1126,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
               Execution e = FunctionService.onRegion(pr);
               try {
                 getCache().getLoggerI18n().fine(addExpectedFunctionExString);
-                e.withFilter(s).withArgs((Serializable) s).execute(function);
+                e.withFilter(s).setArguments((Serializable) s).execute(function);
                 getCache().getLoggerI18n().fine(removeExpectedFunctionExString);
                 fail("expected LowMemoryExcception was not thrown");
               } catch (LowMemoryException ex) {
@@ -1140,7 +1140,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
               s.add(sickKey2);
               Execution e = FunctionService.onRegion(pr);
               try {
-                e.withFilter(s).withArgs((Serializable) s).execute(function);
+                e.withFilter(s).setArguments((Serializable) s).execute(function);
                 fail("expected LowMemoryExcception was not thrown");
               } catch (LowMemoryException ex) {
                 // expected
@@ -1152,7 +1152,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
             Set s = new HashSet();
             s.add(healthyKey);
             Execution e = FunctionService.onRegion(pr);
-            e.withFilter(s).withArgs((Serializable) s).execute(function);
+            e.withFilter(s).setArguments((Serializable) s).execute(function);
           }
           if (sickKey1 != null && sickKey2 != null && healthyKey != null) {
             break;

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
index 638a94d..b5b7c74 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
@@ -198,7 +198,7 @@ public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
 
             rcollector =
                 FunctionService.onRegion(CacheFactory.getAnyInstance().getRegion(repRegionName))
-                    .withArgs(queriesForRR[i]).execute(function);
+                    .setArguments(queriesForRR[i]).execute(function);
 
             // Should not come here, an exception is expected from above function call.
             fail("Function call did not fail for query with function context");
@@ -438,7 +438,7 @@ public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
 
             rcollector = FunctionService
                 .onRegion(CacheFactory.getAnyInstance().getRegion(PartitionedRegionName1))
-                .withArgs(queries[i]).withFilter(filter).execute(function);
+                .setArguments(queries[i]).withFilter(filter).execute(function);
 
             // Should not come here, an exception is expected from above function call.
             fail("Function call did not fail for query with function context");
@@ -509,7 +509,7 @@ public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
 
             rcollector = FunctionService
                 .onRegion(CacheFactory.getAnyInstance().getRegion(PartitionedRegionName1))
-                .withArgs(queries[i]).withFilter(filter).execute(function);
+                .setArguments(queries[i]).withFilter(filter).execute(function);
 
             // Should not come here, an exception is expected from above function call.
             fail("Function call did not fail for query with function context");
@@ -930,10 +930,10 @@ public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
     // Filter can not be set as null if withFilter() is called.
     if (filter != null) {
       rcollector = FunctionService.onRegion(CacheFactory.getAnyInstance().getRegion(regionName))
-          .withArgs(query).withFilter(filter).execute(func);
+          .setArguments(query).withFilter(filter).execute(func);
     } else {
       rcollector = FunctionService.onRegion(CacheFactory.getAnyInstance().getRegion(regionName))
-          .withArgs(query).execute(func);
+          .setArguments(query).execute(func);
     }
     Object result = rcollector.getResult();
     assertTrue(result instanceof ArrayList);
@@ -968,7 +968,7 @@ public class QueryUsingFunctionContextDUnitTest extends JUnit4CacheTestCase {
 
     // Filter can not be set as null if withFilter() is called.
     rcollector = FunctionService.onServer(ClientCacheFactory.getAnyInstance())
-        .withArgs(new Object[] {query, filter}).execute(func);
+        .setArguments(new Object[] {query, filter}).execute(func);
     Object result = rcollector.getResult();
     assertTrue(result instanceof ArrayList);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
index 227d6ce..579bbb2 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/PartitionedRegionEquiJoinIntegrationTest.java
@@ -82,8 +82,8 @@ public class PartitionedRegionEquiJoinIntegrationTest extends EquiJoinIntegratio
 
   @Override
   protected Object[] executeQueries(String[] queries) {
-    ResultCollector collector =
-        FunctionService.onRegion(region1).withArgs(queries).execute(equijoinTestFunction.getId());
+    ResultCollector collector = FunctionService.onRegion(region1).setArguments(queries)
+        .execute(equijoinTestFunction.getId());
     Object result = collector.getResult();
     return (Object[]) ((ArrayList) result).get(0);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
index 4f1f68e..ae8da22 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRColocatedEquiJoinDUnitTest.java
@@ -343,7 +343,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
+                .setArguments("Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
                     + " * from /" + name + " r1, /" + coloName + " r2 where " + queries[j])
                 .execute(func).getResult();
 
@@ -1603,7 +1603,7 @@ public class PRColocatedEquiJoinDUnitTest extends PartitionedRegionDUnitTestCase
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
+                .setArguments("Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
                     + " * from /" + name + " r1, /" + coloName + " r2 where " + queries[j])
                 .execute(func).getResult();
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
index 0f63df5..827f2a7 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java
@@ -2024,8 +2024,9 @@ public class PRQueryDUnitHelper implements Serializable {
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("<trace> Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
-                    + " * from /" + name + " r1, /" + coloName + " r2 where " + queries[j])
+                .setArguments(
+                    "<trace> Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
+                        + " * from /" + name + " r1, /" + coloName + " r2 where " + queries[j])
                 .execute(func).getResult();
 
             r[j][0] = ((ArrayList) funcResult).get(0);
@@ -2138,9 +2139,9 @@ public class PRQueryDUnitHelper implements Serializable {
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("<trace> Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
-                    + " * from /" + name + " r1, /" + coloName
-                    + " r2, r2.positions.values pos2 where " + queries[j])
+                .setArguments("<trace> Select "
+                    + (queries[j].contains("ORDER BY") ? "DISTINCT" : "") + " * from /" + name
+                    + " r1, /" + coloName + " r2, r2.positions.values pos2 where " + queries[j])
                 .execute(func).getResult();
 
             r[j][0] = ((ArrayList) funcResult).get(0);
@@ -2251,9 +2252,9 @@ public class PRQueryDUnitHelper implements Serializable {
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("<trace> Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
-                    + " * from /" + name + " r1, /" + coloName
-                    + " r2, r2.positions.values pos2 where " + queries[j])
+                .setArguments("<trace> Select "
+                    + (queries[j].contains("ORDER BY") ? "DISTINCT" : "") + " * from /" + name
+                    + " r1, /" + coloName + " r2, r2.positions.values pos2 where " + queries[j])
                 .execute(func).getResult();
 
             r[j][0] = ((ArrayList) funcResult).get(0);
@@ -2365,9 +2366,9 @@ public class PRQueryDUnitHelper implements Serializable {
             Object funcResult = FunctionService
                 .onRegion((getCache().getRegion(name) instanceof PartitionedRegion)
                     ? getCache().getRegion(name) : getCache().getRegion(coloName))
-                .withArgs("<trace> Select " + (queries[j].contains("ORDER BY") ? "DISTINCT" : "")
-                    + " * from /" + name + " r1, r1.positions.values pos1, /" + coloName
-                    + " r2 where " + queries[j])
+                .setArguments("<trace> Select "
+                    + (queries[j].contains("ORDER BY") ? "DISTINCT" : "") + " * from /" + name
+                    + " r1, r1.positions.values pos1, /" + coloName + " r2 where " + queries[j])
                 .execute(func).getResult();
 
             r[j][0] = ((ArrayList) funcResult).get(0);

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java
index 95c09b6..ec4e179 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java
@@ -3000,19 +3000,19 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
         args.add(new CustId(0));
         args.add(new Customer("name0", "address0"));
         args.add(null);
-        List result = (List) FunctionService.onRegion(cust).withArgs(args).execute(new TXFunction())
-            .getResult();
+        List result = (List) FunctionService.onRegion(cust).setArguments(args)
+            .execute(new TXFunction()).getResult();
         TransactionId txId = (TransactionId) result.get(0);
         assertNotNull(txId);
         args = new ArrayList();
         args.add(new CustId(1));
         args.add(new Customer("name1", "address1"));
         args.add(txId);
-        result = (List) FunctionService.onRegion(cust).withArgs(args).execute(new TXFunction())
+        result = (List) FunctionService.onRegion(cust).setArguments(args).execute(new TXFunction())
             .getResult();
         TransactionId txId2 = (TransactionId) result.get(0);
         assertEquals(txId, txId2);
-        result = (List) FunctionService.onServer(getCache()).withArgs(txId)
+        result = (List) FunctionService.onServer(getCache()).setArguments(txId)
             .execute(new CommitFunction()).getResult();
         Boolean b = (Boolean) result.get(0);
         assertEquals(Boolean.TRUE, b);
@@ -3088,7 +3088,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
           args.add(new CustId(0));
           args.add(new Customer("name0", "address0"));
           args.add(null);
-          List result = (List) FunctionService.onRegion(cust).withArgs(args)
+          List result = (List) FunctionService.onRegion(cust).setArguments(args)
               .execute(new TXFunction()).getResult();
           TransactionId txId = (TransactionId) result.get(0);
           assertNotNull(txId);
@@ -3096,17 +3096,17 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
           args.add(new CustId(1));
           args.add(new Customer("name1", "address1"));
           args.add(txId);
-          result = (List) FunctionService.onRegion(cust).withArgs(args).execute(new TXFunction())
-              .getResult();
+          result = (List) FunctionService.onRegion(cust).setArguments(args)
+              .execute(new TXFunction()).getResult();
           TransactionId txId2 = (TransactionId) result.get(0);
           assertEquals(txId, txId2);
           // invoke ClientCommitFunction
           try {
             if (commit) {
-              FunctionService.onServer(getCache()).withArgs(new CustId(0))
+              FunctionService.onServer(getCache()).setArguments(new CustId(0))
                   .execute(new CommitFunction()).getResult();
             } else {
-              FunctionService.onServer(getCache()).withArgs(new CustId(0))
+              FunctionService.onServer(getCache()).setArguments(new CustId(0))
                   .execute(new RollbackFunction()).getResult();
             }
             fail("expected exception not thrown");
@@ -3115,10 +3115,10 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
           }
           List list = null;
           if (commit) {
-            list = (List) FunctionService.onServer(getCache()).withArgs(txId)
+            list = (List) FunctionService.onServer(getCache()).setArguments(txId)
                 .execute(new CommitFunction()).getResult();
           } else {
-            list = (List) FunctionService.onServer(getCache()).withArgs(txId)
+            list = (List) FunctionService.onServer(getCache()).setArguments(txId)
                 .execute(new RollbackFunction()).getResult();
           }
           assertEquals(Boolean.TRUE, list.get(0));
@@ -3179,22 +3179,22 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
         args.add(new CustId(0));
         args.add(new Customer("name0", "address0"));
         args.add(null);
-        List result = (List) FunctionService.onRegion(cust).withArgs(args).execute(new TXFunction())
-            .getResult();
+        List result = (List) FunctionService.onRegion(cust).setArguments(args)
+            .execute(new TXFunction()).getResult();
         TransactionId txId = (TransactionId) result.get(0);
         assertNotNull(txId);
         args = new ArrayList();
         args.add(new CustId(1));
         args.add(new Customer("name1", "address1"));
         args.add(txId);
-        result = (List) FunctionService.onRegion(cust).withArgs(args).execute(new TXFunction())
+        result = (List) FunctionService.onRegion(cust).setArguments(args).execute(new TXFunction())
             .getResult();
         TransactionId txId2 = (TransactionId) result.get(0);
         assertEquals(txId, txId2);
         // invoke ClientCommitFunction
         try {
-          FunctionService.onServer(getCache()).withArgs(new CustId(0)).execute(new CommitFunction())
-              .getResult();
+          FunctionService.onServer(getCache()).setArguments(new CustId(0))
+              .execute(new CommitFunction()).getResult();
           fail("expected exception not thrown");
         } catch (FunctionException e) {
           assertTrue(e.getCause() instanceof ClassCastException);
@@ -3216,10 +3216,10 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
         try {
           List list = null;
           if (commit) {
-            list = (List) FunctionService.onServer(getCache()).withArgs(txId)
+            list = (List) FunctionService.onServer(getCache()).setArguments(txId)
                 .execute(new CommitFunction()).getResult();
           } else {
-            list = (List) FunctionService.onServer(getCache()).withArgs(txId)
+            list = (List) FunctionService.onServer(getCache()).setArguments(txId)
                 .execute(new RollbackFunction()).getResult();
           }
           fail("expected exception not thrown");
@@ -3281,7 +3281,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
 
     accessor.invoke(new SerializableCallable() {
       public Object call() throws Exception {
-        Execution exe = FunctionService.onMember(((TXId) txId).getMemberId()).withArgs(txId);
+        Execution exe = FunctionService.onMember(((TXId) txId).getMemberId()).setArguments(txId);
         List list = null;
         if (commit) {
           list = (List) exe.execute(new CommitFunction()).getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/CommitFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CommitFunction.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CommitFunction.java
index 2db03db..c66901a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CommitFunction.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CommitFunction.java
@@ -79,7 +79,7 @@ public class CommitFunction implements Function {
       txId = (TXId) context.getArguments();
     } catch (ClassCastException e) {
       logger.info(
-          "CommitFunction should be invoked with a TransactionId as an argument i.e. withArgs(txId).execute(function)");
+          "CommitFunction should be invoked with a TransactionId as an argument i.e. setArguments(txId).execute(function)");
       throw e;
     }
     DistributedMember member = txId.getMemberId();
@@ -101,7 +101,8 @@ public class CommitFunction implements Function {
       ArrayList args = new ArrayList();
       args.add(txId);
       args.add(NestedTransactionFunction.COMMIT);
-      Execution ex = FunctionService.onMember(cache.getDistributedSystem(), member).withArgs(args);
+      Execution ex =
+          FunctionService.onMember(cache.getDistributedSystem(), member).setArguments(args);
       if (isDebugEnabled) {
         logger.debug(
             "CommitFunction: for transaction: {} executing NestedTransactionFunction on member: {}",

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/FireAndForgetFunctionOnAllServersDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/FireAndForgetFunctionOnAllServersDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/FireAndForgetFunctionOnAllServersDUnitTest.java
index 33e312d..c52ead8 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/FireAndForgetFunctionOnAllServersDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/FireAndForgetFunctionOnAllServersDUnitTest.java
@@ -100,7 +100,7 @@ public class FireAndForgetFunctionOnAllServersDUnitTest extends LocatorTestBase
 
       String regionName = "R1";
       Execution dataSet = FunctionService.onServers(pool1);
-      dataSet.withArgs(regionName).execute(function);
+      dataSet.setArguments(regionName).execute(function);
 
       // Using Awatility, if the condition is not met during the timeout, a
       // ConditionTimeoutException will be thrown. This makes analyzing the failure much simpler
@@ -119,7 +119,7 @@ public class FireAndForgetFunctionOnAllServersDUnitTest extends LocatorTestBase
       await().atMost(60, SECONDS)
           .until(() -> Assert.assertEquals(1, pool.getCurrentServers().size()));
       dataSet = FunctionService.onServers(pool1);
-      dataSet.withArgs(regionName).execute(function);
+      dataSet.setArguments(regionName).execute(function);
 
       await().atMost(60, SECONDS)
           .until(() -> Assert.assertEquals(2, pool.getCurrentServers().size()));
@@ -140,7 +140,7 @@ public class FireAndForgetFunctionOnAllServersDUnitTest extends LocatorTestBase
       // Step 9. Execute the same function to put DistributedMemberID into above created replicated
       // region.
       dataSet = FunctionService.onServers(pool1);
-      dataSet.withArgs(regionName).execute(function);
+      dataSet.setArguments(regionName).execute(function);
 
       await().atMost(60, SECONDS)
           .until(() -> Assert.assertEquals(1, pool.getCurrentServers().size()));

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/NestedTransactionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/NestedTransactionFunction.java b/geode-core/src/test/java/org/apache/geode/internal/cache/NestedTransactionFunction.java
index 3762302..4a208d4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/NestedTransactionFunction.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/NestedTransactionFunction.java
@@ -67,7 +67,7 @@ public class NestedTransactionFunction implements Function {
       action = (Integer) args.get(1);
     } catch (ClassCastException e) {
       logger.info(
-          "CommitFunction should be invoked with a TransactionId as an argument i.e. withArgs(txId).execute(function)");
+          "CommitFunction should be invoked with a TransactionId as an argument i.e. setArguments(txId).execute(function)");
       throw e;
     }
     CacheTransactionManager txMgr = cache.getCacheTransactionManager();

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/RollbackFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RollbackFunction.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RollbackFunction.java
index 00dbd2f..8ec7d2d 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/RollbackFunction.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RollbackFunction.java
@@ -78,7 +78,7 @@ public class RollbackFunction implements Function {
       txId = (TXId) context.getArguments();
     } catch (ClassCastException e) {
       logger.info(
-          "RollbackFunction should be invoked with a TransactionId as an argument i.e. withArgs(txId).execute(function)");
+          "RollbackFunction should be invoked with a TransactionId as an argument i.e. setArguments(txId).execute(function)");
       throw e;
     }
     DistributedMember member = txId.getMemberId();
@@ -100,7 +100,8 @@ public class RollbackFunction implements Function {
       ArrayList args = new ArrayList();
       args.add(txId);
       args.add(NestedTransactionFunction.ROLLBACK);
-      Execution ex = FunctionService.onMember(cache.getDistributedSystem(), member).withArgs(args);
+      Execution ex =
+          FunctionService.onMember(cache.getDistributedSystem(), member).setArguments(args);
       if (isDebugEnabled) {
         logger.debug(
             "RollbackFunction: for transaction: {} executing NestedTransactionFunction on member: {}",

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
index a8c61ae..12b467c 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/Bug51193DUnitTest.java
@@ -145,11 +145,11 @@ public class Bug51193DUnitTest extends JUnit4DistributedTestCase {
     FunctionService.registerFunction(function);
     Execution dataSet = null;
     if ("region".equalsIgnoreCase(mode)) {
-      dataSet = FunctionService.onRegion(cache.getRegion(REGION_NAME)).withArgs(timeout);
+      dataSet = FunctionService.onRegion(cache.getRegion(REGION_NAME)).setArguments(timeout);
     } else if ("server".equalsIgnoreCase(mode)) {
-      dataSet = FunctionService.onServer(cache.getDefaultPool()).withArgs(timeout);
+      dataSet = FunctionService.onServer(cache.getDefaultPool()).setArguments(timeout);
     } else {
-      dataSet = FunctionService.onServers(cache).withArgs(timeout);
+      dataSet = FunctionService.onServers(cache).setArguments(timeout);
     }
     ResultCollector rs = dataSet.execute(function);
     assertTrue("Server did not read client_function_timeout from client.",

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
index 4d5dd7e..becc511 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
@@ -238,7 +238,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
     DistributedSystem.setThreadsSocketPolicy(false);
     Execution member = FunctionService.onServers(pool);
     try {
-      ResultCollector rs = member.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      ResultCollector rs = member.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -465,7 +465,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
 
     // remove any existing attributes
     ((AbstractExecution) member).removeFunctionAttributes(TestFunction.TEST_FUNCTION1);
-    ResultCollector rs = member.withArgs(Boolean.TRUE).execute(TestFunction.TEST_FUNCTION1);
+    ResultCollector rs = member.setArguments(Boolean.TRUE).execute(TestFunction.TEST_FUNCTION1);
     assertEquals(Boolean.TRUE, ((List) rs.getResult()).get(0));
     byte[] functionAttributes =
         ((AbstractExecution) member).getFunctionAttributes(TestFunction.TEST_FUNCTION1);
@@ -698,7 +698,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
     Execution member = FunctionService.onServer(pool);
 
     try {
-      ResultCollector rs = member.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      ResultCollector rs = member.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -730,7 +730,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
     Execution member = FunctionService.onServer(pool);
 
     try {
-      ResultCollector rs = member.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      ResultCollector rs = member.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -887,7 +887,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
     DistributedSystem.setThreadsSocketPolicy(false);
     Execution member = FunctionService.onServers(pool);
     try {
-      ResultCollector rs = member.withArgs(Boolean.TRUE).execute(new FunctionAdapter() {
+      ResultCollector rs = member.setArguments(Boolean.TRUE).execute(new FunctionAdapter() {
         public void execute(FunctionContext context) {
           if (context.getArguments() instanceof String) {
             context.getResultSender().lastResult("Success");
@@ -920,11 +920,11 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
       Boolean isByName) throws Exception {
     if (isByName.booleanValue()) {// by name
       LogWriterUtils.getLogWriter().info("The function name to execute : " + function.getId());
-      Execution me = member.withArgs(args);
+      Execution me = member.setArguments(args);
       LogWriterUtils.getLogWriter().info("The args passed  : " + args);
       return me.execute(function.getId());
     } else { // By Instance
-      return member.withArgs(args).execute(function);
+      return member.setArguments(args).execute(function);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
index 49d67d2..b00921d 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
@@ -960,7 +960,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
 
 
   public static void executeInlineFunction() {
-    List list = (List) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+    List list = (List) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
         .execute(new FunctionAdapter() {
           @Override
           public void execute(FunctionContext context) {
@@ -1067,12 +1067,12 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
     for (int i = 100; i < 120; i++) {
       filter.add("execKey-" + i);
     }
-    ResultCollector rs = FunctionService.onRegion(region).withFilter(filter).withArgs(Boolean.TRUE)
-        .execute(function);
+    ResultCollector rs = FunctionService.onRegion(region).withFilter(filter)
+        .setArguments(Boolean.TRUE).execute(function);
     List list = (List) rs.getResult();
     assertTrue(list.get(0) instanceof MyFunctionExecutionException);
 
-    rs = FunctionService.onRegion(region).withFilter(filter).withArgs((Serializable) filter)
+    rs = FunctionService.onRegion(region).withFilter(filter).setArguments((Serializable) filter)
         .execute(function);
     List resultList = (List) rs.getResult();
     assertEquals((filter.size() + 1), resultList.size());
@@ -1115,7 +1115,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
 
   public static void executeFunctionFunctionInvocationTargetException() {
     try {
-      ResultCollector rc1 = FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+      ResultCollector rc1 = FunctionService.onRegion(region).setArguments(Boolean.TRUE)
           .execute("DistribuedRegionFunctionFunctionInvocationException");
       List list = (ArrayList) rc1.getResult();
       assertEquals(5, list.get(0));
@@ -1127,7 +1127,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
 
   public static void executeFunctionFunctionInvocationTargetExceptionWithoutHA() {
     try {
-      ResultCollector rc1 = FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+      ResultCollector rc1 = FunctionService.onRegion(region).setArguments(Boolean.TRUE)
           .execute("DistribuedRegionFunctionFunctionInvocationException", true, false);
       rc1.getResult();
       fail("Function Invocation Target Exception should be thrown");
@@ -1141,7 +1141,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
 
   public static void executeFunctionFunctionInvocationTargetException_ClientServer() {
     try {
-      List list = (ArrayList) FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+      List list = (ArrayList) FunctionService.onRegion(region).setArguments(Boolean.TRUE)
           .execute("DistribuedRegionFunctionFunctionInvocationException").getResult();
       assertEquals(1, list.size());
       assertEquals(5, list.get(0));
@@ -1153,7 +1153,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
 
   public static void executeFunctionFunctionInvocationTargetException_ClientServer_WithoutHA() {
     try {
-      FunctionService.onRegion(region).withArgs(Boolean.TRUE)
+      FunctionService.onRegion(region).setArguments(Boolean.TRUE)
           .execute("DistribuedRegionFunctionFunctionInvocationException", true, false).getResult();
       fail("Function Invocation Target Exception should be thrown");
     } catch (Exception e) {
@@ -1185,8 +1185,8 @@ public class DistributedRegionFunctionExecutionDUnitTest extends JUnit4Distribut
     }
     // dummy argument Boolean.TRUE indicates that cache should be closed
     // in the function body itself on the first try
-    List list = (List) FunctionService.onRegion(region).withFilter(filter).withArgs(Boolean.TRUE)
-        .execute(function).getResult();
+    List list = (List) FunctionService.onRegion(region).withFilter(filter)
+        .setArguments(Boolean.TRUE).execute(function).getResult();
     return list;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/aaef124e/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
index b5232a7..bdcbd07 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/FunctionExecution_ExceptionDUnitTest.java
@@ -96,12 +96,12 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 = null;
-        rs1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         ArrayList results = (ArrayList) rs1.getResult();
         assertTrue(results.get(0) instanceof Exception);
 
-        rs1 =
-            dataSet.withFilter(testKeysSet).withArgs((Serializable) testKeysSet).execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments((Serializable) testKeysSet)
+            .execute(function);
         results = (ArrayList) rs1.getResult();
         assertEquals((testKeysSet.size() + 1), results.size());
         Iterator resultIterator = results.iterator();
@@ -155,7 +155,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 = null;
-        rs1 = dataSet.withFilter(testKeysSet).withArgs("Multiple").execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments("Multiple").execute(function);
         ArrayList results = (ArrayList) rs1.getResult();
         assertTrue(results.get(0) instanceof Exception);
         return Boolean.TRUE;
@@ -200,7 +200,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 = null;
-        rs1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         try {
           ArrayList results = (ArrayList) rs1.getResult();
           fail("Expecting Exception");
@@ -261,13 +261,13 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 = null;
-        // rs1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(
+        // rs1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(
         // function);
         // ArrayList results = (ArrayList)rs1.getResult();
         // assertTrue(results.get(0) instanceof Exception);
         //
-        rs1 =
-            dataSet.withFilter(testKeysSet).withArgs((Serializable) testKeysSet).execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments((Serializable) testKeysSet)
+            .execute(function);
         ArrayList results = (ArrayList) rs1.getResult();
         assertEquals((testKeysSet.size() + 1), results.size());
         Iterator resultIterator = results.iterator();
@@ -332,7 +332,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
 
         pr.put(testKey, new Integer(1));
         ResultCollector rs1 = null;
-        rs1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(function);
+        rs1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function);
         try {
           ArrayList results = (ArrayList) rs1.getResult();
           fail("Expecting Exception");
@@ -396,7 +396,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
           pr.put(val, "MyValue_" + i);
         }
         ResultCollector rs1 =
-            dataSet.withFilter(origVals).withArgs((Serializable) origVals).execute(function);
+            dataSet.withFilter(origVals).setArguments((Serializable) origVals).execute(function);
         List results = (ArrayList) rs1.getResult();
         assertEquals(((origVals.size() * 3) + 3), results.size());
         Iterator resultIterator = results.iterator();
@@ -458,7 +458,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
         }
         ResultCollector rc2 = null;
         ResultCollector rs1 =
-            dataSet.withFilter(origVals).withArgs((Serializable) origVals).execute(function);
+            dataSet.withFilter(origVals).setArguments((Serializable) origVals).execute(function);
         List results = (ArrayList) rs1.getResult();
         assertEquals(((origVals.size() * 4) + 4), results.size());
         Iterator resultIterator = results.iterator();
@@ -527,7 +527,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
           pr.put(val, "MyValue_" + i);
         }
         ResultCollector rc2 = null;
-        rc2 = dataSet.withFilter(origVals).withArgs(origVals).execute(function.getId());
+        rc2 = dataSet.withFilter(origVals).setArguments(origVals).execute(function.getId());
         try {
           ArrayList results = (ArrayList) rc2.getResult();
           fail("Expecting Exception");
@@ -585,7 +585,7 @@ public class FunctionExecution_ExceptionDUnitTest extends PartitionedRegionDUnit
           pr.put(val, "MyValue_" + i);
         }
         ResultCollector rc2 = null;
-        rc2 = dataSet.withFilter(origVals).withArgs(origVals).execute(function.getId());
+        rc2 = dataSet.withFilter(origVals).setArguments(origVals).execute(function.getId());
         try {
           ArrayList results = (ArrayList) rc2.getResult();
           fail("Expecting Exception");


[30/51] [abbrv] geode git commit: GEODE-2703: Improve exception message when executing lucene within a transaction

Posted by ds...@apache.org.
GEODE-2703: Improve exception message when executing lucene within a transaction

  * Throw a LuceneQueryException instead of a TransactionException


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

Branch: refs/heads/feature/GEODE-2097
Commit: 10770973daa3ea2cd9dce2439a90f1242b6129b5
Parents: 1156011
Author: Jason Huynh <hu...@gmail.com>
Authored: Wed Apr 12 13:54:39 2017 -0700
Committer: Jason Huynh <hu...@gmail.com>
Committed: Tue Apr 18 14:39:10 2017 -0700

----------------------------------------------------------------------
 .../cache/lucene/internal/LuceneQueryImpl.java  | 11 +++++-
 .../lucene/LuceneQueriesClientDUnitTest.java    | 39 ++++++++++++++++++-
 .../cache/lucene/LuceneQueriesDUnitTest.java    | 40 ++++++++++++++++++++
 3 files changed, 88 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/10770973/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
index 73d84d7..bfc561a 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryImpl.java
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.TransactionException;
 import org.apache.geode.cache.execute.Execution;
 import org.apache.geode.cache.execute.FunctionException;
 import org.apache.geode.cache.execute.FunctionService;
@@ -42,6 +43,8 @@ import org.apache.geode.internal.logging.LogService;
 import org.apache.logging.log4j.Logger;
 
 public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
+  public static final String LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION =
+      "Lucene Query cannot be executed within a transaction";
   Logger logger = LogService.getLogger();
 
   private int limit = LuceneQueryFactory.DEFAULT_LIMIT;
@@ -116,12 +119,18 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
     } catch (FunctionException e) {
       if (e.getCause() instanceof LuceneQueryException) {
         throw new LuceneQueryException(e);
+      } else if (e.getCause() instanceof TransactionException) {
+        // When run from client with single hop disabled
+        throw new LuceneQueryException(LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION);
       } else if (e.getCause() instanceof RuntimeException) {
         throw (RuntimeException) e.getCause();
       }
       throw e;
-
+    } catch (TransactionException e) {
+      // When function execution is run from server
+      throw new LuceneQueryException(LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION);
     }
+
     return entries;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/10770973/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesClientDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesClientDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesClientDUnitTest.java
index b0ae47e..e200a19 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesClientDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesClientDUnitTest.java
@@ -14,12 +14,15 @@
  */
 package org.apache.geode.cache.lucene;
 
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.DEFAULT_FIELD;
+import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
 import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.cache.client.ClientCacheFactory;
 import org.apache.geode.cache.client.ClientRegionShortcut;
@@ -30,6 +33,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 import org.junit.runner.RunWith;
 
 import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
@@ -64,6 +68,39 @@ public class LuceneQueriesClientDUnitTest extends LuceneQueriesDUnitTest {
     return new RegionTestableType[] {RegionTestableType.PARTITION_WITH_CLIENT};
   }
 
+  // Due to singlehop transactions differences, the exception actually isn't thrown
+  // So the parent test behaves differently if singlehop is enabled or not for a client
+  @Test
+  @Parameters(method = "getListOfRegionTestTypes")
+  public void transactionWithLuceneQueriesShouldThrowException(RegionTestableType regionTestType) {
+    SerializableRunnableIF createIndex = () -> {
+      LuceneService luceneService = LuceneServiceProvider.get(getCache());
+      luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
+    };
+    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
+    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
+    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
+
+    putDataInRegion(accessor);
+    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
+
+    accessor.invoke(() -> {
+      Cache cache = getCache();
+      try {
+        LuceneService service = LuceneServiceProvider.get(cache);
+        LuceneQuery<Integer, TestObject> query;
+        query = service.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "text:world",
+            DEFAULT_FIELD);
+        cache.getCacheTransactionManager().begin();
+        PageableLuceneQueryResults<Integer, TestObject> results = query.findPages();
+      } finally {
+        cache.getCacheTransactionManager().rollback();
+      }
+    });
+
+  }
+
 
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/10770973/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesDUnitTest.java
index d259205..c319a16 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesDUnitTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.*;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.lucene.internal.LuceneQueryImpl;
 import org.apache.geode.cache.lucene.test.LuceneTestUtilities;
 import org.apache.geode.test.dunit.SerializableRunnableIF;
 import org.apache.geode.test.dunit.VM;
@@ -30,6 +31,9 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
 
@@ -46,6 +50,42 @@ public class LuceneQueriesDUnitTest extends LuceneQueriesAccessorBase {
 
   @Test
   @Parameters(method = "getListOfRegionTestTypes")
+  public void transactionWithLuceneQueriesShouldThrowException(RegionTestableType regionTestType) {
+    SerializableRunnableIF createIndex = () -> {
+      LuceneService luceneService = LuceneServiceProvider.get(getCache());
+      luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
+    };
+    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
+    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
+    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
+
+    putDataInRegion(accessor);
+    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
+    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
+
+    accessor.invoke(() -> {
+      Cache cache = getCache();
+      try {
+        LuceneService service = LuceneServiceProvider.get(cache);
+        LuceneQuery<Integer, TestObject> query;
+        query = service.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "text:world",
+            DEFAULT_FIELD);
+        cache.getCacheTransactionManager().begin();
+        PageableLuceneQueryResults<Integer, TestObject> results = query.findPages();
+        fail();
+      } catch (LuceneQueryException e) {
+        if (!e.getMessage()
+            .equals(LuceneQueryImpl.LUCENE_QUERY_CANNOT_BE_EXECUTED_WITHIN_A_TRANSACTION)) {
+          fail();
+        }
+      } finally {
+        cache.getCacheTransactionManager().rollback();
+      }
+    });
+  }
+
+  @Test
+  @Parameters(method = "getListOfRegionTestTypes")
   public void returnCorrectResultsFromStringQueryWithDefaultAnalyzer(
       RegionTestableType regionTestType) {
     SerializableRunnableIF createIndex = () -> {


[03/51] [abbrv] geode git commit: GEODE-2777 Update docs to be for Geode version 1.2

Posted by ds...@apache.org.
GEODE-2777 Update docs to be for Geode version 1.2


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

Branch: refs/heads/feature/GEODE-2097
Commit: 152509797c437f1c7063d0583435d2f0d93b521f
Parents: 796c15e
Author: Karen Miller <km...@pivotal.io>
Authored: Thu Apr 13 10:17:21 2017 -0700
Committer: Karen Miller <km...@pivotal.io>
Committed: Thu Apr 13 10:17:21 2017 -0700

----------------------------------------------------------------------
 geode-book/config.yml                           |    5 +-
 .../source/subnavs/geode-subnav.erb             | 1730 +++++++++---------
 geode-book/redirects.rb                         |    5 +-
 3 files changed, 871 insertions(+), 869 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/15250979/geode-book/config.yml
----------------------------------------------------------------------
diff --git a/geode-book/config.yml b/geode-book/config.yml
index 741f8b4..013e2d7 100644
--- a/geode-book/config.yml
+++ b/geode-book/config.yml
@@ -21,11 +21,12 @@ public_host: localhost
 sections:
 - repository:
     name: geode-docs
-  directory: docs/guide/11
+  directory: docs/guide/12
   subnav_template: geode-subnav
 
 archive_menu:
-  - v1.1
+  - v1.2
+  - v1.1: index-11.html
   - v1.0: index-10.html
 
 template_variables:


[49/51] [abbrv] geode git commit: GEODE-2632: refactor code to reduce GemFireCacheImpl dependencies

Posted by ds...@apache.org.
GEODE-2632: refactor code to reduce GemFireCacheImpl dependencies

* extract fetching GemFireCacheImpl to Provider interface/class
* use InternalCache instead of casting to Impl
* delete useless javadocs and comments
* reduce scope of constants, vars and methods


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

Branch: refs/heads/feature/GEODE-2097
Commit: 47d8c82036a9863c9fa7c9142c170c9f8552abb4
Parents: 60ec931
Author: Kirk Lund <kl...@apache.org>
Authored: Wed Apr 19 09:56:24 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Apr 21 14:47:50 2017 -0700

----------------------------------------------------------------------
 .../web/controllers/AbstractBaseController.java | 194 +++++++++----------
 .../web/controllers/BaseControllerAdvice.java   |  28 ++-
 .../web/controllers/CommonCrudController.java   |  29 +--
 .../controllers/FunctionAccessController.java   |  39 ++--
 .../web/controllers/PdxBasedCrudController.java |  28 ++-
 .../web/controllers/QueryAccessController.java  |  49 ++---
 .../web/controllers/support/CacheProvider.java  |  22 +++
 .../controllers/support/CacheProviderImpl.java  |  29 +++
 8 files changed, 219 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
index 68080a3..d8eb572 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/AbstractBaseController.java
@@ -12,15 +12,44 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.rest.internal.web.controllers;
 
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.annotation.PostConstruct;
+
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.Assert;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
 import org.apache.geode.SerializationException;
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheLoaderException;
 import org.apache.geode.cache.CacheWriterException;
 import org.apache.geode.cache.LowMemoryException;
@@ -33,11 +62,12 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.LeaseExpiredException;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.pdx.JSONFormatter;
 import org.apache.geode.pdx.JSONFormatterException;
 import org.apache.geode.pdx.PdxInstance;
+import org.apache.geode.rest.internal.web.controllers.support.CacheProvider;
 import org.apache.geode.rest.internal.web.controllers.support.JSONTypes;
 import org.apache.geode.rest.internal.web.controllers.support.UpdateOp;
 import org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException;
@@ -51,79 +81,49 @@ import org.apache.geode.rest.internal.web.util.IdentifiableUtils;
 import org.apache.geode.rest.internal.web.util.JSONUtils;
 import org.apache.geode.rest.internal.web.util.NumberUtils;
 import org.apache.geode.rest.internal.web.util.ValidationUtils;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.Assert;
-import org.springframework.util.ClassUtils;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.PostConstruct;
-
 
 /**
  * AbstractBaseController class contains common functionalities required for other controllers.
  * 
  * @since GemFire 8.0
  */
-
 @SuppressWarnings("unused")
 public abstract class AbstractBaseController {
 
-  protected static final String NEW_META_DATA_PROPERTY = "@new";
-  protected static final String OLD_META_DATA_PROPERTY = "@old";
-  protected static final String TYPE_META_DATA_PROPERTY = "@type";
-  protected static final String UTF_8 = "UTF-8";
-  protected static final String DEFAULT_ENCODING = UTF_8;
+  private static final String NEW_META_DATA_PROPERTY = "@new";
+  private static final String OLD_META_DATA_PROPERTY = "@old";
+  private static final String TYPE_META_DATA_PROPERTY = "@type";
+  private static final String UTF_8 = "UTF-8";
+  private static final String DEFAULT_ENCODING = UTF_8;
   private static final Logger logger = LogService.getLogger();
   private static final AtomicLong ID_SEQUENCE = new AtomicLong(0l);
 
-  // private Cache cache = GemFireCacheImpl.getExisting(null);
   @Autowired
-  protected RestSecurityService securityService;
+  private RestSecurityService securityService;
   @Autowired
   private ObjectMapper objectMapper;
+  @Autowired
+  private CacheProvider cacheProvider;
 
   @PostConstruct
   private void init() {
     JSONUtils.setObjectMapper(objectMapper);
   }
 
-  protected Cache getCache() {
-    Cache cache = GemFireCacheImpl.getExisting();
+  protected InternalCache getCache() {
+    InternalCache cache = cacheProvider.getInternalCache();
     Assert.state(cache != null, "The Gemfire Cache reference was not properly initialized");
     return cache;
   }
 
-  protected URI toUri(final String... pathSegments) {
+  URI toUri(final String... pathSegments) {
     return ServletUriComponentsBuilder.fromCurrentContextPath().path(getRestApiVersion())
         .pathSegment(pathSegments).build().toUri();
   }
 
   protected abstract String getRestApiVersion();
 
-  protected String validateQuery(String queryInUrl, String queryInBody) {
+  String validateQuery(String queryInUrl, String queryInBody) {
 
     if (!(StringUtils.hasText(queryInUrl) || StringUtils.hasText(queryInBody))) {
       throw new GemfireRestException("could not process null value specified in query String");
@@ -131,7 +131,7 @@ public abstract class AbstractBaseController {
     return (StringUtils.hasText(queryInUrl) ? decode(queryInUrl) : queryInBody);
   }
 
-  protected String decode(final String value) {
+  String decode(final String value) {
     if (value == null) {
       throw new GemfireRestException("could not process null value specified in query String");
     }
@@ -175,7 +175,7 @@ public abstract class AbstractBaseController {
   }
 
   @SuppressWarnings("unchecked")
-  protected <T> T casValue(String regionNamePath, String key, String jsonData) {
+  private <T> T casValue(String regionNamePath, String key, String jsonData) {
     JSONObject jsonObject;
     try {
       jsonObject = new JSONObject(jsonData);
@@ -189,7 +189,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  public ResponseEntity<String> processQueryResponse(Query query, Object args[], Object queryResult)
+  ResponseEntity<String> processQueryResponse(Query query, Object args[], Object queryResult)
       throws JSONException {
     if (queryResult instanceof Collection<?>) {
       Collection processedResults = new ArrayList(((Collection) queryResult).size());
@@ -207,7 +207,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected Collection<PdxInstance> convertJsonArrayIntoPdxCollection(final String jsonArray) {
+  Collection<PdxInstance> convertJsonArrayIntoPdxCollection(final String jsonArray) {
     JSONArray jsonArr = null;
     try {
       jsonArr = new JSONArray(jsonArray);
@@ -229,18 +229,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-
-  /*
-   * protected PdxInstance convertJsonIntoPdxCollection(final String jsonArray) { JSONArray jsonArr
-   * = null;
-   * 
-   * PdxInstance pi = convert(jsonArray);
-   * System.out.println("Successfully converted into PdxInstance..!!"); return pi;
-   * 
-   * }
-   */
-
-  protected Object casValue(final String regionNamePath, final Object key, final Object oldValue,
+  private Object casValue(final String regionNamePath, final Object key, final Object oldValue,
       final Object newValue) {
     final Region<Object, Object> region = getRegion(regionNamePath);
     try {
@@ -281,7 +270,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void replaceValue(final String regionNamePath, final Object key,
+  private void replaceValue(final String regionNamePath, final Object key,
       final PdxInstance value) {
     try {
       if (getRegion(regionNamePath).replace(key, value) == null) {
@@ -367,7 +356,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void putValue(final String regionNamePath, final Object key, final Object value) {
+  private void putValue(final String regionNamePath, final Object key, final Object value) {
     try {
       getRegion(regionNamePath).put(key, value);
     } catch (NullPointerException npe) {
@@ -397,23 +386,23 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void deleteQueryId(final String regionNamePath, final String key) {
+  private void deleteQueryId(final String regionNamePath, final String key) {
     getQueryStore(regionNamePath).remove(key);
   }
 
-  protected void deleteNamedQuery(final String regionNamePath, final String key) {
+  void deleteNamedQuery(final String regionNamePath, final String key) {
     // Check whether query ID exist in region or not
     checkForQueryIdExist(regionNamePath, key);
     deleteQueryId(regionNamePath, key);
   }
 
-  protected void checkForQueryIdExist(String region, String key) {
+  void checkForQueryIdExist(String region, String key) {
     if (!getQueryStore(region).containsKey(key)) {
       throw new ResourceNotFoundException(String.format("Named query (%1$s) does not exist!", key));
     }
   }
 
-  protected Region<String, String> getQueryStore(final String namePath) {
+  Region<String, String> getQueryStore(final String namePath) {
     return ValidationUtils.returnValueThrowOnNull(getCache().<String, String>getRegion(namePath),
         new GemfireRestException(String.format("Query store does not exist!", namePath)));
   }
@@ -436,8 +425,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void updateNamedQuery(final String regionNamePath, final String key,
-      final String value) {
+  void updateNamedQuery(final String regionNamePath, final String key, final String value) {
     try {
       getQueryStore(regionNamePath).put(key, value);
     } catch (NullPointerException npe) {
@@ -457,8 +445,7 @@ public abstract class AbstractBaseController {
   }
 
   @SuppressWarnings("unchecked")
-  protected <T> T createNamedQuery(final String regionNamePath, final String key,
-      final String value) {
+  <T> T createNamedQuery(final String regionNamePath, final String key, final String value) {
     try {
       return (T) getQueryStore(regionNamePath).putIfAbsent(key, value);
     } catch (UnsupportedOperationException use) {
@@ -482,7 +469,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void putPdxValues(final String regionNamePath, final Map<Object, PdxInstance> map) {
+  private void putPdxValues(final String regionNamePath, final Map<Object, PdxInstance> map) {
     try {
       getRegion(regionNamePath).putAll(map);
     } catch (LowMemoryException lme) {
@@ -490,7 +477,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void putValues(final String regionNamePath, final Map<Object, Object> values) {
+  private void putValues(final String regionNamePath, final Map<Object, Object> values) {
     getRegion(regionNamePath).putAll(values);
   }
 
@@ -510,7 +497,7 @@ public abstract class AbstractBaseController {
   }
 
   @SuppressWarnings("unchecked")
-  protected <T> T postValue(final String regionNamePath, final Object key, final Object value) {
+  <T> T postValue(final String regionNamePath, final Object key, final Object value) {
     try {
       return (T) getRegion(regionNamePath).putIfAbsent(key, value);
     } catch (UnsupportedOperationException use) {
@@ -561,11 +548,11 @@ public abstract class AbstractBaseController {
     return actualValue;
   }
 
-  protected String generateKey(final String existingKey) {
+  String generateKey(final String existingKey) {
     return generateKey(existingKey, null);
   }
 
-  protected String generateKey(final String existingKey, final Object domainObject) {
+  private String generateKey(final String existingKey, final Object domainObject) {
     Object domainObjectId = IdentifiableUtils.getId(domainObject);
     String newKey;
 
@@ -597,7 +584,7 @@ public abstract class AbstractBaseController {
     return newKey;
   }
 
-  protected String decode(final String value, final String encoding) {
+  private String decode(final String value, final String encoding) {
     try {
       return URLDecoder.decode(value, encoding);
     } catch (UnsupportedEncodingException e) {
@@ -612,19 +599,17 @@ public abstract class AbstractBaseController {
             String.format("The Region identified by name (%1$s) could not be found!", namePath)));
   }
 
-  protected void checkForKeyExist(String region, String key) {
+  private void checkForKeyExist(String region, String key) {
     if (!getRegion(region).containsKey(key)) {
       throw new ResourceNotFoundException(
           String.format("Key (%1$s) does not exist for region (%2$s) in cache!", key, region));
     }
   }
 
-  protected List<String> checkForMultipleKeysExist(String region, String... keys) {
+  List<String> checkForMultipleKeysExist(String region, String... keys) {
     List<String> unknownKeys = new ArrayList<String>();
     for (int index = 0; index < keys.length; index++) {
       if (!getRegion(region).containsKey(keys[index])) {
-        // throw new ResourceNotFoundException(String.format("Key [(%1$s)] does not exist for region
-        // [(%2$s)] in cache!", key, region));
         unknownKeys.add(keys[index]);
       }
     }
@@ -664,11 +649,11 @@ public abstract class AbstractBaseController {
     return entries.values();
   }
 
-  protected void deleteValue(final String regionNamePath, final Object key) {
+  private void deleteValue(final String regionNamePath, final Object key) {
     getRegion(regionNamePath).remove(key);
   }
 
-  protected void deleteValues(final String regionNamePath, final Object... keys) {
+  void deleteValues(final String regionNamePath, final Object... keys) {
     // Check whether all keys exist in cache or not
     for (final Object key : keys) {
       checkForKeyExist(regionNamePath, key.toString());
@@ -679,7 +664,7 @@ public abstract class AbstractBaseController {
     }
   }
 
-  protected void deleteValues(String regionNamePath) {
+  void deleteValues(String regionNamePath) {
     try {
       getRegion(regionNamePath).clear();
     } catch (UnsupportedOperationException ue) {
@@ -694,7 +679,7 @@ public abstract class AbstractBaseController {
   }
 
   @SuppressWarnings("unchecked")
-  protected <T> T introspectAndConvert(final T value) {
+  private <T> T introspectAndConvert(final T value) {
     if (value instanceof Map) {
       final Map rawDataBinding = (Map) value;
 
@@ -736,15 +721,15 @@ public abstract class AbstractBaseController {
     return value;
   }
 
-  protected String convertErrorAsJson(String errorMessage) {
+  String convertErrorAsJson(String errorMessage) {
     return ("{" + "\"message\"" + ":" + "\"" + errorMessage + "\"" + "}");
   }
 
-  protected String convertErrorAsJson(Throwable t) {
+  String convertErrorAsJson(Throwable t) {
     return String.format("{\"message\" : \"%1$s\"}", t.getMessage());
   }
 
-  protected Map<?, ?> convertJsonToMap(final String jsonString) {
+  private Map<?, ?> convertJsonToMap(final String jsonString) {
     Map<String, String> map = new HashMap<String, String>();
 
     // convert JSON string to Map
@@ -762,11 +747,11 @@ public abstract class AbstractBaseController {
     return map;
   }
 
-  protected Object jsonToObject(final String jsonString) {
+  private Object jsonToObject(final String jsonString) {
     return introspectAndConvert(convertJsonToMap(jsonString));
   }
 
-  protected Object[] jsonToObjectArray(final String arguments) {
+  Object[] jsonToObjectArray(final String arguments) {
     final JSONTypes jsonType = validateJsonAndFindType(arguments);
     if (JSONTypes.JSON_ARRAY.equals(jsonType)) {
       try {
@@ -787,8 +772,8 @@ public abstract class AbstractBaseController {
     }
   }
 
-  public ResponseEntity<String> updateSingleKey(final String region, final String key,
-      final String json, final String opValue) {
+  ResponseEntity<String> updateSingleKey(final String region, final String key, final String json,
+      final String opValue) {
 
     final JSONTypes jsonType = validateJsonAndFindType(json);
 
@@ -822,7 +807,7 @@ public abstract class AbstractBaseController {
   }
 
 
-  public ResponseEntity<String> updateMultipleKeys(final String region, final String[] keys,
+  ResponseEntity<String> updateMultipleKeys(final String region, final String[] keys,
       final String json) {
 
     JSONArray jsonArr = null;
@@ -862,7 +847,7 @@ public abstract class AbstractBaseController {
     return new ResponseEntity<String>(headers, HttpStatus.OK);
   }
 
-  public JSONTypes validateJsonAndFindType(String json) {
+  JSONTypes validateJsonAndFindType(String json) {
     try {
       Object jsonObj = new JSONTokener(json).nextValue();
 
@@ -927,17 +912,16 @@ public abstract class AbstractBaseController {
   }
 
   protected Set<DistributedMember> getMembers(final String... memberIdNames) {
-
     ValidationUtils.returnValueThrowOnNull(memberIdNames,
         new GemfireRestException("No member found to run function"));
-    final Set<DistributedMember> targetedMembers =
-        new HashSet<DistributedMember>(ArrayUtils.length(memberIdNames));
+    final Set<DistributedMember> targetedMembers = new HashSet<>(ArrayUtils.length(memberIdNames));
     final List<String> memberIdNameList = Arrays.asList(memberIdNames);
-    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
-    Set<DistributedMember> distMembers = c.getDistributedSystem().getAllOtherMembers();
+
+    InternalCache cache = getCache();
+    Set<DistributedMember> distMembers = cache.getDistributedSystem().getAllOtherMembers();
 
     // Add the local node to list
-    distMembers.add(c.getDistributedSystem().getDistributedMember());
+    distMembers.add(cache.getDistributedSystem().getDistributedMember());
     for (DistributedMember member : distMembers) {
       if (memberIdNameList.contains(member.getId())
           || memberIdNameList.contains(member.getName())) {
@@ -947,10 +931,10 @@ public abstract class AbstractBaseController {
     return targetedMembers;
   }
 
-  protected Set<DistributedMember> getAllMembersInDS() {
-    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
-    Set<DistributedMember> distMembers = c.getDistributedSystem().getAllOtherMembers();
-    final Set<DistributedMember> targetedMembers = new HashSet<DistributedMember>();
+  Set<DistributedMember> getAllMembersInDS() {
+    InternalCache cache = getCache();
+    Set<DistributedMember> distMembers = cache.getDistributedSystem().getAllOtherMembers();
+    final Set<DistributedMember> targetedMembers = new HashSet<>();
 
     // find valid data nodes, i.e non locator, non-admin, non-loner nodes
     for (DistributedMember member : distMembers) {
@@ -960,7 +944,7 @@ public abstract class AbstractBaseController {
       }
     }
     // Add the local node to list
-    targetedMembers.add(c.getDistributedSystem().getDistributedMember());
+    targetedMembers.add(cache.getDistributedSystem().getDistributedMember());
     return targetedMembers;
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
index 8939542..751e6a0 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java
@@ -12,16 +12,11 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.rest.internal.web.controllers;
 
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException;
-import org.apache.geode.rest.internal.web.exception.GemfireRestException;
-import org.apache.geode.rest.internal.web.exception.MalformedJsonException;
-import org.apache.geode.rest.internal.web.exception.RegionNotFoundException;
-import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
-import org.apache.geode.security.NotAuthorizedException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 import org.apache.logging.log4j.Logger;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.AccessDeniedException;
@@ -31,24 +26,26 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseStatus;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException;
+import org.apache.geode.rest.internal.web.exception.GemfireRestException;
+import org.apache.geode.rest.internal.web.exception.MalformedJsonException;
+import org.apache.geode.rest.internal.web.exception.RegionNotFoundException;
+import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
+import org.apache.geode.security.NotAuthorizedException;
 
 /**
  * The CrudControllerAdvice class handles exception thrown while serving the REST request
- * <p/>
- * 
+ *
  * @since GemFire 8.0
  */
-
 @ControllerAdvice
 @SuppressWarnings("unused")
 public class BaseControllerAdvice extends AbstractBaseController {
 
   private static final Logger logger = LogService.getLogger();
 
-  protected static final String REST_API_VERSION = "/v1";
+  private static final String REST_API_VERSION = "/v1";
 
   @Override
   protected String getRestApiVersion() {
@@ -186,4 +183,3 @@ public class BaseControllerAdvice extends AbstractBaseController {
   }
 
 }
-

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
index 62ce860..0449a45 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/CommonCrudController.java
@@ -14,9 +14,24 @@
  */
 package org.apache.geode.rest.internal.web.controllers;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONException;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
 import org.apache.geode.cache.LowMemoryException;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.execute.Execution;
@@ -29,20 +44,6 @@ import org.apache.geode.rest.internal.web.controllers.support.RestServersResultC
 import org.apache.geode.rest.internal.web.exception.GemfireRestException;
 import org.apache.geode.rest.internal.web.util.ArrayUtils;
 import org.apache.geode.rest.internal.web.util.JSONUtils;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONException;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
 
 /**
  * The CommonCrudController serves REST Requests related to listing regions, listing keys in region,

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
index 80996c3..473b8b9 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/FunctionAccessController.java
@@ -12,24 +12,17 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.rest.internal.web.controllers;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
-import org.apache.geode.cache.LowMemoryException;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionException;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.cache.execute.NoResult;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.exception.GemfireRestException;
-import org.apache.geode.rest.internal.web.util.ArrayUtils;
-import org.apache.geode.rest.internal.web.util.JSONUtils;
 import org.apache.logging.log4j.Logger;
 import org.json.JSONException;
 import org.springframework.http.HttpHeaders;
@@ -47,10 +40,17 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseStatus;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.apache.geode.cache.LowMemoryException;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionException;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.internal.cache.execute.NoResult;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.exception.GemfireRestException;
+import org.apache.geode.rest.internal.web.util.ArrayUtils;
+import org.apache.geode.rest.internal.web.util.JSONUtils;
 
 /**
  * The FunctionsController class serving REST Requests related to the function execution
@@ -58,20 +58,18 @@ import java.util.Set;
  * @see org.springframework.stereotype.Controller
  * @since GemFire 8.0
  */
-
 @Controller("functionController")
 @Api(value = "functions", description = "Rest api for gemfire function execution")
 @RequestMapping(FunctionAccessController.REST_API_VERSION + "/functions")
 @SuppressWarnings("unused")
 public class FunctionAccessController extends AbstractBaseController {
   // Constant String value indicating the version of the REST API.
-  protected static final String REST_API_VERSION = "/v1";
+  static final String REST_API_VERSION = "/v1";
   private static final Logger logger = LogService.getLogger();
 
   /**
    * Gets the version of the REST API implemented by this @Controller.
-   * <p>
-   * 
+   *
    * @return a String indicating the REST API version.
    */
   @Override
@@ -256,4 +254,3 @@ public class FunctionAccessController extends AbstractBaseController {
     }
   }
 }
-

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
index 3b08c5f..a6f10b1 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java
@@ -14,16 +14,14 @@
  */
 package org.apache.geode.rest.internal.web.controllers;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.controllers.support.JSONTypes;
-import org.apache.geode.rest.internal.web.controllers.support.RegionData;
-import org.apache.geode.rest.internal.web.controllers.support.RegionEntryData;
-import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
-import org.apache.geode.rest.internal.web.util.ArrayUtils;
 import org.apache.logging.log4j.Logger;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
@@ -38,19 +36,20 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.controllers.support.JSONTypes;
+import org.apache.geode.rest.internal.web.controllers.support.RegionData;
+import org.apache.geode.rest.internal.web.controllers.support.RegionEntryData;
+import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
+import org.apache.geode.rest.internal.web.util.ArrayUtils;
 
 /**
  * The PdxBasedCrudController class serving REST Requests related to the REST CRUD operation on
  * region
- * <p/>
- * 
+ *
  * @see org.springframework.stereotype.Controller
  * @since GemFire 8.0
  */
-
 @Controller("pdxCrudController")
 @Api(value = "region", description = "region CRUD operations")
 @RequestMapping(PdxBasedCrudController.REST_API_VERSION)
@@ -59,9 +58,9 @@ public class PdxBasedCrudController extends CommonCrudController {
 
   private static final Logger logger = LogService.getLogger();
 
-  protected static final String REST_API_VERSION = "/v1";
+  static final String REST_API_VERSION = "/v1";
 
-  protected static final String DEFAULT_GETALL_RESULT_LIMIT = "50";
+  private static final String DEFAULT_GETALL_RESULT_LIMIT = "50";
 
   @Override
   protected String getRestApiVersion() {
@@ -76,7 +75,6 @@ public class PdxBasedCrudController extends CommonCrudController {
    * @param json JSON document that is stored against the key
    * @return JSON document
    */
-
   @RequestMapping(method = RequestMethod.POST, value = "/{region}",
       consumes = MediaType.APPLICATION_JSON_VALUE, produces = {MediaType.APPLICATION_JSON_VALUE})
   @ApiOperation(value = "create entry", notes = "Create (put-if-absent) data in region",

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
index b00a7aa..8007491 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/QueryAccessController.java
@@ -12,28 +12,14 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.rest.internal.web.controllers;
 
+import java.util.concurrent.ConcurrentHashMap;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.query.FunctionDomainException;
-import org.apache.geode.cache.query.NameResolutionException;
-import org.apache.geode.cache.query.Query;
-import org.apache.geode.cache.query.QueryExecutionLowMemoryException;
-import org.apache.geode.cache.query.QueryExecutionTimeoutException;
-import org.apache.geode.cache.query.QueryInvalidException;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.TypeMismatchException;
-import org.apache.geode.cache.query.internal.DefaultQuery;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.rest.internal.web.exception.GemfireRestException;
-import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
-import org.apache.geode.rest.internal.web.util.JSONUtils;
-import org.apache.geode.rest.internal.web.util.ValidationUtils;
 import org.apache.logging.log4j.Logger;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
@@ -49,17 +35,28 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseStatus;
 
-import java.util.concurrent.ConcurrentHashMap;
-
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.FunctionDomainException;
+import org.apache.geode.cache.query.NameResolutionException;
+import org.apache.geode.cache.query.Query;
+import org.apache.geode.cache.query.QueryExecutionLowMemoryException;
+import org.apache.geode.cache.query.QueryExecutionTimeoutException;
+import org.apache.geode.cache.query.QueryInvalidException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.TypeMismatchException;
+import org.apache.geode.cache.query.internal.DefaultQuery;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.rest.internal.web.exception.GemfireRestException;
+import org.apache.geode.rest.internal.web.exception.ResourceNotFoundException;
+import org.apache.geode.rest.internal.web.util.JSONUtils;
+import org.apache.geode.rest.internal.web.util.ValidationUtils;
 
 /**
  * The QueryingController class serves all HTTP REST requests related to the gemfire querying
- * <p/>
- * 
+ *
  * @see org.springframework.stereotype.Controller
  * @since GemFire 8.0
  */
-
 @Controller("queryController")
 @Api(value = "queries", description = "Rest api for geode query execution",
     produces = MediaType.APPLICATION_JSON_VALUE)
@@ -69,17 +66,16 @@ public class QueryAccessController extends AbstractBaseController {
 
   private static final Logger logger = LogService.getLogger();
 
-  protected static final String PARAMETERIZED_QUERIES_REGION = "__ParameterizedQueries__";
+  private static final String PARAMETERIZED_QUERIES_REGION = "__ParameterizedQueries__";
 
   private final ConcurrentHashMap<String, DefaultQuery> compiledQueries = new ConcurrentHashMap<>();
 
   // Constant String value indicating the version of the REST API.
-  protected static final String REST_API_VERSION = "/v1";
+  static final String REST_API_VERSION = "/v1";
 
   /**
    * Gets the version of the REST API implemented by this @Controller.
-   * <p/>
-   * 
+   *
    * @return a String indicating the REST API version.
    */
   @Override
@@ -324,7 +320,6 @@ public class QueryAccessController extends AbstractBaseController {
     logger.debug("Updating a named, parametrized Query ({}) with ID ({})...", oqlStatement,
         queryId);
 
-
     // update the OQL statement with 'queryId' as the Key into the hidden, Parametrized Queries
     // Region...
     checkForQueryIdExist(PARAMETERIZED_QUERIES_REGION, queryId);
@@ -334,7 +329,6 @@ public class QueryAccessController extends AbstractBaseController {
     return new ResponseEntity<>(HttpStatus.OK);
   }
 
-  // delete named, parametrized query
   /**
    * Delete named, parametrized Query
    * 
@@ -360,4 +354,3 @@ public class QueryAccessController extends AbstractBaseController {
   }
 
 }
-

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProvider.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProvider.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProvider.java
new file mode 100644
index 0000000..19d2755
--- /dev/null
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProvider.java
@@ -0,0 +1,22 @@
+/*
+ * 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 org.apache.geode.rest.internal.web.controllers.support;
+
+import org.apache.geode.internal.cache.InternalCache;
+
+public interface CacheProvider {
+
+  InternalCache getInternalCache();
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/47d8c820/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProviderImpl.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProviderImpl.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProviderImpl.java
new file mode 100644
index 0000000..8c00923
--- /dev/null
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/CacheProviderImpl.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 org.apache.geode.rest.internal.web.controllers.support;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+
+@Component("cacheProvider")
+public class CacheProviderImpl implements CacheProvider {
+
+  @Override
+  public InternalCache getInternalCache() {
+    return GemFireCacheImpl.getExisting();
+  }
+}


[32/51] [abbrv] geode git commit: GEODE-2103 Update gfsh start server|locator command reference page.

Posted by ds...@apache.org.
GEODE-2103 Update gfsh start server|locator command
reference page.

- the optional http-service-port defaults to 7070
- both http-service-port and http-service-bind-address
are available for gfsh start server and gfsh start locator


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

Branch: refs/heads/feature/GEODE-2097
Commit: 3a4c6fc66afc59ba907ca815274a1ca73db0a8c3
Parents: 1156011
Author: Karen Miller <km...@pivotal.io>
Authored: Tue Apr 18 15:11:38 2017 -0700
Committer: Karen Miller <km...@pivotal.io>
Committed: Tue Apr 18 17:02:51 2017 -0700

----------------------------------------------------------------------
 .../gfsh/command-pages/start.html.md.erb         | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/3a4c6fc6/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
----------------------------------------------------------------------
diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
index 7fb5165..60ba254 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb
@@ -275,7 +275,9 @@ start locator --name=value [--bind-address=value] [--force(=value)] [--group=val
  [--locators=value] [--log-level=value] [--mcast-address=value] [--mcast-port=value] [--port=value] [--dir=value]
  [--properties-file=value] [--security-properties-file=value] [--initial-heap=value] [--max-heap=value]
  [--connect(=value)] [--enable-cluster-configuration(=value)] [--load-from-cluster-configuration-dir(=value)]
- [--cluster-config-dir=value] [--J=value(,value)*]
+ [--cluster-config-dir=value]
+ [--http-service-port=value] [--http-service-bind-address=value] 
+ [--J=value(,value)*]
 ```
 
 <a id="topic_591260CF25D64562A0EDD7260D2AC6D4__table_hly_vvg_2w"></a>
@@ -398,6 +400,17 @@ See <a href="../../../configuring/cluster_config/gfsh_persist.html">Overview of
 <td>cluster-config</td>
 </tr>
 <tr class="even">
+<td><span class="keyword parmname">\-\-http-service-port</span></td>
+<td>Specifies the port on which the HTTP service will listen.</td>
+<td>7070</td>
+</tr>
+<tr class="even">
+<td><span class="keyword parmname">\-\-http-service-bind-address</span></td>
+<td>Specifies the IP address to which the HTTP service will be bound.
+</td>
+<td>the local host machine's address</td>
+</tr>
+<tr class="even">
 <td><span class="keyword parmname">\-\-J </span></td>
 <td>Argument passed to the JVM on which the Locator will run. For example, specifying <code class="ph codeph">--J=-Dfoo.bar=true</code> sets property &quot;foo.bar&quot; to &quot;true&quot;.
 <div class="note note">
@@ -756,13 +769,13 @@ See <a href="../../../configuring/cluster_config/gfsh_persist.html">Overview of
 <tr class="even">
 <td><span class="keyword parmname">\-\-http-service-port</span></td>
 <td>Specifies the port on which the HTTP service will listen.</td>
-<td></td>
+<td>7070</td>
 </tr>
 <tr class="even">
 <td><span class="keyword parmname">\-\-http-service-bind-address</span></td>
 <td>Specifies the IP address to which the HTTP service will be bound.
 </td>
-<td>all local addresses</td>
+<td>the local host machine's address</td>
 </tr>
 <tr class="even">
 <td><span class="keyword parmname">\-\-user</span></td>


[45/51] [abbrv] geode git commit: GEODE-2806: if the batch is dispatched, even the bucket is no longer primary, the batch should still be deleted as planned.

Posted by ds...@apache.org.
GEODE-2806: if the batch is dispatched, even the bucket is no longer primary, the batch should still be deleted as planned.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 0862174c30cad1536f2c105b783653bd0d4344e8
Parents: 50686b0
Author: zhouxh <gz...@pivotal.io>
Authored: Fri Apr 21 09:57:05 2017 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Fri Apr 21 09:58:19 2017 -0700

----------------------------------------------------------------------
 .../parallel/ParallelGatewaySenderQueue.java    | 58 ++++++++++----------
 1 file changed, 28 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/0862174c/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index cf4c5a9..9696b90 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -1104,38 +1104,36 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
 
   private void destroyEventFromQueue(PartitionedRegion prQ, int bucketId, Object key) {
     boolean isPrimary = prQ.getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
-    if (isPrimary) {
-      BucketRegionQueue brq = getBucketRegionQueueByBucketId(prQ, bucketId);
-      // TODO : Kishor : Make sure we dont need to initalize a bucket
-      // before destroying a key from it
-      try {
-        if (brq != null) {
-          brq.destroyKey(key);
-        }
-        stats.decQueueSize();
-      } catch (EntryNotFoundException e) {
-        if (!this.sender.isBatchConflationEnabled() && logger.isDebugEnabled()) {
-          logger.debug(
-              "ParallelGatewaySenderQueue#remove: Got EntryNotFoundException while removing key {} for {} for bucket = {} for GatewaySender {}",
-              key, this, bucketId, this.sender);
-        }
-      } catch (ForceReattemptException e) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Bucket :{} moved to other member", bucketId);
-        }
-      } catch (PrimaryBucketException e) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Primary bucket :{} moved to other member", bucketId);
-        }
-      } catch (RegionDestroyedException e) {
-        if (logger.isDebugEnabled()) {
-          logger.debug(
-              "Caught RegionDestroyedException attempting to remove key {} from bucket {} in {}",
-              key, bucketId, prQ.getFullPath());
-        }
+    BucketRegionQueue brq = getBucketRegionQueueByBucketId(prQ, bucketId);
+    // TODO : Kishor : Make sure we dont need to initalize a bucket
+    // before destroying a key from it
+    try {
+      if (brq != null) {
+        brq.destroyKey(key);
+      }
+      stats.decQueueSize();
+    } catch (EntryNotFoundException e) {
+      if (!this.sender.isBatchConflationEnabled() && logger.isDebugEnabled()) {
+        logger.debug(
+            "ParallelGatewaySenderQueue#remove: Got EntryNotFoundException while removing key {} for {} for bucket = {} for GatewaySender {}",
+            key, this, bucketId, this.sender);
+      }
+    } catch (ForceReattemptException e) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Bucket :{} moved to other member", bucketId);
+      }
+    } catch (PrimaryBucketException e) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Primary bucket :{} moved to other member", bucketId);
+      }
+    } catch (RegionDestroyedException e) {
+      if (logger.isDebugEnabled()) {
+        logger.debug(
+            "Caught RegionDestroyedException attempting to remove key {} from bucket {} in {}", key,
+            bucketId, prQ.getFullPath());
       }
-      addRemovedEvent(prQ, bucketId, key);
     }
+    addRemovedEvent(prQ, bucketId, key);
   }
 
   public void resetLastPeeked() {


[12/51] [abbrv] geode git commit: GEODE-2097: check offheap limit during recovery

Posted by ds...@apache.org.
GEODE-2097: check offheap limit during recovery

During disk recovery of offheap data,
the offheap LRU eviction limit is now checked
instead of the heap limit.

A new integration test has been added that would
run out of offheap memory during recovery without
this fix.

This fix also includes some refactoring of the
resource manager memory monitors into a new common
interface named MemoryMonitor.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 5c5c947978e8683f39dd9cae24fda4f6cd87f3e8
Parents: 0714c27
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Dec 21 11:40:30 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Fri Apr 14 10:59:49 2017 -0700

----------------------------------------------------------------------
 .../internal/cache/AbstractLRURegionMap.java    |  16 +--
 .../geode/internal/cache/AbstractRegionMap.java |   4 +-
 .../geode/internal/cache/LocalRegion.java       |   2 +-
 .../internal/cache/PlaceHolderDiskRegion.java   |   2 +-
 .../geode/internal/cache/ProxyRegionMap.java    |   4 +-
 .../cache/control/HeapMemoryMonitor.java        |  14 +--
 .../cache/control/InternalResourceManager.java  |   8 ++
 .../internal/cache/control/MemoryMonitor.java   |  39 +++++++
 .../cache/control/OffHeapMemoryMonitor.java     |  14 +--
 .../geode/internal/cache/lru/EnableLRU.java     |   3 +
 .../cache/lru/HeapLRUCapacityController.java    |  30 ++---
 .../cache/lru/LRUCapacityController.java        |   6 +
 .../internal/cache/lru/LRUMapCallbacks.java     |   5 +-
 .../cache/lru/MemLRUCapacityController.java     |   6 +
 .../internal/cache/lru/LRUClockJUnitTest.java   |   6 +
 .../OffHeapLRURecoveryRegressionTest.java       | 115 +++++++++++++++++++
 16 files changed, 222 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
index 328ff35..4d5bb87 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
@@ -36,6 +36,7 @@ import org.apache.geode.internal.cache.lru.LRUStatistics;
 import org.apache.geode.internal.cache.lru.MemLRUCapacityController;
 import org.apache.geode.internal.cache.lru.NewLIFOClockHand;
 import org.apache.geode.internal.cache.lru.NewLRUClockHand;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.cache.versions.RegionVersionVector;
 import org.apache.geode.internal.cache.versions.VersionSource;
 import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -572,15 +573,8 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
   private boolean mustEvict() {
     LocalRegion owner = _getOwner();
     InternalResourceManager resourceManager = owner.getCache().getResourceManager();
-
-    final boolean monitorStateIsEviction;
-    if (!owner.getAttributes().getOffHeap()) {
-      monitorStateIsEviction = resourceManager.getHeapMonitor().getState().isEviction();
-    } else {
-      monitorStateIsEviction = resourceManager.getOffHeapMonitor().getState().isEviction();
-    }
-
-    return monitorStateIsEviction && this.sizeInVM() > 0;
+    boolean offheap = owner.getAttributes().getOffHeap();
+    return resourceManager.getMemoryMonitor(offheap).getState().isEviction() && this.sizeInVM() > 0;
   }
 
   public final int centralizedLruUpdateCallback() {
@@ -856,8 +850,8 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
   }
 
   @Override
-  public final boolean lruLimitExceeded() {
-    return _getCCHelper().mustEvict(_getLruList().stats(), null, 0);
+  public final boolean lruLimitExceeded(DiskRegionView drv) {
+    return _getCCHelper().lruLimitExceeded(_getLruList().stats(), drv);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index eaababa..bc9fcdf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -31,6 +31,7 @@ import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
 import org.apache.geode.internal.cache.ha.HAContainerWrapper;
 import org.apache.geode.internal.cache.ha.HARegionQueue;
 import org.apache.geode.internal.cache.lru.LRUEntry;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.cache.region.entry.RegionEntryFactoryBuilder;
 import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
@@ -478,7 +479,8 @@ public abstract class AbstractRegionMap implements RegionMap {
     e.decRefCount(null, lr);
   }
 
-  public boolean lruLimitExceeded() {
+  @Override
+  public boolean lruLimitExceeded(DiskRegionView drv) {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index d0aacc2..297c90b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -11132,7 +11132,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
   }
 
   public boolean lruLimitExceeded() {
-    return this.entries.lruLimitExceeded();
+    return this.entries.lruLimitExceeded(getDiskRegionView());
   }
 
   public DiskEntry getDiskEntry(Object key) {

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
index db01162..9946f26 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
@@ -127,7 +127,7 @@ public class PlaceHolderDiskRegion extends AbstractDiskRegion implements DiskRec
   }
 
   public boolean lruLimitExceeded() {
-    return getRecoveredEntryMap().lruLimitExceeded();
+    return getRecoveredEntryMap().lruLimitExceeded(this);
   }
 
   public DiskStoreID getDiskStoreID() {

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
index 92c7b6f..8ed07f8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyRegionMap.java
@@ -35,6 +35,7 @@ import org.apache.geode.internal.InternalStatisticsDisabledException;
 import org.apache.geode.internal.cache.AbstractRegionMap.ARMLockTestHook;
 import org.apache.geode.internal.cache.lru.LRUEntry;
 import org.apache.geode.internal.cache.lru.NewLRUClockHand;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
 import org.apache.geode.internal.cache.versions.RegionVersionVector;
 import org.apache.geode.internal.cache.versions.VersionHolder;
@@ -366,7 +367,8 @@ final class ProxyRegionMap implements RegionMap {
     // nothing needed
   }
 
-  public final boolean lruLimitExceeded() {
+  @Override
+  public final boolean lruLimitExceeded(DiskRegionView drv) {
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
index afc9a23..0de41bf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/HeapMemoryMonitor.java
@@ -55,7 +55,7 @@ import java.util.concurrent.*;
  * 
  * @since Geode 1.0
  */
-public class HeapMemoryMonitor implements NotificationListener, ResourceMonitor {
+public class HeapMemoryMonitor implements NotificationListener, MemoryMonitor {
   private static final Logger logger = LogService.getLogger();
 
   // Allow for an unknown heap pool for VMs we may support in the future.
@@ -397,10 +397,7 @@ public class HeapMemoryMonitor implements NotificationListener, ResourceMonitor
     }
   }
 
-  float getCriticalThreshold() {
-    return this.thresholds.getCriticalThreshold();
-  }
-
+  @Override
   public boolean hasEvictionThreshold() {
     return this.hasEvictionThreshold;
   }
@@ -449,10 +446,6 @@ public class HeapMemoryMonitor implements NotificationListener, ResourceMonitor
     }
   }
 
-  public float getEvictionThreshold() {
-    return this.thresholds.getEvictionThreshold();
-  }
-
   /**
    * Compare the number of bytes used (fetched from the JVM) to the thresholds. If necessary, change
    * the state and send an event for the state change.
@@ -539,10 +532,12 @@ public class HeapMemoryMonitor implements NotificationListener, ResourceMonitor
         eventToPopulate.getThresholds());
   }
 
+  @Override
   public MemoryState getState() {
     return this.currentState;
   }
 
+  @Override
   public MemoryThresholds getThresholds() {
     MemoryThresholds saveThresholds = this.thresholds;
 
@@ -634,6 +629,7 @@ public class HeapMemoryMonitor implements NotificationListener, ResourceMonitor
   /**
    * Returns the number of bytes of memory reported by the tenured pool as currently in use.
    */
+  @Override
   public long getBytesUsed() {
     return getTenuredMemoryPoolMXBean().getUsage().getUsed();
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
index d16cd98..e98b6db 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
@@ -265,6 +265,14 @@ public class InternalResourceManager implements ResourceManager {
     return (OffHeapMemoryMonitor) this.resourceMonitors.get(ResourceType.OFFHEAP_MEMORY);
   }
 
+  public MemoryMonitor getMemoryMonitor(boolean offheap) {
+    if (offheap) {
+      return getOffHeapMonitor();
+    } else {
+      return getHeapMonitor();
+    }
+  }
+
   /**
    * Use threshold event processor to execute the event embedded in the runnable.
    * 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/control/MemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/MemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/MemoryMonitor.java
new file mode 100644
index 0000000..45d60f6
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/MemoryMonitor.java
@@ -0,0 +1,39 @@
+/*
+ * 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 org.apache.geode.internal.cache.control;
+
+import org.apache.geode.internal.cache.control.MemoryThresholds.MemoryState;
+
+/**
+ * A resource monitor that monitors memory.
+ */
+public interface MemoryMonitor extends ResourceMonitor {
+  public MemoryState getState();
+
+  public MemoryThresholds getThresholds();
+
+  public long getBytesUsed();
+
+  public boolean hasEvictionThreshold();
+
+  default public float getCriticalThreshold() {
+    return getThresholds().getCriticalThreshold();
+  }
+
+  default public float getEvictionThreshold() {
+    return getThresholds().getEvictionThreshold();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
index 4140367..c9fe6b6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/OffHeapMemoryMonitor.java
@@ -37,7 +37,7 @@ import org.apache.geode.internal.offheap.MemoryUsageListener;
  *
  * @since Geode 1.0
  */
-public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListener {
+public class OffHeapMemoryMonitor implements MemoryMonitor, MemoryUsageListener {
   private static final Logger logger = LogService.getLogger();
   private volatile MemoryThresholds thresholds = new MemoryThresholds(0);
   private volatile MemoryEvent mostRecentEvent = new MemoryEvent(ResourceType.OFFHEAP_MEMORY,
@@ -230,10 +230,7 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
     }
   }
 
-  float getCriticalThreshold() {
-    return this.thresholds.getCriticalThreshold();
-  }
-
+  @Override
   public boolean hasEvictionThreshold() {
     return this.hasEvictionThreshold;
   }
@@ -283,10 +280,6 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
     }
   }
 
-  public float getEvictionThreshold() {
-    return this.thresholds.getEvictionThreshold();
-  }
-
   /**
    * Compare the number of bytes used (fetched from the JVM) to the thresholds. If necessary, change
    * the state and send an event for the state change.
@@ -415,10 +408,12 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
         eventToPopulate.getThresholds());
   }
 
+  @Override
   public MemoryState getState() {
     return this.currentState;
   }
 
+  @Override
   public MemoryThresholds getThresholds() {
     MemoryThresholds saveThresholds = this.thresholds;
 
@@ -429,6 +424,7 @@ public class OffHeapMemoryMonitor implements ResourceMonitor, MemoryUsageListene
   /**
    * Returns the number of bytes of memory reported by the memory allocator as currently in use.
    */
+  @Override
   public long getBytesUsed() {
     if (this.memoryAllocator == null) {
       return 0;

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/lru/EnableLRU.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/EnableLRU.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/EnableLRU.java
index 6aaf8cc..5beae60 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/EnableLRU.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/EnableLRU.java
@@ -20,6 +20,7 @@ import org.apache.geode.StatisticsType;
 import org.apache.geode.cache.EvictionAction;
 import org.apache.geode.cache.EvictionAlgorithm;
 import org.apache.geode.cache.Region;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 
 /**
  * Marker interface to eviction controller that determines if LRU list maintainance is required.
@@ -108,5 +109,7 @@ public interface EnableLRU {
    */
   public void afterEviction();
 
+  public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv);
+
 }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
index 5e86ce8..cc2cd7e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/HeapLRUCapacityController.java
@@ -26,6 +26,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 import org.apache.geode.internal.cache.*;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 
 import java.util.Properties;
@@ -267,31 +268,24 @@ public class HeapLRUCapacityController extends LRUAlgorithm {
        * greater than the overflow threshold, then we evict the LRU entry.
        */
       public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
-        final GemFireCacheImpl cache;
-        if (region != null) {
-          cache = (GemFireCacheImpl) region.getRegionService();
-        } else {
-          cache = GemFireCacheImpl.getInstance();
-        }
+        final GemFireCacheImpl cache = (GemFireCacheImpl) region.getRegionService();
         InternalResourceManager resourceManager = cache.getResourceManager();
-
-        if (region == null) {
-          return resourceManager.getHeapMonitor().getState().isEviction();
-        }
-
-        final boolean monitorStateIsEviction;
-        if (!((AbstractRegion) region).getOffHeap()) {
-          monitorStateIsEviction = resourceManager.getHeapMonitor().getState().isEviction();
-        } else {
-          monitorStateIsEviction = resourceManager.getOffHeapMonitor().getState().isEviction();
-        }
-
+        boolean offheap = region.getAttributes().getOffHeap();
+        final boolean monitorStateIsEviction =
+            resourceManager.getMemoryMonitor(offheap).getState().isEviction();
         if (region instanceof BucketRegion) {
           return monitorStateIsEviction && ((BucketRegion) region).getSizeForEviction() > 0;
         }
 
         return monitorStateIsEviction && ((LocalRegion) region).getRegionMap().sizeInVM() > 0;
       }
+
+      @Override
+      public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv) {
+        InternalResourceManager resourceManager =
+            drv.getDiskStore().getCache().getResourceManager();
+        return resourceManager.getMemoryMonitor(drv.getOffHeap()).getState().isEviction();
+      }
     };
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUCapacityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUCapacityController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUCapacityController.java
index 3596a07..98e007c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUCapacityController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUCapacityController.java
@@ -18,6 +18,7 @@ import org.apache.geode.*;
 import org.apache.geode.cache.*;
 import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 import org.apache.geode.internal.cache.*;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 
 import java.util.*;
@@ -287,6 +288,11 @@ public final class LRUCapacityController extends LRUAlgorithm implements Declara
       public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
         return stats.getCounter() + delta > stats.getLimit();
       }
+
+      @Override
+      public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv) {
+        return lruStatistics.getCounter() > lruStatistics.getLimit();
+      }
     };
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUMapCallbacks.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUMapCallbacks.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUMapCallbacks.java
index 27a4ec0..0b1cc6f 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUMapCallbacks.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUMapCallbacks.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache.lru;
 // import org.apache.geode.cache.Region;
 import org.apache.geode.internal.cache.RegionEntry;
 // import org.apache.geode.internal.cache.LocalRegion;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 
 /**
  * The lru action on the map for evicting items must be called while the current thread is free of
@@ -54,8 +55,10 @@ public interface LRUMapCallbacks {
   /**
    * Return true if the lru has exceeded its limit and needs to evict. Note that this method is
    * currently used to prevent disk recovery from faulting in values once the limit is exceeded.
+   * 
+   * @param drv the disk region whose limit is checked
    */
-  public boolean lruLimitExceeded();
+  public boolean lruLimitExceeded(DiskRegionView drv);
 
   public void lruCloseStats();
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/main/java/org/apache/geode/internal/cache/lru/MemLRUCapacityController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/MemLRUCapacityController.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/MemLRUCapacityController.java
index 2c2e8ec..1694f1b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/MemLRUCapacityController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/MemLRUCapacityController.java
@@ -31,6 +31,7 @@ import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 import org.apache.geode.internal.cache.AbstractLRURegionMap.CDValueWrapper;
 import org.apache.geode.internal.cache.CachedDeserializableFactory;
 import org.apache.geode.internal.cache.Token;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 
 
@@ -421,6 +422,11 @@ public final class MemLRUCapacityController extends LRUAlgorithm implements Decl
       public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
         return stats.getCounter() + delta > stats.getLimit();
       }
+
+      @Override
+      public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv) {
+        return lruStatistics.getCounter() > lruStatistics.getLimit();
+      }
     };
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUClockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUClockJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUClockJUnitTest.java
index 8095d5a..39759f4 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUClockJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUClockJUnitTest.java
@@ -40,6 +40,7 @@ import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl;
 import org.apache.geode.internal.cache.InternalRegionArguments;
 import org.apache.geode.internal.cache.PlaceHolderDiskRegion;
+import org.apache.geode.internal.cache.persistence.DiskRegionView;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 
 /**
@@ -483,6 +484,11 @@ public class LRUClockJUnitTest {
       stats.setLimit(limit());
       return stats;
     }
+
+    @Override
+    public boolean lruLimitExceeded(LRUStatistics lruStatistics, DiskRegionView drv) {
+      throw new UnsupportedOperationException("Not implemented");
+    }
   }
 
   /** overridden in SharedLRUClockTest to test SharedLRUClockHand */

http://git-wip-us.apache.org/repos/asf/geode/blob/5c5c9479/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
new file mode 100644
index 0000000..489c62b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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 org.apache.geode.internal.offheap;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.cache.DiskStoreFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+
+/**
+ * Test to reproduce GEODE-2097.
+ */
+@Category(IntegrationTest.class)
+public class OffHeapLRURecoveryRegressionTest {
+
+  static final String DS_NAME = "OffHeapLRURecoveryRegressionTestDS";
+
+  /**
+   * Test populates an offheap heaplru persistent region that contains more data than can fit in
+   * offheap memory. It then recovers the region to demonstrate that recovering this data will not
+   * try to put everything into offheap but instead leave some of it on disk.
+   */
+  @Test
+  public void recoveringTooMuchDataDoesNotRunOutOfOffHeapMemory() {
+    final int ENTRY_COUNT = 40;
+    final int expectedObjectCount;
+    GemFireCacheImpl gfc = createCache();
+    try {
+      Region<Object, Object> r = createRegion(gfc);
+      byte[] v = new byte[1024 * 1024];
+      for (int i = 0; i < ENTRY_COUNT; i++) {
+        r.put(i, v);
+      }
+      // expect one more during recovery because of the way the LRU limit is
+      // enforced during recover.
+      expectedObjectCount = MemoryAllocatorImpl.getAllocator().getStats().getObjects() + 1;
+    } finally {
+      gfc.close();
+    }
+    System.setProperty("gemfire.disk.recoverValuesSync", "true");
+    System.setProperty("gemfire.disk.recoverLruValues", "true");
+    try {
+      gfc = createCache();
+      try {
+        Region<Object, Object> r = createRegion(gfc);
+        try {
+          assertEquals(ENTRY_COUNT, r.size());
+          assertEquals(expectedObjectCount,
+              MemoryAllocatorImpl.getAllocator().getStats().getObjects());
+        } finally {
+          r.destroyRegion();
+          DiskStore ds = gfc.findDiskStore(DS_NAME);
+          ds.destroy();
+        }
+      } finally {
+        gfc.close();
+      }
+    } finally {
+      System.clearProperty("gemfire.disk.recoverValuesSync");
+      System.clearProperty("gemfire.disk.recoverLruValues");
+    }
+  }
+
+  private GemFireCacheImpl createCache() {
+    Properties props = new Properties();
+    props.setProperty(LOCATORS, "");
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, "20m");
+    GemFireCacheImpl result = (GemFireCacheImpl) new CacheFactory(props).create();
+    result.getResourceManager().setEvictionOffHeapPercentage(50.0f);
+    return result;
+  }
+
+  private Region<Object, Object> createRegion(GemFireCacheImpl gfc) {
+    DiskStoreFactory dsf = gfc.createDiskStoreFactory();
+    dsf.create(DS_NAME);
+    RegionFactory<Object, Object> rf =
+        gfc.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT_OVERFLOW);
+    rf.setOffHeap(true);
+    rf.setDiskStoreName(DS_NAME);
+    Region<Object, Object> r = rf.create("OffHeapLRURecoveryRegressionTestRegion");
+    return r;
+  }
+
+  private void closeCache(GemFireCacheImpl gfc) {
+    gfc.close();
+    MemoryAllocatorImpl.freeOffHeapMemory();
+  }
+}


[27/51] [abbrv] geode git commit: GEODE-2768: Lucene Queries executed before index is fully created should be retried

Posted by ds...@apache.org.
GEODE-2768: Lucene Queries executed before index is fully created should be retried

  * Added a sleep to prevent rapid retries which lead to stack overflow
  * Sleep can be removed when Function Execution retry does not add to stack


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

Branch: refs/heads/feature/GEODE-2097
Commit: 43a4de8c24750ec85813ab27846c02f84bea2a90
Parents: 5100498
Author: Jason Huynh <hu...@gmail.com>
Authored: Wed Apr 12 11:39:28 2017 -0700
Committer: Jason Huynh <hu...@gmail.com>
Committed: Mon Apr 17 10:31:41 2017 -0700

----------------------------------------------------------------------
 .../distributed/LuceneQueryFunction.java        | 20 ++++++++++++++++++++
 .../LuceneQueryFunctionJUnitTest.java           | 18 ++++++++++++++++++
 2 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/43a4de8c/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java
index 0bd9046..9ad69ac 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java
@@ -25,6 +25,7 @@ import org.apache.geode.cache.lucene.LuceneIndexDestroyedException;
 import org.apache.geode.cache.lucene.LuceneIndexNotFoundException;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
 import org.apache.geode.cache.lucene.internal.LuceneIndexStats;
+import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
 import org.apache.geode.internal.cache.PrimaryBucketException;
 import org.apache.geode.internal.cache.execute.InternalFunctionInvocationTargetException;
 import org.apache.logging.log4j.Logger;
@@ -132,6 +133,25 @@ public class LuceneQueryFunction implements Function, InternalEntity {
     try {
       index =
           (LuceneIndexImpl) service.getIndex(searchContext.getIndexName(), region.getFullPath());
+      if (index == null && service instanceof LuceneServiceImpl) {
+        if (((LuceneServiceImpl) service).getDefinedIndex(searchContext.getIndexName(),
+            region.getFullPath()) != null) {
+          // The node may be in the process of recovering, where we have the index defined but yet
+          // to be recovered
+          // If we retry fast enough, we could get a stack overflow based on the way function
+          // execution is currently written
+          // Instead we will add an artificial sleep to slow down the retry at this point
+          // Hopefully in the future, the function execution would retry without adding to the stack
+          // and this can be removed
+          try {
+            Thread.sleep(1000);
+          } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+          }
+          throw new InternalFunctionInvocationTargetException(
+              "Defined Lucene Index has not been created");
+        }
+      }
     } catch (CacheClosedException e) {
       throw new InternalFunctionInvocationTargetException(
           "Cache is closed when attempting to retrieve index:" + region.getFullPath(), e);

http://git-wip-us.apache.org/repos/asf/geode/blob/43a4de8c/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
index 0283ffa..5313ced 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunctionJUnitTest.java
@@ -33,8 +33,10 @@ import org.apache.geode.cache.lucene.LuceneQueryException;
 import org.apache.geode.cache.lucene.LuceneQueryFactory;
 import org.apache.geode.cache.lucene.LuceneQueryProvider;
 import org.apache.geode.cache.lucene.internal.InternalLuceneService;
+import org.apache.geode.cache.lucene.internal.LuceneIndexCreationProfile;
 import org.apache.geode.cache.lucene.internal.LuceneIndexImpl;
 import org.apache.geode.cache.lucene.internal.LuceneIndexStats;
+import org.apache.geode.cache.lucene.internal.LuceneServiceImpl;
 import org.apache.geode.cache.lucene.internal.StringQueryProvider;
 import org.apache.geode.cache.lucene.internal.repository.IndexRepository;
 import org.apache.geode.cache.lucene.internal.repository.IndexResultCollector;
@@ -223,6 +225,22 @@ public class LuceneQueryFunctionJUnitTest {
   }
 
   @Test(expected = InternalFunctionInvocationTargetException.class)
+  public void whenServiceReturnsNullIndexButHasDefinedLuceneIndexDuringQueryExecutionInternalFunctionExceptionShouldBeThrown()
+      throws Exception {
+    LuceneServiceImpl mockServiceImpl = mock(LuceneServiceImpl.class);
+    when(mockCache.getService(any())).thenReturn(mockServiceImpl);
+    when(mockServiceImpl.getIndex(eq("indexName"), eq(regionPath))).thenReturn(null);
+    when(mockServiceImpl.getDefinedIndex(eq("indexName"), eq(regionPath)))
+        .thenReturn(mock(LuceneIndexCreationProfile.class));
+    when(mockContext.getDataSet()).thenReturn(mockRegion);
+    when(mockContext.getArguments()).thenReturn(searchArgs);
+
+    LuceneQueryFunction function = new LuceneQueryFunction();
+    when(mockService.getIndex(eq("indexName"), eq(regionPath))).thenReturn(null);
+    function.execute(mockContext);
+  }
+
+  @Test(expected = InternalFunctionInvocationTargetException.class)
   public void whenServiceThrowsCacheClosedDuringQueryExecutionFunctionExceptionShouldBeThrown()
       throws Exception {
     when(mockContext.getDataSet()).thenReturn(mockRegion);


[13/51] [abbrv] geode git commit: GEODE-2787: When distribution happened, it calls startOperation() to increase a count, then call an endOperation() to decrease the count.

Posted by ds...@apache.org.
GEODE-2787: When distribution happened, it calls startOperation() to increase a count, then call an endOperation() to decrease the count.

state flush will wait for this count to become 0.

But notifyGateway() is called after distribute(). So there's race that stateflush finished but notifyGateway has not done yet.

The fix is to move the endOperation() after callbacks.


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

Branch: refs/heads/feature/GEODE-2097
Commit: 7e607de71163200ce3741664dd64d32f692acc4f
Parents: 5c5c947
Author: zhouxh <gz...@pivotal.io>
Authored: Fri Apr 7 18:43:43 2017 -0700
Committer: zhouxh <gz...@pivotal.io>
Committed: Fri Apr 14 15:31:25 2017 -0700

----------------------------------------------------------------------
 .../internal/cache/AbstractUpdateOperation.java |  19 --
 .../geode/internal/cache/BucketRegion.java      | 256 ++++++++++++-------
 .../cache/DistributedCacheOperation.java        |  86 +++++--
 .../geode/internal/cache/DistributedRegion.java |  18 +-
 .../geode/internal/cache/LocalRegion.java       |   6 +-
 .../internal/cache/LocalRegionDataView.java     |  24 +-
 .../geode/internal/cache/PartitionedRegion.java |   6 +-
 .../geode/internal/cache/Bug45934DUnitTest.java |   4 +-
 8 files changed, 270 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractUpdateOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractUpdateOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractUpdateOperation.java
index 55df601..26fdde5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractUpdateOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractUpdateOperation.java
@@ -40,8 +40,6 @@ import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationExcep
 import org.apache.geode.internal.cache.versions.VersionTag;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LogMarker;
-import org.apache.geode.internal.util.DelayedAction;
 
 /**
  * Common code for both UpdateOperation and DistributedPutAllOperation.
@@ -55,7 +53,6 @@ public abstract class AbstractUpdateOperation extends DistributedCacheOperation
   @edu.umd.cs.findbugs.annotations.SuppressWarnings(
       value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
       justification = "test hook that is unset normally")
-  public static volatile DelayedAction test_InvalidVersionAction;
 
   private final long lastModifiedTime;
 
@@ -65,22 +62,6 @@ public abstract class AbstractUpdateOperation extends DistributedCacheOperation
   }
 
   @Override
-  public void distribute() {
-    try {
-      super.distribute();
-    } catch (InvalidVersionException e) {
-      if (logger.isDebugEnabled()) {
-        logger.trace(LogMarker.DM, "PutAll failed since versions were missing; retrying again", e);
-      }
-
-      if (test_InvalidVersionAction != null) {
-        test_InvalidVersionAction.run();
-      }
-      super.distribute();
-    }
-  }
-
-  @Override
   protected Set getRecipients() {
     CacheDistributionAdvisor advisor = getRegion().getCacheDistributionAdvisor();
     return advisor.adviseUpdate(getEvent());

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
index d92ddab..136d7b9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketRegion.java
@@ -577,21 +577,32 @@ public class BucketRegion extends DistributedRegion implements Bucket {
   }
 
   protected void distributeUpdateOperation(EntryEventImpl event, long lastModified) {
-    if (!event.isOriginRemote() && !event.isNetSearch() && getBucketAdvisor().isPrimary()) {
-      if (event.isBulkOpInProgress()) {
-        // consolidate the UpdateOperation for each entry into a PutAllMessage
-        // since we did not call basicPutPart3(), so we have to explicitly addEntry here
-        event.getPutAllOperation().addEntry(event, this.getId());
-      } else {
-        new UpdateOperation(event, lastModified).distribute();
-        if (logger.isDebugEnabled()) {
-          logger.debug("sent update operation : for region  : {}: with event: {}", this.getName(),
-              event);
+    long token = -1;
+    UpdateOperation op = null;
+
+    try {
+      if (!event.isOriginRemote() && !event.isNetSearch() && getBucketAdvisor().isPrimary()) {
+        if (event.isBulkOpInProgress()) {
+          // consolidate the UpdateOperation for each entry into a PutAllMessage
+          // since we did not call basicPutPart3(), so we have to explicitly addEntry here
+          event.getPutAllOperation().addEntry(event, this.getId());
+        } else {
+          // before distribute: BR's put
+          op = new UpdateOperation(event, lastModified);
+          token = op.startOperation();
+          if (logger.isDebugEnabled()) {
+            logger.debug("sent update operation : for region  : {}: with event: {}", this.getName(),
+                event);
+          }
         }
       }
-    }
-    if (!event.getOperation().isPutAll()) { // putAll will invoke listeners later
-      event.invokeCallbacks(this, true, true);
+      if (!event.getOperation().isPutAll()) { // putAll will invoke listeners later
+        event.invokeCallbacks(this, true, true);
+      }
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
     }
   }
 
@@ -607,40 +618,54 @@ public class BucketRegion extends DistributedRegion implements Bucket {
     // timestamp returned from basicPutPart2, but as a bucket we want to do
     // distribution *before* we do basicPutPart2.
     final long modifiedTime = event.getEventTime(lastModified);
-    // Update the get stats if necessary.
-    if (this.partitionedRegion.getDataStore().hasClientInterest(event)) {
-      updateStatsForGet(entry, true);
-    }
-    if (!event.isOriginRemote()) {
-      if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
-        boolean eventHasDelta = event.getDeltaBytes() != null;
-        VersionTag v = entry.generateVersionTag(null, eventHasDelta, this, event);
-        if (v != null) {
-          if (logger.isDebugEnabled()) {
-            logger.debug("generated version tag {} in region {}", v, this.getName());
+
+    long token = -1;
+    UpdateOperation op = null;
+
+    try {
+      // Update the get stats if necessary.
+      if (this.partitionedRegion.getDataStore().hasClientInterest(event)) {
+        updateStatsForGet(entry, true);
+      }
+      if (!event.isOriginRemote()) {
+        if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
+          boolean eventHasDelta = event.getDeltaBytes() != null;
+          VersionTag v = entry.generateVersionTag(null, eventHasDelta, this, event);
+          if (v != null) {
+            if (logger.isDebugEnabled()) {
+              logger.debug("generated version tag {} in region {}", v, this.getName());
+            }
           }
         }
-      }
 
-      // This code assumes it is safe ignore token mode (GII in progress)
-      // because it assumes when the origin of the event is local,
-      // the GII has completed and the region is initialized and open for local
-      // ops
-      if (!event.isBulkOpInProgress()) {
-        long start = this.partitionedRegion.getPrStats().startSendReplication();
-        try {
-          UpdateOperation op = new UpdateOperation(event, modifiedTime);
-          op.distribute();
-        } finally {
-          this.partitionedRegion.getPrStats().endSendReplication(start);
+        // This code assumes it is safe ignore token mode (GII in progress)
+        // because it assumes when the origin of the event is local,
+        // the GII has completed and the region is initialized and open for local
+        // ops
+
+        if (!event.isBulkOpInProgress()) {
+          long start = this.partitionedRegion.getPrStats().startSendReplication();
+          try {
+            // before distribute: PR's put PR
+            op = new UpdateOperation(event, modifiedTime);
+            token = op.startOperation();
+          } finally {
+            this.partitionedRegion.getPrStats().endSendReplication(start);
+          }
+        } else {
+          // consolidate the UpdateOperation for each entry into a PutAllMessage
+          // basicPutPart3 takes care of this
         }
-      } else {
-        // consolidate the UpdateOperation for each entry into a PutAllMessage
-        // basicPutPart3 takes care of this
       }
-    }
 
-    return super.basicPutPart2(event, entry, isInitialized, lastModified, clearConflict);
+      long lastModifiedTime =
+          super.basicPutPart2(event, entry, isInitialized, lastModified, clearConflict);
+      return lastModifiedTime;
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
+    }
   }
 
   protected void notifyGatewaySender(EnumListenerEvent operation, EntryEventImpl event) {
@@ -883,39 +908,59 @@ public class BucketRegion extends DistributedRegion implements Bucket {
   }
 
   protected void distributeInvalidateOperation(EntryEventImpl event) {
-    if (!event.isOriginRemote() && getBucketAdvisor().isPrimary()) {
-      // This cache has processed the event, forward operation
-      // and event messages to backup buckets
-      new InvalidateOperation(event).distribute();
+    InvalidateOperation op = null;
+    long token = -1;
+    try {
+      if (!event.isOriginRemote() && getBucketAdvisor().isPrimary()) {
+        // This cache has processed the event, forward operation
+        // and event messages to backup buckets
+        // before distribute: BR.invalidate hasSeenEvent
+        op = new InvalidateOperation(event);
+        token = op.startOperation();
+      }
+      event.invokeCallbacks(this, true, false);
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
     }
-    event.invokeCallbacks(this, true, false);
   }
 
   @Override
   void basicInvalidatePart2(final RegionEntry re, final EntryEventImpl event, boolean clearConflict,
       boolean invokeCallbacks) {
     // Assumed this is called with the entry synchronized
-    if (!event.isOriginRemote()) {
-      if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
-        VersionTag v = re.generateVersionTag(null, false, this, event);
-        if (logger.isDebugEnabled() && v != null) {
-          logger.debug("generated version tag {} in region {}", v, this.getName());
+    long token = -1;
+    InvalidateOperation op = null;
+
+    try {
+      if (!event.isOriginRemote()) {
+        if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
+          VersionTag v = re.generateVersionTag(null, false, this, event);
+          if (logger.isDebugEnabled() && v != null) {
+            logger.debug("generated version tag {} in region {}", v, this.getName());
+          }
+          event.setVersionTag(v);
         }
-        event.setVersionTag(v);
-      }
 
-      // This code assumes it is safe ignore token mode (GII in progress)
-      // because it assumes when the origin of the event is local,
-      // the GII has completed and the region is initialized and open for local
-      // ops
+        // This code assumes it is safe ignore token mode (GII in progress)
+        // because it assumes when the origin of the event is local,
+        // the GII has completed and the region is initialized and open for local
+        // ops
 
-      // This code assumes that this bucket is primary
-      // distribute op to bucket secondaries and event to other listeners
-      InvalidateOperation op = new InvalidateOperation(event);
-      op.distribute();
+        // This code assumes that this bucket is primary
+        // distribute op to bucket secondaries and event to other listeners
+        // before distribute: BR's invalidate
+        op = new InvalidateOperation(event);
+        token = op.startOperation();
+      }
+      super.basicInvalidatePart2(re, event, clearConflict /* Clear conflict occurred */,
+          invokeCallbacks);
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
     }
-    super.basicInvalidatePart2(re, event, clearConflict /* Clear conflict occurred */,
-        invokeCallbacks);
   }
 
   @Override
@@ -1131,49 +1176,70 @@ public class BucketRegion extends DistributedRegion implements Bucket {
   }
 
   protected void distributeDestroyOperation(EntryEventImpl event) {
-    if (logger.isTraceEnabled(LogMarker.DM)) {
-      logger.trace(LogMarker.DM, "BR.basicDestroy: this cache has already seen this event {}",
-          event);
-    }
-    if (!event.isOriginRemote() && getBucketAdvisor().isPrimary()) {
-      if (event.isBulkOpInProgress()) {
-        // consolidate the DestroyOperation for each entry into a RemoveAllMessage
-        event.getRemoveAllOperation().addEntry(event, this.getId());
-      } else {
-        // This cache has processed the event, forward operation
-        // and event messages to backup buckets
-        event.setOldValueFromRegion();
-        new DestroyOperation(event).distribute();
+    long token = -1;
+    DestroyOperation op = null;
+
+    try {
+      if (logger.isTraceEnabled(LogMarker.DM)) {
+        logger.trace(LogMarker.DM, "BR.basicDestroy: this cache has already seen this event {}",
+            event);
+      }
+      if (!event.isOriginRemote() && getBucketAdvisor().isPrimary()) {
+        if (event.isBulkOpInProgress()) {
+          // consolidate the DestroyOperation for each entry into a RemoveAllMessage
+          event.getRemoveAllOperation().addEntry(event, this.getId());
+        } else {
+          // This cache has processed the event, forward operation
+          // and event messages to backup buckets
+          // before distribute: BR's destroy, not to trigger callback here
+          event.setOldValueFromRegion();
+          op = new DestroyOperation(event);
+          token = op.startOperation();
+        }
       }
-    }
 
-    if (!event.getOperation().isRemoveAll()) { // removeAll will invoke listeners later
-      event.invokeCallbacks(this, true, false);
+      if (!event.getOperation().isRemoveAll()) { // removeAll will invoke listeners later
+        event.invokeCallbacks(this, true, false);
+      }
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
     }
   }
 
   @Override
   protected void basicDestroyBeforeRemoval(RegionEntry entry, EntryEventImpl event) {
-    // Assumed this is called with entry synchrony
-    if (!event.isOriginRemote() && !event.isBulkOpInProgress() && !event.getOperation().isLocal()
-        && !Operation.EVICT_DESTROY.equals(event.getOperation())
-        && !(event.isExpiration() && isEntryEvictDestroyEnabled())) {
-
-      if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
-        VersionTag v = entry.generateVersionTag(null, false, this, event);
-        if (logger.isDebugEnabled() && v != null) {
-          logger.debug("generated version tag {} in region {}", v, this.getName());
+    long token = -1;
+    DestroyOperation op = null;
+    try {
+      // Assumed this is called with entry synchrony
+      if (!event.isOriginRemote() && !event.isBulkOpInProgress() && !event.getOperation().isLocal()
+          && !Operation.EVICT_DESTROY.equals(event.getOperation())
+          && !(event.isExpiration() && isEntryEvictDestroyEnabled())) {
+
+        if (event.getVersionTag() == null || event.getVersionTag().isGatewayTag()) {
+          VersionTag v = entry.generateVersionTag(null, false, this, event);
+          if (logger.isDebugEnabled() && v != null) {
+            logger.debug("generated version tag {} in region {}", v, this.getName());
+          }
         }
-      }
 
-      // This code assumes it is safe ignore token mode (GII in progress)
-      // because it assume when the origin of the event is local,
-      // then GII has completed (the region has been completely initialized)
+        // This code assumes it is safe ignore token mode (GII in progress)
+        // because it assume when the origin of the event is local,
+        // then GII has completed (the region has been completely initialized)
 
-      // This code assumes that this bucket is primary
-      new DestroyOperation(event).distribute();
+        // This code assumes that this bucket is primary
+        // before distribute: BR.destroy for retain
+        op = new DestroyOperation(event);
+        token = op.startOperation();
+      }
+      super.basicDestroyBeforeRemoval(entry, event);
+    } finally {
+      if (op != null) {
+        op.endOperation(token);
+      }
     }
-    super.basicDestroyBeforeRemoval(entry, event);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index bded899..0a9ccd8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
@@ -33,6 +33,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.InvalidDeltaException;
+import org.apache.geode.InvalidVersionException;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheEvent;
 import org.apache.geode.cache.CacheFactory;
@@ -78,6 +79,7 @@ import org.apache.geode.internal.offheap.StoredObject;
 import org.apache.geode.internal.offheap.annotations.Released;
 import org.apache.geode.internal.offheap.annotations.Unretained;
 import org.apache.geode.internal.sequencelog.EntryLogger;
+import org.apache.geode.internal.util.DelayedAction;
 
 /**
  * 
@@ -240,11 +242,74 @@ public abstract class DistributedCacheOperation {
     return true;
   }
 
+  public static volatile DelayedAction test_InvalidVersionAction;
+
+  /**
+   * region's distribution advisor marked that a distribution is about to start, then distribute. It
+   * returns a token, which is view version. Return -1 means the method did not succeed. This method
+   * must be invoked before toDistribute(). This method should pair with endOperation() in
+   * try/finally block.
+   */
+  public long startOperation() {
+    DistributedRegion region = getRegion();
+    long viewVersion = -1;
+    if (this.containsRegionContentChange()) {
+      viewVersion = region.getDistributionAdvisor().startOperation();
+    }
+    if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) {
+      logger.trace(LogMarker.STATE_FLUSH_OP, "dispatching operation in view version {}",
+          viewVersion);
+    }
+    try {
+      _distribute();
+    } catch (InvalidVersionException e) {
+      if (logger.isDebugEnabled()) {
+        logger.trace(LogMarker.DM, "PutAll failed since versions were missing; retrying again", e);
+      }
+
+      if (test_InvalidVersionAction != null) {
+        test_InvalidVersionAction.run();
+      }
+      _distribute();
+    }
+    return viewVersion;
+  }
+
+  /**
+   * region's distribution advisor marked that a distribution is ended. This method should pair with
+   * startOperation in try/finally block.
+   */
+  public void endOperation(long viewVersion) {
+    DistributedRegion region = getRegion();
+    if (viewVersion != -1) {
+      region.getDistributionAdvisor().endOperation(viewVersion);
+      if (logger.isDebugEnabled()) {
+        logger.trace(LogMarker.STATE_FLUSH_OP, "done dispatching operation in view version {}",
+            viewVersion);
+      }
+    }
+  }
+
   /**
    * Distribute a cache operation to other members of the distributed system. This method determines
    * who the recipients are and handles careful delivery of the operation to those members.
    */
   public void distribute() {
+    long token = -1;
+    try {
+      token = startOperation();
+    } finally {
+      endOperation(token);
+    }
+  }
+
+  /**
+   * About to distribute a cache operation to other members of the distributed system. This method
+   * determines who the recipients are and handles careful delivery of the operation to those
+   * members. This method should wrapped by startOperation() and endOperation() in try/finally
+   * block.
+   */
+  private void _distribute() {
     DistributedRegion region = getRegion();
     DM mgr = region.getDistributionManager();
     boolean reliableOp = isOperationReliable() && region.requiresReliabilityCheck();
@@ -261,15 +326,6 @@ public abstract class DistributedCacheOperation {
     boolean isPutAll = (this instanceof DistributedPutAllOperation);
     boolean isRemoveAll = (this instanceof DistributedRemoveAllOperation);
 
-    long viewVersion = -1;
-    if (this.containsRegionContentChange()) {
-      viewVersion = region.getDistributionAdvisor().startOperation();
-    }
-    if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) {
-      logger.trace(LogMarker.STATE_FLUSH_OP, "dispatching operation in view version {}",
-          viewVersion);
-    }
-
     try {
       // Recipients with CacheOp
       Set<InternalDistributedMember> recipients = getRecipients();
@@ -596,11 +652,6 @@ public abstract class DistributedCacheOperation {
           }
         }
 
-        if (viewVersion > 0) {
-          region.getDistributionAdvisor().endOperation(viewVersion);
-          viewVersion = -1;
-        }
-
         /** compute local client routing before waiting for an ack only for a bucket */
         if (region.isUsedForPartitionedRegionBucket()) {
           FilterInfo filterInfo = getLocalFilterRouting(filterRouting);
@@ -639,13 +690,6 @@ public abstract class DistributedCacheOperation {
       throw e;
     } finally {
       ReplyProcessor21.setShortSevereAlertProcessing(false);
-      if (viewVersion != -1) {
-        if (logger.isDebugEnabled()) {
-          logger.trace(LogMarker.STATE_FLUSH_OP, "done dispatching operation in view version {}",
-              viewVersion);
-        }
-        region.getDistributionAdvisor().endOperation(viewVersion);
-      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 8cdc517..926f36d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -437,6 +437,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
         distribute = false;
       }
       if (distribute) {
+        // before distribute: DR's put, it has notified gateway sender earlier
         UpdateOperation op = new UpdateOperation(event, lastModified);
         if (logger.isTraceEnabled()) {
           logger.trace("distributing operation for event : {} : for region : {}", event,
@@ -1657,6 +1658,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
           event.getRemoveAllOperation().addEntry(event, true);
         }
         if (!getConcurrencyChecksEnabled() || event.hasValidVersionTag()) {
+          // before distribute: DR.destroy, hasSeenEvent. no to notifyGateway
           distributeDestroy(event, expectedOldValue);
           event.invokeCallbacks(this, true, false);
         }
@@ -1676,6 +1678,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     if (event.isDistributed() && !event.isOriginRemote() && !event.isBulkOpInProgress()) {
       boolean distribute = !event.getInhibitDistribution();
       if (distribute) {
+        // before distribute: DR.destroy, it has notifiedGatewaySender ealier
         DestroyOperation op = new DestroyOperation(event);
         op.distribute();
       }
@@ -1858,6 +1861,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
       if (event.isDistributed() && !event.isOriginRemote()) {
         boolean distribute = !event.getInhibitDistribution();
         if (distribute) {
+          // before distribute: DR.invalidate, it has triggered callback earlier
           InvalidateOperation op = new InvalidateOperation(event);
           op.distribute();
         }
@@ -1890,6 +1894,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
     if (!this.regionInvalid && event.isDistributed() && !event.isOriginRemote()
         && !isTX() /* only distribute if non-tx */) {
       if (event.isDistributed() && !event.isOriginRemote()) {
+        // before distribute: DR has sent callback earlier
         UpdateEntryVersionOperation op = new UpdateEntryVersionOperation(event);
         op.distribute();
       }
@@ -3339,28 +3344,33 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
   /**
    * Distribute the PutAllOp. This implementation distributes it to peers.
    * 
+   * @return token >0 means startOperation finished distribution
    * @since GemFire 5.7
    */
   @Override
-  public void postPutAllSend(DistributedPutAllOperation putAllOp,
+  public long postPutAllSend(DistributedPutAllOperation putAllOp,
       VersionedObjectList successfulPuts) {
+    long token = -1;
     if (putAllOp.putAllDataSize > 0) {
-      putAllOp.distribute();
+      token = putAllOp.startOperation();
     } else {
       if (logger.isDebugEnabled()) {
         logger.debug("DR.postPutAll: no data to distribute");
       }
     }
+    return token;
   }
 
   @Override
-  public void postRemoveAllSend(DistributedRemoveAllOperation op,
+  public long postRemoveAllSend(DistributedRemoveAllOperation op,
       VersionedObjectList successfulOps) {
+    long token = -1;
     if (op.removeAllDataSize > 0) {
-      op.distribute();
+      token = op.startOperation();
     } else {
       getCache().getLoggerI18n().fine("DR.postRemoveAll: no data to distribute");
     }
+    return token;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 297c90b..4b1786f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -10458,14 +10458,16 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
     }
   }
 
-  public void postPutAllSend(DistributedPutAllOperation putallOp,
+  public long postPutAllSend(DistributedPutAllOperation putallOp,
       VersionedObjectList successfulPuts) {
     /* No-op for local region of course */
+    return -1;
   }
 
-  public void postRemoveAllSend(DistributedRemoveAllOperation op,
+  public long postRemoveAllSend(DistributedRemoveAllOperation op,
       VersionedObjectList successfulOps) {
     /* No-op for local region of course */
+    return -1;
   }
 
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
index 119dd43..b4aa20b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegionDataView.java
@@ -311,8 +311,16 @@ public class LocalRegionDataView implements InternalDataView {
       successfulPuts.clear();
       putallOp.fillVersionedObjectList(successfulPuts);
     }
-    region.postPutAllSend(putallOp, successfulPuts);
-    region.postPutAllFireEvents(putallOp, successfulPuts);
+    // BR & DR's putAll
+    long token = -1;
+    try {
+      token = region.postPutAllSend(putallOp, successfulPuts);
+      region.postPutAllFireEvents(putallOp, successfulPuts);
+    } finally {
+      if (region instanceof DistributedRegion) {
+        putallOp.endOperation(token);
+      }
+    }
   }
 
   @Override
@@ -325,7 +333,15 @@ public class LocalRegionDataView implements InternalDataView {
       successfulOps.clear();
       op.fillVersionedObjectList(successfulOps);
     }
-    region.postRemoveAllSend(op, successfulOps);
-    region.postRemoveAllFireEvents(op, successfulOps);
+    // BR, DR's removeAll
+    long token = -1;
+    try {
+      token = region.postRemoveAllSend(op, successfulOps);
+      region.postRemoveAllFireEvents(op, successfulOps);
+    } finally {
+      if (region instanceof DistributedRegion) {
+        op.endOperation(token);
+      }
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 0f5e316..614de4d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -2077,7 +2077,7 @@ public class PartitionedRegion extends LocalRegion
    * @param successfulPuts not used in PartitionedRegion.
    */
   @Override
-  public void postPutAllSend(DistributedPutAllOperation putallO,
+  public long postPutAllSend(DistributedPutAllOperation putallO,
       VersionedObjectList successfulPuts) {
     final boolean isDebugEnabled = logger.isDebugEnabled();
 
@@ -2174,10 +2174,11 @@ public class PartitionedRegion extends LocalRegion
        * != null) { e.release(); } } }
        */
     }
+    return -1;
   }
 
   @Override
-  public void postRemoveAllSend(DistributedRemoveAllOperation op,
+  public long postRemoveAllSend(DistributedRemoveAllOperation op,
       VersionedObjectList successfulOps) {
     final boolean isDebugEnabled = logger.isDebugEnabled();
 
@@ -2264,6 +2265,7 @@ public class PartitionedRegion extends LocalRegion
         }
       }
     }
+    return -1;
   }
 
   /*

http://git-wip-us.apache.org/repos/asf/geode/blob/7e607de7/geode-core/src/test/java/org/apache/geode/internal/cache/Bug45934DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug45934DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug45934DUnitTest.java
index 0bf501f..8021b97 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug45934DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug45934DUnitTest.java
@@ -63,13 +63,13 @@ public class Bug45934DUnitTest extends JUnit4CacheTestCase {
     Region<Integer, Integer> region = rf.create(name);
 
     // 3. reset the error flag after initial failure
-    AbstractUpdateOperation.test_InvalidVersionAction = new DelayedAction(new Runnable() {
+    DistributedCacheOperation.test_InvalidVersionAction = new DelayedAction(new Runnable() {
       @Override
       public void run() {
         unsetRemoteFlag(remote);
       }
     });
-    AbstractUpdateOperation.test_InvalidVersionAction.allowToProceed();
+    DistributedCacheOperation.test_InvalidVersionAction.allowToProceed();
 
     // 3. put data
     Map<Integer, Integer> values = new HashMap<Integer, Integer>();


[19/51] [abbrv] geode git commit: GEODE-2686: Remove JarClassLoader

Posted by ds...@apache.org.
GEODE-2686: Remove JarClassLoader

 - Remove JarClassLoader
 - Replace ClassPathLoader's collection of JarClassLoaders with a single URLClassLoader
 - Change naming scheme for deployed jars from 'vf.gf#myJar.jar#1' to 'myJar.v1.jar'


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

Branch: refs/heads/feature/GEODE-2097
Commit: 6fd2d123a6c4dbb0c7af0bbf135314bda0c6d5e9
Parents: f272762
Author: Jared Stewart <js...@pivotal.io>
Authored: Thu Jan 19 12:00:04 2017 -0800
Committer: Jared Stewart <js...@pivotal.io>
Committed: Sun Apr 16 09:10:00 2017 -0700

----------------------------------------------------------------------
 .../apache/geode/internal/ClassPathLoader.java  | 515 ++---------
 .../org/apache/geode/internal/DeployedJar.java  | 442 ++++++++++
 .../geode/internal/InternalDataSerializer.java  |   2 +-
 .../apache/geode/internal/JarClassLoader.java   | 721 ----------------
 .../org/apache/geode/internal/JarDeployer.java  | 699 +++++++--------
 .../cache/ClusterConfigurationLoader.java       |  40 +-
 .../geode/internal/cache/GemFireCacheImpl.java  |   4 +-
 .../cache/persistence/BackupManager.java        |  10 +-
 .../internal/cli/functions/DeployFunction.java  |  11 +-
 .../cli/functions/ListDeployedFunction.java     |  10 +-
 .../cli/functions/UndeployFunction.java         |  15 +-
 .../ClassPathLoaderIntegrationTest.java         | 454 +++++-----
 .../geode/internal/ClassPathLoaderTest.java     | 402 ++-------
 .../geode/internal/DeployedJarJUnitTest.java    | 538 ++++++++++++
 .../geode/internal/JarClassLoaderJUnitTest.java | 851 -------------------
 .../geode/internal/JarDeployerDUnitTest.java    | 574 -------------
 .../internal/JarDeployerIntegrationTest.java    | 214 +++--
 .../cache/IncrementalBackupDUnitTest.java       |  33 +-
 .../geode/management/DeployJarTestSuite.java    |  31 +
 .../DeployCommandRedeployDUnitTest.java         | 159 ++++
 .../cli/commands/DeployCommandsDUnitTest.java   | 662 +++++----------
 .../cli/commands/UserCommandsDUnitTest.java     | 164 ----
 .../internal/configuration/ClusterConfig.java   |  35 +-
 .../dunit/rules/GfshShellConnectionRule.java    |  10 +
 .../cli/commands/CommandOverHttpDUnitTest.java  |   2 +-
 25 files changed, 2323 insertions(+), 4275 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java b/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
index 9ab7c30..41cce05 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/ClassPathLoader.java
@@ -14,6 +14,9 @@
  */
 package org.apache.geode.internal;
 
+import static java.util.stream.Collectors.joining;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.CollectionUtils;
@@ -27,6 +30,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
 
 /**
@@ -62,271 +66,54 @@ public final class ClassPathLoader {
    * 
    * See also http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html
    */
-
-  public static final String ENABLE_TRACE_PROPERTY =
-      DistributionConfig.GEMFIRE_PREFIX + "ClassPathLoader.enableTrace";
-  public static final String ENABLE_TRACE_DEFAULT_VALUE = "false";
-  private final boolean ENABLE_TRACE = false;
-
   private static final Logger logger = LogService.getLogger();
 
   public static final String EXCLUDE_TCCL_PROPERTY =
       DistributionConfig.GEMFIRE_PREFIX + "excludeThreadContextClassLoader";
   public static final boolean EXCLUDE_TCCL_DEFAULT_VALUE = false;
-  private boolean excludeTCCL;
-
-  // This calculates the location of the extlib directory relative to the
-  // location of the gemfire jar file. If for some reason the ClassPathLoader
-  // class is found in a directory instead of a JAR file (as when testing),
-  // then it will be relative to the location of the root of the package and
-  // class.
-  public static final String EXT_LIB_DIR_PARENT_PROPERTY =
-      DistributionConfig.GEMFIRE_PREFIX + "ClassPathLoader.EXT_LIB_DIR";
-  public static final String EXT_LIB_DIR_PARENT_DEFAULT =
-      ClassPathLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-
-  static final File defineEXT_LIB_DIR() {
-    return new File(
-        (new File(System.getProperty(EXT_LIB_DIR_PARENT_PROPERTY, EXT_LIB_DIR_PARENT_DEFAULT)))
-            .getParent(),
-        "ext");
-  }
-
-  // This token is placed into the list of class loaders to determine where
-  // to insert the TCCL when in forName(...), getResource(...), etc.
-  private static final ClassLoader TCCL_PLACEHOLDER = new ClassLoader() { // This is never used for
-                                                                          // class loading
-  };
-
-  private static final AtomicReference<ClassPathLoader> latest =
-      new AtomicReference<ClassPathLoader>();
-
-  private final List<ClassLoader> classLoaders;
-
-  private static final Set<ClassLoader> defaultLoaders;
-  static {
-    defaultLoaders = new HashSet<ClassLoader>();
-    try {
-      ClassLoader classLoader = ClassPathLoader.class.getClassLoader();
-      if (classLoader != null) {
-        defaultLoaders.add(classLoader);
-      }
-    } catch (SecurityException sex) {
-      // Nothing to do, just don't add it
-    }
 
-    try {
-      ClassLoader classLoader = ClassLoader.getSystemClassLoader();
-      if (classLoader != null) {
-        defaultLoaders.add(classLoader);
-      }
-    } catch (SecurityException sex) {
-      // Nothing to do, just don't add it
-    }
+  private static volatile ClassPathLoader latest;
 
-    setLatestToDefault();
-  }
+  private volatile URLClassLoader classLoaderForDeployedJars;
+  private final JarDeployer jarDeployer;
 
-  /**
-   * Starting at the files or directories identified by 'files', search for valid JAR files and
-   * return a list of their URLs. Sub-directories will also be searched.
-   * 
-   * @param files Files or directories to search for valid JAR content.
-   * 
-   * @return A list of URLs for all JAR files found.
-   */
-  private static List<URL> getJarURLsFromFiles(final File... files) {
-    final List<URL> urls = new ArrayList<URL>();
-
-    Assert.assertTrue(files != null, "file list cannot be null");
-
-    for (File file : files) {
-      if (file.exists()) {
-        if (file.isDirectory()) {
-          urls.addAll(getJarURLsFromFiles(file.listFiles()));
-        } else {
-          if (!JarClassLoader.hasValidJarContent(file)) {
-            logger.warn("Invalid JAR content when attempting to create ClassLoader for file: {}",
-                file.getAbsolutePath());
-            continue;
-          }
+  private boolean excludeTCCL;
 
-          try {
-            urls.add(file.toURI().toURL());
-          } catch (MalformedURLException muex) {
-            logger.warn(
-                "Encountered invalid URL when attempting to create ClassLoader for file: {}:{}",
-                file.getAbsolutePath(), muex.getMessage());
-            continue;
-          }
-        }
-      }
-    }
+  public void rebuildClassLoaderForDeployedJars() {
+    ClassLoader parent = ClassPathLoader.class.getClassLoader();
 
-    return urls;
+    this.classLoaderForDeployedJars = new URLClassLoader(jarDeployer.getDeployedJarURLs(), parent);
   }
 
-  private ClassPathLoader(final List<ClassLoader> classLoaders, final boolean excludeTCCL) {
-
-    Assert.assertTrue(classLoaders != null, "custom loaders must not be null");
-    for (ClassLoader classLoader : classLoaders) {
-      Assert.assertTrue(classLoader != null, "null classloaders not allowed");
-    }
-
-    this.classLoaders = new ArrayList<ClassLoader>(classLoaders);
+  public ClassPathLoader(boolean excludeTCCL) {
     this.excludeTCCL = excludeTCCL;
+    this.jarDeployer = new JarDeployer();
+    rebuildClassLoaderForDeployedJars();
   }
 
-  /**
-   * Get a copy of the collection of ClassLoaders currently in use.
-   * 
-   * @return Collection of ClassLoaders currently in use.
-   */
-  public Collection<ClassLoader> getClassLoaders() {
-    List<ClassLoader> classLoadersCopy = new ArrayList<ClassLoader>(this.classLoaders);
-
-    for (int i = 0; i < classLoadersCopy.size(); i++) {
-      if (classLoadersCopy.get(i).equals(TCCL_PLACEHOLDER)) {
-        if (excludeTCCL) {
-          classLoadersCopy.remove(i);
-        } else {
-          classLoadersCopy.set(i, Thread.currentThread().getContextClassLoader());
-        }
-        break;
-      }
-    }
-
-    return classLoadersCopy;
-  }
-
-  // This is exposed for testing.
-  static ClassPathLoader createWithDefaults(final boolean excludeTCCL) {
-    List<ClassLoader> classLoaders = new LinkedList<ClassLoader>();
-
-    classLoaders.add(TCCL_PLACEHOLDER);
-
-    for (final ClassLoader classLoader : defaultLoaders) {
-      classLoaders.add(classLoader);
-    }
-
-    // Add user JAR files from the EXT_LIB_DIR directory using a single ClassLoader
-    try {
-      File EXT_LIB_DIR = defineEXT_LIB_DIR();
-      if (EXT_LIB_DIR.exists()) {
-        if (!EXT_LIB_DIR.isDirectory() || !EXT_LIB_DIR.canRead()) {
-          logger.warn("Cannot read from directory when attempting to load JAR files: {}",
-              EXT_LIB_DIR.getAbsolutePath());
-        } else {
-          List<URL> extLibJarURLs = getJarURLsFromFiles(EXT_LIB_DIR);
-          ClassLoader classLoader =
-              new URLClassLoader(extLibJarURLs.toArray(new URL[extLibJarURLs.size()]));
-          classLoaders.add(classLoader);
-        }
-      }
-    } catch (SecurityException sex) {
-      // Nothing to do, just don't add it
-    }
-
-    return new ClassPathLoader(classLoaders, excludeTCCL);
+  public ClassPathLoader(boolean excludeTCCL, File workingDir) {
+    this.excludeTCCL = excludeTCCL;
+    this.jarDeployer = new JarDeployer(workingDir);
+    rebuildClassLoaderForDeployedJars();
   }
 
   public static ClassPathLoader setLatestToDefault() {
-    return setLatestToDefault(Boolean.getBoolean(EXCLUDE_TCCL_PROPERTY));
+    latest = new ClassPathLoader(Boolean.getBoolean(EXCLUDE_TCCL_PROPERTY));
+    return latest;
   }
 
-  public static ClassPathLoader setLatestToDefault(final boolean excludeTCCL) {
-    ClassPathLoader classPathLoader = createWithDefaults(excludeTCCL);
-
-    // Clean up JarClassLoaders that attached to the previous ClassPathLoader
-    ClassPathLoader oldClassPathLoader = latest.getAndSet(classPathLoader);
-    if (oldClassPathLoader != null) {
-      for (ClassLoader classLoader : oldClassPathLoader.classLoaders) {
-        if (classLoader instanceof JarClassLoader) {
-          ((JarClassLoader) classLoader).cleanUp();
-        }
-      }
-    }
-
-    return classPathLoader;
+  public static ClassPathLoader setLatestToDefault(File workingDir) {
+    latest = new ClassPathLoader(Boolean.getBoolean(EXCLUDE_TCCL_PROPERTY), workingDir);
+    return latest;
   }
 
-  // This is exposed for testing.
-  ClassPathLoader addOrReplace(final ClassLoader classLoader) {
-    final boolean isDebugEnabled = logger.isTraceEnabled();
-    if (isDebugEnabled) {
-      logger.trace("adding classLoader: {}", classLoader);
-    }
-
-    List<ClassLoader> classLoadersCopy = new ArrayList<ClassLoader>(this.classLoaders);
-    classLoadersCopy.add(0, classLoader);
-
-    // Ensure there is only one instance of this class loader in the list
-    ClassLoader removingClassLoader = null;
-    int index = classLoadersCopy.lastIndexOf(classLoader);
-    if (index != 0) {
-      removingClassLoader = classLoadersCopy.get(index);
-      if (isDebugEnabled) {
-        logger.trace("removing previous classLoader: {}", removingClassLoader);
-      }
-      classLoadersCopy.remove(index);
-    }
-
-    if (removingClassLoader != null && removingClassLoader instanceof JarClassLoader) {
-      ((JarClassLoader) removingClassLoader).cleanUp();
-    }
-
-    return new ClassPathLoader(classLoadersCopy, this.excludeTCCL);
-  }
-
-  /**
-   * Add or replace the provided {@link ClassLoader} to the list held by this ClassPathLoader. Then
-   * use the resulting list to create a new ClassPathLoader and set it as the latest.
-   * 
-   * @param classLoader {@link ClassLoader} to add
-   */
-  public ClassPathLoader addOrReplaceAndSetLatest(final ClassLoader classLoader) {
-    ClassPathLoader classPathLoader = addOrReplace(classLoader);
-    latest.set(classPathLoader);
-    return classPathLoader;
+  public JarDeployer getJarDeployer() {
+    return this.jarDeployer;
   }
 
   // This is exposed for testing.
-  ClassPathLoader remove(final ClassLoader classLoader) {
-    final boolean isDebugEnabled = logger.isTraceEnabled();
-    if (isDebugEnabled) {
-      logger.trace("removing classLoader: {}", classLoader);
-    }
-
-    List<ClassLoader> classLoadersCopy = new ArrayList<ClassLoader>();
-    classLoadersCopy.addAll(this.classLoaders);
-
-    if (!classLoadersCopy.contains(classLoader)) {
-      if (isDebugEnabled) {
-        logger.trace("cannot remove classLoader since it doesn't exist: {}", classLoader);
-      }
-      return this;
-    }
-
-    classLoadersCopy.remove(classLoader);
-
-    if (classLoader instanceof JarClassLoader) {
-      ((JarClassLoader) classLoader).cleanUp();
-    }
-
-    return new ClassPathLoader(classLoadersCopy, this.excludeTCCL);
-  }
-
-  /**
-   * Remove the provided {@link ClassLoader} from the list held by this ClassPathLoader. Then use
-   * the resulting list to create a new ClassPathLoader and set it as the latest. Silently ignores
-   * requests to remove non-existent ClassLoaders.
-   * 
-   * @param classLoader {@link ClassLoader} to remove
-   */
-  public ClassPathLoader removeAndSetLatest(final ClassLoader classLoader) {
-    ClassPathLoader classPathLoader = remove(classLoader);
-    latest.set(classPathLoader);
-    return classPathLoader;
+  static ClassPathLoader createWithDefaults(final boolean excludeTCCL) {
+    return new ClassPathLoader(excludeTCCL);
   }
 
   public URL getResource(final String name) {
@@ -334,52 +121,26 @@ public final class ClassPathLoader {
     if (isDebugEnabled) {
       logger.trace("getResource({})", name);
     }
-    URL url = null;
-    ClassLoader tccl = null;
-    if (!excludeTCCL) {
-      tccl = Thread.currentThread().getContextClassLoader();
-    }
 
-    for (ClassLoader classLoader : this.classLoaders) {
-      if (classLoader == TCCL_PLACEHOLDER) {
-        try {
-          if (tccl != null) {
-            if (isDebugEnabled) {
-              logger.trace("getResource trying TCCL: {}", tccl);
-            }
-            url = tccl.getResource(name);
-            if (url != null) {
-              if (isDebugEnabled) {
-                logger.trace("getResource found by TCCL");
-              }
-              return url;
-            }
-          } else {
-            if (isDebugEnabled) {
-              logger.trace("getResource skipping TCCL because it's null");
-            }
-          }
-        } catch (SecurityException sex) {
-          // Continue to next ClassLoader
-        }
-      } else if (excludeTCCL || !classLoader.equals(tccl)) {
-        if (isDebugEnabled) {
-          logger.trace("getResource trying classLoader: {}", classLoader);
-        }
-        url = classLoader.getResource(name);
+    for (ClassLoader classLoader : getClassLoaders()) {
+      if (isDebugEnabled) {
+        logger.trace("getResource trying: {}", classLoader);
+      }
+      try {
+        URL url = classLoader.getResource(name);
+
         if (url != null) {
           if (isDebugEnabled) {
-            logger.trace("getResource found by classLoader: {}", classLoader);
+            logger.trace("getResource found by: {}", classLoader);
           }
           return url;
         }
+      } catch (SecurityException e) {
+        // try next classLoader
       }
     }
 
-    if (isDebugEnabled) {
-      logger.trace("getResource returning null");
-    }
-    return url;
+    return null;
   }
 
   public Class<?> forName(final String name) throws ClassNotFoundException {
@@ -387,53 +148,25 @@ public final class ClassPathLoader {
     if (isDebugEnabled) {
       logger.trace("forName({})", name);
     }
-    Class<?> clazz = null;
-    ClassLoader tccl = null;
-    if (!excludeTCCL) {
-      tccl = Thread.currentThread().getContextClassLoader();
-    }
 
-    for (ClassLoader classLoader : this.classLoaders) {
+    for (ClassLoader classLoader : this.getClassLoaders()) {
+      if (isDebugEnabled) {
+        logger.trace("forName trying: {}", classLoader);
+      }
       try {
-        if (classLoader == TCCL_PLACEHOLDER) {
-          if (tccl != null) {
-            if (isDebugEnabled) {
-              logger.trace("forName trying TCCL: {}", tccl);
-            }
-            clazz = Class.forName(name, true, tccl);
-            if (clazz != null) {
-              if (isDebugEnabled) {
-                logger.trace("forName found by TCCL");
-              }
-              return clazz;
-            } else {
-              if (isDebugEnabled) {
-                logger.trace("forName skipping TCCL because it's null");
-              }
-            }
-          }
-        } else if (excludeTCCL || !classLoader.equals(tccl)) {
+        Class<?> clazz = Class.forName(name, true, classLoader);
+
+        if (clazz != null) {
           if (isDebugEnabled) {
-            logger.trace("forName trying classLoader: {}", classLoader);
-          }
-          clazz = Class.forName(name, true, classLoader);
-          if (clazz != null) {
-            if (isDebugEnabled) {
-              logger.trace("forName found by classLoader: {}", classLoader);
-            }
-            return clazz;
+            logger.trace("forName found by: {}", classLoader);
           }
+          return clazz;
         }
-      } catch (SecurityException sex) {
-        // Continue to next ClassLoader
-      } catch (ClassNotFoundException cnfex) {
-        // Continue to next ClassLoader
+      } catch (SecurityException | ClassNotFoundException e) {
+        // try next classLoader
       }
     }
 
-    if (isDebugEnabled) {
-      logger.trace("forName throwing ClassNotFoundException");
-    }
     throw new ClassNotFoundException(name);
   }
 
@@ -442,20 +175,10 @@ public final class ClassPathLoader {
    */
   public Class<?> getProxyClass(final Class<?>[] classObjs) {
     IllegalArgumentException ex = null;
-    ClassLoader tccl = null;
-    if (!excludeTCCL) {
-      tccl = Thread.currentThread().getContextClassLoader();
-    }
 
-    for (ClassLoader classLoader : this.classLoaders) {
+    for (ClassLoader classLoader : this.getClassLoaders()) {
       try {
-        if (classLoader == TCCL_PLACEHOLDER) {
-          if (tccl != null) {
-            return Proxy.getProxyClass(tccl, classObjs);
-          }
-        } else if (excludeTCCL || !classLoader.equals(tccl)) {
-          return Proxy.getProxyClass(classLoader, classObjs);
-        }
+        return Proxy.getProxyClass(classLoader, classObjs);
       } catch (SecurityException sex) {
         // Continue to next classloader
       } catch (IllegalArgumentException iaex) {
@@ -464,7 +187,6 @@ public final class ClassPathLoader {
       }
     }
 
-    assert ex != null;
     if (ex != null) {
       throw ex;
     }
@@ -475,19 +197,9 @@ public final class ClassPathLoader {
   public String toString() {
     final StringBuilder sb = new StringBuilder(getClass().getName());
     sb.append("@").append(System.identityHashCode(this)).append("{");
-    sb.append("isLatest=").append(getLatest() == this);
     sb.append(", excludeTCCL=").append(this.excludeTCCL);
     sb.append(", classLoaders=[");
-    for (int i = 0; i < this.classLoaders.size(); i++) {
-      if (i > 0) {
-        sb.append(", ");
-      }
-      sb.append(this.classLoaders.get(i).toString());
-    }
-    sb.append("]");
-    if (!this.excludeTCCL) {
-      sb.append(", TCCL=").append(Thread.currentThread().getContextClassLoader());
-    }
+    sb.append(this.getClassLoaders().stream().map(ClassLoader::toString).collect(joining(", ")));
     sb.append("]}");
     return sb.toString();
   }
@@ -514,13 +226,12 @@ public final class ClassPathLoader {
 
   /**
    * Returns an input stream for reading the specified resource.
-   * 
+   *
    * <p>
    * The search order is described in the documentation for {@link #getResource(String)}.
    * </p>
    * 
    * @param name The resource name
-   * 
    * @return An input stream for reading the resource, or <tt>null</tt> if the resource could not be
    *         found
    */
@@ -553,122 +264,51 @@ public final class ClassPathLoader {
     return getResourceAsStream(name);
   }
 
+
   /**
    * Finds all the resources with the given name. This method will first search the class loader of
    * the context class for the resource before searching all other {@link ClassLoader}s.
    * 
    * @param contextClass The class whose class loader will first be searched
-   * 
    * @param name The resource name
-   *
    * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for the resource. If no
    *         resources could be found, the enumeration will be empty. Resources that the class
    *         loader doesn't have access to will not be in the enumeration.
-   *
    * @throws IOException If I/O errors occur
-   * 
    * @see ClassLoader#getResources(String)
    */
   public Enumeration<URL> getResources(final Class<?> contextClass, final String name)
       throws IOException {
-    final boolean isDebugEnabled = logger.isTraceEnabled();
+    final LinkedHashSet<URL> urls = new LinkedHashSet<URL>();
 
-    if (isDebugEnabled) {
-      logger.trace(new StringBuilder("getResources(").append(name).append(")"));
+    if (contextClass != null) {
+      CollectionUtils.addAll(urls, contextClass.getClassLoader().getResources(name));
     }
 
-    final LinkedHashSet<URL> urls = new LinkedHashSet<URL>();
-
-    try {
-      if (contextClass != null) {
-        CollectionUtils.addAll(urls, contextClass.getClassLoader().getResources(name));
+    for (ClassLoader classLoader : getClassLoaders()) {
+      Enumeration<URL> resources = classLoader.getResources(name);
+      if (resources != null && resources.hasMoreElements()) {
+        CollectionUtils.addAll(urls, resources);
       }
-    } catch (IOException ignore) {
-      // ignore and search others
     }
 
-    Enumeration<URL> resources = null;
-    ClassLoader tccl = null;
-    if (!excludeTCCL) {
-      tccl = Thread.currentThread().getContextClassLoader();
-    }
+    return Collections.enumeration(urls);
+  }
 
-    IOException ioException = null;
-    for (ClassLoader classLoader : this.classLoaders) {
-      ioException = null; // reset to null for next ClassLoader
-      if (classLoader == TCCL_PLACEHOLDER) {
-        try {
-          if (tccl != null) {
-            if (isDebugEnabled) {
-              logger.trace("getResources trying TCCL: {}", tccl);
-            }
-            resources = tccl.getResources(name);
-            if (resources != null && resources.hasMoreElements()) {
-              if (isDebugEnabled) {
-                logger.trace("getResources found by TCCL");
-              }
-              CollectionUtils.addAll(urls, resources);
-            }
-          } else {
-            if (isDebugEnabled) {
-              logger.trace("getResources skipping TCCL because it's null");
-            }
-          }
-        } catch (SecurityException ignore) {
-          // Continue to next ClassLoader
-        } catch (IOException ignore) {
-          ioException = ignore;
-          // Continue to next ClassLoader
-        }
-      } else if (excludeTCCL || !classLoader.equals(tccl)) {
-        try {
-          if (isDebugEnabled) {
-            logger.trace("getResources trying classLoader: {}", classLoader);
-          }
-          resources = classLoader.getResources(name);
-          if (resources != null && resources.hasMoreElements()) {
-            if (logger.isTraceEnabled()) {
-              logger.trace(
-                  new StringBuilder("getResources found by classLoader: ").append(classLoader));
-            }
-            CollectionUtils.addAll(urls, resources);
-          }
-        } catch (IOException ignore) {
-          ioException = ignore;
-          // Continue to next ClassLoader
-        }
-      }
-    }
+  public Enumeration<URL> getResources(final String name) throws IOException {
+    return getResources(null, name);
+  }
 
-    if (ioException != null) {
-      if (isDebugEnabled) {
-        logger.trace("getResources throwing IOException");
-      }
-      throw ioException;
-    }
+  private List<ClassLoader> getClassLoaders() {
+    ArrayList<ClassLoader> classLoaders = new ArrayList<>();
 
-    if (isDebugEnabled) {
-      logger.trace("getResources returning empty enumeration");
+    if (!excludeTCCL) {
+      classLoaders.add(Thread.currentThread().getContextClassLoader());
     }
 
-    return Collections.enumeration(urls);
-  }
+    classLoaders.add(classLoaderForDeployedJars);
 
-  /**
-   * Finds all the resources with the given name.
-   * 
-   * @param name The resource name
-   *
-   * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for the resource. If no
-   *         resources could be found, the enumeration will be empty. Resources that the class
-   *         loader doesn't have access to will not be in the enumeration.
-   *
-   * @throws IOException If I/O errors occur
-   * 
-   * @see ClassLoader#getResources(String)
-   */
-  public Enumeration<URL> getResources(String name) throws IOException {
-    return getResources(null, name);
+    return classLoaders;
   }
 
   /**
@@ -707,7 +347,14 @@ public final class ClassPathLoader {
   }
 
   public static ClassPathLoader getLatest() {
-    return latest.get();
+    if (latest == null) {
+      synchronized (ClassPathLoader.class) {
+        if (latest == null)
+          setLatestToDefault();
+      }
+    }
+
+    return latest;
   }
 
   /**
@@ -717,7 +364,7 @@ public final class ClassPathLoader {
    * @since GemFire 8.1
    */
   public static final ClassLoader getLatestAsClassLoader() {
-    return latest.get().asClassLoader();
+    return latest.asClassLoader();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
new file mode 100644
index 0000000..f4f4028
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/DeployedJar.java
@@ -0,0 +1,442 @@
+/*
+ * 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 org.apache.geode.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.nio.channels.FileLock;
+import java.nio.file.Files;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.geode.cache.Cache;
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Declarable;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.pdx.internal.TypeRegistry;
+import sun.nio.ch.ChannelInputStream;
+
+/**
+ * ClassLoader for a single JAR file.
+ * 
+ * @since GemFire 7.0
+ */
+public class DeployedJar {
+  private final static Logger logger = LogService.getLogger();
+  private final static MessageDigest messageDigest = getMessageDigest();
+
+  private final String jarName;
+  private final File file;
+  private final byte[] md5hash;
+  private final Collection<Function> registeredFunctions = new ArrayList<Function>();
+
+  private static MessageDigest getMessageDigest() {
+    try {
+      return MessageDigest.getInstance("MD5");
+    } catch (NoSuchAlgorithmException nsaex) {
+      // Failure just means we can't do a simple compare for content equality
+    }
+    return null;
+  }
+
+  public File getFile() {
+    return this.file;
+  }
+
+  public int getVersion() {
+    return JarDeployer.extractVersionFromFilename(file.getName());
+  }
+
+  public DeployedJar(File versionedJarFile, String jarName) throws IOException {
+    this(versionedJarFile, jarName, Files.readAllBytes(versionedJarFile.toPath()));
+  }
+
+  public DeployedJar(File versionedJarFile, final String jarName, byte[] jarBytes)
+      throws IOException {
+    Assert.assertTrue(jarBytes != null, "jarBytes cannot be null");
+    Assert.assertTrue(jarName != null, "jarName cannot be null");
+    Assert.assertTrue(versionedJarFile != null, "versionedJarFile cannot be null");
+
+    this.file = versionedJarFile;
+    this.jarName = jarName;
+
+    final byte[] fileContent = getJarContent();
+    if (!Arrays.equals(fileContent, jarBytes)) {
+      throw new FileNotFoundException("JAR file: " + versionedJarFile.getAbsolutePath()
+          + ", was modified prior to obtaining a lock: " + jarName);
+    }
+
+    if (!isValidJarContent(getJarContent())) {
+      throw new IllegalArgumentException(
+          "File does not contain valid JAR content: " + versionedJarFile.getAbsolutePath());
+    }
+
+    if (messageDigest != null) {
+      this.md5hash = messageDigest.digest(jarBytes);
+    } else {
+      this.md5hash = null;
+    }
+  }
+
+  /**
+   * Peek into the JAR data and make sure that it is valid JAR content.
+   * 
+   * @param inputStream InputStream containing data to be validated.
+   * @return True if the data has JAR content, false otherwise
+   */
+  private static boolean hasValidJarContent(final InputStream inputStream) {
+    JarInputStream jarInputStream = null;
+    boolean valid = false;
+
+    try {
+      jarInputStream = new JarInputStream(inputStream);
+      valid = (jarInputStream.getNextJarEntry() != null);
+    } catch (IOException ignore) {
+      // Ignore this exception and just return false
+    } finally {
+      try {
+        jarInputStream.close();
+      } catch (IOException ioex) {
+        // Ignore this exception and just return result
+      }
+    }
+
+    return valid;
+  }
+
+  /**
+   * Peek into the JAR data and make sure that it is valid JAR content.
+   * 
+   * @param jarBytes Bytes of data to be validated.
+   * @return True if the data has JAR content, false otherwise
+   */
+  public static boolean isValidJarContent(final byte[] jarBytes) {
+    return hasValidJarContent(new ByteArrayInputStream(jarBytes));
+  }
+
+  /**
+   * Peek into the JAR data and make sure that it is valid JAR content.
+   * 
+   * @param jarFile File whose contents should be validated.
+   * @return True if the data has JAR content, false otherwise
+   */
+  public static boolean hasValidJarContent(final File jarFile) {
+    try {
+      return hasValidJarContent(new FileInputStream(jarFile));
+    } catch (IOException ioex) {
+      return false;
+    }
+  }
+
+  /**
+   * Scan the JAR file and attempt to load all classes and register any function classes found.
+   */
+  // This method will process the contents of the JAR file as stored in this.jarByteContent
+  // instead of reading from the original JAR file. This is done because we can't open up
+  // the original file and then close it without releasing the shared lock that was obtained
+  // in the constructor. Once this method is finished, all classes will have been loaded and
+  // there will no longer be a need to hang on to the original contents so they will be
+  // discarded.
+  public synchronized void loadClassesAndRegisterFunctions() throws ClassNotFoundException {
+    final boolean isDebugEnabled = logger.isDebugEnabled();
+    if (isDebugEnabled) {
+      logger.debug("Registering functions with DeployedJar: {}", this);
+    }
+
+    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.getJarContent());
+
+    JarInputStream jarInputStream = null;
+    try {
+      jarInputStream = new JarInputStream(byteArrayInputStream);
+      JarEntry jarEntry = jarInputStream.getNextJarEntry();
+
+      while (jarEntry != null) {
+        if (jarEntry.getName().endsWith(".class")) {
+          if (isDebugEnabled) {
+            logger.debug("Attempting to load class: {}, from JAR file: {}", jarEntry.getName(),
+                this.file.getAbsolutePath());
+          }
+
+          final String className = jarEntry.getName().replaceAll("/", "\\.").substring(0,
+              (jarEntry.getName().length() - 6));
+          try {
+            Class<?> clazz = ClassPathLoader.getLatest().forName(className);
+            Collection<Function> registerableFunctions = getRegisterableFunctionsFromClass(clazz);
+            for (Function function : registerableFunctions) {
+              FunctionService.registerFunction(function);
+              if (isDebugEnabled) {
+                logger.debug("Registering function class: {}, from JAR file: {}", className,
+                    this.file.getAbsolutePath());
+              }
+              this.registeredFunctions.add(function);
+            }
+          } catch (ClassNotFoundException cnfex) {
+            logger.error("Unable to load all classes from JAR file: {}",
+                this.file.getAbsolutePath(), cnfex);
+            throw cnfex;
+          } catch (NoClassDefFoundError ncdfex) {
+            logger.error("Unable to load all classes from JAR file: {}",
+                this.file.getAbsolutePath(), ncdfex);
+            throw ncdfex;
+          }
+        }
+        jarEntry = jarInputStream.getNextJarEntry();
+      }
+    } catch (IOException ioex) {
+      logger.error("Exception when trying to read class from ByteArrayInputStream", ioex);
+    } finally {
+      if (jarInputStream != null) {
+        try {
+          jarInputStream.close();
+        } catch (IOException ioex) {
+          logger.error("Exception attempting to close JAR input stream", ioex);
+        }
+      }
+    }
+  }
+
+  synchronized void cleanUp() {
+    for (Function function : this.registeredFunctions) {
+      FunctionService.unregisterFunction(function.getId());
+    }
+    this.registeredFunctions.clear();
+
+    try {
+      TypeRegistry typeRegistry =
+          ((GemFireCacheImpl) CacheFactory.getAnyInstance()).getPdxRegistry();
+      if (typeRegistry != null) {
+        typeRegistry.flushCache();
+      }
+    } catch (CacheClosedException ccex) {
+      // That's okay, it just means there was nothing to flush to begin with
+    }
+  }
+
+  /**
+   * Uses MD5 hashes to determine if the original byte content of this DeployedJar is the same as
+   * that past in.
+   * 
+   * @param compareToBytes Bytes to compare the original content to
+   * @return True of the MD5 hash is the same o
+   */
+  public boolean hasSameContentAs(final byte[] compareToBytes) {
+    // If the MD5 hash can't be calculated then silently return no match
+    if (messageDigest == null || this.md5hash == null) {
+      return Arrays.equals(compareToBytes, getJarContent());
+    }
+
+    byte[] compareToMd5 = messageDigest.digest(compareToBytes);
+    if (logger.isDebugEnabled()) {
+      logger.debug("For JAR file: {}, Comparing MD5 hash {} to {}", this.file.getAbsolutePath(),
+          new String(this.md5hash), new String(compareToMd5));
+    }
+    return Arrays.equals(this.md5hash, compareToMd5);
+  }
+
+  /**
+   * Check to see if the class implements the Function interface. If so, it will be registered with
+   * FunctionService. Also, if the functions's class was originally declared in a cache.xml file
+   * then any properties specified at that time will be reused when re-registering the function.
+   * 
+   * @param clazz Class to check for implementation of the Function class
+   * @return A collection of Objects that implement the Function interface.
+   */
+  private Collection<Function> getRegisterableFunctionsFromClass(Class<?> clazz) {
+    final List<Function> registerableFunctions = new ArrayList<Function>();
+
+    try {
+      if (Function.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
+        boolean registerUninitializedFunction = true;
+        if (Declarable.class.isAssignableFrom(clazz)) {
+          try {
+            final List<Properties> propertiesList =
+                ((GemFireCacheImpl) CacheFactory.getAnyInstance())
+                    .getDeclarableProperties(clazz.getName());
+
+            if (!propertiesList.isEmpty()) {
+              registerUninitializedFunction = false;
+              // It's possible that the same function was declared multiple times in cache.xml
+              // with different properties. So, register the function using each set of
+              // properties.
+              for (Properties properties : propertiesList) {
+                @SuppressWarnings("unchecked")
+                Function function = newFunction((Class<Function>) clazz, true);
+                if (function != null) {
+                  ((Declarable) function).init(properties);
+                  if (function.getId() != null) {
+                    registerableFunctions.add(function);
+                  }
+                }
+              }
+            }
+          } catch (CacheClosedException ccex) {
+            // That's okay, it just means there were no properties to init the function with
+          }
+        }
+
+        if (registerUninitializedFunction) {
+          @SuppressWarnings("unchecked")
+          Function function = newFunction((Class<Function>) clazz, false);
+          if (function != null && function.getId() != null) {
+            registerableFunctions.add(function);
+          }
+        }
+      }
+    } catch (Exception ex) {
+      logger.error("Attempting to register function from JAR file: " + this.file.getAbsolutePath(),
+          ex);
+    }
+
+    return registerableFunctions;
+  }
+
+  private Function newFunction(final Class<Function> clazz, final boolean errorOnNoSuchMethod) {
+    try {
+      final Constructor<Function> constructor = clazz.getConstructor();
+      return constructor.newInstance();
+    } catch (NoSuchMethodException nsmex) {
+      if (errorOnNoSuchMethod) {
+        logger.error("Zero-arg constructor is required, but not found for class: {}",
+            clazz.getName(), nsmex);
+      } else {
+        if (logger.isDebugEnabled()) {
+          logger.debug(
+              "Not registering function because it doesn't have a zero-arg constructor: {}",
+              clazz.getName());
+        }
+      }
+    } catch (SecurityException sex) {
+      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
+          sex);
+    } catch (IllegalAccessException iae) {
+      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
+          iae);
+    } catch (InvocationTargetException ite) {
+      logger.error("Error when attempting constructor for function for class: {}", clazz.getName(),
+          ite);
+    } catch (InstantiationException ie) {
+      logger.error("Unable to instantiate function for class: {}", clazz.getName(), ie);
+    } catch (ExceptionInInitializerError eiiex) {
+      logger.error("Error during function initialization for class: {}", clazz.getName(), eiiex);
+    }
+    return null;
+  }
+
+  private byte[] getJarContent() {
+    InputStream channelInputStream = null;
+    try {
+      channelInputStream = new FileInputStream(this.file);
+
+      final ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
+      final byte[] bytes = new byte[4096];
+
+      int bytesRead;
+      while (((bytesRead = channelInputStream.read(bytes)) != -1)) {
+        byteOutStream.write(bytes, 0, bytesRead);
+      }
+      channelInputStream.close();
+      return byteOutStream.toByteArray();
+    } catch (IOException e) {
+      logger.error("Error when attempting to read jar contents: ", e);
+    }
+
+    return new byte[0];
+  }
+
+  public String getJarName() {
+    return this.jarName;
+  }
+
+  public String getFileName() {
+    return this.file.getName();
+  }
+
+  public String getFileCanonicalPath() throws IOException {
+    return this.file.getCanonicalPath();
+  }
+
+  public URL getFileURL() {
+    try {
+      return this.file.toURL();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    return null;
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((this.jarName == null) ? 0 : this.jarName.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    DeployedJar other = (DeployedJar) obj;
+    if (this.jarName == null) {
+      if (other.jarName != null) {
+        return false;
+      }
+    } else if (!this.jarName.equals(other.jarName)) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder(getClass().getName());
+    sb.append("@").append(System.identityHashCode(this)).append("{");
+    sb.append("jarName=").append(this.jarName);
+    sb.append(",file=").append(this.file.getAbsolutePath());
+    sb.append(",md5hash=").append(Arrays.toString(this.md5hash));
+    sb.append(",version=").append(this.getVersion());
+    sb.append("}");
+    return sb.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index f4f4069..51212c6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -4033,7 +4033,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
 
   public static void flushClassCache() {
     if (classCache != null) {
-      // Not locking classCache during clear as doing so causes a deadlock in the JarClassLoader
+      // Not locking classCache during clear as doing so causes a deadlock in the DeployedJar
       classCache.clear();
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/6fd2d123/geode-core/src/main/java/org/apache/geode/internal/JarClassLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/JarClassLoader.java b/geode-core/src/main/java/org/apache/geode/internal/JarClassLoader.java
deleted file mode 100644
index 9cd0589..0000000
--- a/geode-core/src/main/java/org/apache/geode/internal/JarClassLoader.java
+++ /dev/null
@@ -1,721 +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 org.apache.geode.internal;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Properties;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Declarable;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.pdx.internal.TypeRegistry;
-
-/**
- * ClassLoader for a single JAR file.
- * 
- * @since GemFire 7.0
- */
-public class JarClassLoader extends ClassLoader {
-  private final static Logger logger = LogService.getLogger();
-  private final static MessageDigest messageDigest;
-
-  private final String jarName;
-  private final File file;
-  private final byte[] md5hash;
-  private FileLock fileLock;
-  private final Collection<Function> registeredFunctions = new ArrayList<Function>();
-
-  private final ThreadLocal<Boolean> alreadyScanned = new ThreadLocal<Boolean>();
-
-  // Lock used by ChannelInputStream (inner class) to prevent multiple threads from
-  // trying to use the channel simultaneously.
-  static final ReentrantLock channelLock = new ReentrantLock();
-
-  private byte[] jarByteContent;
-
-  static {
-    MessageDigest md = null;
-    try {
-      md = MessageDigest.getInstance("MD5");
-    } catch (NoSuchAlgorithmException nsaex) {
-      // Failure just means we can't do a simple compare for content equality
-    }
-    messageDigest = md;
-  }
-
-  public JarClassLoader(final File file, final String jarName, byte[] jarBytes) throws IOException {
-    Assert.assertTrue(file != null, "file cannot be null");
-    Assert.assertTrue(jarName != null, "jarName cannot be null");
-
-    final boolean isDebugEnabled = logger.isDebugEnabled();
-    try {
-      @SuppressWarnings("resource")
-      FileInputStream fileInputStream = new FileInputStream(file);
-      this.fileLock = fileInputStream.getChannel().lock(0, file.length(), true);
-
-      if (isDebugEnabled) {
-        logger.debug("Acquired shared file lock w/ channel: {}, for JAR: {}",
-            this.fileLock.channel(), file.getAbsolutePath());
-      }
-
-      if (file.length() == 0) {
-        throw new FileNotFoundException(
-            "JAR file was truncated prior to obtaining a lock: " + jarName);
-      }
-
-      final byte[] fileContent = getJarContent();
-      if (!Arrays.equals(fileContent, jarBytes)) {
-        throw new FileNotFoundException("JAR file: " + file.getAbsolutePath()
-            + ", was modified prior to obtaining a lock: " + jarName);
-      }
-
-      if (!isValidJarContent(jarBytes)) {
-        if (this.fileLock != null) {
-          this.fileLock.release();
-          this.fileLock.channel().close();
-          if (isDebugEnabled) {
-            logger.debug(
-                "Prematurely releasing shared file lock due to bad content for JAR file: {}, w/ channel: {}",
-                file.getAbsolutePath(), this.fileLock.channel());
-          }
-        }
-        throw new IllegalArgumentException(
-            "File does not contain valid JAR content: " + file.getAbsolutePath());
-      }
-
-      Assert.assertTrue(jarBytes != null, "jarBytes cannot be null");
-
-      // Temporarily save the contents of the JAR file until they can be processed by the
-      // loadClassesandRegisterFunctions() method.
-      this.jarByteContent = jarBytes;
-
-      if (messageDigest != null) {
-        this.md5hash = messageDigest.digest(this.jarByteContent);
-      } else {
-        this.md5hash = null;
-      }
-
-      this.file = file;
-      this.jarName = jarName;
-
-    } catch (FileNotFoundException fnfex) {
-      if (this.fileLock != null) {
-        this.fileLock.release();
-        this.fileLock.channel().close();
-        if (isDebugEnabled) {
-          logger.debug(
-              "Prematurely releasing shared file lock due to file not found for JAR file: {}, w/ channel: {}",
-              file.getAbsolutePath(), this.fileLock.channel());
-        }
-      }
-      throw fnfex;
-    }
-  }
-
-  /**
-   * Peek into the JAR data and make sure that it is valid JAR content.
-   * 
-   * @param inputStream InputStream containing data to be validated.
-   * 
-   * @return True if the data has JAR content, false otherwise
-   */
-  private static boolean hasValidJarContent(final InputStream inputStream) {
-    JarInputStream jarInputStream = null;
-    boolean valid = false;
-
-    try {
-      jarInputStream = new JarInputStream(inputStream);
-      valid = (jarInputStream.getNextJarEntry() != null);
-    } catch (IOException ignore) {
-      // Ignore this exception and just return false
-    } finally {
-      try {
-        jarInputStream.close();
-      } catch (IOException ioex) {
-        // Ignore this exception and just return result
-      }
-    }
-
-    return valid;
-  }
-
-  /**
-   * Peek into the JAR data and make sure that it is valid JAR content.
-   * 
-   * @param jarBytes Bytes of data to be validated.
-   * 
-   * @return True if the data has JAR content, false otherwise
-   */
-  public static boolean isValidJarContent(final byte[] jarBytes) {
-    return hasValidJarContent(new ByteArrayInputStream(jarBytes));
-  }
-
-  /**
-   * Peek into the JAR data and make sure that it is valid JAR content.
-   * 
-   * @param jarFile File whose contents should be validated.
-   * 
-   * @return True if the data has JAR content, false otherwise
-   */
-  public static boolean hasValidJarContent(final File jarFile) {
-    try {
-      return hasValidJarContent(new FileInputStream(jarFile));
-    } catch (IOException ioex) {
-      return false;
-    }
-  }
-
-  /**
-   * Scan the JAR file and attempt to load all classes and register any function classes found.
-   */
-  // This method will process the contents of the JAR file as stored in this.jarByteContent
-  // instead of reading from the original JAR file. This is done because we can't open up
-  // the original file and then close it without releasing the shared lock that was obtained
-  // in the constructor. Once this method is finished, all classes will have been loaded and
-  // there will no longer be a need to hang on to the original contents so they will be
-  // discarded.
-  public synchronized void loadClassesAndRegisterFunctions() throws ClassNotFoundException {
-    final boolean isDebugEnabled = logger.isDebugEnabled();
-    if (isDebugEnabled) {
-      logger.debug("Registering functions with JarClassLoader: {}", this);
-    }
-
-    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.jarByteContent);
-
-    JarInputStream jarInputStream = null;
-    try {
-      jarInputStream = new JarInputStream(byteArrayInputStream);
-      JarEntry jarEntry = jarInputStream.getNextJarEntry();
-
-      while (jarEntry != null) {
-        if (jarEntry.getName().endsWith(".class")) {
-          if (isDebugEnabled) {
-            logger.debug("Attempting to load class: {}, from JAR file: {}", jarEntry.getName(),
-                this.file.getAbsolutePath());
-          }
-
-          final String className = jarEntry.getName().replaceAll("/", "\\.").substring(0,
-              (jarEntry.getName().length() - 6));
-          try {
-            Class<?> clazz = loadClass(className, true, false);
-            Collection<Function> registerableFunctions = getRegisterableFunctionsFromClass(clazz);
-            for (Function function : registerableFunctions) {
-              FunctionService.registerFunction(function);
-              if (isDebugEnabled) {
-                logger.debug("Registering function class: {}, from JAR file: {}", className,
-                    this.file.getAbsolutePath());
-              }
-              this.registeredFunctions.add(function);
-            }
-          } catch (ClassNotFoundException cnfex) {
-            logger.error("Unable to load all classes from JAR file: {}",
-                this.file.getAbsolutePath(), cnfex);
-            throw cnfex;
-          } catch (NoClassDefFoundError ncdfex) {
-            logger.error("Unable to load all classes from JAR file: {}",
-                this.file.getAbsolutePath(), ncdfex);
-            throw ncdfex;
-          }
-        }
-        jarEntry = jarInputStream.getNextJarEntry();
-      }
-    } catch (IOException ioex) {
-      logger.error("Exception when trying to read class from ByteArrayInputStream", ioex);
-    } finally {
-      if (jarInputStream != null) {
-        try {
-          jarInputStream.close();
-        } catch (IOException ioex) {
-          logger.error("Exception attempting to close JAR input stream", ioex);
-        }
-      }
-    }
-    this.jarByteContent = new byte[0];
-  }
-
-  synchronized void cleanUp() {
-    for (Function function : this.registeredFunctions) {
-      FunctionService.unregisterFunction(function.getId());
-    }
-    this.registeredFunctions.clear();
-
-    try {
-      TypeRegistry typeRegistry =
-          ((GemFireCacheImpl) CacheFactory.getAnyInstance()).getPdxRegistry();
-      if (typeRegistry != null) {
-        typeRegistry.flushCache();
-      }
-    } catch (CacheClosedException ccex) {
-      // That's okay, it just means there was nothing to flush to begin with
-    }
-
-    try {
-      this.fileLock.release();
-      this.fileLock.channel().close();
-      if (logger.isDebugEnabled()) {
-        logger.debug("Released shared file lock on JAR file: {}, w/ channel: {}",
-            this.file.getAbsolutePath(), this.fileLock.channel());
-      }
-    } catch (IOException ioex) {
-      logger.error("Could not release the shared lock for JAR file: {}",
-          this.file.getAbsolutePath(), ioex);
-    }
-  }
-
-  /**
-   * Uses MD5 hashes to determine if the original byte content of this JarClassLoader is the same as
-   * that past in.
-   * 
-   * @param compareToBytes Bytes to compare the original content to
-   * @return True of the MD5 hash is the same o
-   */
-  public boolean hasSameContent(final byte[] compareToBytes) {
-    // If the MD5 hash can't be calculated then silently return no match
-    if (messageDigest == null || this.md5hash == null) {
-      return false;
-    }
-
-    byte[] compareToMd5 = messageDigest.digest(compareToBytes);
-    if (logger.isDebugEnabled()) {
-      logger.debug("For JAR file: {}, Comparing MD5 hash {} to {}", this.file.getAbsolutePath(),
-          new String(this.md5hash), new String(compareToMd5));
-    }
-    return Arrays.equals(this.md5hash, compareToMd5);
-  }
-
-  private boolean alreadyScanned() {
-    if (this.alreadyScanned.get() == null) {
-      this.alreadyScanned.set(Boolean.FALSE);
-    }
-    return this.alreadyScanned.get();
-  }
-
-  @Override
-  protected URL findResource(String resourceName) {
-    URL returnURL = null;
-    JarInputStream jarInputStream = null;
-
-    try {
-      ChannelInputStream channelInputStream = new ChannelInputStream(this.fileLock.channel());
-      jarInputStream = new JarInputStream(channelInputStream);
-
-      JarEntry jarEntry = jarInputStream.getNextJarEntry();
-      while (jarEntry != null && !jarEntry.getName().equals(resourceName)) {
-        jarEntry = jarInputStream.getNextJarEntry();
-      }
-      if (jarEntry != null) {
-        try {
-          returnURL = new URL("jar", "", this.file.toURI().toURL() + "!/" + jarEntry.getName());
-        } catch (MalformedURLException muex) {
-          logger.error("Could not create resource URL from file URL", muex);
-        }
-      }
-    } catch (IOException ioex) {
-      logger.error("Exception when trying to read class from ByteArrayInputStream", ioex);
-    } finally {
-      if (jarInputStream != null) {
-        try {
-          jarInputStream.close();
-        } catch (IOException ioex) {
-          logger.error("Unable to close JAR input stream when finding resource", ioex);
-        }
-      }
-    }
-
-    return returnURL;
-  }
-
-  @Override
-  protected Enumeration<URL> findResources(final String resourceName) {
-    return new Enumeration<URL>() {
-      private URL element = findResource(resourceName);
-
-      @Override
-      public boolean hasMoreElements() {
-        return this.element != null;
-      }
-
-      @Override
-      public URL nextElement() {
-        if (this.element != null) {
-          URL element = this.element;
-          this.element = null;
-          return element;
-        }
-        throw new NoSuchElementException();
-      }
-    };
-  }
-
-  @Override
-  public Class<?> loadClass(final String className) throws ClassNotFoundException {
-    return (loadClass(className, true));
-  }
-
-  @Override
-  public Class<?> loadClass(final String className, final boolean resolveIt)
-      throws ClassNotFoundException {
-    return loadClass(className, resolveIt, true);
-  }
-
-  Class<?> loadClass(final String className, final boolean resolveIt,
-      final boolean useClassPathLoader) throws ClassNotFoundException {
-    Class<?> clazz = findLoadedClass(className);
-    if (clazz != null) {
-      return clazz;
-    }
-
-    try {
-      clazz = findClass(className);
-      if (resolveIt) {
-        resolveClass(clazz);
-      }
-    } catch (ClassNotFoundException cnfex) {
-      if (!useClassPathLoader) {
-        throw cnfex;
-      }
-    }
-
-    if (clazz == null) {
-      try {
-        this.alreadyScanned.set(true);
-        return forName(className, ClassPathLoader.getLatest().getClassLoaders());
-      } finally {
-        this.alreadyScanned.set(false);
-      }
-    }
-
-    return clazz;
-  }
-
-  // When loadClassesAndRegisterFunctions() is called and it starts to load classes, this method
-  // may be called multiple times to resolve dependencies on other classes in the same or
-  // another JAR file. During this stage, this.jarByteContent will contain the complete contents of
-  // the JAR file and will be used when attempting to resolve these dependencies. Once
-  // loadClassesAndRegisterFunctions() is complete it discards the data in this.jarByteContent.
-  // However, at that point all of the classes available in the JAR file will already have been
-  // loaded. Future calls to loadClass(...) will return the cached Class object for any
-  // classes available in this JAR and findClass(...) will no longer be needed to find them.
-  @Override
-  protected Class<?> findClass(String className) throws ClassNotFoundException {
-    String formattedClassName = className.replaceAll("\\.", "/") + ".class";
-
-    JarInputStream jarInputStream = null;
-    if (this.jarByteContent.length == 0) {
-      throw new ClassNotFoundException(className);
-    }
-
-    try {
-      jarInputStream = new JarInputStream(new ByteArrayInputStream(this.jarByteContent));
-      JarEntry jarEntry = jarInputStream.getNextJarEntry();
-
-      while (jarEntry != null && !jarEntry.getName().equals(formattedClassName)) {
-        jarEntry = jarInputStream.getNextJarEntry();
-      }
-
-      if (jarEntry != null) {
-        byte[] buffer = new byte[1024];
-        ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream(buffer.length);
-
-        int bytesRead = -1;
-        while ((bytesRead = jarInputStream.read(buffer)) != -1) {
-          byteOutStream.write(buffer, 0, bytesRead);
-        }
-
-        // Add the package first if it doesn't already exist
-        int lastDotIndex = className.lastIndexOf('.');
-        if (lastDotIndex != -1) {
-          String pkgName = className.substring(0, lastDotIndex);
-          Package pkg = getPackage(pkgName);
-          if (pkg == null) {
-            definePackage(pkgName, null, null, null, null, null, null, null);
-          }
-        }
-
-        byte[] classBytes = byteOutStream.toByteArray();
-
-        synchronized (this.file) {
-          Class<?> clazz = findLoadedClass(className);
-          if (clazz == null) {
-            clazz = defineClass(className, classBytes, 0, classBytes.length, null);
-          }
-          return clazz;
-        }
-      }
-    } catch (IOException ioex) {
-      logger.error("Exception when trying to read class from ByteArrayInputStream", ioex);
-    } finally {
-      if (jarInputStream != null) {
-        try {
-          jarInputStream.close();
-        } catch (IOException ioex) {
-          logger.error("Exception attempting to close JAR input stream", ioex);
-        }
-      }
-    }
-
-    throw new ClassNotFoundException(className);
-  }
-
-  /**
-   * Check to see if the class implements the Function interface. If so, it will be registered with
-   * FunctionService. Also, if the functions's class was originally declared in a cache.xml file
-   * then any properties specified at that time will be reused when re-registering the function.
-   * 
-   * @param clazz Class to check for implementation of the Function class
-   * @return A collection of Objects that implement the Function interface.
-   */
-  private Collection<Function> getRegisterableFunctionsFromClass(Class<?> clazz) {
-    final List<Function> registerableFunctions = new ArrayList<Function>();
-
-    try {
-      if (Function.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
-        boolean registerUninitializedFunction = true;
-        if (Declarable.class.isAssignableFrom(clazz)) {
-          try {
-            final List<Properties> propertiesList =
-                ((GemFireCacheImpl) CacheFactory.getAnyInstance())
-                    .getDeclarableProperties(clazz.getName());
-
-            if (!propertiesList.isEmpty()) {
-              registerUninitializedFunction = false;
-              // It's possible that the same function was declared multiple times in cache.xml
-              // with different properties. So, register the function using each set of
-              // properties.
-              for (Properties properties : propertiesList) {
-                @SuppressWarnings("unchecked")
-                Function function = newFunction((Class<Function>) clazz, true);
-                if (function != null) {
-                  ((Declarable) function).init(properties);
-                  if (function.getId() != null) {
-                    registerableFunctions.add(function);
-                  }
-                }
-              }
-            }
-          } catch (CacheClosedException ccex) {
-            // That's okay, it just means there were no properties to init the function with
-          }
-        }
-
-        if (registerUninitializedFunction) {
-          @SuppressWarnings("unchecked")
-          Function function = newFunction((Class<Function>) clazz, false);
-          if (function != null && function.getId() != null) {
-            registerableFunctions.add(function);
-          }
-        }
-      }
-    } catch (Exception ex) {
-      logger.error("Attempting to register function from JAR file: " + this.file.getAbsolutePath(),
-          ex);
-    }
-
-    return registerableFunctions;
-  }
-
-  private Class<?> forName(final String className, final Collection<ClassLoader> classLoaders)
-      throws ClassNotFoundException {
-    Class<?> clazz = null;
-
-    for (ClassLoader classLoader : classLoaders) {
-      try {
-        if (classLoader instanceof JarClassLoader) {
-          if (!((JarClassLoader) classLoader).alreadyScanned()) {
-            clazz = ((JarClassLoader) classLoader).loadClass(className, true, false);
-          }
-        } else {
-          clazz = Class.forName(className, true, classLoader);
-        }
-        if (clazz != null) {
-          return clazz;
-        }
-      } catch (SecurityException sex) {
-        // Continue to next ClassLoader
-      } catch (ClassNotFoundException cnfex) {
-        // Continue to next ClassLoader
-      }
-    }
-    throw new ClassNotFoundException(className);
-  }
-
-  private Function newFunction(final Class<Function> clazz, final boolean errorOnNoSuchMethod) {
-    try {
-      final Constructor<Function> constructor = clazz.getConstructor();
-      return constructor.newInstance();
-    } catch (NoSuchMethodException nsmex) {
-      if (errorOnNoSuchMethod) {
-        logger.error("Zero-arg constructor is required, but not found for class: {}",
-            clazz.getName(), nsmex);
-      } else {
-        if (logger.isDebugEnabled()) {
-          logger.debug(
-              "Not registering function because it doesn't have a zero-arg constructor: {}",
-              clazz.getName());
-        }
-      }
-    } catch (SecurityException sex) {
-      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
-          sex);
-    } catch (IllegalAccessException iae) {
-      logger.error("Zero-arg constructor of function not accessible for class: {}", clazz.getName(),
-          iae);
-    } catch (InvocationTargetException ite) {
-      logger.error("Error when attempting constructor for function for class: {}", clazz.getName(),
-          ite);
-    } catch (InstantiationException ie) {
-      logger.error("Unable to instantiate function for class: {}", clazz.getName(), ie);
-    } catch (ExceptionInInitializerError eiiex) {
-      logger.error("Error during function initialization for class: {}", clazz.getName(), eiiex);
-    }
-    return null;
-  }
-
-  private byte[] getJarContent() throws IOException {
-    ChannelInputStream channelInputStream = new ChannelInputStream(this.fileLock.channel());
-    final ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
-    final byte[] bytes = new byte[4096];
-
-    int bytesRead;
-    while (((bytesRead = channelInputStream.read(bytes)) != -1)) {
-      byteOutStream.write(bytes, 0, bytesRead);
-    }
-    channelInputStream.close();
-    return byteOutStream.toByteArray();
-  }
-
-  public String getJarName() {
-    return this.jarName;
-  }
-
-  public String getFileName() {
-    return this.file.getName();
-  }
-
-  public String getFileCanonicalPath() throws IOException {
-    return this.file.getCanonicalPath();
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + ((this.jarName == null) ? 0 : this.jarName.hashCode());
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (obj == null)
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
-    JarClassLoader other = (JarClassLoader) obj;
-    if (this.jarName == null) {
-      if (other.jarName != null)
-        return false;
-    } else if (!this.jarName.equals(other.jarName))
-      return false;
-    return true;
-  }
-
-  @Override
-  public String toString() {
-    final StringBuilder sb = new StringBuilder(getClass().getName());
-    sb.append("@").append(System.identityHashCode(this)).append("{");
-    sb.append("jarName=").append(this.jarName);
-    sb.append(",file=").append(this.file.getAbsolutePath());
-    sb.append(",md5hash=").append(Arrays.toString(this.md5hash));
-    sb.append(",fileLock=").append(this.fileLock);
-    sb.append("}");
-    return sb.toString();
-  }
-
-  /**
-   * When a lock is acquired it is done so through an open file (FileInputStream, etc.). If for any
-   * reason that same file is used to open another input stream, when the second input stream is
-   * closed the file lock will not be held (although an OverlappingFileLock exception will be thrown
-   * if an attempt is made to acquire the lock again). To get around this problem, this class is
-   * used to wrap the original file channel used by the lock with an InputStream. When this class is
-   * instantiated a lock is obtained to prevent other threads from attempting to use the file
-   * channel at the same time. The file channel can then be read as with any other InputStream. When
-   * the input stream is closed, instead of closing the file channel, the lock is released instead.
-   * 
-   * This class is thread safe. However, multiple instances cannot be created by the same thread.
-   * The reason for this is that the lock will be obtained in all cases (it's reentrant), and then
-   * the channel position will be modified by both instances causing arbitrary values being returned
-   * from the read() method.
-   * 
-   * @since GemFire 7.0
-   */
-  private class ChannelInputStream extends InputStream {
-    private final FileChannel fileChannel;
-    private final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1);
-
-    ChannelInputStream(final FileChannel fileChannel) throws IOException {
-      channelLock.lock();
-      this.fileChannel = fileChannel;
-      this.fileChannel.position(0);
-    }
-
-    @Override
-    public int read() throws IOException {
-      this.byteBuffer.rewind();
-      if (this.fileChannel.read(this.byteBuffer) <= 0) {
-        return -1;
-      }
-      this.byteBuffer.rewind();
-      return (this.byteBuffer.get() & 255);
-    }
-
-    @Override
-    public void close() {
-      channelLock.unlock();
-    }
-  }
-}