You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/07/25 18:01:35 UTC

[1/6] incubator-geode git commit: GEODE-17: update selenium-firefox driver to run uiTest [Forced Update!]

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1673-PR-212 83020077b -> 8812d5403 (forced update)


GEODE-17: update selenium-firefox driver to run uiTest


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

Branch: refs/heads/feature/GEODE-1673-PR-212
Commit: fe281928d3c1e1e5ec8f20a6ac4139964e456d93
Parents: 686db9c
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jul 21 22:41:20 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jul 21 22:41:20 2016 -0700

----------------------------------------------------------------------
 gradle/dependency-versions.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/fe281928/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 31c181f..aafacef 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -87,7 +87,7 @@ paranamer.version = 2.3
 powermock.version = 1.6.4
 quartz.version = 2.2.1
 scala.version = 2.10.0
-selenium.version=2.53.0
+selenium.version=2.53.1
 shiro.version=1.2.4
 slf4j-api.version = 1.7.7
 snappy-java.version=0.4


[6/6] incubator-geode git commit: GEODE-1673: fail start if security.json cannot be found

Posted by kl...@apache.org.
GEODE-1673: fail start if security.json cannot be found

* collapse JSONAuthorization into SampleSecurityManager
* update SampleSecurityManager to support file, resource and string json
* cleanup security tests
* add SecurityTest category to security tests

This closes #212


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

Branch: refs/heads/feature/GEODE-1673-PR-212
Commit: 8812d540372786cdd6dc664574effb38123e3292
Parents: 7ca571c
Author: Grace Meilen <gm...@pivotal.io>
Authored: Fri Jul 22 17:43:41 2016 -0700
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Mon Jul 25 10:59:23 2016 -0700

----------------------------------------------------------------------
 .../internal/InternalDistributedSystem.java     |   2 +-
 .../gms/mgr/GMSMembershipManager.java           |   1 -
 .../internal/security/GeodeSecurityUtil.java    |  58 ++---
 .../security/shiro/CustomAuthRealm.java         |  17 +-
 .../apache/geode/security/GeodePermission.java  |  58 ++---
 .../apache/geode/security/SecurityManager.java  |   4 +-
 .../security/templates/SamplePostProcessor.java |   5 +-
 .../templates/SampleSecurityManager.java        | 261 +++++++++++--------
 .../internal/DistributionConfigJUnitTest.java   |   7 +-
 .../security/GeodeSecurityUtilTest.java         |  23 +-
 .../cli/commands/CliCommandTestBase.java        |  26 +-
 .../security/AccessControlMBeanJUnitTest.java   |  14 +-
 ...CacheServerMBeanAuthenticationJUnitTest.java |   7 +-
 .../CacheServerMBeanAuthorizationJUnitTest.java |  14 +-
 .../CacheServerMBeanShiroJUnitTest.java         |  12 +-
 .../security/CliCommandsSecurityTest.java       |   7 +-
 .../security/DataCommandsSecurityTest.java      |  17 +-
 .../DiskStoreMXBeanSecurityJUnitTest.java       |  14 +-
 .../GatewayReceiverMBeanSecurityTest.java       |  20 +-
 .../GatewaySenderMBeanSecurityTest.java         |  21 +-
 .../security/GeodePermissionJUnitTest.java      |   8 +-
 .../GeodeSecurityUtilCustomRealmJUnitTest.java  |  22 +-
 .../GeodeSecurityUtilWithIniFileJUnitTest.java  |  12 +-
 .../security/GfshCommandsPostProcessorTest.java |  18 +-
 .../security/GfshCommandsSecurityTest.java      |  18 +-
 .../JsonAuthorizationCacheStartRule.java        |  13 +-
 .../LockServiceMBeanAuthorizationJUnitTest.java |  20 +-
 .../security/MBeanSecurityJUnitTest.java        |  50 ++--
 .../security/MBeanServerConnectionRule.java     |   6 +-
 .../ManagerMBeanAuthorizationJUnitTest.java     |  17 +-
 .../security/MemberMBeanSecurityJUnitTest.java  |  14 +-
 .../internal/security/MultiUserDUnitTest.java   |   8 +-
 .../internal/security/ShiroCacheStartRule.java  |  10 +-
 .../internal/security/TestCommand.java          |   5 +-
 ...ractIntegratedClientAuthDistributedTest.java |  17 +-
 ...gratedClientGetEntryAuthDistributedTest.java |   1 -
 ...IntegratedClientSizeAuthDistributedTest.java |   1 -
 ...edSecurityCacheLifecycleDistributedTest.java |   6 +-
 ...edSecurityCacheLifecycleIntegrationTest.java |   1 -
 ...urityNoShowValue1PostProcessorDUnitTest.java |   2 -
 ...tegratedSecurityPeerAuthDistributedTest.java |  28 +-
 ...ntegratedSecurityPostProcessorDUnitTest.java |   2 -
 .../gemfire/security/JSONAuthorization.java     |  54 ----
 .../security/NoShowValue1PostProcessor.java     |   6 +-
 .../gemfire/security/SecurityTestUtils.java     |   2 +-
 .../templates/SampleSecurityManagerTest.java    | 123 +++++++++
 .../geode/security/templates/security.json      |  30 +++
 .../gemfire/tools/pulse/tests/Server.java       |  10 +-
 48 files changed, 618 insertions(+), 474 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
index 32f1bff..013a72d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/InternalDistributedSystem.java
@@ -2085,7 +2085,7 @@ public class InternalDistributedSystem
         listener.handleEvent(event, resource);
       } catch(CancelException e) {
         //ignore
-      } catch (ManagementException ex) {
+      } catch (GemFireSecurityException|ManagementException ex) {
         if (event == ResourceEvent.CACHE_CREATE) {
           throw ex;
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index cfd11ed..4ed30a4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -2070,7 +2070,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
    * 
    * Concurrency: protected by {@link #latestViewLock} ReentrantReadWriteLock
    *
-   * guarded.By latestViewLock
    * @return true if the given member is a zombie
    */
   public boolean isShunned(DistributedMember m) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index 0d5e701..19f3325 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.internal.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
@@ -58,10 +57,17 @@ public class GeodeSecurityUtil {
 
   private static Logger logger = LogService.getLogger();
 
+  private static PostProcessor postProcessor;
+  private static SecurityManager securityManager;
+  private static boolean isIntegratedSecurity;
+  private static boolean isClientAuthenticator;
+  private static boolean isPeerAuthenticator;
 
   /**
-   * It first looks the shiro subject in AccessControlContext since JMX will use multiple threads to process operations from the same client.
-   * then it looks into Shiro's thead context.
+   * It first looks the shiro subject in AccessControlContext since JMX will
+   * use multiple threads to process operations from the same client, then it
+   * looks into Shiro's thead context.
+   *
    * @return the shiro subject, null if security is not enabled
    */
   public static Subject getSubject() {
@@ -97,8 +103,6 @@ public class GeodeSecurityUtil {
   }
 
   /**
-   * @param username
-   * @param password
    * @return null if security is not enabled, otherwise return a shiro subject
    */
   public static Subject login(String username, String password) {
@@ -153,7 +157,9 @@ public class GeodeSecurityUtil {
   }
 
   /**
-   * this binds the passed-in subject to the executing thread, normally, you would do this:
+   * this binds the passed-in subject to the executing thread, normally, you
+   * would do this:
+   *
    * ThreadState state = null;
    * try{
    *   state = GeodeSecurityUtil.bindSubject(subject);
@@ -269,15 +275,8 @@ public class GeodeSecurityUtil {
     }
   }
 
-  private static PostProcessor postProcessor;
-  private static SecurityManager securityManager;
-  private static boolean isIntegratedSecurity;
-  private static boolean isClientAuthenticator;
-  private static boolean isPeerAuthenticator;
-
   /**
    * initialize Shiro's Security Manager and Security Utilities
-   * @param securityProps
    */
   public static void initSecurity(Properties securityProps) {
     if (securityProps == null) {
@@ -352,8 +351,10 @@ public class GeodeSecurityUtil {
   }
 
   /**
-   * postProcess call already has this logic built in, you don't need to call this everytime you call postProcess.
-   * But if your postProcess is pretty involved with preparations and you need to bypass it entirely, call this first.
+   * postProcess call already has this logic built in, you don't need to call
+   * this everytime you call postProcess. But if your postProcess is pretty
+   * involved with preparations and you need to bypass it entirely, call this
+   * first.
    */
   public static boolean needPostProcess(){
     return (isIntegratedSecurity && postProcessor != null);
@@ -372,13 +373,9 @@ public class GeodeSecurityUtil {
     return postProcessor.processRegionValue((Principal)subject.getPrincipal(), regionName, key,  result);
   }
 
-
   /**
-   * this method would never return null, it either throws an exception or returns an object
-   * @param className
-   * @param expectedClazz
-   * @param <T>
-   * @return the expected object loadded by using the className
+   * this method would never return null, it either throws an exception or
+   * returns an object
    */
   public static <T> T getObjectOfTypeFromClassName(String className, Class<T> expectedClazz) {
     Class actualClass = null;
@@ -403,11 +400,8 @@ public class GeodeSecurityUtil {
   }
 
   /**
-   * this method would never return null, it either throws an exception or returns an object
-   * @param factoryMethodName
-   * @param expectedClazz
-   * @param <T>
-   * @return the expected object loaded by the factory method
+   * this method would never return null, it either throws an exception or
+   * returns an object
    */
   public static <T> T getObjectOfTypeFromFactoryMethod(String factoryMethodName, Class<T> expectedClazz){
     T actualObject = null;
@@ -426,12 +420,11 @@ public class GeodeSecurityUtil {
   }
 
   /**
-   * this method would never return null, it either throws an exception or returns an object
-   * @param classOrMethod
-   * @param expectedClazz
-   * @param <T>
-   * @return an object of type expectedClazz. This method would never return null. It either returns an non-null
-   * object or throws exception.
+   * this method would never return null, it either throws an exception or
+   * returns an object
+   *
+   * @return an object of type expectedClazz. This method would never return
+   * null. It either returns an non-null object or throws exception.
    */
   public static <T> T getObjectOfType(String classOrMethod, Class<T> expectedClazz) {
     T object = null;
@@ -448,7 +441,6 @@ public class GeodeSecurityUtil {
     return securityManager;
   }
 
-
   public static boolean isClientSecurityRequired() {
     return isClientAuthenticator || isIntegratedSecurity;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
index db07fe0..c890dc9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
@@ -34,18 +34,31 @@ import org.apache.shiro.subject.PrincipalCollection;
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.management.internal.security.ResourceConstants;
 
-public class CustomAuthRealm extends AuthorizingRealm{
+public class CustomAuthRealm extends AuthorizingRealm {
 
   private static final String REALM_NAME = "CUSTOMAUTHREALM";
 
   private SecurityManager securityManager = null;
 
+  /**
+   * The caller must invoke {@link org.apache.geode.security.SecurityManager#init(Properties)}
+   * prior to instantiating CustomAuthRealm.
+   *
+   * @param securityManager instance of SecurityManager which has already been initialized
+   */
   public CustomAuthRealm(SecurityManager securityManager) {
     this.securityManager = securityManager;
   }
 
-  public CustomAuthRealm (String authenticatorFactory) {
+  /**
+   * SecurityManager will be constructed and initialized with the provided security properties.
+   *
+   * @param authenticatorFactory name of the SecurityManager implementation to construct
+   * @param securityProperties the security properties to initialize SecurityManager with
+   */
+  public CustomAuthRealm(String authenticatorFactory, Properties securityProperties) {
     this.securityManager = GeodeSecurityUtil.getObjectOfTypeFromClassName(authenticatorFactory, SecurityManager.class);
+    this.securityManager.init(securityProperties);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java b/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
index 9f0ce2d..21cec6b 100644
--- a/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
+++ b/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.geode.security;
 
 import org.apache.shiro.authz.permission.WildcardPermission;
@@ -42,35 +41,6 @@ public class GeodePermission extends WildcardPermission {
     READ
   }
 
-  /**
-   * Returns
-   * @return the resource, could be either DATA or CLUSTER
-   */
-  public Resource getResource() {
-    return resource;
-  }
-
-  /**
-   * @return the operation, could be either MANAGE, WRITE or READ
-   */
-  public Operation getOperation() {
-    return operation;
-  }
-
-  /**
-   * @return the regionName, could be "*", meaning all regions
-   */
-  public String getRegionName() {
-    return regionName;
-  }
-
-  /**
-   * @return the key, could be "*" meaning all keys.
-   */
-  public String getKey() {
-    return key;
-  }
-
   // these default values are used when creating a lock around an operation
   private Resource resource = Resource.NULL;
   private Operation operation = Operation.NULL;
@@ -113,6 +83,34 @@ public class GeodePermission extends WildcardPermission {
     setParts(this.resource+":"+this.operation+":"+this.regionName+":"+this.key, true);
   }
 
+  /**
+   * Returns the resource, could be either DATA or CLUSTER
+   */
+  public Resource getResource() {
+    return resource;
+  }
+
+  /**
+   * Returns the operation, could be either MANAGE, WRITE or READ
+   */
+  public Operation getOperation() {
+    return operation;
+  }
+
+  /**
+   * returns the regionName, could be "*", meaning all regions
+   */
+  public String getRegionName() {
+    return regionName;
+  }
+
+  /**
+   * returns the key, could be "*" meaning all keys.
+   */
+  public String getKey() {
+    return key;
+  }
+
   @Override
   public String toString() {
     if (ALL_REGIONS.equals(regionName)) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/org/apache/geode/security/SecurityManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/SecurityManager.java b/geode-core/src/main/java/org/apache/geode/security/SecurityManager.java
index 269ed43..51a6879 100644
--- a/geode-core/src/main/java/org/apache/geode/security/SecurityManager.java
+++ b/geode-core/src/main/java/org/apache/geode/security/SecurityManager.java
@@ -43,13 +43,13 @@ public interface SecurityManager {
 
   /**
    * Verify the credentials provided in the properties
-   * @param props
+   * @param credentials
    *        it contains the security-username and security-password as keys of the properties
    * @return
    *        the authenticated Principal object
    * @throws AuthenticationFailedException
    */
-  Principal authenticate(Properties props) throws AuthenticationFailedException;
+  Principal authenticate(Properties credentials) throws AuthenticationFailedException;
 
   /**
    * Authorize the GeodePermission for a given Principal

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java b/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
index 5eca744..ce87bf8 100644
--- a/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.geode.security.templates;
 
 import java.security.Principal;
@@ -29,11 +28,11 @@ public class SamplePostProcessor implements PostProcessor{
 
   @Override
   public void init(final Properties securityProps) {
-
   }
 
   /**
-   * this simply modifies the value with all the parameter values
+   * This simply modifies the value with all the parameter values
+   *
    * @param principal
    *        The principal that's accessing the value
    * @param regionName

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java b/geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java
index dd49f11..97ebe4f 100644
--- a/geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java
+++ b/geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java
@@ -16,6 +16,8 @@
  */
 package org.apache.geode.security.templates;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
@@ -45,19 +47,24 @@ import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
 /**
- * This class provides a sample implementation for authentication and authorization via the {@link SecurityManager}
+ * This class provides a sample implementation of {@link SecurityManager} for
+ * authentication and authorization initialized from data provided as JSON.
  *
- * In order to use it, a Geode member must be started with the following properties:
- * <p/>
- * <code>
- *   security-manager = com.gemstone.gemfire.security.examples.SampleSecurityManager
- * </code>
- * <p/>
- * The class is initialized with a JSON file called {@code security.json}. This file must exist on the classpath,
+ * <p>A Geode member must be configured with the following:
+ *
+ * <p>{@code security-manager = com.gemstone.gemfire.security.examples.SampleSecurityManager}
+ *
+ * <p>The class can be initialized with from either a JSON string or a JSON
+ * file
+ *
+ * <p>TODO: example of configuring from in-memory JSON string specified in securityProperties
+ *
+ * <p>TODO: example of configuring from a JSON file specified in securityProperties<br/>
+ * ...called {@code security.json}. This file must exist on the classpath,
  * so members should be started with an appropriate {@code --classpath} option.
- * <p/>
- * The format of the file is as follows:
- * <pre>
+ *
+ * <p>The format of the JSON for configuration is as follows:
+ * <pre><code>
  * {
  *   "roles": [
  *     {
@@ -74,11 +81,11 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
  *       ],
  *       "regions": ["RegionA", "RegionB"]
  *     }
- *   ]
+ *   ],
  *   "users": [
  *     {
  *       "name": "admin",
- *       "password": "secret".
+ *       "password": "secret",
  *       "roles": ["admin"]
  *     },
  *     {
@@ -88,105 +95,177 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
  *     }
  *   ]
  * }
- * </pre>
+ * </code></pre>
  */
 public class SampleSecurityManager implements SecurityManager {
 
-  public SampleSecurityManager() {
-    try {
-      setUpWithJsonFile("security.json");
+  public static final String SECURITY_JSON = "security-json";
+
+  protected static final String DEFAULT_JSON_FILE_NAME = "security.json";
+
+  private Map<String, User> userNameToUser;
+
+  @Override
+  public boolean authorize(final Principal principal, final GeodePermission context) {
+    if (principal == null) return false;
+
+    User user = this.userNameToUser.get(principal.getName());
+    if (user == null) return false; // this user is not authorized to do anything
+
+    // check if the user has this permission defined in the context
+    for (Role role : this.userNameToUser.get(user.name).roles) {
+      for (Permission permitted : role.permissions) {
+        if (permitted.implies(context)) {
+          return true;
+        }
+      }
     }
-    catch (IOException e) {
-      e.printStackTrace();
+
+    return false;
+  }
+
+  @Override
+  public void init(final Properties securityProperties) throws NotAuthorizedException {
+    String jsonPropertyValue = securityProperties.getProperty(SECURITY_JSON);
+    if (jsonPropertyValue == null) {
+      throw new AuthenticationFailedException("SampleSecurityManager: property [" + SECURITY_JSON + "] must be set.");
+    }
+
+    // 1st try to load value as a json resource
+    boolean initialized = initializeFromJsonResource(jsonPropertyValue);
+
+    // 2nd try to load value as a json file
+    if (!initialized) {
+      initialized = initializeFromJsonFile(new File(jsonPropertyValue));
+    }
+
+    // 3rd try to use value as a json string
+    if (!initialized) {
+      initialized = initializeFromJson(jsonPropertyValue);
+    }
+
+    if (!initialized) {
+      throw new AuthenticationFailedException("SampleSecurityManager: unable to read json from \"" + jsonPropertyValue + "\" as specified by [" + SECURITY_JSON + "].");
     }
   }
 
-  public static class Role {
-    List<GeodePermission> permissions = new ArrayList<>();
-    String name;
-    String serverGroup;
+  @Override
+  public Principal authenticate(final Properties credentials) throws AuthenticationFailedException {
+    String user = credentials.getProperty(ResourceConstants.USER_NAME);
+    String password = credentials.getProperty(ResourceConstants.PASSWORD);
+
+    User userObj = this.userNameToUser.get(user);
+    if (userObj == null) {
+      throw new AuthenticationFailedException("SampleSecurityManager: wrong username/password");
+    }
+
+    if (user != null && !userObj.password.equals(password) && !"".equals(user)) {
+      throw new AuthenticationFailedException("SampleSecurityManager: wrong username/password");
+    }
+
+    return new JMXPrincipal(user);
   }
 
-  public static class User {
-    String name;
-    Set<Role> roles = new HashSet<>();
-    String pwd;
+  boolean initializeFromJson(final String json) {//throws IOException {
+    try {
+      ObjectMapper mapper = new ObjectMapper();
+      JsonNode jsonNode = mapper.readTree(json);
+      this.userNameToUser = new HashMap<>();
+      Map<String, Role> roleMap = readRoles(jsonNode);
+      readUsers(this.userNameToUser, jsonNode, roleMap);
+      return true;
+    } catch (IOException ex) {
+      return false;
+    }
   }
 
-  private static Map<String, User> acl = null;
+  boolean initializeFromJsonFile(final File jsonFile) {//throws IOException {
+    try {
+      InputStream input = new FileInputStream(jsonFile);
+      if (input != null) {
+        initializeFromJson(readJsonFromInputStream(input));
+        return true;
+      }
+    } catch (IOException ex) {
+    }
+    return false;
+  }
 
+  boolean initializeFromJsonResource(final String jsonResource) {//throws IOException {
+    try {
+      InputStream input = ClassLoader.getSystemResourceAsStream(jsonResource);
+      if (input != null) {
+        initializeFromJson(readJsonFromInputStream(input));
+        return true;
+      }
+    } catch (IOException ex) {
+    }
+    return false;
+  }
 
-  public static void setUpWithJsonFile(String jsonFileName) throws IOException {
-    InputStream input = ClassLoader.getSystemResourceAsStream(jsonFileName);
-    if (input == null)
-      return;
+  User getUser(final String user) {
+    return this.userNameToUser.get(user);
+  }
 
+  private String readJsonFromInputStream(final InputStream input) throws IOException {
     StringWriter writer = new StringWriter();
     IOUtils.copy(input, writer, "UTF-8");
-    String json = writer.toString();
-    readSecurityDescriptor(json);
+    return writer.toString();
   }
 
-  protected static void readSecurityDescriptor(String json) throws IOException {
-    ObjectMapper mapper = new ObjectMapper();
-    JsonNode jsonNode = mapper.readTree(json);
-    acl = new HashMap<>();
-    Map<String, Role> roleMap = readRoles(jsonNode);
-    readUsers(acl, jsonNode, roleMap);
-  }
-
-  private static void readUsers(Map<String, User> acl, JsonNode node, Map<String, Role> roleMap) {
-    for (JsonNode u : node.get("users")) {
+  private void readUsers(final Map<String, User> rolesToUsers, final JsonNode node, final Map<String, Role> roleMap) {
+    for (JsonNode usersNode : node.get("users")) {
       User user = new User();
-      user.name = u.get("name").asText();
+      user.name = usersNode.get("name").asText();
 
-      if (u.has("password")) {
-        user.pwd = u.get("password").asText();
+      if (usersNode.has("password")) {
+        user.password = usersNode.get("password").asText();
       } else {
-        user.pwd = user.name;
+        user.password = user.name;
       }
 
-      for (JsonNode r : u.get("roles")) {
-        user.roles.add(roleMap.get(r.asText()));
+      for (JsonNode rolesNode : usersNode.get("roles")) {
+        user.roles.add(roleMap.get(rolesNode.asText()));
       }
 
-      acl.put(user.name, user);
+      rolesToUsers.put(user.name, user);
     }
   }
 
-  private static Map<String, Role> readRoles(JsonNode jsonNode) {
+  private Map<String, Role> readRoles(final JsonNode jsonNode) {
     if (jsonNode.get("roles") == null) {
       return Collections.EMPTY_MAP;
     }
-
     Map<String, Role> roleMap = new HashMap<>();
-    for (JsonNode r : jsonNode.get("roles")) {
+    for (JsonNode rolesNode : jsonNode.get("roles")) {
       Role role = new Role();
-      role.name = r.get("name").asText();
+      role.name = rolesNode.get("name").asText();
       String regionNames = null;
       String keys = null;
 
-      JsonNode regions = r.get("regions");
-      if (regions != null) {
-        if (regions.isArray()) {
-          regionNames = StreamSupport.stream(regions.spliterator(), false)
-              .map(JsonNode::asText)
-              .collect(Collectors.joining(","));
+      JsonNode regionsNode = rolesNode.get("regions");
+      if (regionsNode != null) {
+        if (regionsNode.isArray()) {
+          regionNames = StreamSupport.stream(regionsNode.spliterator(), false)
+                                     .map(JsonNode::asText)
+                                     .collect(Collectors.joining(","));
         } else {
-          regionNames = regions.asText();
+          regionNames = regionsNode.asText();
         }
       }
 
-      for (JsonNode op : r.get("operationsAllowed")) {
-        String[] parts = op.asText().split(":");
+      for (JsonNode operationsAllowedNode : rolesNode.get("operationsAllowed")) {
+        String[] parts = operationsAllowedNode.asText().split(":");
         String resourcePart = (parts.length > 0) ? parts[0] : null;
         String operationPart = (parts.length > 1) ? parts[1] : null;
-        if(parts.length>2){
+
+        if (parts.length>2){
           regionNames = parts[2];
         }
-        if(parts.length>3){
+        if (parts.length>3){
           keys = parts[3];
         }
+
         String regionPart = (regionNames != null) ? regionNames : "*";
         String keyPart = (keys !=null) ? keys : "*";
 
@@ -195,54 +274,24 @@ public class SampleSecurityManager implements SecurityManager {
 
       roleMap.put(role.name, role);
 
-      if (r.has("serverGroup")) {
-        role.serverGroup = r.get("serverGroup").asText();
+      if (rolesNode.has("serverGroup")) {
+        role.serverGroup = rolesNode.get("serverGroup").asText();
       }
     }
 
     return roleMap;
   }
-  public static Map<String, User> getAcl() {
-    return acl;
-  }
 
-  @Override
-  public boolean authorize(Principal principal, GeodePermission context) {
-    if (principal == null) return false;
-
-    User user = acl.get(principal.getName());
-    if (user == null) return false; // this user is not authorized to do anything
-
-    // check if the user has this permission defined in the context
-    for (Role role : acl.get(user.name).roles) {
-      for (Permission permitted : role.permissions) {
-        if (permitted.implies(context)) {
-          return true;
-        }
-      }
-    }
-
-    return false;
+  static class Role {
+    List<GeodePermission> permissions = new ArrayList<>();
+    String name;
+    String serverGroup;
   }
 
-  @Override
-  public void init(Properties props) throws NotAuthorizedException {
+  static class User {
+    String name;
+    Set<Role> roles = new HashSet<>();
+    String password;
   }
 
-  @Override
-  public Principal authenticate(Properties props) throws AuthenticationFailedException {
-    String user = props.getProperty(ResourceConstants.USER_NAME);
-    String pwd = props.getProperty(ResourceConstants.PASSWORD);
-
-    User userObj = acl.get(user);
-    if (userObj == null) {
-      throw new AuthenticationFailedException("Wrong username/password");
-    }
-
-    if (user != null && !userObj.pwd.equals(pwd) && !"".equals(user)) {
-      throw new AuthenticationFailedException("Wrong username/password");
-    }
-
-    return new JMXPrincipal(user);
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
index c4b3a4d..36783ed 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionConfigJUnitTest.java
@@ -31,6 +31,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.apache.geode.security.templates.SamplePostProcessor;
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -38,7 +39,6 @@ import org.junit.experimental.categories.Category;
 import com.gemstone.gemfire.InternalGemFireException;
 import com.gemstone.gemfire.UnmodifiableException;
 import com.gemstone.gemfire.internal.ConfigSource;
-import com.gemstone.gemfire.security.JSONAuthorization;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
@@ -326,11 +326,10 @@ public class DistributionConfigJUnitTest {
     assertTrue(config.isAttributeModifiable(JMX_MANAGER_HTTP_PORT));
   }
 
-
   @Test
   public void testSecurityProps(){
     Properties props = new Properties();
-    props.put(SECURITY_MANAGER, JSONAuthorization.class.getName());
+    props.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
     props.put(SECURITY_POST_PROCESSOR, SamplePostProcessor.class.getName());
     props.put(SECURITY_LOG_LEVEL, "config");
     // add another non-security property to verify it won't get put in the security properties
@@ -343,7 +342,7 @@ public class DistributionConfigJUnitTest {
   @Test
   public void testSecurityPropsWithNoSetter(){
     Properties props = new Properties();
-    props.put(SECURITY_MANAGER, JSONAuthorization.class.getName());
+    props.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
     props.put(SECURITY_POST_PROCESSOR, SamplePostProcessor.class.getName());
     props.put(SECURITY_LOG_LEVEL, "config");
     // add another non-security property to verify it won't get put in the security properties

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
index 272b04f..bdd1ec6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtilTest.java
@@ -16,13 +16,13 @@
  */
 package com.gemstone.gemfire.internal.security;
 
-
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 import static org.assertj.core.api.Java6Assertions.*;
 import static org.junit.Assert.*;
 
 import java.util.Properties;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -32,15 +32,17 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class GeodeSecurityUtilTest {
-  Properties properties;
+
+  private Properties properties;
+
   @Before
-  public void before(){
+  public void before() {
     properties = new Properties();
     GeodeSecurityUtil.initSecurity(properties);
   }
 
   @Test
-  public void testGetObjectFromConstructor(){
+  public void testGetObjectFromConstructor() {
     String string = GeodeSecurityUtil.getObjectOfType(String.class.getName(), String.class);
     assertNotNull(string);
     CharSequence charSequence = GeodeSecurityUtil.getObjectOfType(String.class.getName(), CharSequence.class);
@@ -58,7 +60,7 @@ public class GeodeSecurityUtilTest {
   }
 
   @Test
-  public void testGetObjectFromFactoryMethod(){
+  public void testGetObjectFromFactoryMethod() {
     String string = GeodeSecurityUtil.getObjectOfType(Factories.class.getName()+".getString", String.class);
     assertNotNull(string);
     CharSequence charSequence = GeodeSecurityUtil.getObjectOfType(Factories.class.getName()+".getString", String.class);
@@ -82,6 +84,7 @@ public class GeodeSecurityUtilTest {
   @Test
   public void testInitWithSecurityManager() {
     properties.setProperty(SECURITY_MANAGER, "org.apache.geode.security.templates.SampleSecurityManager");
+    properties.setProperty(SampleSecurityManager.SECURITY_JSON, "org/apache/geode/security/templates/security.json");
     GeodeSecurityUtil.initSecurity(properties);
     assertTrue(GeodeSecurityUtil.isClientSecurityRequired());
     assertTrue(GeodeSecurityUtil.isIntegratedSecurity());
@@ -89,8 +92,7 @@ public class GeodeSecurityUtilTest {
   }
 
   @Test
-  public void testInitWithClientAuthenticator()
-  {
+  public void testInitWithClientAuthenticator() {
     properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
     GeodeSecurityUtil.initSecurity(properties);
     assertTrue(GeodeSecurityUtil.isClientSecurityRequired());
@@ -99,8 +101,7 @@ public class GeodeSecurityUtilTest {
   }
 
   @Test
-  public void testInitWithPeerAuthenticator()
-  {
+  public void testInitWithPeerAuthenticator() {
     properties.setProperty(SECURITY_PEER_AUTHENTICATOR, "org.abc.test");
     GeodeSecurityUtil.initSecurity(properties);
     assertFalse(GeodeSecurityUtil.isClientSecurityRequired());
@@ -109,8 +110,7 @@ public class GeodeSecurityUtilTest {
   }
 
   @Test
-  public void testInitWithShiroAuthenticator()
-  {
+  public void testInitWithShiroAuthenticator() {
     properties.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");
     GeodeSecurityUtil.initSecurity(properties);
     assertTrue(GeodeSecurityUtil.isClientSecurityRequired());
@@ -119,6 +119,7 @@ public class GeodeSecurityUtilTest {
   }
 
   private static class Factories{
+
     public static String getString(){
       return new String();
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 163f9b5..a6627d5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -29,6 +29,7 @@ import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.Rule;
 import org.junit.rules.TemporaryFolder;
 
@@ -42,31 +43,33 @@ import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
 import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
-import com.gemstone.gemfire.security.JSONAuthorization;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.rules.DistributedRestoreSystemProperties;
 
 /**
  * Base class for all the CLI/gfsh command dunit tests.
  */
 public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
 
-  private static final long serialVersionUID = 1L;
+  public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
+
+  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
 
   private ManagementService managementService;
 
   private transient HeadlessGfsh shell;
 
-  public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
-  private boolean useHttpOnConnect = Boolean.getBoolean(USE_HTTP_SYSTEM_PROPERTY);
-
   protected transient int httpPort;
   protected transient int jmxPort;
   protected transient String jmxHost;
   protected transient String gfshDir;
 
   @Rule
+  public transient DistributedRestoreSystemProperties restoreSystemProperties = new DistributedRestoreSystemProperties();
+
+  @Rule
   public transient TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Override
@@ -97,7 +100,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
    * cache). When adding regions, functions, keys, whatever to your cache for tests, you'll need to use
    * Host.getHost(0).getVM(0).invoke(new SerializableRunnable() { public void run() { ... } } in order to have this
    * setup run in the same VM as the manager.
-   * <p>
    *
    * @param props the Properties used when creating the cache for this default setup.
    * @return the default testable GemFire shell.
@@ -117,10 +119,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
   }
 
   /**
-   *
-   * @param vm
-   * @param props
-   * @param jsonFile
    * @return an object array, result[0] is jmxHost(String), result[1] is jmxPort, result[2] is httpPort
    */
   protected Object[] setUpJMXManagerOnVM(int vm, final Properties props, String jsonFile) {
@@ -139,6 +137,10 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
         localProps.setProperty(NAME, "Manager");
       }
 
+      if (jsonFile!=null) {
+        localProps.setProperty(SampleSecurityManager.SECURITY_JSON, jsonFile);
+      }
+
       final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
 
       jmxPort = ports[0];
@@ -153,10 +155,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
       getSystem(localProps);
       verifyManagementServiceStarted(getCache());
 
-      if(jsonFile!=null){
-        JSONAuthorization.setUpWithJsonFile(jsonFile);
-      }
-
       IgnoredException.addIgnoredException("org.eclipse.jetty.io.EofException");
       IgnoredException.addIgnoredException("java.nio.channels.ClosedChannelException");
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/AccessControlMBeanJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/AccessControlMBeanJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/AccessControlMBeanJUnitTest.java
index 6c626fc..6124e31 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/AccessControlMBeanJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/AccessControlMBeanJUnitTest.java
@@ -16,27 +16,28 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static org.assertj.core.api.Assertions.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.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;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class AccessControlMBeanJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private AccessControlMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);
@@ -48,7 +49,6 @@ public class AccessControlMBeanJUnitTest {
 
   /**
    * Test that any authenticated user can access this method
-   * @throws Exception
    */
   @Test
   @JMXConnectionConfiguration(user = "stranger", password = "1234567")

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
index 6857e18..53fce5f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
@@ -16,8 +16,6 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
-
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
@@ -30,13 +28,14 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
 public class CacheServerMBeanAuthenticationJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private CacheServerMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);
@@ -46,7 +45,7 @@ public class CacheServerMBeanAuthenticationJUnitTest {
     bean = connectionRule.getProxyMBean(CacheServerMXBean.class, "GemFire:service=CacheServer,*");
   }
 
-  @Test()
+  @Test
   @JMXConnectionConfiguration(user = "data-admin", password = "1234567")
   public void testAllAccess() throws Exception {
     bean.removeIndex("foo");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
index 39094fb..aba0b58 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthorizationJUnitTest.java
@@ -16,27 +16,29 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static org.assertj.core.api.Assertions.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.CacheServerMXBean;
-import com.gemstone.gemfire.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;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.CacheServerMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class CacheServerMBeanAuthorizationJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private CacheServerMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
index 85a55a7..d53dc0e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanShiroJUnitTest.java
@@ -18,17 +18,20 @@ package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.CacheServerMXBean;
-import com.gemstone.gemfire.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;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.CacheServerMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class CacheServerMBeanShiroJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private CacheServerMXBean bean;
@@ -57,7 +60,6 @@ public class CacheServerMBeanShiroJUnitTest {
     bean.showClientQueueDetails("foo");
   }
 
-
   @Test
   @JMXConnectionConfiguration(user = "guest", password = "guest")
   public void testNoAccess() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CliCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CliCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CliCommandsSecurityTest.java
index af26147..56078e1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CliCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CliCommandsSecurityTest.java
@@ -16,8 +16,6 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
-import static org.assertj.core.api.AssertionsForClassTypes.fail;
 import static org.junit.Assert.*;
 
 import java.util.List;
@@ -35,8 +33,9 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category({IntegrationTest.class, SecurityTest.class})
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class CliCommandsSecurityTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private MemberMXBean bean;
@@ -45,7 +44,7 @@ public class CliCommandsSecurityTest {
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
index 73da024..eea9f06 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DataCommandsSecurityTest.java
@@ -17,28 +17,29 @@
 package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.MemberMXBean;
-import com.gemstone.gemfire.security.GemFireSecurityException;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category({IntegrationTest.class, SecurityTest.class})
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.MemberMXBean;
+import com.gemstone.gemfire.security.GemFireSecurityException;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class DataCommandsSecurityTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private MemberMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
index 2d8099d..185c984 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
@@ -17,11 +17,7 @@
 package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.DiskStoreMXBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
@@ -29,15 +25,21 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.DiskStoreMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class DiskStoreMXBeanSecurityJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private DiskStoreMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewayReceiverMBeanSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewayReceiverMBeanSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewayReceiverMBeanSecurityTest.java
index 8bc55f0..b339094 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewayReceiverMBeanSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewayReceiverMBeanSecurityTest.java
@@ -18,15 +18,9 @@ package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
 import static org.mockito.Mockito.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
 import javax.management.ObjectName;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.GatewayReceiverMXBean;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -35,18 +29,26 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.GatewayReceiverMXBean;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GatewayReceiverMBeanSecurityTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
-  private GatewayReceiverMXBean bean;
   private static GatewayReceiverMXBean mock = mock(GatewayReceiverMXBean.class);
   private static ObjectName mockBeanName = null;
   private static ManagementService service = null;
 
+  private GatewayReceiverMXBean bean;
+
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewaySenderMBeanSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewaySenderMBeanSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewaySenderMBeanSecurityTest.java
index fe4f624..e65adfb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewaySenderMBeanSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GatewaySenderMBeanSecurityTest.java
@@ -18,15 +18,9 @@ package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
 import static org.mockito.Mockito.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
 import javax.management.ObjectName;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.GatewaySenderMXBean;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.internal.beans.GatewaySenderMBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -35,18 +29,27 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.GatewaySenderMXBean;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.internal.beans.GatewaySenderMBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GatewaySenderMBeanSecurityTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
-  private GatewaySenderMXBean bean;
   private static GatewaySenderMBean mock = mock(GatewaySenderMBean.class);
   private static ObjectName mockBeanName = null;
   private static ManagementService service = null;
 
+  private GatewaySenderMXBean bean;
+
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodePermissionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodePermissionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodePermissionJUnitTest.java
index a955dae..104ea5e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodePermissionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodePermissionJUnitTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import static org.junit.Assert.*;
@@ -22,13 +21,14 @@ import static org.junit.Assert.*;
 import org.apache.geode.security.GeodePermission;
 import org.apache.geode.security.GeodePermission.Operation;
 import org.apache.geode.security.GeodePermission.Resource;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
 import org.apache.shiro.authz.permission.WildcardPermission;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(UnitTest.class)
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category({ UnitTest.class, SecurityTest.class })
 public class GeodePermissionJUnitTest {
 
   private GeodePermission context;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
index dd9961d..78168bf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilCustomRealmJUnitTest.java
@@ -14,30 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.BeforeClass;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
-import com.gemstone.gemfire.security.JSONAuthorization;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
 /**
- * this test and ShiroUtilWithIniFileJunitTest uses the same test body, but initialize the SecurityUtils differently.
- * If you change shiro-ini.json, remmber to change the shiro.ini to match the changes as well.
+ * Integration tests for {@link GeodeSecurityUtil} using shiro-ini.json.
+ *
+ * @see GeodeSecurityUtilWithIniFileJUnitTest
  */
-
-@Category(UnitTest.class)
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GeodeSecurityUtilCustomRealmJUnitTest extends GeodeSecurityUtilWithIniFileJUnitTest {
+
   @BeforeClass
-  public static void beforeClass() throws Exception{
-    props.put(SECURITY_MANAGER, JSONAuthorization.class.getName());
-    JSONAuthorization.setUpWithJsonFile(SHIRO_INI_JSON);
+  public static void beforeClass() throws Exception {
+    props.put(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/management/internal/security/shiro-ini.json");
+    props.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
     GeodeSecurityUtil.initSecurity(props);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
index 6496076..ec0d393 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GeodeSecurityUtilWithIniFileJUnitTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
@@ -22,23 +21,24 @@ import static org.assertj.core.api.Assertions.*;
 
 import java.util.Properties;
 
+import org.apache.geode.security.GeodePermission;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.GemFireSecurityException;
-import org.apache.geode.security.GeodePermission;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
- * this test and ShiroUtilCustomRealmJUunitTest uses the same test body, but initialize the SecurityUtils differently.
- * If you change shiro.ini, remmber to change the shiro-ini.json to match the changes as well.
+ * Integration tests for {@link GeodeSecurityUtil} using shiro.ini
  */
-@Category({UnitTest.class, SecurityTest.class})
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GeodeSecurityUtilWithIniFileJUnitTest {
+
   protected static Properties props = new Properties();
+
   @BeforeClass
   public static void beforeClass() throws Exception{
     props.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
index 8b96e8b..44db600 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
@@ -14,12 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.internal.Assert.assertTrue;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
+import static com.gemstone.gemfire.internal.Assert.*;
 
+import org.apache.geode.security.templates.SamplePostProcessor;
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
@@ -28,25 +27,22 @@ import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.management.internal.cli.HeadlessGfsh;
-import org.apache.geode.security.templates.SamplePostProcessor;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(IntegrationTest.class)
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GfshCommandsPostProcessorTest {
+
   protected static int jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
   private HeadlessGfsh gfsh = null;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxPort, CACHE_SERVER_JSON, SamplePostProcessor.class);
+      jmxPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json", SamplePostProcessor.class);
 
   @Rule
-  public GfshShellConnectionRule gfshConnection;
-
-  public GfshCommandsPostProcessorTest(){
-    gfshConnection = new GfshShellConnectionRule(jmxPort);
-  }
+  public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(jmxPort);
 
   @Before
   public void before(){

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
index 603088e..8d6c54d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsSecurityTest.java
@@ -14,11 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import static org.junit.Assert.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
 import java.util.List;
 
@@ -37,9 +35,11 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.result.ErrorResultData;
 import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(IntegrationTest.class)
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class GfshCommandsSecurityTest {
+
   protected static int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
   protected static int jmxPort = ports[0];
   protected static int httpPort = ports[1];
@@ -48,15 +48,10 @@ public class GfshCommandsSecurityTest {
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxPort, httpPort, CACHE_SERVER_JSON);
+      jmxPort, httpPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
-  public GfshShellConnectionRule gfshConnection;
-
-  public GfshCommandsSecurityTest(){
-    gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, false);
-  }
-
+  public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(jmxPort, httpPort, false);
 
   @Before
   public void before(){
@@ -129,7 +124,6 @@ public class GfshCommandsSecurityTest {
     runCommandsWithAndWithout("DATA:MANAGE:RegionA");
   }
 
-
   private void runCommandsWithAndWithout(String permission) throws Exception{
     List<TestCommand> allPermitted = TestCommand.getPermittedCommands(new WildcardPermission(permission, true));
     for(TestCommand permitted:allPermitted) {
@@ -184,6 +178,4 @@ public class GfshCommandsSecurityTest {
     gfsh.executeCommand("query --query=\"select * from /region1\"");
   }
 
-
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
index 1d4fb40..81cf92f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
@@ -20,13 +20,14 @@ import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 
 import java.util.Properties;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.rules.ExternalResource;
 
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.security.JSONAuthorization;
 
 public class JsonAuthorizationCacheStartRule extends ExternalResource {
+
   private Cache cache;
   private int jmxManagerPort = 0;
   private int httpPort = 0;
@@ -39,7 +40,6 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
     this.postProcessor = postProcessor;
   }
 
-
   public JsonAuthorizationCacheStartRule(int jmxManagerPort, String jsonFile) {
     this.jmxManagerPort = jmxManagerPort;
     this.jsonFile = jsonFile;
@@ -53,6 +53,7 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
 
   protected void before() throws Throwable {
     Properties properties = new Properties();
+    properties.put(SampleSecurityManager.SECURITY_JSON, jsonFile);
     properties.put(NAME, JsonAuthorizationCacheStartRule.class.getSimpleName());
     properties.put(LOCATORS, "");
     properties.put(MCAST_PORT, "0");
@@ -60,20 +61,18 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
     properties.put(JMX_MANAGER_START, "true");
     properties.put(JMX_MANAGER_PORT, String.valueOf(jmxManagerPort));
     properties.put(HTTP_SERVICE_PORT, String.valueOf(httpPort));
-    properties.put(SECURITY_MANAGER, JSONAuthorization.class.getName());
+    properties.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
 
-    if(postProcessor!=null){
+    if (postProcessor!=null) {
       properties.put(SECURITY_POST_PROCESSOR, postProcessor.getName());
     }
 
-    JSONAuthorization.setUpWithJsonFile(jsonFile);
-
     cache = new CacheFactory(properties).create();
     cache.addCacheServer().start();
     cache.createRegionFactory().create("region1");
   }
 
-  public Cache getCache(){
+  public Cache getCache() {
     return cache;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
index 44e414c..8258f81 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/LockServiceMBeanAuthorizationJUnitTest.java
@@ -17,14 +17,7 @@
 package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.distributed.internal.locks.DLockService;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.LockServiceMXBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -33,15 +26,24 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.locks.DLockService;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.LockServiceMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class LockServiceMBeanAuthorizationJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private LockServiceMXBean lockServiceMBean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
index 1d6c95d..1d77375 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanSecurityJUnitTest.java
@@ -16,17 +16,11 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.ManagementException;
-import com.gemstone.gemfire.management.ManagementService;
-import com.gemstone.gemfire.management.MemberMXBean;
-import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.util.Set;
 
 import javax.management.DynamicMBean;
 import javax.management.MBeanServer;
@@ -35,25 +29,31 @@ import javax.management.MalformedObjectNameException;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
-import java.io.IOException;
-import java.util.Set;
 
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.ManagementException;
+import com.gemstone.gemfire.management.ManagementService;
+import com.gemstone.gemfire.management.MemberMXBean;
+import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(IntegrationTest.class)
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class MBeanSecurityJUnitTest {
 
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   @ClassRule
-  public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(jmxManagerPort, CACHE_SERVER_JSON);
+  public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);
 
-
   /**
    * No user can call createBean or unregisterBean of GemFire Domain
    */
@@ -75,9 +75,9 @@ public class MBeanSecurityJUnitTest {
     ).isInstanceOf(ReflectionException.class);
   }
 
-  /*
-  * looks like everyone can query for beans, but the AccessControlMXBean is filtered from the result
-  */
+  /**
+   * looks like everyone can query for beans, but the AccessControlMXBean is filtered from the result
+   */
   @Test
   @JMXConnectionConfiguration(user = "stranger", password = "1234567")
   public void testQueryBean() throws MalformedObjectNameException, IOException {
@@ -89,8 +89,8 @@ public class MBeanSecurityJUnitTest {
     assertThat(objects.size()).isEqualTo(1);
   }
 
-  /*
-  * These calls does not go through the MBeanServerWrapper authentication, therefore is not throwing the SecurityExceptions
+  /**
+   * These calls does not go through the MBeanServerWrapper authentication, therefore is not throwing the SecurityExceptions
    */
   @Test
   public void testLocalCalls() throws Exception{
@@ -103,8 +103,6 @@ public class MBeanSecurityJUnitTest {
     assertThatThrownBy(
         () -> adapter.registerMBean(mock(DynamicMBean.class), new ObjectName("MockDomain", "name", "mock"), false)
     ).isInstanceOf(ManagementException.class);
-
-
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
index 51cc6b8..2ca4b19 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+
 import javax.management.JMX;
 import javax.management.MBeanServerConnection;
 import javax.management.MalformedObjectNameException;
@@ -33,13 +34,13 @@ import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
 
-import com.gemstone.gemfire.test.junit.rules.DescribedExternalResource;
 import org.junit.runner.Description;
 
+import com.gemstone.gemfire.test.junit.rules.DescribedExternalResource;
+
 /**
  * Class which eases the creation of MBeans for security testing. When combined with {@link JMXConnectionConfiguration}
  * it allows for the creation of per-test connections with different user/password combinations.
- *
  */
 public class MBeanServerConnectionRule extends DescribedExternalResource {
 
@@ -96,7 +97,6 @@ public class MBeanServerConnectionRule extends DescribedExternalResource {
     return getProxyMBean(null, beanQueryName);
   }
 
-
   public MBeanServerConnection getMBeanServerConnection() throws IOException {
     return con;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
index 635daa6..4df20e7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ManagerMBeanAuthorizationJUnitTest.java
@@ -18,15 +18,11 @@ package com.gemstone.gemfire.management.internal.security;
 
 import static org.assertj.core.api.Assertions.*;
 import static org.mockito.Mockito.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
 import java.lang.management.ManagementFactory;
+
 import javax.management.ObjectName;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.ManagerMXBean;
-import com.gemstone.gemfire.management.internal.beans.ManagerMBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
@@ -34,15 +30,22 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.ManagerMXBean;
+import com.gemstone.gemfire.management.internal.beans.ManagerMBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class ManagerMBeanAuthorizationJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private ManagerMXBean managerMXBean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);



[3/6] incubator-geode git commit: javadoc clean-up for commmunications/membership classes

Posted by kl...@apache.org.
javadoc clean-up for commmunications/membership classes


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

Branch: refs/heads/feature/GEODE-1673-PR-212
Commit: 40f95887bfafc0720b0bdfc4984d711c15f4c791
Parents: f230349
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Fri Jul 22 09:05:24 2016 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Fri Jul 22 09:07:23 2016 -0700

----------------------------------------------------------------------
 .../internal/DistributionAdvisor.java           |  2 +-
 .../internal/locks/Collaboration.java           |  6 +-
 .../internal/locks/DLockGrantor.java            | 80 ++++++++++----------
 .../internal/locks/GrantorRequestProcessor.java |  6 +-
 .../membership/gms/fd/GMSHealthMonitor.java     |  2 -
 .../gms/messenger/JGroupsMessenger.java         |  2 -
 .../gms/mgr/GMSMembershipManager.java           |  1 +
 .../cache/tier/InternalClientMembership.java    |  4 +-
 .../cache/tier/sockets/AcceptorImpl.java        |  4 +-
 .../cache/tier/sockets/CacheClientProxy.java    |  2 +-
 .../gemfire/internal/tcp/ConnectionTable.java   |  2 +-
 11 files changed, 54 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
index cefe9da..41fc4a6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisor.java
@@ -175,7 +175,7 @@ public class DistributionAdvisor  {
   /**
    * Hold onto removed profiles to compare to late-processed profiles. Fix for
    * bug 36881. Protected by synchronizing on this DistributionAdvisor.
-   * @guarded.By this DistributionAdvisor
+   * guarded.By this DistributionAdvisor
    */
   private final Map removedProfiles = new HashMap();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/Collaboration.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/Collaboration.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/Collaboration.java
old mode 100755
new mode 100644
index cb36fd9..061154a
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/Collaboration.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/Collaboration.java
@@ -50,7 +50,7 @@ public class Collaboration {
   
   /** The current topic of collaboration 
    *
-   * @guarded.By {@link #topicsQueue}
+   * guarded.By {@link #topicsQueue}
    */
   private volatile Topic currentTopic;
   
@@ -353,8 +353,8 @@ public class Collaboration {
     private final Object topicObject;
     
     /**
-     * @guarded.By {@link Collaboration#topicsQueue}
-     * @guarded.By this instance, <em>after</em> acquiring the topicsQueue
+     * guarded.By {@link Collaboration#topicsQueue}
+     * guarded.By this instance, <em>after</em> acquiring the topicsQueue
      */
     private final List participatingThreads = new ArrayList();
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockGrantor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockGrantor.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockGrantor.java
index 21a0300..3fcc720 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockGrantor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/DLockGrantor.java
@@ -90,7 +90,7 @@ public class DLockGrantor {
    * Map of grant tokens for tracking grantor-side state of distributed locks.
    * Key: Object name, Value: DLockGrantToken grant
    * 
-   * @guarded.By grantTokens
+   * guarded.By grantTokens
    */
   private final Map grantTokens = new HashMap();
 
@@ -118,7 +118,7 @@ public class DLockGrantor {
    * transfer grantorship request. At that point the state will be HALTED as
    * described above.
    * 
-   * @guarded.By this
+   * guarded.By this
    */
   private volatile int state = INITIALIZING;
 
@@ -134,7 +134,7 @@ public class DLockGrantor {
    * <p>
    * Handling of batch locks synchronizes on this to assure serial processing.
    * 
-   * @guarded.By batchLocks
+   * guarded.By batchLocks
    */
   private final Map batchLocks = new HashMap();
   
@@ -199,7 +199,7 @@ public class DLockGrantor {
   /** 
    * FIFO queue for suspend read and write lock waiters.
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private final LinkedList suspendQueue = new LinkedList();
   
@@ -208,28 +208,28 @@ public class DLockGrantor {
    * <p> 
    * Key=RemoteThread, Value=ReadLockCount 
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private final HashMap readLockCountMap = new HashMap();
   
   /** 
    * Number of suspend waiters waiting for write lock. 
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private int writeLockWaiters = 0;
   
   /** 
    * Total number of read locks held against suspend write lock. 
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private int totalReadLockCount = 0;
   
   /** 
    * List of next requests to process after handling an unlock or resume. 
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private ArrayList permittedRequests = new ArrayList();
 
@@ -237,7 +237,7 @@ public class DLockGrantor {
    * List of active drains of permittedRequests. TODO: does this need to be
    * a synchronizedList?
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private final List permittedRequestsDrain = 
       Collections.synchronizedList(new LinkedList());
@@ -815,7 +815,7 @@ public class DLockGrantor {
    * suspendLock and the grant token.
    * 
    * @param request the lock request to be processed by this grantor
-   * @guarded.By {@link #acquireDestroyReadLock(long)}
+   * guarded.By {@link #acquireDestroyReadLock(long)}
    */
   private void handlePermittedLockRequest(final DLockRequestMessage request) {
     if (logger.isTraceEnabled(LogMarker.DLS)) {
@@ -1050,7 +1050,7 @@ public class DLockGrantor {
    * @param name the name of the lock to release
    * @param owner the member attempting to release the granted lock
    * @param lockId the id of the lease used by the owner
-   * @guarded.By {@link #acquireDestroyReadLock(long)}
+   * guarded.By {@link #acquireDestroyReadLock(long)}
    */
   private void getAndReleaseGrantIfLockedBy(Object name, 
                                             InternalDistributedMember owner,
@@ -1290,7 +1290,7 @@ public class DLockGrantor {
    * Caller must acquire destroyWriteLock. Synchronizes on suspendLock,
    * grantTokens, and each grant token.
    * 
-   * @guarded.By {@link #acquireDestroyWriteLock(long)}
+   * guarded.By {@link #acquireDestroyWriteLock(long)}
    */
   private void destroyGrantor() {
     Assert.assertHoldsLock(this,true);
@@ -1352,7 +1352,7 @@ public class DLockGrantor {
    * Caller must acquire destroyWriteLock.
    * 
    * @param requests the requests to respond to
-   * @guarded.By {@link #acquireDestroyWriteLock(long)}
+   * guarded.By {@link #acquireDestroyWriteLock(long)}
    */
   private void respondWithNotGrantor(Iterator requests) {
     while (requests.hasNext()) {
@@ -1688,7 +1688,7 @@ public class DLockGrantor {
    * 
    * @param name the key to fetch the grant token value for
    * @return the grant token stored under key name
-   * @guarded.By {@link #grantTokens}
+   * guarded.By {@link #grantTokens}
    */
   private DLockGrantToken basicGetGrantToken(Object name) {
     return (DLockGrantToken) this.grantTokens.get(name);
@@ -1700,7 +1700,7 @@ public class DLockGrantor {
    * Caller must synchronize on grantTokens
    * 
    * @param grantToken the grant token to store in the map
-   * @guarded.By {@link #grantTokens}
+   * guarded.By {@link #grantTokens}
    */
   private void basicPutGrantToken(DLockGrantToken grantToken) {
     this.grantTokens.put(grantToken.getName(), grantToken);
@@ -1713,7 +1713,7 @@ public class DLockGrantor {
    * Caller must synchronize on grantTokens and then the grantToken.
    * 
    * @param grantToken the grant token to remove from the map.
-   * @guarded.By {@link #grantTokens} and grantToken
+   * guarded.By {@link #grantTokens} and grantToken
    */
   private void basicRemoveGrantToken(DLockGrantToken grantToken) {
     Object removed = this.grantTokens.remove(grantToken.getName()); // changed to ref token
@@ -1789,7 +1789,7 @@ public class DLockGrantor {
   /**
    * True to enable test hook to sleep while handling suspend to cause timeout.
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private int debugHandleSuspendTimeouts = 0;
   
@@ -2019,7 +2019,7 @@ public class DLockGrantor {
   }
   
   /**
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private void postReleaseSuspendLock(RemoteThread rThread, Object lock) {
     if (!isLockingSuspendedBy(rThread)) {
@@ -2073,7 +2073,7 @@ public class DLockGrantor {
   }
 
   /**
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private void postReleaseReadLock(RemoteThread rThread, Object lock) {
     final boolean isDebugEnabled_DLS = logger.isTraceEnabled(LogMarker.DLS);
@@ -2391,7 +2391,7 @@ public class DLockGrantor {
   /**
    * Verify the waiters (for debugging)
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private void checkWriteLockWaiters() {
     if (!DEBUG_SUSPEND_LOCK) {
@@ -2412,7 +2412,7 @@ public class DLockGrantor {
   /**
    * Debugging method
    * 
-   * @guarded.By {@link #suspendLock}
+   * guarded.By {@link #suspendLock}
    */
   private void checkTotalReadLockCount() {
     if (!DEBUG_SUSPEND_LOCK) {
@@ -2453,7 +2453,7 @@ public class DLockGrantor {
     /** 
      * Pending requests queued up for the lock
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private LinkedList pendingRequests;
     
@@ -2461,14 +2461,14 @@ public class DLockGrantor {
      * The reply processor id is used to identify the specific lock operation
      * used by the lessee to lease this lock 
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private int leaseId = -1;
     
     /** 
      * Distributed member that currently has a lease on this lock
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private InternalDistributedMember lessee;
 
@@ -2478,28 +2478,28 @@ public class DLockGrantor {
      * leased out, the value is > 0. A value of Long.MAX_VALUE indicates a
      * non-expiring (infinite) lease.
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private long leaseExpireTime = -1;
     
     /** 
      * Current count of threads attempting to access this grant token.
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private int accessCount = 0;
     
     /** 
      * True if this token has been destroyed and removed from usage.
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private boolean destroyed = false;
     
     /** 
      * RemoteThread identity of thread currently holding lease on this lock
      * 
-     * @guarded.By this
+     * guarded.By this
      */
     private RemoteThread lesseeThread = null;
     
@@ -2868,7 +2868,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @param requestsToRemove the pending requests to remove
-     * @guarded.By this
+     * guarded.By this
      */
     private void removeRequests(Collection requestsToRemove) {
       if (!requestsToRemove.isEmpty()) {
@@ -2939,7 +2939,7 @@ public class DLockGrantor {
      * 
      * @param request the request to grant the lock to
      * @return leaseExpireTime or -1 if failed to grant. 
-     * @guarded.By this
+     * guarded.By this
      */
     private long grantAndRespondToRequest(DLockRequestMessage request) {
       
@@ -3045,7 +3045,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @return a string of the pending requests for logging or debugging
-     * @guarded.By this
+     * guarded.By this
      */
     private String pendingRequestsToString() {
       if (this.pendingRequests == null) {
@@ -3124,7 +3124,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @return the lock id used to lease this lock
-     * @guarded.By this
+     * guarded.By this
      */
     int getLockId() {
       return this.leaseId;
@@ -3136,7 +3136,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @return the identity of the thread that has this lock leased
-     * @guarded.By this
+     * guarded.By this
      */
     RemoteThread getRemoteThread() {
       return this.lesseeThread;
@@ -3279,7 +3279,7 @@ public class DLockGrantor {
      * @param newLeaseExpireTime the absolute expiration time
      * @param lockId the lock id used to request the lock
      * @param remoteThread identity of the locking thread
-     * @guarded.By this
+     * guarded.By this
      */
     void grantLock(InternalDistributedMember owner, 
                    long newLeaseExpireTime, 
@@ -3299,7 +3299,7 @@ public class DLockGrantor {
      * @param newLeaseExpireTime the absolute expiration time
      * @param lockId the lock id used to request the lock
      * @param remoteThread identity of the locking thread
-     * @guarded.By this
+     * guarded.By this
      */
     private void basicGrantLock(InternalDistributedMember owner, 
                                 long newLeaseExpireTime, 
@@ -3322,7 +3322,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @return true if this lock is currently leased out
-     * @guarded.By this
+     * guarded.By this
      */
     boolean isLeaseHeld() {
       return this.lessee != null && this.leaseId > -1;
@@ -3333,7 +3333,7 @@ public class DLockGrantor {
      * that is no longer in use.
      * <p>
      * Caller must synchronize on this grant token.
-     * @guarded.By this
+     * guarded.By this
      */
     void destroy() {
       if (!this.destroyed) {
@@ -3352,7 +3352,7 @@ public class DLockGrantor {
      * Caller must synchronize on this grant token.
      * 
      * @throws IllegalStateException if this grant token has been destroyed
-     * @guarded.By this
+     * guarded.By this
      */
     private void checkDestroyed() {
       if (this.destroyed) {
@@ -3372,7 +3372,7 @@ public class DLockGrantor {
      * @param member the member to release the lock from
      * @param lockId the lock id that the member used when locking
      * @return true if lock was released
-     * @guarded.By this
+     * guarded.By this
      */
     private boolean releaseLock(InternalDistributedMember member, 
                                 int lockId) {
@@ -3405,7 +3405,7 @@ public class DLockGrantor {
      * @param sender the member that potentially holds a lease
      * @param lockId the lock id provided by the member
      * @return true if the sender holds a lease on this lock
-     * @guarded.By this
+     * guarded.By this
      */
     private boolean isLeaseHeldBy(InternalDistributedMember sender, 
                                        int lockId) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/GrantorRequestProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/GrantorRequestProcessor.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/GrantorRequestProcessor.java
index ec5cd96..e22a8c0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/GrantorRequestProcessor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/locks/GrantorRequestProcessor.java
@@ -91,14 +91,14 @@ public class GrantorRequestProcessor extends ReplyProcessor21 {
     /**
      * Our notion of the current elder
      * 
-     * @guarded.By {@link #elderLock}
+     * guarded.By {@link #elderLock}
      */
     InternalDistributedMember currentElder = null;
     
     /**
      * Count of the elder calls in-flight
      * 
-     * @guarded.By {@link #elderLock}
+     * guarded.By {@link #elderLock}
      */
     int elderCallsInProgress = 0;
     
@@ -106,7 +106,7 @@ public class GrantorRequestProcessor extends ReplyProcessor21 {
      * If true, we're cooling our heels waiting for the elders to pass
      * the baton
      * 
-     * @guarded.By {@link #elderLock}
+     * guarded.By {@link #elderLock}
      */
     boolean waitingToChangeElder = false;
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index 586427f..4b63d4f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -419,8 +419,6 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler {
   /**
    * This method sends heartbeat request to other member and waits for member-timeout
    * time for response. If it doesn't see response then it returns false.
-   * @param member
-   * @return
    */
   private boolean doCheckMember(InternalDistributedMember member, boolean waitForResponse) {
     if (playingDead || beingSick) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
old mode 100755
new mode 100644
index fc81049..879b0a5
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
@@ -1076,8 +1076,6 @@ public class JGroupsMessenger implements Messenger {
     /**
      * returns the handler that should process the given message.
      * The default handler is the membership manager
-     * @param msg
-     * @return
      */
     private MessageHandler getMessageHandler(DistributionMessage msg) {
       Class<?> msgClazz = msg.getClass();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index 4ed30a4..cfd11ed 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -2070,6 +2070,7 @@ public class GMSMembershipManager implements MembershipManager, Manager
    * 
    * Concurrency: protected by {@link #latestViewLock} ReentrantReadWriteLock
    *
+   * guarded.By latestViewLock
    * @return true if the given member is a zombie
    */
   public boolean isShunned(DistributedMember m) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalClientMembership.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalClientMembership.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalClientMembership.java
old mode 100755
new mode 100644
index 04752b3..b2d5959
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalClientMembership.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/InternalClientMembership.java
@@ -93,7 +93,7 @@ public final class InternalClientMembership  {
   /**
    * True if class is monitoring systems
    * 
-   * @guarded.By InternalClientMembership.class
+   * guarded.By InternalClientMembership.class
    */
   private static boolean isMonitoring = false;
   
@@ -552,7 +552,7 @@ for (int i=0; i<queueElementsAfter.length; i++) {
   }
 
   /**
-   * @guarded.By {@link #systems}
+   * guarded.By {@link #systems}
    */
   private static void ensureExecutorIsRunning() {
     // protected by calling method synchronized on systems

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
index 4f952a8..d016fd3 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/AcceptorImpl.java
@@ -232,13 +232,13 @@ public class AcceptorImpl extends Acceptor implements Runnable
    * 
    * Instances added when constructed; removed when terminated.
    * 
-   * @guarded.By {@link #allSCsLock}
+   * guarded.By {@link #allSCsLock}
    */
   private final HashSet allSCs = new HashSet();
 
   /** List of ServerConnections, for {@link #emergencyClose()}
    * 
-   *  @guarded.By {@link #allSCsLock}
+   *  guarded.By {@link #allSCsLock}
    */
   private volatile ServerConnection allSCList[] = new ServerConnection[0];
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
index e080cbb..46737b7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
@@ -2381,7 +2381,7 @@ public class CacheClientProxy implements ClientSession {
     private volatile boolean _isStopped = true;
 
     /**
-     * @guarded.By _pausedLock
+     * guarded.By _pausedLock
      */
     //boolean _isPausedDispatcher = false;
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/40f95887/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/ConnectionTable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/ConnectionTable.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/ConnectionTable.java
index 7161088..9f0b61b 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/ConnectionTable.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/tcp/ConnectionTable.java
@@ -108,7 +108,7 @@ public class ConnectionTable  {
   /**
    * Timer to kill idle threads
    * 
-   * @guarded.By this
+   * guarded.By this
    */
   private SystemTimer idleConnTimer;
   


[2/6] incubator-geode git commit: GEODE-17: fix javadoc warnings

Posted by kl...@apache.org.
GEODE-17: fix javadoc warnings


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

Branch: refs/heads/feature/GEODE-1673-PR-212
Commit: f230349f8b7994e4b2f35b06ebe417e8cf294945
Parents: fe28192
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Fri Jul 22 09:01:35 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri Jul 22 09:01:35 2016 -0700

----------------------------------------------------------------------
 .../gms/mgr/GMSMembershipManager.java           | 63 +++++++++++++++-----
 .../internal/security/GeodeSecurityUtil.java    |  4 +-
 .../apache/geode/security/GeodePermission.java  | 13 ++--
 .../security/templates/SamplePostProcessor.java |  2 +-
 4 files changed, 57 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f230349f/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
index e6ca8e1..4ed30a4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
@@ -16,17 +16,63 @@
  */
 package com.gemstone.gemfire.distributed.internal.membership.gms.mgr;
 
-import com.gemstone.gemfire.*;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.CancelException;
+import com.gemstone.gemfire.ForcedDisconnectException;
+import com.gemstone.gemfire.GemFireConfigException;
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.SystemConnectException;
+import com.gemstone.gemfire.SystemFailure;
+import com.gemstone.gemfire.ToDataException;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
 import com.gemstone.gemfire.distributed.Locator;
-import com.gemstone.gemfire.distributed.internal.*;
+import com.gemstone.gemfire.distributed.internal.AdminMessageType;
+import com.gemstone.gemfire.distributed.internal.DMStats;
+import com.gemstone.gemfire.distributed.internal.DSClock;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionException;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.OverflowQueueWithDMStats;
+import com.gemstone.gemfire.distributed.internal.SizeableRunnable;
+import com.gemstone.gemfire.distributed.internal.StartupMessage;
 import com.gemstone.gemfire.distributed.internal.direct.DirectChannel;
 import com.gemstone.gemfire.distributed.internal.direct.DirectChannelListener;
 import com.gemstone.gemfire.distributed.internal.direct.ShunnedMemberException;
-import com.gemstone.gemfire.distributed.internal.membership.*;
+import com.gemstone.gemfire.distributed.internal.membership.DistributedMembershipListener;
+import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
+import com.gemstone.gemfire.distributed.internal.membership.MembershipTestHook;
+import com.gemstone.gemfire.distributed.internal.membership.NetView;
+import com.gemstone.gemfire.distributed.internal.membership.QuorumChecker;
 import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember;
 import com.gemstone.gemfire.distributed.internal.membership.gms.Services;
 import com.gemstone.gemfire.distributed.internal.membership.gms.SuspectMember;
@@ -51,16 +97,6 @@ import com.gemstone.gemfire.internal.shared.StringPrintWriter;
 import com.gemstone.gemfire.internal.tcp.ConnectExceptions;
 import com.gemstone.gemfire.internal.tcp.MemberShunnedException;
 import com.gemstone.gemfire.internal.util.Breadcrumbs;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.io.NotSerializableException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.*;
 
 public class GMSMembershipManager implements MembershipManager, Manager
 {
@@ -2034,7 +2070,6 @@ public class GMSMembershipManager implements MembershipManager, Manager
    * 
    * Concurrency: protected by {@link #latestViewLock} ReentrantReadWriteLock
    *
-   * @guarded.By latestViewLock
    * @return true if the given member is a zombie
    */
   public boolean isShunned(DistributedMember m) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f230349f/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index ead82e5..0d5e701 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -378,7 +378,7 @@ public class GeodeSecurityUtil {
    * @param className
    * @param expectedClazz
    * @param <T>
-   * @return
+   * @return the expected object loadded by using the className
    */
   public static <T> T getObjectOfTypeFromClassName(String className, Class<T> expectedClazz) {
     Class actualClass = null;
@@ -407,7 +407,7 @@ public class GeodeSecurityUtil {
    * @param factoryMethodName
    * @param expectedClazz
    * @param <T>
-   * @return
+   * @return the expected object loaded by the factory method
    */
   public static <T> T getObjectOfTypeFromFactoryMethod(String factoryMethodName, Class<T> expectedClazz){
     T actualObject = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f230349f/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java b/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
index 0a777a8..9f0ce2d 100644
--- a/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
+++ b/geode-core/src/main/java/org/apache/geode/security/GeodePermission.java
@@ -43,32 +43,29 @@ public class GeodePermission extends WildcardPermission {
   }
 
   /**
-   * Returns the resource, could be either DATA or CLUSTER
-   * @return
+   * Returns
+   * @return the resource, could be either DATA or CLUSTER
    */
   public Resource getResource() {
     return resource;
   }
 
   /**
-   * Returns the operation, could be either MANAGE, WRITE or READ
-   * @return
+   * @return the operation, could be either MANAGE, WRITE or READ
    */
   public Operation getOperation() {
     return operation;
   }
 
   /**
-   * returns the regionName, could be "*", meaning all regions
-   * @return
+   * @return the regionName, could be "*", meaning all regions
    */
   public String getRegionName() {
     return regionName;
   }
 
   /**
-   * returns the key, could be "*" meaning all keys.
-   * @return
+   * @return the key, could be "*" meaning all keys.
    */
   public String getKey() {
     return key;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f230349f/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java b/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
index 8f61db7..5eca744 100644
--- a/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/security/templates/SamplePostProcessor.java
@@ -42,7 +42,7 @@ public class SamplePostProcessor implements PostProcessor{
    *        the key of the value that's been accessed. This could be null.
    * @param value
    *        the value, this could be null.
-   * @return
+   * @return the processed value
    */
   @Override
   public Object processRegionValue(Principal principal,


[5/6] incubator-geode git commit: GEODE-1673: fail start if security.json cannot be found

Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MemberMBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MemberMBeanSecurityJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MemberMBeanSecurityJUnitTest.java
index 4ee5b13..6c8a638 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MemberMBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MemberMBeanSecurityJUnitTest.java
@@ -16,27 +16,29 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static org.assertj.core.api.Assertions.*;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.MemberMXBean;
-import com.gemstone.gemfire.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;
 
-@Category(IntegrationTest.class)
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.MemberMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
 public class MemberMBeanSecurityJUnitTest {
+
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
 
   private MemberMXBean bean;
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, CACHE_SERVER_JSON);
+      jmxManagerPort, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java
index e86cf61..3324e7a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MultiUserDUnitTest.java
@@ -14,20 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 import static org.junit.Assert.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 
 import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
-import com.gemstone.gemfire.security.JSONAuthorization;
 import com.jayway.awaitility.Awaitility;
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.json.JSONException;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -53,10 +51,10 @@ public class MultiUserDUnitTest extends CliCommandTestBase {
   public void testMultiUser() throws IOException, JSONException, InterruptedException {
     Properties properties = new Properties();
     properties.put(NAME, MultiUserDUnitTest.class.getSimpleName());
-    properties.put(SECURITY_MANAGER, JSONAuthorization.class.getName());
+    properties.put(SECURITY_MANAGER, SampleSecurityManager.class.getName());
 
     // set up vm_0 the secure jmx manager
-    Object[] results = setUpJMXManagerOnVM(0, properties, CACHE_SERVER_JSON);
+    Object[] results = setUpJMXManagerOnVM(0, properties, "com/gemstone/gemfire/management/internal/security/cacheServer.json");
     String gfshDir = this.gfshDir;
 
     // set up vm_1 as a gfsh vm, data-reader will login and log out constantly in this vm until the test is done.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
index 49cbbaa..3c11e53 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/ShiroCacheStartRule.java
@@ -16,13 +16,14 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import org.junit.rules.ExternalResource;
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 
 import java.util.Properties;
 
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import org.junit.rules.ExternalResource;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
 
 public class ShiroCacheStartRule extends ExternalResource {
   private Cache cache;
@@ -34,7 +35,6 @@ public class ShiroCacheStartRule extends ExternalResource {
     this.shiroFile = shiroFile;
   }
 
-
   protected void before() throws Throwable {
     Properties properties = new Properties();
     properties.put(NAME, ShiroCacheStartRule.class.getSimpleName());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
index 8c8ed40..875aeef 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/TestCommand.java
@@ -14,17 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.management.internal.security;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.geode.security.GeodePermission;
-
 import org.apache.shiro.authz.Permission;
 
 public class TestCommand {
+
   public static GeodePermission none = null;
   public static GeodePermission everyOneAllowed = new GeodePermission();
   public static GeodePermission dataRead = new GeodePermission("DATA", "READ");
@@ -206,7 +205,6 @@ public class TestCommand {
     createTestCommand("sleep", null);
     createTestCommand("sh ls", null);
 
-
     // WAN Commands
     createTestCommand("create gateway-sender --id=sender1 --remote-distributed-system-id=2", dataManage);
     createTestCommand("start gateway-sender --id=sender1", dataManage);
@@ -223,6 +221,7 @@ public class TestCommand {
 
     //ShellCommand
     createTestCommand("disconnect", null);
+
     //Misc commands
     //createTestCommand("shutdown", clusterManage);
   };

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
index feee478..feda4b4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
@@ -17,12 +17,12 @@
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static org.assertj.core.api.Assertions.*;
 import static org.junit.Assert.*;
 
 import java.util.Properties;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
 import org.junit.Before;
 
@@ -56,16 +56,15 @@ public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTest
     this.client2 = host.getVM(2);
     this.client3 = host.getVM(3);
 
-    JSONAuthorization.setUpWithJsonFile(CLIENT_SERVER_JSON);
-
     Properties props = new Properties();
-    props.setProperty(SECURITY_MANAGER, JSONAuthorization.class.getName());
-    if(postProcessor!=null){
+    props.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/management/internal/security/clientServer.json");
+    props.setProperty(LOCATORS, "");
+    props.setProperty(MCAST_PORT, "0");
+    if (postProcessor!=null) {
       props.setProperty(SECURITY_POST_PROCESSOR, postProcessor.getName());
     }
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
     props.setProperty(SECURITY_LOG_LEVEL, "finest");
+    props.setProperty(SECURITY_MANAGER, SampleSecurityManager.class.getName());
 
     getSystem(props);
 
@@ -101,9 +100,9 @@ public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTest
     Properties props = new Properties();
     props.setProperty(UserPasswordAuthInit.USER_NAME, userName);
     props.setProperty(UserPasswordAuthInit.PASSWORD, password);
-    props.setProperty(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName() + ".create");
-    props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(SECURITY_CLIENT_AUTH_INIT, UserPasswordAuthInit.class.getName() + ".create");
     props.setProperty(SECURITY_LOG_LEVEL, "finest");
     return props;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
index 8472af9..746dbb1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
@@ -16,7 +16,6 @@
  */
 package com.gemstone.gemfire.security;
 
-
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
index b0a1fa2..6aa3d68 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
@@ -16,7 +16,6 @@
  */
 package com.gemstone.gemfire.security;
 
-
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleDistributedTest.java
index dc63f2f..902ebf0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleDistributedTest.java
@@ -17,11 +17,11 @@
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static org.assertj.core.api.Assertions.*;
 
 import java.util.Properties;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -45,7 +45,7 @@ public class IntegratedSecurityCacheLifecycleDistributedTest extends JUnit4Cache
   public final void postSetUp() throws Exception {
     Host host = Host.getHost(0);
     locator = host.getVM(0);
-    JSONAuthorization.setUpWithJsonFile(CLIENT_SERVER_JSON);
+
     int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     String locators =  NetworkUtils.getServerHostName(host) + "[" + locatorPort + "]";
 
@@ -53,6 +53,7 @@ public class IntegratedSecurityCacheLifecycleDistributedTest extends JUnit4Cache
       DistributedTestUtils.deleteLocatorStateFile(locatorPort);
 
       final Properties properties = new Properties();
+      properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/management/internal/security/clientServer.json");
 //      properties.setProperty(LOCATORS, locators);
       properties.setProperty(MCAST_PORT, "0");
       properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
@@ -63,6 +64,7 @@ public class IntegratedSecurityCacheLifecycleDistributedTest extends JUnit4Cache
     });
 
     final Properties properties = new Properties();
+    properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/management/internal/security/clientServer.json");
     properties.setProperty(LOCATORS, locators);
     properties.setProperty(MCAST_PORT, "0");
     properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
index 228a8d6..5eabe7a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
@@ -18,7 +18,6 @@ package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 import static org.assertj.core.api.Assertions.*;
-import static org.mockito.Mockito.*;
 
 import java.util.Properties;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
index d6ac3aa..ce090f1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.security;
 
 import static org.junit.Assert.*;
@@ -81,7 +80,6 @@ public class IntegratedSecurityNoShowValue1PostProcessorDUnitTest extends Abstra
       assertTrue(result.contains("value2"));
       assertTrue(result.contains("value3"));
       assertTrue(result.contains("value4"));
-
     });
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPeerAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPeerAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPeerAuthDistributedTest.java
index a5e0aa0..7a4830d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPeerAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPeerAuthDistributedTest.java
@@ -17,7 +17,6 @@
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.security.JSONAuthorization.*;
 import static com.gemstone.gemfire.test.dunit.Invoke.*;
 import static org.assertj.core.api.Assertions.*;
 
@@ -33,13 +32,14 @@ import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCase{
 
-  private static SpyJSONAuthorization spyJSONAuthorization;
+  private static SpySecurityManager spySecurityManager;
 
   private VM locator;
   private VM server1;
@@ -58,12 +58,12 @@ public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCa
     locators =  NetworkUtils.getServerHostName(host) + "[" + locatorPort + "]";
 
     locator.invoke(() -> {
-      JSONAuthorization.setUpWithJsonFile(PEER_AUTH_JSON);
-      spyJSONAuthorization = new SpyJSONAuthorization();
+      spySecurityManager = new SpySecurityManager();
 
       DistributedTestUtils.deleteLocatorStateFile(locatorPort);
 
       final Properties properties = createProperties(locators);
+      properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/security/peerAuth.json");
       properties.setProperty(UserPasswordAuthInit.USER_NAME, "locator1");
       properties.setProperty(UserPasswordAuthInit.PASSWORD, "1234567");
       properties.setProperty(START_LOCATOR, locators);
@@ -73,10 +73,10 @@ public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCa
     });
 
     server1.invoke(()-> {
-      JSONAuthorization.setUpWithJsonFile(PEER_AUTH_JSON);
-      spyJSONAuthorization = new SpyJSONAuthorization();
+      spySecurityManager = new SpySecurityManager();
 
       final Properties properties = createProperties(locators);
+      properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/security/peerAuth.json");
       properties.setProperty(UserPasswordAuthInit.USER_NAME, "server1");
       properties.setProperty(UserPasswordAuthInit.PASSWORD, "1234567");
 
@@ -85,10 +85,10 @@ public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCa
     });
 
     server2.invoke(()-> {
-      JSONAuthorization.setUpWithJsonFile(PEER_AUTH_JSON);
-      spyJSONAuthorization = new SpyJSONAuthorization();
+      spySecurityManager = new SpySecurityManager();
 
       final Properties properties = createProperties(locators);
+      properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/security/peerAuth.json");
       properties.setProperty(UserPasswordAuthInit.USER_NAME, "server2");
       properties.setProperty(UserPasswordAuthInit.PASSWORD, "1234567");
 
@@ -99,10 +99,10 @@ public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCa
 
   @Test
   public void initAndCloseTest() throws Exception {
-    JSONAuthorization.setUpWithJsonFile(PEER_AUTH_JSON);
-    spyJSONAuthorization = new SpyJSONAuthorization();
+    spySecurityManager = new SpySecurityManager();
 
     final Properties properties = createProperties(locators);
+    properties.setProperty(SampleSecurityManager.SECURITY_JSON, "com/gemstone/gemfire/security/peerAuth.json");
     properties.setProperty(UserPasswordAuthInit.USER_NAME, "stranger");
     properties.setProperty(UserPasswordAuthInit.PASSWORD, "1234567");
 
@@ -112,21 +112,21 @@ public class IntegratedSecurityPeerAuthDistributedTest extends JUnit4CacheTestCa
   @Override
   public void postTearDownCacheTestCase() throws Exception {
     closeAllCache();
-    spyJSONAuthorization = null;
-    invokeInEveryVM(() -> { spyJSONAuthorization = null; });
+    spySecurityManager = null;
+    invokeInEveryVM(() -> { spySecurityManager = null; });
   }
 
   private static Properties createProperties(String locators) {
     Properties allProperties = new Properties();
     allProperties.setProperty(LOCATORS, locators);
     allProperties.setProperty(MCAST_PORT, "0");
-    allProperties.setProperty(SECURITY_MANAGER, SpyJSONAuthorization.class.getName());
+    allProperties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
     allProperties.setProperty(SECURITY_PEER_AUTH_INIT, UserPasswordAuthInit.class.getName() + ".create");
     allProperties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
     return allProperties;
   }
 
-  public static class SpyJSONAuthorization extends JSONAuthorization {
+  public static class SpySecurityManager extends SampleSecurityManager {
 
     static int initInvoked = 0;
     static int closeInvoked = 0;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
index f573073..0568659 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.security;
 
 import static org.junit.Assert.*;
@@ -85,7 +84,6 @@ public class IntegratedSecurityPostProcessorDUnitTest extends AbstractIntegrated
       assertTrue(result.contains("super-user/null/null/value2"));
       assertTrue(result.contains("super-user/null/null/value3"));
       assertTrue(result.contains("super-user/null/null/value4"));
-
     });
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/JSONAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/JSONAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/security/JSONAuthorization.java
deleted file mode 100644
index bf7990a..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/JSONAuthorization.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.security;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.apache.geode.security.templates.SampleSecurityManager;
-import com.gemstone.gemfire.util.test.TestUtil;
-
-/**
- * Used by test code. when using this class for security-manager, you will need explicitly call setUpWithJsonFile
- * to initialize the acl (access control list).
- */
-public class JSONAuthorization extends SampleSecurityManager {
-
-  public static String AUTH1_JSON = "/com/gemstone/gemfire/management/internal/security/auth1.json";
-  public static String AUTH2_JSON = "/com/gemstone/gemfire/management/internal/security/auth2.json";
-  public static String AUTH3_JSON = "/com/gemstone/gemfire/management/internal/security/auth3.json";
-  public static String CACHE_SERVER_JSON = "/com/gemstone/gemfire/management/internal/security/cacheServer.json";
-  public static String CLIENT_SERVER_JSON = "/com/gemstone/gemfire/management/internal/security/clientServer.json";
-  public static String SHIRO_INI_JSON = "/com/gemstone/gemfire/management/internal/security/shiro-ini.json";
-  public static String PEER_AUTH_JSON = "/com/gemstone/gemfire/security/peerAuth.json";
-
-  /**
-   * Override the child class's implemention to look for jsonFile in the same package as this class instead of
-   * in the classpath
-   */
-  public static void setUpWithJsonFile(String jsonFileName) throws IOException {
-    String filePath = TestUtil.getResourcePath(JSONAuthorization.class, jsonFileName);
-    File file = new File(filePath);
-    FileReader reader = new FileReader(file);
-    char[] buffer = new char[(int) file.length()];
-    reader.read(buffer);
-    String json = new String(buffer);
-    reader.close();
-    readSecurityDescriptor(json);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java b/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
index b6fd2f7..b428144 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.gemstone.gemfire.security;
 
 import java.security.Principal;
@@ -28,9 +27,10 @@ public class NoShowValue1PostProcessor implements PostProcessor {
                                    final String regionName,
                                    final Object key,
                                    final Object value) {
-    if(value.equals("value1"))
+    if (value.equals("value1")) {
       return null;
-    else
+    } else {
       return value;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
index b74b054..598242d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.cache30.ClientServerTestCase.*;
@@ -90,6 +89,7 @@ import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 /**
  * Contains utility methods for setting up servers/clients for authentication
  * and authorization tests.
+ *
  * @since GemFire 5.5
  */
 public final class SecurityTestUtils {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/java/org/apache/geode/security/templates/SampleSecurityManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/templates/SampleSecurityManagerTest.java b/geode-core/src/test/java/org/apache/geode/security/templates/SampleSecurityManagerTest.java
new file mode 100644
index 0000000..c810cb0
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/security/templates/SampleSecurityManagerTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.security.templates;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import org.apache.geode.security.templates.SampleSecurityManager.Role;
+import org.apache.geode.security.templates.SampleSecurityManager.User;
+
+@Category({ IntegrationTest.class, SecurityTest.class })
+public class SampleSecurityManagerTest {
+
+  private SampleSecurityManager sampleSecurityManager;
+  private String jsonResource;
+  private File jsonFile;
+  private String json;
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  @Before
+  public void setUp() throws Exception {
+    // resource file
+    this.jsonResource = "org/apache/geode/security/templates/security.json";
+    InputStream inputStream = ClassLoader.getSystemResourceAsStream(this.jsonResource);
+
+    assertThat(inputStream).isNotNull();
+
+    // non-resource file
+    this.jsonFile = new File(temporaryFolder.getRoot(), "security.json");
+    IOUtils.copy(inputStream, new FileOutputStream(this.jsonFile));
+
+    // string
+    this.json = FileUtils.readFileToString(this.jsonFile, "UTF-8");
+    this.sampleSecurityManager = new SampleSecurityManager();
+  }
+
+  @Test
+  public void shouldInitializeFromJsonString() throws Exception {
+    this.sampleSecurityManager.initializeFromJson(this.json);
+    verifySecurityManagerState();
+  }
+
+  @Test
+  public void shouldInitializeFromJsonResource() throws Exception {
+    this.sampleSecurityManager.initializeFromJsonResource(this.jsonResource);
+    verifySecurityManagerState();
+  }
+
+  @Test
+  public void shouldInitializeFromJsonFile() throws Exception {
+    this.sampleSecurityManager.initializeFromJsonFile(this.jsonFile);
+    verifySecurityManagerState();
+  }
+
+  @Test
+  public void initShouldUsePropertyAsJsonString() throws Exception {
+    Properties securityProperties = new Properties();
+    securityProperties.setProperty(SampleSecurityManager.SECURITY_JSON, this.json);
+    this.sampleSecurityManager.init(securityProperties);
+    verifySecurityManagerState();
+  }
+
+  @Test
+  public void initShouldUsePropertyAsJsonFile() throws Exception {
+    Properties securityProperties = new Properties();
+    securityProperties.setProperty(SampleSecurityManager.SECURITY_JSON, this.jsonFile.getAbsolutePath());
+    this.sampleSecurityManager.init(securityProperties);
+    verifySecurityManagerState();
+  }
+
+  @Test
+  public void initShouldUsePropertyAsJsonResource() throws Exception {
+    Properties securityProperties = new Properties();
+    securityProperties.setProperty(SampleSecurityManager.SECURITY_JSON, this.jsonResource);
+    this.sampleSecurityManager.init(securityProperties);
+    verifySecurityManagerState();
+  }
+
+  private void verifySecurityManagerState() {
+    User adminUser = this.sampleSecurityManager.getUser("admin");
+    assertThat(adminUser).isNotNull();
+    assertThat(adminUser.name).isEqualTo("admin");
+    assertThat(adminUser.password).isEqualTo("secret");
+    assertThat(adminUser.roles).hasSize(1);
+
+    User guestUser = this.sampleSecurityManager.getUser("guest");
+    assertThat(guestUser).isNotNull();
+    assertThat(guestUser.name).isEqualTo("guest");
+    assertThat(guestUser.password).isEqualTo("guest");
+    assertThat(guestUser.roles).hasSize(1);
+    // TODO: need to do more verification
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-core/src/test/resources/org/apache/geode/security/templates/security.json
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/security/templates/security.json b/geode-core/src/test/resources/org/apache/geode/security/templates/security.json
new file mode 100644
index 0000000..c1ee9fc
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/security/templates/security.json
@@ -0,0 +1,30 @@
+{
+  "roles": [
+    {
+      "name": "admin",
+      "operationsAllowed": [
+        "CLUSTER:MANAGE",
+        "DATA:MANAGE"
+      ]
+    },
+    {
+      "name": "readRegionA",
+      "operationsAllowed": [
+        "DATA:READ"
+      ],
+      "regions": ["RegionA", "RegionB"]
+    }
+  ],
+  "users": [
+    {
+      "name": "admin",
+      "password": "secret",
+      "roles": ["admin"]
+    },
+    {
+      "name": "guest",
+      "password": "guest",
+      "roles": ["readRegionA"]
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8812d540/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/Server.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/Server.java b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/Server.java
index 8f47145..d59b562 100644
--- a/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/Server.java
+++ b/geode-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/Server.java
@@ -26,6 +26,7 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.MBeanRegistrationException;
@@ -38,6 +39,7 @@ import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
 
 import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
+import org.apache.geode.security.templates.SampleSecurityManager;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.mgt.DefaultSecurityManager;
 import org.apache.shiro.mgt.SecurityManager;
@@ -46,11 +48,11 @@ import org.apache.shiro.realm.Realm;
 import com.gemstone.gemfire.internal.security.shiro.CustomAuthRealm;
 import com.gemstone.gemfire.internal.security.shiro.JMXShiroAuthenticator;
 import com.gemstone.gemfire.management.internal.security.AccessControlMBean;
-import com.gemstone.gemfire.security.JSONAuthorization;
 import com.gemstone.gemfire.management.internal.security.MBeanServerWrapper;
 import com.gemstone.gemfire.management.internal.security.ResourceConstants;
 
 public class Server {
+
   private static final String DEFAULT_HOST = "127.0.0.1"; //"localhost"
   private static final int DEFAULT_PORT = 9999;
   private final JMXServiceURL url;
@@ -68,11 +70,13 @@ public class Server {
 
     if (jsonAuthFile != null) {
       System.setProperty("spring.profiles.active", "pulse.authentication.gemfire");
-      JSONAuthorization.setUpWithJsonFile(jsonAuthFile);
+
       Map<String, Object> env = new HashMap<String, Object>();
 
       // set up Shiro Security Manager
-      Realm realm = new CustomAuthRealm(JSONAuthorization.class.getName());
+      Properties securityProperties = new Properties();
+      securityProperties.setProperty(SampleSecurityManager.SECURITY_JSON, jsonAuthFile);
+      Realm realm = new CustomAuthRealm(SampleSecurityManager.class.getName(), securityProperties);
       SecurityManager securityManager = new DefaultSecurityManager(realm);
       SecurityUtils.setSecurityManager(securityManager);
 



[4/6] incubator-geode git commit: GEODE-1617: Regions can be created with a variety of characters that are unsupported

Posted by kl...@apache.org.
GEODE-1617: Regions can be created with a variety of characters that are unsupported

* Test for valid characters when creating non-internal regions
* Updated unit tests and added a new isInternalRegion field to InternalRegionAttributes
* Fixed issue with HA region.
* Found a potential issue with Attributes for a region.
* This closes #201


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

Branch: refs/heads/feature/GEODE-1673-PR-212
Commit: 7ca571c56e8d49e35b9e4f445bd3ca4fbdea974e
Parents: 40f9588
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Mon Jul 11 14:20:56 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Jul 25 10:25:17 2016 -0700

----------------------------------------------------------------------
 .../modules/util/CreateRegionFunction.java      |  33 +++-
 .../gemfire/cache/DynamicRegionFactory.java     |   1 +
 .../gemstone/gemfire/cache/RegionFactory.java   |   1 +
 .../internal/cache/GemFireCacheImpl.java        |  11 +-
 .../gemfire/internal/cache/HARegion.java        |   9 +-
 .../internal/cache/InternalRegionArguments.java |  11 +-
 .../gemfire/internal/cache/LocalRegion.java     | 187 ++++++++++++++++---
 .../internal/cache/PartitionedRegionHelper.java |  34 +++-
 .../parallel/ParallelGatewaySenderQueue.java    |  10 +-
 .../wan/serial/SerialGatewaySenderQueue.java    |  65 +++++--
 .../apache/geode/redis/GeodeRedisServer.java    |  80 +++++---
 .../gemfire/cache/query/QueryJUnitTest.java     | 104 +----------
 .../gemfire/cache/query/RegionJUnitTest.java    |  16 +-
 .../gemfire/distributed/LocatorDUnitTest.java   |  48 +++--
 .../PartitionedRegionCreationDUnitTest.java     |  33 +---
 .../cache/tier/sockets/Bug36829DUnitTest.java   |  13 +-
 .../cache/tier/sockets/Bug37805DUnitTest.java   |   2 +-
 .../RegionCreateDestroyDUnitTest.java           | 174 +++++++++++++++++
 .../management/RegionManagementDUnitTest.java   |  23 +--
 19 files changed, 564 insertions(+), 291 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/CreateRegionFunction.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/CreateRegionFunction.java b/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/CreateRegionFunction.java
index 564ccb7..342968c 100644
--- a/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/CreateRegionFunction.java
+++ b/extensions/geode-modules/src/main/java/com/gemstone/gemfire/modules/util/CreateRegionFunction.java
@@ -16,28 +16,34 @@
 */
 package com.gemstone.gemfire.modules.util;
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Declarable;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.RegionFactory;
 import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.execute.Function;
 import com.gemstone.gemfire.cache.execute.FunctionContext;
 import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
 import com.gemstone.gemfire.distributed.DistributedLockService;
 import com.gemstone.gemfire.distributed.internal.locks.DistributedMemberLock;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Properties;
-
 public class CreateRegionFunction implements Function, Declarable {
 
   private static final long serialVersionUID = -9210226844302128969L;
@@ -195,7 +201,7 @@ public class CreateRegionFunction implements Function, Declarable {
       // Unlock the distributed lock
       try {
         dml.unlock();
-      } catch (Exception e) {
+      } catch (Exception ignore) {
       }
     }
     return status;
@@ -214,7 +220,18 @@ public class CreateRegionFunction implements Function, Declarable {
     }
     RegionFactory<String, RegionConfiguration> factory = this.cache.createRegionFactory(RegionShortcut.REPLICATE);
     factory.addCacheListener(new RegionConfigurationCacheListener());
-    return factory.create(REGION_CONFIGURATION_METADATA_REGION);
+    GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
+    InternalRegionArguments ira = new InternalRegionArguments().setInternalRegion(true);
+    AttributesFactory af = new AttributesFactory();
+    af.setScope(Scope.LOCAL);
+    RegionAttributes ra = af.create();
+    try {
+      return gemFireCache.createVMRegion(REGION_CONFIGURATION_METADATA_REGION, ra, ira);
+    } catch (IOException | ClassNotFoundException e) {
+      InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
+      assErr.initCause(e);
+      throw assErr;
+    }
   }
 
   private void writeCacheXml() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/cache/DynamicRegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/DynamicRegionFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/DynamicRegionFactory.java
index 9a59833..1f449cd 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/DynamicRegionFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/DynamicRegionFactory.java
@@ -232,6 +232,7 @@ public abstract class DynamicRegionFactory  {
       if (this.dynamicRegionList == null) {
         InternalRegionArguments ira = new InternalRegionArguments()
         .setDestroyLockFlag(true)
+        .setInternalRegion(true)
         .setSnapshotInputStream(null)
         .setImageTarget(null);
         AttributesFactory af = new AttributesFactory ();       

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/cache/RegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/RegionFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/RegionFactory.java
index 3fd383a..4fe8ee2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/RegionFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/RegionFactory.java
@@ -822,6 +822,7 @@ public class RegionFactory<K,V>
     RegionAttributes<K,V> ra = this.attrsFactory.create();
     return getCache().createRegion(name, ra);
   }
+
   /**
    * Creates a sub-region in the {@link Cache} using
    * the configuration contained in this RegionFactory. Validation of the

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
index a9e1631..84ba926 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
@@ -3015,12 +3015,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
         ira.setIndexes(((UserSpecifiedRegionAttributes) attrs).getIndexes());
       }
       return createVMRegion(name, attrs, ira);
-    } catch (IOException e) {
-      // only if loading snapshot, not here
-      InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
-      assErr.initCause(e);
-      throw assErr;
-    } catch (ClassNotFoundException e) {
+    } catch (IOException | ClassNotFoundException e) {
       // only if loading snapshot, not here
       InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
       assErr.initCause(e);
@@ -3036,7 +3031,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
       }
     }
     stopper.checkCancelInProgress(null);
-    LocalRegion.validateRegionName(name);
+    LocalRegion.validateRegionName(name, internalRegionArgs);
     RegionAttributes<K, V> attrs = p_attrs;
     attrs = invokeRegionBefore(null, name, attrs, internalRegionArgs);
     if (attrs == null) {
@@ -3049,7 +3044,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
     InternalDistributedMember imageTarget = internalRegionArgs.getImageTarget();
     final boolean recreate = internalRegionArgs.getRecreateFlag();
 
-    final boolean isPartitionedRegion = (attrs.getPartitionAttributes() == null) ? false : true;
+    final boolean isPartitionedRegion = attrs.getPartitionAttributes() != null;
     final boolean isReinitCreate = snapshotInputStream != null || imageTarget != null || recreate;
 
     final String regionPath = LocalRegion.calcFullPath(name, null);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/HARegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/HARegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/HARegion.java
index cac3d0a..d79cb72 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/HARegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/HARegion.java
@@ -273,10 +273,11 @@ public final class HARegion extends DistributedRegion
 
     HARegion haRegion = new HARegion(regionName, ra, null, cache);
     haRegion.setOwner(hrq);
-    Region region = cache.createVMRegion(regionName, ra,
-        new InternalRegionArguments().setInternalMetaRegion(haRegion)
-            .setDestroyLockFlag(true).setSnapshotInputStream(null)
-            .setImageTarget(null));
+    Region region = cache.createVMRegion(regionName, ra, new InternalRegionArguments().setInternalMetaRegion(haRegion)
+                                                                                      .setDestroyLockFlag(true)
+                                                                                      .setSnapshotInputStream(null)
+                                                                                      .setInternalRegion(true)
+                                                                                      .setImageTarget(null));
 
     return (HARegion)region;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalRegionArguments.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalRegionArguments.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalRegionArguments.java
index c403231..54c9194 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalRegionArguments.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalRegionArguments.java
@@ -20,7 +20,6 @@ import java.io.InputStream;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.internal.cache.LocalRegion.TestCallable;
@@ -39,6 +38,7 @@ public final class InternalRegionArguments
   private boolean isUsedForPartitionedRegionAdmin;
   private boolean isUsedForSerialGatewaySenderQueue;
   private boolean isUsedForParallelGatewaySenderQueue;
+  private boolean isInternalRegion;
   private int bucketRedundancy;
   private boolean isUsedForPartitionedRegionBucket;
   private RegionAdvisor partitionedRegionAdvisor;
@@ -311,4 +311,13 @@ public final class InternalRegionArguments
   public Map<String,CacheServiceProfile> getCacheServiceProfiles() {
     return this.cacheServiceProfiles;
   }
+
+  public boolean isInternalRegion() {
+    return isInternalRegion;
+  }
+
+  public InternalRegionArguments setInternalRegion(final boolean internalRegion) {
+    isInternalRegion = internalRegion;
+    return this;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
index 7da2b45..46ccd47 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java
@@ -17,10 +17,96 @@
 
 package com.gemstone.gemfire.internal.cache;
 
-import com.gemstone.gemfire.*;
+import static com.gemstone.gemfire.internal.offheap.annotations.OffHeapIdentifier.*;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.CancelCriterion;
+import com.gemstone.gemfire.CancelException;
+import com.gemstone.gemfire.CopyHelper;
+import com.gemstone.gemfire.DataSerializable;
+import com.gemstone.gemfire.DataSerializer;
+import com.gemstone.gemfire.DeltaSerializationException;
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.InternalGemFireException;
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.SystemFailure;
 import com.gemstone.gemfire.admin.internal.SystemMemberCacheEventProcessor;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CacheEvent;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.CacheRuntimeException;
+import com.gemstone.gemfire.cache.CacheStatistics;
+import com.gemstone.gemfire.cache.CacheWriter;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.CustomExpiry;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskAccessException;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.DiskWriteAttributes;
+import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
+import com.gemstone.gemfire.cache.EntryDestroyedException;
+import com.gemstone.gemfire.cache.EntryExistsException;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.FailedSynchronizationException;
+import com.gemstone.gemfire.cache.InterestRegistrationEvent;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.LowMemoryException;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.PartitionedRegionStorageException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionExistsException;
+import com.gemstone.gemfire.cache.RegionMembershipListener;
+import com.gemstone.gemfire.cache.RegionReinitializedException;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.StatisticsDisabledException;
 import com.gemstone.gemfire.cache.TimeoutException;
+import com.gemstone.gemfire.cache.TransactionException;
+import com.gemstone.gemfire.cache.TransactionId;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.ServerOperationException;
 import com.gemstone.gemfire.cache.client.SubscriptionNotEnabledException;
@@ -32,7 +118,17 @@ import com.gemstone.gemfire.cache.control.ResourceManager;
 import com.gemstone.gemfire.cache.execute.Function;
 import com.gemstone.gemfire.cache.execute.ResultCollector;
 import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
-import com.gemstone.gemfire.cache.query.*;
+import com.gemstone.gemfire.cache.query.FunctionDomainException;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.IndexMaintenanceException;
+import com.gemstone.gemfire.cache.query.IndexType;
+import com.gemstone.gemfire.cache.query.MultiIndexCreationException;
+import com.gemstone.gemfire.cache.query.NameResolutionException;
+import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.TypeMismatchException;
 import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
 import com.gemstone.gemfire.cache.query.internal.DefaultQueryService;
 import com.gemstone.gemfire.cache.query.internal.ExecutionContext;
@@ -45,11 +141,22 @@ import com.gemstone.gemfire.cache.util.ObjectSizer;
 import com.gemstone.gemfire.cache.wan.GatewaySender;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.internal.*;
+import com.gemstone.gemfire.distributed.internal.DM;
+import com.gemstone.gemfire.distributed.internal.DistributionAdvisor;
 import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionStats;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ResourceEvent;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.i18n.StringId;
-import com.gemstone.gemfire.internal.*;
+import com.gemstone.gemfire.internal.Assert;
+import com.gemstone.gemfire.internal.ClassLoadUtil;
+import com.gemstone.gemfire.internal.HeapDataOutputStream;
+import com.gemstone.gemfire.internal.InternalStatisticsDisabledException;
+import com.gemstone.gemfire.internal.NanoTimer;
+import com.gemstone.gemfire.internal.Version;
+import com.gemstone.gemfire.internal.admin.ClientHealthMonitoringRegion;
 import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisor.CacheProfile;
 import com.gemstone.gemfire.internal.cache.DiskInitFile.DiskRegionFlag;
 import com.gemstone.gemfire.internal.cache.FilterRoutingInfo.FilterInfo;
@@ -60,7 +167,11 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.Resou
 import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
 import com.gemstone.gemfire.internal.cache.control.MemoryThresholds;
 import com.gemstone.gemfire.internal.cache.control.ResourceListener;
-import com.gemstone.gemfire.internal.cache.execute.*;
+import com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionExecutor;
+import com.gemstone.gemfire.internal.cache.execute.DistributedRegionFunctionResultSender;
+import com.gemstone.gemfire.internal.cache.execute.LocalResultCollector;
+import com.gemstone.gemfire.internal.cache.execute.RegionFunctionContextImpl;
+import com.gemstone.gemfire.internal.cache.execute.ServerToClientFunctionResultSender;
 import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
 import com.gemstone.gemfire.internal.cache.lru.LRUEntry;
 import com.gemstone.gemfire.internal.cache.partitioned.RedundancyAlreadyMetException;
@@ -71,8 +182,19 @@ import com.gemstone.gemfire.internal.cache.persistence.PersistentMemberID;
 import com.gemstone.gemfire.internal.cache.persistence.query.IndexMap;
 import com.gemstone.gemfire.internal.cache.persistence.query.mock.IndexMapImpl;
 import com.gemstone.gemfire.internal.cache.tier.InterestType;
-import com.gemstone.gemfire.internal.cache.tier.sockets.*;
-import com.gemstone.gemfire.internal.cache.versions.*;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientHealthMonitor;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientTombstoneMessage;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessage;
+import com.gemstone.gemfire.internal.cache.tier.sockets.HandShake;
+import com.gemstone.gemfire.internal.cache.tier.sockets.VersionedObjectList;
+import com.gemstone.gemfire.internal.cache.versions.ConcurrentCacheModificationException;
+import com.gemstone.gemfire.internal.cache.versions.RegionVersionHolder;
+import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
+import com.gemstone.gemfire.internal.cache.versions.VersionSource;
+import com.gemstone.gemfire.internal.cache.versions.VersionStamp;
+import com.gemstone.gemfire.internal.cache.versions.VersionTag;
 import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
 import com.gemstone.gemfire.internal.cache.wan.GatewaySenderEventCallbackArgument;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
@@ -89,18 +211,6 @@ import com.gemstone.gemfire.internal.sequencelog.EntryLogger;
 import com.gemstone.gemfire.internal.util.concurrent.FutureResult;
 import com.gemstone.gemfire.internal.util.concurrent.StoppableCountDownLatch;
 import com.gemstone.gemfire.internal.util.concurrent.StoppableReadWriteLock;
-import org.apache.logging.log4j.Logger;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.regex.Pattern;
-
-import static com.gemstone.gemfire.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
 
 /**
  * Implementation of a local scoped-region. Note that this class has a different
@@ -111,12 +221,13 @@ import static com.gemstone.gemfire.internal.offheap.annotations.OffHeapIdentifie
  *
  */
 @SuppressWarnings("deprecation")
-public class LocalRegion extends AbstractRegion 
+public class LocalRegion extends AbstractRegion
   implements LoaderHelperFactory, ResourceListener<MemoryEvent>,
              DiskExceptionHandler, DiskRecoveryStore
 {
   private static final Logger logger = LogService.getLogger();
-  
+  private static final Pattern NAME_PATTERN = Pattern.compile("[aA-zZ0-9-_.]+");
+
   /**
    * Internal interface used to simulate failures when performing entry operations
    * @since GemFire 5.7
@@ -809,7 +920,7 @@ public class LocalRegion extends AbstractRegion
           }
           throw new RegionDestroyedException(toString(), getFullPath());
         }
-        validateRegionName(subregionName);
+        validateRegionName(subregionName, internalRegionArgs);
 
         validateSubregionAttributes(regionAttributes);
         String regionPath = calcFullPath(subregionName, this);
@@ -7769,17 +7880,41 @@ public class LocalRegion extends AbstractRegion
     this.entries.removeEntry(event.getKey(), re, false) ;      
   }
 
-  static void validateRegionName(String name)
+  static void validateRegionName(String name, InternalRegionArguments internalRegionArgs)
   {
     if (name == null) {
       throw new IllegalArgumentException(LocalizedStrings.LocalRegion_NAME_CANNOT_BE_NULL.toLocalizedString());
     }
-    if (name.length() == 0) {
+    if (name.isEmpty()) {
       throw new IllegalArgumentException(LocalizedStrings.LocalRegion_NAME_CANNOT_BE_EMPTY.toLocalizedString());
     }
-    if (name.indexOf(SEPARATOR) >= 0) {
+    if (name.contains(SEPARATOR)) {
       throw new IllegalArgumentException(LocalizedStrings.LocalRegion_NAME_CANNOT_CONTAIN_THE_SEPARATOR_0.toLocalizedString(SEPARATOR));
     }
+
+    // Validate the name of the region only if it isn't an internal region
+    if (internalRegionArgs.isInternalRegion()){
+      return;
+    }
+    if (internalRegionArgs.isUsedForMetaRegion()) {
+      return;
+    }
+    if (internalRegionArgs.isUsedForPartitionedRegionAdmin()) {
+      return;
+    }
+    if (internalRegionArgs.isUsedForPartitionedRegionBucket()) {
+      return;
+    }
+
+    if (name.startsWith("__")) {
+      throw new IllegalArgumentException("Region names may not begin with a double-underscore: " + name);
+    }
+
+    // Ensure the region only contains valid characters
+    Matcher matcher = NAME_PATTERN.matcher(name);
+    if (!matcher.matches()) {
+      throw new IllegalArgumentException("Region names may only be alphanumeric and may contain hyphens or underscores: " + name);
+    }
   }
 
   private void checkCacheClosed()

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHelper.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHelper.java
index e0d4f48..397f35f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHelper.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionHelper.java
@@ -17,8 +17,35 @@
 
 package com.gemstone.gemfire.internal.cache;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.CancelException;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryDestroyedException;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.EntryOperation;
+import com.gemstone.gemfire.cache.FixedPartitionAttributes;
+import com.gemstone.gemfire.cache.FixedPartitionResolver;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.PartitionResolver;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionExistsException;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.partition.PartitionNotAvailableException;
 import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
@@ -37,10 +64,6 @@ import com.gemstone.gemfire.internal.cache.partitioned.RegionAdvisor;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.util.*;
 
 /**
  */
@@ -287,6 +310,7 @@ public class PartitionedRegionHelper
         root = (DistributedRegion) gemCache.createVMRegion(PR_ROOT_REGION_NAME, ra, 
             new InternalRegionArguments()
             .setIsUsedForPartitionedRegionAdmin(true)
+            .setInternalRegion(true)
             .setCachePerfStatsHolder(prMetaStatsHolder));
         root.getDistributionAdvisor().addMembershipListener(new MemberFailureListener());
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index d703c6e..d21d6dc 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -16,8 +16,6 @@
  */
 package com.gemstone.gemfire.internal.cache.wan.parallel;
 
-import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -38,6 +36,7 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.CancelException;
@@ -557,7 +556,7 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
         try {
           prQ = (PartitionedRegion)cache
               .createVMRegion(prQName, ra, new InternalRegionArguments()
-                  .setInternalMetaRegion(meta).setDestroyLockFlag(true)
+                  .setInternalMetaRegion(meta).setDestroyLockFlag(true).setInternalRegion(true)
                   .setSnapshotInputStream(null).setImageTarget(null));
           // at this point we should be able to assert prQ == meta; 
           
@@ -570,12 +569,9 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
           //Wait for buckets to be recovered.
           prQ.shadowPRWaitForBucketRecovery();
 
-        } catch (IOException veryUnLikely) {
+        } catch (IOException | ClassNotFoundException veryUnLikely) {
           logger.fatal(LocalizedMessage.create(LocalizedStrings.SingleWriteSingleReadRegionQueue_UNEXPECTED_EXCEPTION_DURING_INIT_OF_0,
                   this.getClass()), veryUnLikely);
-        } catch (ClassNotFoundException alsoUnlikely) {
-          logger.fatal(LocalizedMessage.create(LocalizedStrings.SingleWriteSingleReadRegionQueue_UNEXPECTED_EXCEPTION_DURING_INIT_OF_0,
-                  this.getClass()), alsoUnlikely);
         }
         if (logger.isDebugEnabled()) {
           logger.debug("{}: Created queue region: {}", this, prQ);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java
index 57d6e34..efa7870 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderQueue.java
@@ -16,14 +16,51 @@
  */
 package com.gemstone.gemfire.internal.cache.wan.serial;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.PriorityQueue;
+import java.util.Set;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.CancelException;
 import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.TimeoutException;
 import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
 import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.cache.*;
+import com.gemstone.gemfire.internal.cache.CachedDeserializable;
+import com.gemstone.gemfire.internal.cache.Conflatable;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.EntryEventImpl;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.RegionQueue;
+import com.gemstone.gemfire.internal.cache.Token;
 import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
 import com.gemstone.gemfire.internal.cache.versions.VersionSource;
 import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
@@ -34,13 +71,6 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.offheap.OffHeapRegionEntryHelper;
 import com.gemstone.gemfire.pdx.internal.PeerTypeRegistration;
-import org.apache.logging.log4j.Logger;
-
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * @since GemFire 7.0
@@ -979,15 +1009,14 @@ public class SerialGatewaySenderQueue implements RegionQueue {
         SerialGatewaySenderQueueMetaRegion meta = new SerialGatewaySenderQueueMetaRegion(
             this.regionName, ra, null, gemCache, sender);
         try {
-          this.region = gemCache.createVMRegion(
-              this.regionName,
-              ra,
-              new InternalRegionArguments().setInternalMetaRegion(meta)
-                  .setDestroyLockFlag(true).setSnapshotInputStream(null)
-                  .setImageTarget(null)
-                  .setIsUsedForSerialGatewaySenderQueue(true)
-                  .setSerialGatewaySender(sender));
-          
+          this.region = gemCache.createVMRegion(this.regionName, ra, new InternalRegionArguments().setInternalMetaRegion(meta)
+                                                                                                  .setDestroyLockFlag(true)
+                                                                                                  .setSnapshotInputStream(null)
+                                                                                                  .setImageTarget(null)
+                                                                                                  .setIsUsedForSerialGatewaySenderQueue(true)
+                                                                                                  .setInternalRegion(true)
+                                                                                                  .setSerialGatewaySender(sender));
+
         } catch (IOException veryUnLikely) {
           logger.fatal(LocalizedMessage.create(LocalizedStrings.SingleWriteSingleReadRegionQueue_UNEXPECTED_EXCEPTION_DURING_INIT_OF_0,
                   this.getClass()), veryUnLikely);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
index e586829..6f6ae6d 100644
--- a/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
+++ b/geode-core/src/main/java/org/apache/geode/redis/GeodeRedisServer.java
@@ -32,27 +32,6 @@ import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.EntryEvent;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionDestroyedException;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.hll.HyperLogLogPlus;
-
-import org.apache.geode.redis.internal.ByteArrayWrapper;
-import org.apache.geode.redis.internal.ByteToCommandDecoder;
-import org.apache.geode.redis.internal.Coder;
-import org.apache.geode.redis.internal.ExecutionHandlerContext;
-import org.apache.geode.redis.internal.RedisDataType;
-import org.apache.geode.redis.internal.RegionProvider;
-
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.channel.Channel;
@@ -68,6 +47,32 @@ import io.netty.channel.socket.SocketChannel;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
 import io.netty.channel.socket.oio.OioServerSocketChannel;
 import io.netty.util.concurrent.Future;
+import org.apache.geode.redis.internal.ByteArrayWrapper;
+import org.apache.geode.redis.internal.ByteToCommandDecoder;
+import org.apache.geode.redis.internal.Coder;
+import org.apache.geode.redis.internal.ExecutionHandlerContext;
+import org.apache.geode.redis.internal.RedisDataType;
+import org.apache.geode.redis.internal.RegionProvider;
+
+import com.gemstone.gemfire.InternalGemFireError;
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
+import com.gemstone.gemfire.internal.hll.HyperLogLogPlus;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
 /**
  * The GeodeRedisServer is a server that understands the Redis protocol. As
@@ -419,19 +424,32 @@ public class GeodeRedisServer {
 
   private void initializeRedis() {
     synchronized (this.cache) {
-      RegionFactory<String, RedisDataType> rfMeta = cache.createRegionFactory(RegionShortcut.REPLICATE);
-      rfMeta.addCacheListener(this.metaListener);
-      RegionFactory<ByteArrayWrapper, ByteArrayWrapper> rfString = cache.createRegionFactory(DEFAULT_REGION_TYPE);
-      RegionFactory<ByteArrayWrapper, HyperLogLogPlus> rfHLL = cache.createRegionFactory(DEFAULT_REGION_TYPE);
       Region<ByteArrayWrapper, ByteArrayWrapper> stringsRegion;
-      if ((stringsRegion = this.cache.getRegion(STRING_REGION)) == null)
-        stringsRegion = rfString.create(GeodeRedisServer.STRING_REGION);
+      InternalRegionArguments ira = new InternalRegionArguments().setInternalRegion(true);
+      AttributesFactory af = new AttributesFactory();
+      af.setScope(Scope.LOCAL);
+      RegionAttributes ra = af.create();
       Region<ByteArrayWrapper, HyperLogLogPlus> hLLRegion;
-      if ((hLLRegion = this.cache.getRegion(HLL_REGION)) == null)
-        hLLRegion = rfHLL.create(HLL_REGION);
       Region<String, RedisDataType> redisMetaData;
-      if ((redisMetaData = this.cache.getRegion(REDIS_META_DATA_REGION)) == null)
-        redisMetaData = rfMeta.create(REDIS_META_DATA_REGION);
+      GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
+      try {
+        if ((stringsRegion = cache.getRegion(STRING_REGION)) == null) {
+          stringsRegion = gemFireCache.createVMRegion(GeodeRedisServer.STRING_REGION, ra, ira);
+        }
+        if ((hLLRegion = cache.getRegion(HLL_REGION)) == null) {
+          hLLRegion = gemFireCache.createVMRegion(HLL_REGION, ra, ira);
+        }
+        if ((redisMetaData = cache.getRegion(REDIS_META_DATA_REGION)) == null) {
+          af.addCacheListener(metaListener);
+          af.setDataPolicy(DataPolicy.REPLICATE);
+          redisMetaData = gemFireCache.createVMRegion(REDIS_META_DATA_REGION, af.create(), ira);
+        }
+      } catch (IOException | ClassNotFoundException e) {
+        // only if loading snapshot, not here
+        InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.GemFireCache_UNEXPECTED_EXCEPTION.toLocalizedString());
+        assErr.initCause(e);
+        throw assErr;
+      }
       this.regionCache = new RegionProvider(stringsRegion, hLLRegion, redisMetaData, expirationFutures, expirationExecutor, this.DEFAULT_REGION_TYPE);
       redisMetaData.put(REDIS_META_DATA_REGION, RedisDataType.REDIS_PROTECTED);
       redisMetaData.put(HLL_REGION, RedisDataType.REDIS_PROTECTED);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
index d677b17..10e14d4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
@@ -117,101 +117,13 @@ public class QueryJUnitTest {
   }
 
   @Test
-  public void test003UnicodeInRegionNameAndQuery() {
-    CacheUtils.log("testUnicodeInQuery");
-    try{
-      Region region = CacheUtils.createRegion("\u4e2d��", Portfolio.class);
-      Portfolio p = new Portfolio(0);
-      p.unicode\u1e64tring = "\u4e2d��";
-      region.put("1",p);
-      region.put("2",new Portfolio(1));
-      String queryStr = "SELECT DISTINCT * FROM " + region.getFullPath() +" WHERE unicode\u1e64tring = '\u4e2d��'";
-      Query q = CacheUtils.getQueryService().newQuery(queryStr);
-      SelectResults results = (SelectResults)q.execute();
-      assertEquals(results.size(), 1);
-      p = (Portfolio)results.iterator().next();
-      assertEquals(p.unicode\u1e64tring, "\u4e2d��");
-    }catch(Exception e){
-      e.printStackTrace();
-      fail("Exception during Query.execute");
-    }
-  }
-
-  @Test
-  public void test004UnicodeInRegionNameAndQueryWithIndex() {
-    try {
-      String unicode = "\u2030\u220f\u2260���±��";
-      Region region = CacheUtils.createRegion(unicode, Portfolio.class);
-      CacheUtils.getQueryService().createIndex("unicodeIndex", "unicode\u1e64tring",
-          "/'" + unicode + "'");
-      Portfolio p = new Portfolio(0);
-      p.unicode\u1e64tring = unicode;
-      region.put("1", p);
-      region.put("2", new Portfolio(1));
-      String queryStr = "SELECT DISTINCT * FROM /'" + unicode
-          + "' WHERE unicode\u1e64tring = '" + unicode + "'";
-      Query q = CacheUtils.getQueryService().newQuery(queryStr);
-      SelectResults results = (SelectResults) q.execute();
-      assertEquals(results.size(), 1);
-      p = (Portfolio) results.iterator().next();
-      assertEquals(p.unicode\u1e64tring, unicode);
-
-      String unicode2 = "\u2030�±�\u220f\u2260��";
-      CacheUtils.createRegion(unicode2, Portfolio.class);
-      queryStr = "SELECT DISTINCT * FROM /'" + unicode + "' u1, /'" + unicode2
-          + "' u2 WHERE u1.unicode\u1e64tring = '" + unicode
-          + "' order by u1.unicode\u1e64tring  limit 1";
-      CacheUtils.log(queryStr);
-      CacheUtils.getQueryService().newQuery(queryStr).execute();
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("Exception during Query.execute");
-    }
-  }
-
-
-  @Test
-  public void test005UnicodeInRegionNameAndQueryWithIndexUsingQuotesAsDelim() {
-    try {
-      String unicode = "\u2030\u220f\u2260���±*+|<?>=. !@#$%^&*()_+,;:��[]{}?";
-      Region region = CacheUtils.createRegion(unicode, Portfolio.class);
-      CacheUtils.getQueryService().createIndex("unicodeIndex", "unicode\u1e64tring",
-          "/'" + unicode + "'");
-      Portfolio p = new Portfolio(0);
-      p.unicode\u1e64tring = unicode;
-      region.put("1", p);
-      region.put("2", new Portfolio(1));
-      String queryStr = "SELECT DISTINCT * FROM /'" + unicode
-          + "' WHERE unicode\u1e64tring = '" + unicode + "'";
-      Query q = CacheUtils.getQueryService().newQuery(queryStr);
-      SelectResults results = (SelectResults) q.execute();
-      assertEquals(results.size(), 1);
-      p = (Portfolio) results.iterator().next();
-      assertEquals(p.unicode\u1e64tring, unicode);
-
-      String unicode2 = "!@#$%^&*(|)_?+,;: ��\u2030\u220f\u2260���±*+<>=.[]{}?";
-      CacheUtils.createRegion(unicode2, Portfolio.class);
-      queryStr = "SELECT DISTINCT * FROM /'" + unicode + "' u1, /'" + unicode2
-          + "' u2 WHERE u1.unicode\u1e64tring = '" + unicode
-          + "' order by u1.unicode\u1e64tring  limit 1";
-      CacheUtils.log(queryStr);
-      CacheUtils.getQueryService().newQuery(queryStr).execute();
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("Exception during Query.execute");
-    }
-  }
-
-  @Test
-  public void test006Compile() {
+  public void test003Compile() {
     CacheUtils.log("testCompile");
     //fail("The test case is empty.");
   }
   
   @Test
-  public void test007IsCompiled() {
+  public void test004IsCompiled() {
     CacheUtils.log("testIsCompiled");
     String queryStr = "SELECT DISTINCT * FROM /root";
     Query q = CacheUtils.getQueryService().newQuery(queryStr);
@@ -220,7 +132,7 @@ public class QueryJUnitTest {
   }
     
   @Test
-  public void test008GetStatistics() {
+  public void test005GetStatistics() {
     CacheUtils.log("testGetStatistics");
     String queryStr = "SELECT DISTINCT * FROM /Portfolios where status='active'";
     Query q = CacheUtils.getQueryService().newQuery(queryStr);
@@ -253,7 +165,7 @@ public class QueryJUnitTest {
   }
   
   @Test
-  public void test009GetRegionsInQuery() {
+  public void test006GetRegionsInQuery() {
     
     String queryStrs[] = new String[] {
         "SELECT DISTINCT * FROM /Portfolios where status='active'",
@@ -300,7 +212,7 @@ public class QueryJUnitTest {
   }
 
   @Test
-  public void test010UndefinedResults() {
+  public void test007UndefinedResults() {
     CacheUtils.log("testQueryExceptionLogMessage");
     Region region = CacheUtils.createRegion("Portfolios", Portfolio.class);
     region.put("1",new Portfolio(1));
@@ -334,7 +246,7 @@ public class QueryJUnitTest {
   }  
 
   @Test
-  public void test011NullCollectionField() {
+  public void test008NullCollectionField() {
     Region region = CacheUtils.createRegion("Portfolios", Portfolio.class);
     for (int i = 0; i < 10; i++) {
       Portfolio p = new Portfolio(i);
@@ -365,7 +277,7 @@ public class QueryJUnitTest {
     } catch (Exception e) {
       fail("Query execution failed " + e);
     }
-    assertEquals("Incorrect result size ", 1, sr.size());
+    assertEquals("Incorrect result size ", 2, sr.size());
   }
 
   @Test
@@ -448,6 +360,4 @@ public class QueryJUnitTest {
       return exceptionsThrown.size() == 0;
     }
   }
-
-  
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/cache/query/RegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/RegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/RegionJUnitTest.java
index 9564a5f..c35847e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/RegionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/RegionJUnitTest.java
@@ -169,25 +169,17 @@ public class RegionJUnitTest{
     
     String queryStrs[] = new String[] {
         "SELECT * FROM /pos",
-        "SELECT * FROM /pos where status='active'",
-        "SELECT * FROM /p:os", // Using ':' in region name.
-        "SELECT * FROM /p@os", // Using '@' in region name.
-        "SELECT * FROM /p-os", // Using '-' in region name.
-        "SELECT * FROM /p#os", // Using '#' in region name.
-        "SELECT * FROM /p+os", // Using '+' in region name.
-    };
+        "SELECT * FROM /pos where status='active'"
+  };
     
     CacheUtils.startCache();
     cache = CacheUtils.getCache();
     AttributesFactory attributesFactory = new AttributesFactory();
     attributesFactory.setValueConstraint(Portfolio.class);
     RegionAttributes regionAttributes = attributesFactory.create();
-    
-    cache.createRegion("p:os",regionAttributes);
-    cache.createRegion("p@os",regionAttributes);
+
+    cache.createRegion("p_os",regionAttributes);
     cache.createRegion("p-os",regionAttributes);
-    cache.createRegion("p#os",regionAttributes);
-    cache.createRegion("p+os",regionAttributes);
 
     for(int i=0; i<queryStrs.length;++i) {
        Query q = CacheUtils.getQueryService().newQuery(queryStrs[i]);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index 5e68b9e..954846f 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -16,13 +16,18 @@
  */
 package com.gemstone.gemfire.distributed;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.ForcedDisconnectException;
 import com.gemstone.gemfire.GemFireConfigException;
@@ -32,7 +37,12 @@ import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.distributed.internal.*;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionException;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.InternalLocator;
+import com.gemstone.gemfire.distributed.internal.MembershipListener;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
 import com.gemstone.gemfire.distributed.internal.membership.MembershipTestHook;
@@ -46,16 +56,20 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.internal.tcp.Connection;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Tests the ability of the {@link Locator} API to start and stop
@@ -167,7 +181,7 @@ public class LocatorDUnitTest extends JUnit4DistributedTestCase {
 
     // ensure that I, as a collocated locator owner, can create a cache region
     Cache cache = CacheFactory.create(system);
-    Region r = cache.createRegionFactory(RegionShortcut.REPLICATE).create("test region");
+    Region r = cache.createRegionFactory(RegionShortcut.REPLICATE).create("test-region");
     assertNotNull("expected to create a region", r);
 
     // create a lock service and have every vm get a lock

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
index 6c89ab7..7c93604 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
@@ -284,38 +284,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
     vm3.invoke(getCacheSerializableRunnableForPRValidate(regionNamePrefix));
   }
 
-  /**
-   * Test Partitioned Region names that contain spaces
-   * @throws Exception
-   */
-  @Test
-  public void testPartitionedRegionNameWithSpaces() throws Exception 
-  {
-    final String rName = getUniqueName() + " with some spaces";
-    
-    CacheSerializableRunnable csr = new CacheSerializableRunnable("validateNoExceptionWhenUsingNameWithSpaces") {
-      @Override
-      public void run2() throws CacheException
-      {
-        Cache cache = getCache();
-        Region partitionedregion = null;
-        AttributesFactory attr = new AttributesFactory();
-        attr.setPartitionAttributes(new PartitionAttributesFactory()
-            .setRedundantCopies(0).create());
-        partitionedregion = cache.createRegion(rName, attr
-            .create());
-        assertNotNull("Partitioned Region ref null", partitionedregion);
-        assertNotNull("Cache does not contain PR " + rName, cache
-            .getRegion(rName));
-        assertTrue("Partitioned Region ref claims to be destroyed",
-            !partitionedregion.isDestroyed());
-      }
-    };
-    Host.getHost(0).getVM(2).invoke(csr);
-    Host.getHost(0).getVM(3).invoke(csr);
-  }
-
-  /**
+   /**
    * Test whether partition region creation is preveented when
    * an instance is created that has the incorrect redundancy
    */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
index fa00bef..7d719be 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
@@ -46,7 +46,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
 
   private VM ClientVM;
 
-  private String regionName;
+  private static final String REGION_NAME = "Bug36829_region";
 
   private int PORT;
 
@@ -55,7 +55,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
     Host host = Host.getHost(0);
     this.serverVM = host.getVM(0);
     this.ClientVM = host.getVM(1);
-    regionName = Bug36829DUnitTest.class.getName() + "_region";
+
     CacheServerTestUtil.disableShufflingOfEndpoints();
   }
 
@@ -70,8 +70,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
           ))).intValue();
 
     this.ClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(
-            getClientPool(NetworkUtils.getServerHostName(ClientVM.getHost()), PORT, true, 0),
-            regionName,
+            getClientPool(NetworkUtils.getServerHostName(ClientVM.getHost()), PORT, true, 0), REGION_NAME,
             getClientDistributedSystemProperties(durableClientId,
                 durableClientTimeout), Boolean.TRUE ));
 
@@ -87,7 +86,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
     this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKey( "Key1" ));
 
     // creating Region on the Server
-/*    this.serverVM.invoke(() -> CacheServerTestUtil.createRegion( regionName ));
+/*    this.serverVM.invoke(() -> CacheServerTestUtil.createRegion( REGION_NAME ));
      // should be successful.
     this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKeyAfterRegionCreation( "Key1" ));*/
 
@@ -100,7 +99,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
 
   private static void registerKey(String key) throws Exception {
     // Get the region
-    Region region = CacheServerTestUtil.getCache().getRegion(Bug36829DUnitTest.class.getName() + "_region");
+    Region region = CacheServerTestUtil.getCache().getRegion(REGION_NAME);
     assertNotNull(region);
     try {
       region.registerInterest(key, InterestResultPolicy.NONE);
@@ -112,7 +111,7 @@ public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
 
   private static void registerKeyAfterRegionCreation(String key) throws Exception {
     // Get the region
-    Region region = CacheServerTestUtil.getCache().getRegion(Bug36829DUnitTest.class.getName() + "_region");
+    Region region = CacheServerTestUtil.getCache().getRegion(REGION_NAME);
     assertNotNull(region);
 
     region.registerInterest(key, InterestResultPolicy.NONE);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
index ee4471f..3d18e23 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
@@ -60,7 +60,7 @@ public class Bug37805DUnitTest extends JUnit4DistributedTestCase {
     Host host = Host.getHost(0);
     this.server1VM = host.getVM(0);
     this.durableClientVM = host.getVM(1);
-    regionName = Bug37805DUnitTest.class.getName() + "_region";
+    regionName = "Bug37805_region";
     CacheServerTestUtil.disableShufflingOfEndpoints();
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/management/RegionCreateDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/RegionCreateDestroyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/RegionCreateDestroyDUnitTest.java
new file mode 100644
index 0000000..8b75f1b
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/RegionCreateDestroyDUnitTest.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.management;
+
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.RMIException;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+
+@Category({ DistributedTest.class, SecurityTest.class })
+public class RegionCreateDestroyDUnitTest extends JUnit4CacheTestCase {
+
+  private static final String GOOD_REGION_NAME = "Good-Region";
+  private static final String BAD_REGION_NAME = "Bad@Region";
+  private static final String RESERVED_REGION_NAME = "__ReservedRegion";
+
+  protected VM client1 = null;
+  protected VM client2 = null;
+  protected VM client3 = null;
+  protected int serverPort;
+
+  @Before
+  public void before() throws Exception {
+    final Host host = Host.getHost(0);
+    this.client1 = host.getVM(1);
+    this.client2 = host.getVM(2);
+    this.client3 = host.getVM(3);
+
+    Properties props = new Properties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+
+    getSystem(props);
+
+  }
+
+  private void startServer(final Cache cache) throws IOException {
+    CacheServer server1 = cache.addCacheServer();
+    server1.setPort(0);
+    server1.start();
+
+    this.serverPort = server1.getPort();
+  }
+
+  @Override
+  public void preTearDownCacheTestCase() throws Exception {
+    Invoke.invokeInEveryVM(() -> closeCache());
+    closeCache();
+  }
+
+  protected Properties createClientProperties() {
+    Properties props = new Properties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+    props.setProperty(SECURITY_LOG_LEVEL, "finest");
+    return props;
+  }
+
+  @Test
+  public void testCreateDestroyValidRegion() throws InterruptedException {
+    Cache serverCache = getCache();
+    serverCache.createRegionFactory(RegionShortcut.REPLICATE).create(GOOD_REGION_NAME);
+
+    try {
+      startServer(serverCache);
+    } catch (IOException e) {
+      fail(e.getMessage());
+    }
+    client1.invoke(() -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties()).setPoolSubscriptionEnabled(true)
+                                                                          .addPoolServer("localhost", serverPort)
+                                                                          .create();
+      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(GOOD_REGION_NAME);
+      region.destroyRegion();
+      assertThat(region.isDestroyed()).isTrue();
+    });
+  }
+
+  @Test
+  public void testCreateInvalidRegion() throws InterruptedException {
+    Cache serverCache = getCache();
+    try {
+      serverCache.createRegionFactory(RegionShortcut.REPLICATE).create(BAD_REGION_NAME);
+    } catch (IllegalArgumentException iae) {
+      assertEquals("Region names may only be alphanumeric and may contain hyphens or underscores: Bad@Region", iae.getMessage());
+    }
+
+    try {
+      startServer(serverCache);
+    } catch (IOException e) {
+      fail(e.getMessage());
+    }
+    client1.invoke(() -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties()).setPoolSubscriptionEnabled(true)
+                                                                          .addPoolServer("localhost", serverPort)
+                                                                          .create();
+      try {
+        cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(BAD_REGION_NAME);
+        fail("Should have thrown an IllegalArgumentException");
+      } catch (IllegalArgumentException iae) {
+        assertEquals("Region names may only be alphanumeric and may contain hyphens or underscores: Bad@Region", iae.getMessage());
+      }
+    });
+  }
+
+  @Test
+  public void testCreateDestroyReservedRegion() throws InterruptedException {
+    Cache serverCache = getCache();
+    try {
+      serverCache.createRegionFactory(RegionShortcut.REPLICATE).create(RESERVED_REGION_NAME);
+      fail("Should have thrown an IllegalArgumentException");
+    } catch (IllegalArgumentException arg) {
+      assertEquals("Region names may not begin with a double-underscore: __ReservedRegion", arg.getMessage());
+    }
+    try {
+      startServer(serverCache);
+    } catch (IOException e) {
+      fail(e.getMessage());
+    }
+
+    try {
+      client1.invoke(() -> {
+        ClientCache cache = new ClientCacheFactory(createClientProperties()).setPoolSubscriptionEnabled(true)
+                                                                            .addPoolServer("localhost", serverPort)
+                                                                            .create();
+        try {
+          cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(RESERVED_REGION_NAME);
+          fail("Should have thrown an IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+          assertEquals("Region names may not begin with a double-underscore: __ReservedRegion", e.getMessage());
+        }
+      });
+    } catch (RMIException rmi) {
+      rmi.getCause();
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7ca571c5/geode-core/src/test/java/com/gemstone/gemfire/management/RegionManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/RegionManagementDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/RegionManagementDUnitTest.java
index 9b72ff7..081be54 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/RegionManagementDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/RegionManagementDUnitTest.java
@@ -16,15 +16,8 @@
  */
 package com.gemstone.gemfire.management;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -37,6 +30,9 @@ import javax.management.Notification;
 import javax.management.NotificationListener;
 import javax.management.ObjectName;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheListener;
@@ -64,6 +60,7 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * This class checks and verifies various data and operations exposed through
@@ -362,12 +359,8 @@ public class RegionManagementDUnitTest extends ManagementTestBase {
           attributesFactory.setValueConstraint(Portfolio.class);
           RegionAttributes regionAttributes = attributesFactory.create();
           
-          cache.createRegion("p:os",regionAttributes);
-          cache.createRegion("p@os",regionAttributes);
           cache.createRegion("p-os",regionAttributes);
-          cache.createRegion("p#os",regionAttributes);
-          cache.createRegion("p+os",regionAttributes);
-          cache.createRegion("p?os",regionAttributes);
+          cache.createRegion("p_os",regionAttributes);
         }
       });
 
@@ -384,12 +377,8 @@ public class RegionManagementDUnitTest extends ManagementTestBase {
           ManagementService service = getManagementService();
           
           try {
-            MBeanUtil.getDistributedRegionMbean("/p:os", 1);
-            MBeanUtil.getDistributedRegionMbean("/p@os", 1);
             MBeanUtil.getDistributedRegionMbean("/p-os", 1);
-            MBeanUtil.getDistributedRegionMbean("/p#os", 1);
-            MBeanUtil.getDistributedRegionMbean("/p+os", 1);
-            MBeanUtil.getDistributedRegionMbean("/p?os", 1);
+            MBeanUtil.getDistributedRegionMbean("/p_os", 1);
 
           } catch (Exception e) {
             InternalDistributedSystem.getLoggerI18n().fine(