geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/3] geode git commit: Fix precheckin failures
Date Fri, 02 Jun 2017 20:58:53 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2632-19 9b1905c23 -> b8d211f44


http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java b/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
deleted file mode 100644
index bdd3d71..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTHENTICATOR;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTHENTICATOR;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.geode.security.GemFireSecurityException;
-import org.apache.geode.security.TestPostProcessor;
-import org.apache.geode.security.TestSecurityManager;
-import org.apache.geode.security.SimpleTestSecurityManager;
-import org.apache.geode.test.junit.categories.UnitTest;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.mgt.DefaultSecurityManager;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-@Category(UnitTest.class)
-public class IntegratedSecurityServiceTest {
-
-  private Properties properties;
-  private SecurityService securityService;
-
-  @Before
-  public void before() {
-    properties = new Properties();
-    securityService = SecurityServiceFactory.create(null, null);
-    securityService.initSecurity(properties);
-  }
-
-  @Test
-  public void testGetObjectFromConstructor() {
-    String string = SecurityService.getObjectOfType(String.class.getName(), String.class);
-    assertNotNull(string);
-
-    CharSequence charSequence =
-        SecurityService.getObjectOfType(String.class.getName(), CharSequence.class);
-    assertNotNull(charSequence);
-
-    assertThatThrownBy(() -> SecurityService.getObjectOfType("com.abc.testString", String.class))
-        .isInstanceOf(GemFireSecurityException.class);
-
-    assertThatThrownBy(() -> SecurityService.getObjectOfType(String.class.getName(), Boolean.class))
-        .isInstanceOf(GemFireSecurityException.class);
-
-    assertThatThrownBy(() -> SecurityService.getObjectOfType("", String.class))
-        .isInstanceOf(GemFireSecurityException.class);
-
-    assertThatThrownBy(() -> SecurityService.getObjectOfType(null, String.class))
-        .isInstanceOf(GemFireSecurityException.class);
-
-    assertThatThrownBy(() -> SecurityService.getObjectOfType("  ", String.class))
-        .isInstanceOf(GemFireSecurityException.class);
-  }
-
-  @Test
-  public void testGetObjectFromFactoryMethod() {
-    String string =
-        SecurityService.getObjectOfType(Factories.class.getName() + ".getString", String.class);
-    assertNotNull(string);
-
-    CharSequence charSequence =
-        SecurityService.getObjectOfType(Factories.class.getName() + ".getString", String.class);
-    assertNotNull(charSequence);
-
-    assertThatThrownBy(() -> SecurityService
-        .getObjectOfType(Factories.class.getName() + ".getStringNonStatic", String.class))
-            .isInstanceOf(GemFireSecurityException.class);
-
-    assertThatThrownBy(() -> SecurityService
-        .getObjectOfType(Factories.class.getName() + ".getNullString", String.class))
-            .isInstanceOf(GemFireSecurityException.class);
-  }
-
-  @Test
-  public void testInitialSecurityFlags() {
-    // initial state of IntegratedSecurityService
-    assertFalse(securityService.isIntegratedSecurity());
-    assertFalse(securityService.isClientSecurityRequired());
-    assertFalse(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testInitWithSecurityManager() {
-    properties.setProperty(SECURITY_MANAGER, "org.apache.geode.security.TestSecurityManager");
-    properties.setProperty(TestSecurityManager.SECURITY_JSON,
-        "org/apache/geode/security/templates/security.json");
-
-    securityService.initSecurity(properties);
-
-    assertTrue(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertTrue(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testInitWithClientAuthenticator() {
-    properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
-
-    securityService.initSecurity(properties);
-    assertFalse(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertFalse(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testInitWithPeerAuthenticator() {
-    properties.setProperty(SECURITY_PEER_AUTHENTICATOR, "org.abc.test");
-
-    securityService.initSecurity(properties);
-
-    assertFalse(securityService.isIntegratedSecurity());
-    assertFalse(securityService.isClientSecurityRequired());
-    assertTrue(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testInitWithAuthenticators() {
-    properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
-    properties.setProperty(SECURITY_PEER_AUTHENTICATOR, "org.abc.test");
-
-    securityService.initSecurity(properties);
-
-    assertFalse(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertTrue(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testInitWithShiroAuthenticator() {
-    properties.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");
-
-    securityService.initSecurity(properties);
-
-    assertTrue(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertTrue(securityService.isPeerSecurityRequired());
-  }
-
-  @Test
-  public void testNoInit() {
-    assertFalse(securityService.isIntegratedSecurity());
-  }
-
-  @Test
-  public void testInitWithOutsideShiroSecurityManager() {
-    SecurityUtils.setSecurityManager(new DefaultSecurityManager());
-    securityService.initSecurity(properties);
-    assertTrue(securityService.isIntegratedSecurity());
-  }
-
-  @Test
-  public void testSetSecurityManager() {
-    // initially
-    assertFalse(securityService.isIntegratedSecurity());
-
-    // init with client authenticator
-    properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
-    securityService.initSecurity(properties);
-    assertFalse(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertFalse(securityService.isPeerSecurityRequired());
-
-    // set a security manager
-    securityService.setSecurityManager(new SimpleTestSecurityManager());
-    assertTrue(securityService.isIntegratedSecurity());
-    assertTrue(securityService.isClientSecurityRequired());
-    assertTrue(securityService.isPeerSecurityRequired());
-    assertFalse(securityService.needPostProcess());
-
-    // set a post processor
-    securityService.setPostProcessor(new TestPostProcessor());
-    assertTrue(securityService.isIntegratedSecurity());
-    assertTrue(securityService.needPostProcess());
-  }
-
-  @After
-  public void after() {
-    securityService.close();
-  }
-
-  private static class Factories {
-
-    public static String getString() {
-      return new String();
-    }
-
-    public static String getNullString() {
-      return null;
-    }
-
-    public String getStringNonStatic() {
-      return new String();
-    }
-
-    public static Boolean getBoolean() {
-      return Boolean.TRUE;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceTest.java b/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceTest.java
new file mode 100644
index 0000000..279e818
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceTest.java
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.security;
+
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTHENTICATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTHENTICATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.security.GemFireSecurityException;
+import org.apache.geode.security.TestSecurityManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.mgt.DefaultSecurityManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+
+@Category(UnitTest.class)
+public class SecurityServiceTest {
+
+  private Properties properties;
+  private DistributionConfig distributionConfig;
+  private SecurityService securityService;
+
+  @Before
+  public void before() {
+    this.properties = new Properties();
+    this.distributionConfig = mock(DistributionConfig.class);
+    when(this.distributionConfig.getSecurityProps()).thenReturn(this.properties);
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+  }
+
+  @After
+  public void after() throws Exception {
+    this.securityService.close();
+    SecurityUtils.setSecurityManager(null);
+  }
+
+  @Test
+  public void testGetObjectFromConstructor() {
+    String string = SecurityService.getObjectOfType(String.class.getName(), String.class);
+    assertNotNull(string);
+
+    CharSequence charSequence =
+        SecurityService.getObjectOfType(String.class.getName(), CharSequence.class);
+    assertNotNull(charSequence);
+
+    assertThatThrownBy(() -> SecurityService.getObjectOfType("com.abc.testString", String.class))
+        .isInstanceOf(GemFireSecurityException.class);
+
+    assertThatThrownBy(() -> SecurityService.getObjectOfType(String.class.getName(), Boolean.class))
+        .isInstanceOf(GemFireSecurityException.class);
+
+    assertThatThrownBy(() -> SecurityService.getObjectOfType("", String.class))
+        .isInstanceOf(GemFireSecurityException.class);
+
+    assertThatThrownBy(() -> SecurityService.getObjectOfType(null, String.class))
+        .isInstanceOf(GemFireSecurityException.class);
+
+    assertThatThrownBy(() -> SecurityService.getObjectOfType("  ", String.class))
+        .isInstanceOf(GemFireSecurityException.class);
+  }
+
+  @Test
+  public void testGetObjectFromFactoryMethod() {
+    String string =
+        SecurityService.getObjectOfType(Factories.class.getName() + ".getString", String.class);
+    assertNotNull(string);
+
+    CharSequence charSequence =
+        SecurityService.getObjectOfType(Factories.class.getName() + ".getString", String.class);
+    assertNotNull(charSequence);
+
+    assertThatThrownBy(() -> SecurityService
+        .getObjectOfType(Factories.class.getName() + ".getStringNonStatic", String.class))
+            .isInstanceOf(GemFireSecurityException.class);
+
+    assertThatThrownBy(() -> SecurityService
+        .getObjectOfType(Factories.class.getName() + ".getNullString", String.class))
+            .isInstanceOf(GemFireSecurityException.class);
+  }
+
+  @Test
+  public void testInitialSecurityFlags() {
+    // initial state of IntegratedSecurityService
+    assertFalse(this.securityService.isIntegratedSecurity());
+    assertFalse(this.securityService.isClientSecurityRequired());
+    assertFalse(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testInitWithSecurityManager() {
+    this.properties.setProperty(SECURITY_MANAGER, "org.apache.geode.security.TestSecurityManager");
+    this.properties.setProperty(TestSecurityManager.SECURITY_JSON,
+        "org/apache/geode/security/templates/security.json");
+
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertTrue(this.securityService.isIntegratedSecurity());
+    assertTrue(this.securityService.isClientSecurityRequired());
+    assertTrue(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testInitWithClientAuthenticator() {
+    this.properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertFalse(this.securityService.isIntegratedSecurity());
+    assertTrue(this.securityService.isClientSecurityRequired());
+    assertFalse(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testInitWithPeerAuthenticator() {
+    this.properties.setProperty(SECURITY_PEER_AUTHENTICATOR, "org.abc.test");
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertFalse(this.securityService.isIntegratedSecurity());
+    assertFalse(this.securityService.isClientSecurityRequired());
+    assertTrue(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testInitWithAuthenticators() {
+    this.properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
+    this.properties.setProperty(SECURITY_PEER_AUTHENTICATOR, "org.abc.test");
+
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertFalse(this.securityService.isIntegratedSecurity());
+    assertTrue(this.securityService.isClientSecurityRequired());
+    assertTrue(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testInitWithShiroAuthenticator() {
+    this.properties.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");
+
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertTrue(this.securityService.isIntegratedSecurity());
+    assertTrue(this.securityService.isClientSecurityRequired());
+    assertTrue(this.securityService.isPeerSecurityRequired());
+  }
+
+  @Test
+  public void testNoInit() {
+    assertFalse(this.securityService.isIntegratedSecurity());
+  }
+
+  @Test
+  public void testInitWithOutsideShiroSecurityManager() {
+    SecurityUtils.setSecurityManager(new DefaultSecurityManager());
+    this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+
+    assertTrue(this.securityService.isIntegratedSecurity());
+  }
+
+  // @Test
+  // public void testSetSecurityManager() {
+  // // initially
+  // assertFalse(this.securityService.isIntegratedSecurity());
+  //
+  // // init with client authenticator
+  // this.properties.setProperty(SECURITY_CLIENT_AUTHENTICATOR, "org.abc.test");
+  // this.securityService = SecurityServiceFactory.create(null, this.distributionConfig);
+  //
+  // assertFalse(this.securityService.isIntegratedSecurity());
+  // assertTrue(this.securityService.isClientSecurityRequired());
+  // assertFalse(this.securityService.isPeerSecurityRequired());
+  //
+  // // set a security manager
+  // this.securityService.setSecurityManager(new SimpleTestSecurityManager());
+  // assertTrue(this.securityService.isIntegratedSecurity());
+  // assertTrue(this.securityService.isClientSecurityRequired());
+  // assertTrue(this.securityService.isPeerSecurityRequired());
+  // assertFalse(this.securityService.needPostProcess());
+  //
+  // // set a post processor
+  // this.securityService.setPostProcessor(new TestPostProcessor());
+  // assertTrue(this.securityService.isIntegratedSecurity());
+  // assertTrue(this.securityService.needPostProcess());
+  // }
+
+  private static class Factories {
+
+    public static String getString() {
+      return new String();
+    }
+
+    public static String getNullString() {
+      return null;
+    }
+
+    public String getStringNonStatic() {
+      return new String();
+    }
+
+    public static Boolean getBoolean() {
+      return Boolean.TRUE;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
deleted file mode 100644
index d0ea209..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanShiroJUnitTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.apache.geode.management.CacheServerMXBean;
-import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
-import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
-import org.apache.geode.test.dunit.rules.ServerStarterRule;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category({IntegrationTest.class, SecurityTest.class})
-public class CacheServerMBeanShiroJUnitTest {
-  private CacheServerMXBean bean;
-
-  @ClassRule
-  public static ServerStarterRule server = new ServerStarterRule()
-      .withProperty(SECURITY_SHIRO_INIT, "shiro.ini").withJMXManager().withAutoStart();
-
-  @Rule
-  public MBeanServerConnectionRule connectionRule =
-      new MBeanServerConnectionRule(server::getJmxPort);
-
-  @Before
-  public void setUp() throws Exception {
-    bean = connectionRule.getProxyMBean(CacheServerMXBean.class);
-  }
-
-  @Test
-  @ConnectionConfiguration(user = "root", password = "secret")
-  public void testAllAccess() throws Exception {
-    bean.removeIndex("foo");
-    bean.executeContinuousQuery("bar");
-    bean.fetchLoadProbe();
-    bean.getActiveCQCount();
-    bean.stopContinuousQuery("bar");
-    bean.closeAllContinuousQuery("bar");
-    bean.isRunning();
-    bean.showClientQueueDetails("foo");
-  }
-
-  @Test
-  @ConnectionConfiguration(user = "guest", password = "guest")
-  public void testNoAccess() throws Exception {
-    assertThatThrownBy(() -> bean.removeIndex("foo"))
-        .hasMessageContaining(TestCommand.dataManage.toString());
-    assertThatThrownBy(() -> bean.executeContinuousQuery("bar"))
-        .hasMessageContaining(TestCommand.dataRead.toString());
-    assertThatThrownBy(() -> bean.fetchLoadProbe())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-    assertThatThrownBy(() -> bean.getActiveCQCount())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-    assertThatThrownBy(() -> bean.stopContinuousQuery("bar"))
-        .hasMessageContaining(TestCommand.dataManage.toString());
-    assertThatThrownBy(() -> bean.closeAllContinuousQuery("bar"))
-        .hasMessageContaining(TestCommand.dataManage.toString());
-    assertThatThrownBy(() -> bean.isRunning())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-    assertThatThrownBy(() -> bean.showClientQueueDetails("bar"))
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-  }
-
-  @Test
-  @ConnectionConfiguration(user = "regionAReader", password = "password")
-  public void testRegionAccess() throws Exception {
-    assertThatThrownBy(() -> bean.removeIndex("foo"))
-        .hasMessageContaining(TestCommand.dataManage.toString());
-    assertThatThrownBy(() -> bean.fetchLoadProbe())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-    assertThatThrownBy(() -> bean.getActiveCQCount())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-
-    assertThatThrownBy(() -> bean.executeContinuousQuery("bar"))
-        .hasMessageContaining(TestCommand.dataRead.toString());
-  }
-
-  @Test
-  @ConnectionConfiguration(user = "dataReader", password = "12345")
-  public void testDataRead() throws Exception {
-    assertThatThrownBy(() -> bean.removeIndex("foo"))
-        .hasMessageContaining(TestCommand.dataManage.toString());
-    assertThatThrownBy(() -> bean.fetchLoadProbe())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-    assertThatThrownBy(() -> bean.getActiveCQCount())
-        .hasMessageContaining(TestCommand.clusterRead.toString());
-
-    bean.executeContinuousQuery("bar");
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanWithShiroIniIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanWithShiroIniIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanWithShiroIniIntegrationTest.java
new file mode 100644
index 0000000..55f592e
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/CacheServerMBeanWithShiroIniIntegrationTest.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.security;
+
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.apache.geode.management.CacheServerMXBean;
+import org.apache.geode.test.dunit.rules.ConnectionConfiguration;
+import org.apache.geode.test.dunit.rules.MBeanServerConnectionRule;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({IntegrationTest.class, SecurityTest.class})
+public class CacheServerMBeanWithShiroIniIntegrationTest {
+  private CacheServerMXBean bean;
+
+  @ClassRule
+  public static ServerStarterRule server = new ServerStarterRule()
+      .withProperty(SECURITY_SHIRO_INIT, "shiro.ini").withJMXManager().withAutoStart();
+
+  @Rule
+  public MBeanServerConnectionRule connectionRule =
+      new MBeanServerConnectionRule(server::getJmxPort);
+
+  @Before
+  public void setUp() throws Exception {
+    bean = connectionRule.getProxyMBean(CacheServerMXBean.class);
+  }
+
+  @Test
+  @ConnectionConfiguration(user = "root", password = "secret")
+  public void testAllAccess() throws Exception {
+    bean.removeIndex("foo");
+    bean.executeContinuousQuery("bar");
+    bean.fetchLoadProbe();
+    bean.getActiveCQCount();
+    bean.stopContinuousQuery("bar");
+    bean.closeAllContinuousQuery("bar");
+    bean.isRunning();
+    bean.showClientQueueDetails("foo");
+  }
+
+  @Test
+  @ConnectionConfiguration(user = "guest", password = "guest")
+  public void testNoAccess() throws Exception {
+    assertThatThrownBy(() -> bean.removeIndex("foo"))
+        .hasMessageContaining(TestCommand.dataManage.toString());
+    assertThatThrownBy(() -> bean.executeContinuousQuery("bar"))
+        .hasMessageContaining(TestCommand.dataRead.toString());
+    assertThatThrownBy(() -> bean.fetchLoadProbe())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+    assertThatThrownBy(() -> bean.getActiveCQCount())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+    assertThatThrownBy(() -> bean.stopContinuousQuery("bar"))
+        .hasMessageContaining(TestCommand.dataManage.toString());
+    assertThatThrownBy(() -> bean.closeAllContinuousQuery("bar"))
+        .hasMessageContaining(TestCommand.dataManage.toString());
+    assertThatThrownBy(() -> bean.isRunning())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+    assertThatThrownBy(() -> bean.showClientQueueDetails("bar"))
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+  }
+
+  @Test
+  @ConnectionConfiguration(user = "regionAReader", password = "password")
+  public void testRegionAccess() throws Exception {
+    assertThatThrownBy(() -> bean.removeIndex("foo"))
+        .hasMessageContaining(TestCommand.dataManage.toString());
+    assertThatThrownBy(() -> bean.fetchLoadProbe())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+    assertThatThrownBy(() -> bean.getActiveCQCount())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+
+    assertThatThrownBy(() -> bean.executeContinuousQuery("bar"))
+        .hasMessageContaining(TestCommand.dataRead.toString());
+  }
+
+  @Test
+  @ConnectionConfiguration(user = "dataReader", password = "12345")
+  public void testDataRead() throws Exception {
+    assertThatThrownBy(() -> bean.removeIndex("foo"))
+        .hasMessageContaining(TestCommand.dataManage.toString());
+    assertThatThrownBy(() -> bean.fetchLoadProbe())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+    assertThatThrownBy(() -> bean.getActiveCQCount())
+        .hasMessageContaining(TestCommand.clusterRead.toString());
+
+    bean.executeContinuousQuery("bar");
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceCustomRealmJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceCustomRealmJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceCustomRealmJUnitTest.java
deleted file mode 100644
index 22a7eae..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceCustomRealmJUnitTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import org.apache.geode.security.TestSecurityManager;
-import org.junit.BeforeClass;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.internal.security.IntegratedSecurityService;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-/**
- * Integration tests for {@link IntegratedSecurityService} using shiro-ini.json.
- *
- * @see IntegratedSecurityServiceWithIniFileJUnitTest
- */
-@Category({IntegrationTest.class, SecurityTest.class})
-public class IntegratedSecurityServiceCustomRealmJUnitTest
-    extends IntegratedSecurityServiceWithIniFileJUnitTest {
-
-  @BeforeClass
-  public static void beforeClass() throws Exception {
-    props.put(TestSecurityManager.SECURITY_JSON,
-        "org/apache/geode/management/internal/security/shiro-ini.json");
-    props.put(SECURITY_MANAGER, TestSecurityManager.class.getName());
-    IntegratedSecurityService.getSecurityService().initSecurity(props);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
deleted file mode 100644
index dabcde0..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import org.apache.geode.internal.security.IntegratedSecurityService;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.internal.security.SecurityServiceFactory;
-import org.apache.geode.security.GemFireSecurityException;
-import org.apache.geode.security.ResourcePermission;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-/**
- * Integration tests for {@link IntegratedSecurityService} using shiro.ini
- */
-@Category({IntegrationTest.class, SecurityTest.class})
-public class IntegratedSecurityServiceWithIniFileJUnitTest {
-
-  protected static Properties props = new Properties();
-
-  private SecurityService securityService;
-
-  @BeforeClass
-  public static void beforeClass() throws Exception {
-    props.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");
-  }
-
-  @Before
-  public void before() {
-    this.securityService = SecurityServiceFactory.create(null, null);
-    this.securityService.initSecurity(props);
-  }
-
-  @Test
-  public void testRoot() {
-    this.securityService.login(loginCredentials("root", "secret"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-    this.securityService.authorize(TestCommand.dataRead);
-    this.securityService.authorize(TestCommand.dataWrite);
-    this.securityService.authorize(TestCommand.regionARead);
-    this.securityService.authorize(TestCommand.regionAWrite);
-    this.securityService.authorize(TestCommand.clusterWrite);
-    this.securityService.authorize(TestCommand.clusterRead);
-  }
-
-  @Test
-  public void testGuest() {
-    this.securityService.login(loginCredentials("guest", "guest"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-
-    assertNotAuthorized(TestCommand.dataRead);
-    assertNotAuthorized(TestCommand.dataWrite);
-    assertNotAuthorized(TestCommand.regionARead);
-    assertNotAuthorized(TestCommand.regionAWrite);
-    assertNotAuthorized(TestCommand.clusterRead);
-    assertNotAuthorized(TestCommand.clusterWrite);
-    this.securityService.logout();
-  }
-
-  @Test
-  public void testRegionAReader() {
-    this.securityService.login(loginCredentials("regionAReader", "password"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-    this.securityService.authorize(TestCommand.regionARead);
-
-    assertNotAuthorized(TestCommand.regionAWrite);
-    assertNotAuthorized(TestCommand.dataRead);
-    assertNotAuthorized(TestCommand.dataWrite);
-    assertNotAuthorized(TestCommand.clusterRead);
-    assertNotAuthorized(TestCommand.clusterWrite);
-    this.securityService.logout();
-  }
-
-  @Test
-  public void testRegionAUser() {
-    this.securityService.login(loginCredentials("regionAUser", "password"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-    this.securityService.authorize(TestCommand.regionAWrite);
-    this.securityService.authorize(TestCommand.regionARead);
-
-    assertNotAuthorized(TestCommand.dataRead);
-    assertNotAuthorized(TestCommand.dataWrite);
-    assertNotAuthorized(TestCommand.clusterRead);
-    assertNotAuthorized(TestCommand.clusterWrite);
-    this.securityService.logout();
-  }
-
-  @Test
-  public void testDataReader() {
-    this.securityService.login(loginCredentials("dataReader", "12345"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-    this.securityService.authorize(TestCommand.regionARead);
-    this.securityService.authorize(TestCommand.dataRead);
-
-    assertNotAuthorized(TestCommand.regionAWrite);
-    assertNotAuthorized(TestCommand.dataWrite);
-    assertNotAuthorized(TestCommand.clusterRead);
-    assertNotAuthorized(TestCommand.clusterWrite);
-    this.securityService.logout();
-  }
-
-  @Test
-  public void testReader() {
-    this.securityService.login(loginCredentials("reader", "12345"));
-    this.securityService.authorize(TestCommand.none);
-    this.securityService.authorize(TestCommand.everyOneAllowed);
-    this.securityService.authorize(TestCommand.regionARead);
-    this.securityService.authorize(TestCommand.dataRead);
-    this.securityService.authorize(TestCommand.clusterRead);
-
-    assertNotAuthorized(TestCommand.regionAWrite);
-    assertNotAuthorized(TestCommand.dataWrite);
-    assertNotAuthorized(TestCommand.clusterWrite);
-    this.securityService.logout();
-  }
-
-  private void assertNotAuthorized(ResourcePermission context) {
-    assertThatThrownBy(() -> this.securityService.authorize(context))
-        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining(context.toString());
-  }
-
-  private Properties loginCredentials(String username, String password) {
-    Properties credentials = new Properties();
-    credentials.put(ResourceConstants.USER_NAME, username);
-    credentials.put(ResourceConstants.PASSWORD, password);
-    return credentials;
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithCustomRealmIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithCustomRealmIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithCustomRealmIntegrationTest.java
new file mode 100644
index 0000000..8f84476
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithCustomRealmIntegrationTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.security;
+
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+
+import org.apache.geode.security.TestSecurityManager;
+import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.internal.security.IntegratedSecurityService;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+
+/**
+ * Integration tests for {@link IntegratedSecurityService} using shiro-ini.json.
+ *
+ * @see SecurityServiceWithShiroIniIntegrationTest
+ */
+@Category({IntegrationTest.class, SecurityTest.class})
+public class SecurityServiceWithCustomRealmIntegrationTest
+    extends SecurityServiceWithShiroIniIntegrationTest {
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    props.put(TestSecurityManager.SECURITY_JSON,
+        "org/apache/geode/management/internal/security/shiro-ini.json");
+    props.put(SECURITY_MANAGER, TestSecurityManager.class.getName());
+    IntegratedSecurityService.getSecurityService().initSecurity(props);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithShiroIniIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithShiroIniIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithShiroIniIntegrationTest.java
new file mode 100644
index 0000000..47188f2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/SecurityServiceWithShiroIniIntegrationTest.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.security;
+
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_SHIRO_INIT;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.apache.geode.internal.security.IntegratedSecurityService;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
+import org.apache.geode.security.GemFireSecurityException;
+import org.apache.geode.security.ResourcePermission;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+
+/**
+ * Integration tests for {@link IntegratedSecurityService} using shiro.ini
+ */
+@Category({IntegrationTest.class, SecurityTest.class})
+public class SecurityServiceWithShiroIniIntegrationTest {
+
+  protected static Properties props = new Properties();
+
+  private SecurityService securityService;
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    props.setProperty(SECURITY_SHIRO_INIT, "shiro.ini");
+  }
+
+  @Before
+  public void before() {
+    this.securityService = SecurityServiceFactory.create(null, null);
+    this.securityService.initSecurity(props);
+  }
+
+  @Test
+  public void testRoot() {
+    this.securityService.login(loginCredentials("root", "secret"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+    this.securityService.authorize(TestCommand.dataRead);
+    this.securityService.authorize(TestCommand.dataWrite);
+    this.securityService.authorize(TestCommand.regionARead);
+    this.securityService.authorize(TestCommand.regionAWrite);
+    this.securityService.authorize(TestCommand.clusterWrite);
+    this.securityService.authorize(TestCommand.clusterRead);
+  }
+
+  @Test
+  public void testGuest() {
+    this.securityService.login(loginCredentials("guest", "guest"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+
+    assertNotAuthorized(TestCommand.dataRead);
+    assertNotAuthorized(TestCommand.dataWrite);
+    assertNotAuthorized(TestCommand.regionARead);
+    assertNotAuthorized(TestCommand.regionAWrite);
+    assertNotAuthorized(TestCommand.clusterRead);
+    assertNotAuthorized(TestCommand.clusterWrite);
+    this.securityService.logout();
+  }
+
+  @Test
+  public void testRegionAReader() {
+    this.securityService.login(loginCredentials("regionAReader", "password"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+    this.securityService.authorize(TestCommand.regionARead);
+
+    assertNotAuthorized(TestCommand.regionAWrite);
+    assertNotAuthorized(TestCommand.dataRead);
+    assertNotAuthorized(TestCommand.dataWrite);
+    assertNotAuthorized(TestCommand.clusterRead);
+    assertNotAuthorized(TestCommand.clusterWrite);
+    this.securityService.logout();
+  }
+
+  @Test
+  public void testRegionAUser() {
+    this.securityService.login(loginCredentials("regionAUser", "password"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+    this.securityService.authorize(TestCommand.regionAWrite);
+    this.securityService.authorize(TestCommand.regionARead);
+
+    assertNotAuthorized(TestCommand.dataRead);
+    assertNotAuthorized(TestCommand.dataWrite);
+    assertNotAuthorized(TestCommand.clusterRead);
+    assertNotAuthorized(TestCommand.clusterWrite);
+    this.securityService.logout();
+  }
+
+  @Test
+  public void testDataReader() {
+    this.securityService.login(loginCredentials("dataReader", "12345"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+    this.securityService.authorize(TestCommand.regionARead);
+    this.securityService.authorize(TestCommand.dataRead);
+
+    assertNotAuthorized(TestCommand.regionAWrite);
+    assertNotAuthorized(TestCommand.dataWrite);
+    assertNotAuthorized(TestCommand.clusterRead);
+    assertNotAuthorized(TestCommand.clusterWrite);
+    this.securityService.logout();
+  }
+
+  @Test
+  public void testReader() {
+    this.securityService.login(loginCredentials("reader", "12345"));
+    this.securityService.authorize(TestCommand.none);
+    this.securityService.authorize(TestCommand.everyOneAllowed);
+    this.securityService.authorize(TestCommand.regionARead);
+    this.securityService.authorize(TestCommand.dataRead);
+    this.securityService.authorize(TestCommand.clusterRead);
+
+    assertNotAuthorized(TestCommand.regionAWrite);
+    assertNotAuthorized(TestCommand.dataWrite);
+    assertNotAuthorized(TestCommand.clusterWrite);
+    this.securityService.logout();
+  }
+
+  private void assertNotAuthorized(ResourcePermission context) {
+    assertThatThrownBy(() -> this.securityService.authorize(context))
+        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining(context.toString());
+  }
+
+  private Properties loginCredentials(String username, String password) {
+    Properties credentials = new Properties();
+    credentials.put(ResourceConstants.USER_NAME, username);
+    credentials.put(ResourceConstants.PASSWORD, password);
+    return credentials;
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/IntegratedSecurityCacheLifecycleIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
deleted file mode 100644
index 4f0ea0d..0000000
--- a/geode-core/src/test/java/org/apache/geode/security/IntegratedSecurityCacheLifecycleIntegrationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.Properties;
-
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.internal.security.IntegratedSecurityService;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category({IntegrationTest.class, SecurityTest.class})
-public class IntegratedSecurityCacheLifecycleIntegrationTest {
-
-  private Properties securityProps;
-  private Cache cache;
-  private SecurityService securityService;
-
-  @Before
-  public void before() {
-    securityService = IntegratedSecurityService.getSecurityService();
-
-    securityProps = new Properties();
-    securityProps.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
-
-    Properties props = new Properties();
-    props.putAll(securityProps);
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(LOCATORS, "");
-
-    cache = new CacheFactory(props).create();
-  }
-
-  @After
-  public void after() {
-    if (cache != null && !cache.isClosed()) {
-      cache.close();
-    }
-  }
-
-  @Category(FlakyTest.class) // GEODE-1661
-  @Test
-  public void initAndCloseTest() {
-    SpySecurityManager ssm = (SpySecurityManager) securityService.getSecurityManager();
-    assertThat(ssm.initInvoked).isEqualTo(1);
-    cache.close();
-    assertThat(ssm.closeInvoked).isEqualTo(1);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/security/SecurityManagerCallbacksDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityManagerCallbacksDistributedTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityManagerCallbacksDistributedTest.java
deleted file mode 100644
index 09c30f5..0000000
--- a/geode-core/src/test/java/org/apache/geode/security/SecurityManagerCallbacksDistributedTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.security;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
-import static org.apache.geode.internal.security.IntegratedSecurityService.getSecurityService;
-import static org.apache.geode.management.ManagementService.getExistingManagementService;
-import static org.apache.geode.test.dunit.DistributedTestUtils.deleteLocatorStateFile;
-import static org.apache.geode.test.dunit.Host.getHost;
-import static org.apache.geode.test.dunit.NetworkUtils.getServerHostName;
-import static org.assertj.core.api.Assertions.*;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.cache30.CacheTestCase;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class SecurityManagerCallbacksDistributedTest extends CacheTestCase {
-
-  private String locators;
-  private VM locatorVM;
-
-  @Before
-  public void before() throws Exception {
-    Host host = getHost(0);
-    this.locatorVM = host.getVM(0);
-
-    int[] ports = getRandomAvailableTCPPorts(2);
-    int locatorPort = ports[0];
-    int managerPort = ports[1];
-
-    this.locators = getServerHostName(host) + "[" + locatorPort + "]";
-
-    this.locatorVM.invoke(() -> {
-      deleteLocatorStateFile(locatorPort);
-
-      Properties properties = new Properties();
-      properties.setProperty(LOCATORS, locators);
-      properties.setProperty(MCAST_PORT, "0");
-      properties.setProperty(START_LOCATOR, locators);
-      properties.setProperty(JMX_MANAGER, "true");
-      properties.setProperty(JMX_MANAGER_PORT, String.valueOf(managerPort));
-      properties.setProperty(JMX_MANAGER_START, "true");
-      properties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
-      properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
-      properties.setProperty("security-username", "secure");
-      properties.setProperty("security-password", "secure");
-
-      getSystem(properties);
-      getCache();
-    });
-  }
-
-  @After
-  public void after() throws Exception {
-    closeAllCache();
-  }
-
-  @Test
-  public void callbacksShouldBeInvoked() throws Exception {
-    connectServer();
-
-    verifyCallbacksRegardlessOfManager(false);
-
-    this.locatorVM.invoke(() -> {
-      verifyCallbacksRegardlessOfManager(true);
-    });
-  }
-
-  private void connectServer() throws IOException {
-    Properties properties = new Properties();
-    properties.setProperty(LOCATORS, locators);
-    properties.setProperty(MCAST_PORT, "0");
-    properties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
-    properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
-    properties.setProperty("security-username", "secure");
-    properties.setProperty("security-password", "secure");
-
-    getSystem(properties);
-
-    CacheServer server1 = getCache().addCacheServer();
-    server1.setPort(0);
-    server1.start();
-
-    getCache();
-  }
-
-  private void verifyCallbacksRegardlessOfManager(final boolean isManager) {
-    ManagementService ms = getExistingManagementService(getCache());
-    assertThat(ms).isNotNull();
-    assertThat(ms.isManager()).isEqualTo(isManager);
-
-    verifyInitAndCloseInvoked();
-  }
-
-  private void verifyInitAndCloseInvoked() {
-    SpySecurityManager ssm = (SpySecurityManager) getSecurityService().getSecurityManager();
-
-    assertThat(ssm.initInvoked).isEqualTo(1);
-    assertThat(ssm.closeInvoked).isEqualTo(0);
-
-    getCache().close();
-
-    assertThat(ssm.initInvoked).isEqualTo(1);
-    assertThat(ssm.closeInvoked).isEqualTo(1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleDistributedTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleDistributedTest.java
new file mode 100644
index 0000000..a9048b9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleDistributedTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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;
+
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPorts;
+import static org.apache.geode.management.ManagementService.getExistingManagementService;
+import static org.apache.geode.test.dunit.DistributedTestUtils.deleteLocatorStateFile;
+import static org.apache.geode.test.dunit.Host.getHost;
+import static org.apache.geode.test.dunit.NetworkUtils.getServerHostName;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.cache30.CacheTestCase;
+import org.apache.geode.internal.security.EnabledSecurityService;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.IOException;
+import java.util.Properties;
+
+@Category({DistributedTest.class, SecurityTest.class})
+public class SecurityManagerLifecycleDistributedTest extends CacheTestCase {
+
+  private String locators;
+  private VM locatorVM;
+
+  @Before
+  public void before() throws Exception {
+    Host host = getHost(0);
+    this.locatorVM = host.getVM(0);
+
+    int[] ports = getRandomAvailableTCPPorts(2);
+    int locatorPort = ports[0];
+    int managerPort = ports[1];
+
+    this.locators = getServerHostName(host) + "[" + locatorPort + "]";
+
+    this.locatorVM.invoke(() -> {
+      deleteLocatorStateFile(locatorPort);
+
+      Properties properties = new Properties();
+      properties.setProperty(LOCATORS, locators);
+      properties.setProperty(MCAST_PORT, "0");
+      properties.setProperty(START_LOCATOR, locators);
+      properties.setProperty(JMX_MANAGER, "true");
+      properties.setProperty(JMX_MANAGER_PORT, String.valueOf(managerPort));
+      properties.setProperty(JMX_MANAGER_START, "true");
+      properties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
+      properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
+      properties.setProperty("security-username", "secure");
+      properties.setProperty("security-password", "secure");
+
+      getSystem(properties);
+      getCache();
+    });
+  }
+
+  @After
+  public void after() throws Exception {
+    closeAllCache();
+  }
+
+  @Test
+  public void callbacksShouldBeInvoked() throws Exception {
+    connectServer();
+
+    verifyCallbacksRegardlessOfManager(false);
+
+    this.locatorVM.invoke(() -> {
+      verifyCallbacksRegardlessOfManager(true);
+    });
+  }
+
+  private void connectServer() throws IOException {
+    Properties properties = new Properties();
+    properties.setProperty(LOCATORS, locators);
+    properties.setProperty(MCAST_PORT, "0");
+    properties.setProperty(USE_CLUSTER_CONFIGURATION, "false");
+    properties.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
+    properties.setProperty("security-username", "secure");
+    properties.setProperty("security-password", "secure");
+
+    getSystem(properties);
+
+    CacheServer server1 = getCache().addCacheServer();
+    server1.setPort(0);
+    server1.start();
+
+    getCache();
+  }
+
+  private void verifyCallbacksRegardlessOfManager(final boolean isManager) {
+    ManagementService ms = getExistingManagementService(getCache());
+    assertThat(ms).isNotNull();
+    assertThat(ms.isManager()).isEqualTo(isManager);
+
+    verifyInitAndCloseInvoked();
+  }
+
+  private void verifyInitAndCloseInvoked() {
+    SecurityService securityService = getCache().getSecurityService();
+    assertThat(securityService).isNotNull().isInstanceOf(EnabledSecurityService.class);
+
+    SpySecurityManager ssm =
+        (SpySecurityManager) getCache().getSecurityService().getSecurityManager();
+
+    assertThat(ssm.getInitInvocationCount()).isEqualTo(1);
+    assertThat(ssm.getCloseInvocationCount()).isEqualTo(0);
+
+    getCache().close();
+
+    assertThat(ssm.getInitInvocationCount()).isEqualTo(1);
+    assertThat(ssm.getCloseInvocationCount()).isEqualTo(1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleIntegrationTest.java
new file mode 100644
index 0000000..f00b03a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/security/SecurityManagerLifecycleIntegrationTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.test.junit.categories.FlakyTest;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+
+@Category({IntegrationTest.class, SecurityTest.class})
+public class SecurityManagerLifecycleIntegrationTest {
+
+  private Properties securityProps;
+  private InternalCache cache;
+  private SecurityService securityService;
+
+  @Before
+  public void before() {
+    this.securityProps = new Properties();
+    this.securityProps.setProperty(SECURITY_MANAGER, SpySecurityManager.class.getName());
+
+    Properties props = new Properties();
+    props.putAll(this.securityProps);
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(LOCATORS, "");
+
+    this.cache = (InternalCache) new CacheFactory(props).create();
+
+    this.securityService = this.cache.getSecurityService();
+  }
+
+  @After
+  public void after() {
+    if (this.cache != null && !this.cache.isClosed()) {
+      this.cache.close();
+    }
+  }
+
+  @Category(FlakyTest.class) // GEODE-1661
+  @Test
+  public void initAndCloseTest() {
+    SpySecurityManager ssm = (SpySecurityManager) this.securityService.getSecurityManager();
+    assertThat(ssm.getInitInvocationCount()).isEqualTo(1);
+    this.cache.close();
+    assertThat(ssm.getCloseInvocationCount()).isEqualTo(1);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-core/src/test/java/org/apache/geode/security/SpySecurityManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/SpySecurityManager.java b/geode-core/src/test/java/org/apache/geode/security/SpySecurityManager.java
index 1109489..4523dae 100644
--- a/geode-core/src/test/java/org/apache/geode/security/SpySecurityManager.java
+++ b/geode-core/src/test/java/org/apache/geode/security/SpySecurityManager.java
@@ -15,17 +15,16 @@
 package org.apache.geode.security;
 
 import java.util.Properties;
-
-import org.apache.geode.security.SecurityManager;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class SpySecurityManager extends SimpleTestSecurityManager {
 
-  public int initInvoked = 0;
-  public int closeInvoked = 0;
+  private final AtomicInteger initInvoked = new AtomicInteger(0);
+  private final AtomicInteger closeInvoked = new AtomicInteger(0);
 
   @Override
   public void init(final Properties securityProps) {
-    initInvoked++;
+    this.initInvoked.incrementAndGet();
   }
 
   @Override
@@ -35,6 +34,14 @@ public class SpySecurityManager extends SimpleTestSecurityManager {
 
   @Override
   public void close() {
-    closeInvoked++;
+    this.closeInvoked.incrementAndGet();
+  }
+
+  public int getInitInvocationCount() {
+    return this.initInvoked.get();
+  }
+
+  public int getCloseInvocationCount() {
+    return this.closeInvoked.get();
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-cq/src/test/java/org/apache/geode/security/ClientAuthzObjectModDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/ClientAuthzObjectModDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/security/ClientAuthzObjectModDUnitTest.java
index dd50467..a8ab8f9 100755
--- a/geode-cq/src/test/java/org/apache/geode/security/ClientAuthzObjectModDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/ClientAuthzObjectModDUnitTest.java
@@ -14,6 +14,9 @@
  */
 package org.apache.geode.security;
 
+import static org.apache.geode.security.SecurityTestUtils.closeCache;
+import static org.apache.geode.security.SecurityTestUtils.getLocatorPort;
+
 import org.apache.geode.DataSerializable;
 import org.apache.geode.Instantiator;
 import org.apache.geode.cache.operations.OperationContext.OperationCode;
@@ -37,9 +40,6 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
-import static org.apache.geode.security.SecurityTestUtils.closeCache;
-import static org.apache.geode.security.SecurityTestUtils.getLocatorPort;
-
 /**
  * Tests for authorization callback that modify objects and callbacks from client to server.
  * 
@@ -57,8 +57,10 @@ import static org.apache.geode.security.SecurityTestUtils.getLocatorPort;
 @Category({DistributedTest.class, SecurityTest.class})
 public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestCase {
 
-  private static final String preAccessor = FilterPreAuthorization.class.getName() + ".create";
-  private static final String postAccessor = FilterPostAuthorization.class.getName() + ".create";
+  private static final String PRE_ACCESSOR_CREATE =
+      FilterPreAuthorization.class.getName() + ".create";
+  private static final String POST_ACCESSOR_CREATE =
+      FilterPostAuthorization.class.getName() + ".create";
 
   @Override
   protected final void postSetUpClientAuthorizationTestBase() throws Exception {
@@ -88,13 +90,14 @@ public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestCase {
 
     System.out.println("testPutsGetsObjectModWithFailover: Using authinit: " + authInit);
     System.out.println("testPutsGetsObjectModWithFailover: Using authenticator: " + authenticator);
-    System.out
-        .println("testPutsGetsObjectModWithFailover: Using pre-operation accessor: " + preAccessor);
     System.out.println(
-        "testPutsGetsObjectModWithFailover: Using post-operation accessor: " + postAccessor);
+        "testPutsGetsObjectModWithFailover: Using pre-operation accessor: " + PRE_ACCESSOR_CREATE);
+    System.out.println("testPutsGetsObjectModWithFailover: Using post-operation accessor: "
+        + POST_ACCESSOR_CREATE);
 
     // Start servers with all required properties
-    Properties serverProps = buildProperties(authenticator, extraProps, preAccessor, postAccessor);
+    Properties serverProps =
+        buildProperties(authenticator, extraProps, PRE_ACCESSOR_CREATE, POST_ACCESSOR_CREATE);
 
     // Get ports for the servers
     int[] portsList = AvailablePortHelper.getRandomAvailableTCPPorts(2);
@@ -249,7 +252,6 @@ public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestCase {
         OperationWithAction.OPBLOCK_END};
   }
 
-
   private Properties buildProperties(final String authenticator, final Properties extraProps,
       final String preAccessor, final String postAccessor) {
     Properties authProps = new Properties();

http://git-wip-us.apache.org/repos/asf/geode/blob/21b1e19e/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index 66e15bb..f1da154 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -37,6 +37,7 @@ import org.apache.geode.cache.lucene.internal.cli.functions.LuceneListIndexFunct
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.AbstractExecution;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.internal.util.CollectionUtils;
 import org.apache.geode.management.cli.Result.Status;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
@@ -50,6 +51,7 @@ import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -85,9 +87,16 @@ import junitparams.Parameters;
 @RunWith(JUnitParamsRunner.class)
 public class LuceneIndexCommandsJUnitTest {
 
+  private InternalCache mockCache;
+
+  @Before
+  public void before() throws Exception {
+    this.mockCache = mock(InternalCache.class, "InternalCache");
+    when(this.mockCache.getSecurityService()).thenReturn(mock(SecurityService.class));
+  }
+
   @Test
-  public void testListIndexWithoutStats() {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
+  public void testListIndexWithoutStats() throws Exception {
     final String serverName = "mockServer";
     final AbstractExecution mockFunctionExecutor =
         mock(AbstractExecution.class, "Function Executor");
@@ -113,7 +122,7 @@ public class LuceneIndexCommandsJUnitTest {
         .thenReturn(mockResultCollector);
     when(mockResultCollector.getResult()).thenReturn(results);
 
-    final LuceneIndexCommands commands = createIndexCommands(mockCache, mockFunctionExecutor);
+    final LuceneIndexCommands commands = createIndexCommands(this.mockCache, mockFunctionExecutor);
 
     CommandResult result = (CommandResult) commands.listIndex(false);
     TabularResultData data = (TabularResultData) result.getResultData();
@@ -133,8 +142,7 @@ public class LuceneIndexCommandsJUnitTest {
   }
 
   @Test
-  public void testListIndexWithStats() {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
+  public void testListIndexWithStats() throws Exception {
     final String serverName = "mockServer";
     final AbstractExecution mockFunctionExecutor =
         mock(AbstractExecution.class, "Function Executor");
@@ -162,7 +170,7 @@ public class LuceneIndexCommandsJUnitTest {
         .thenReturn(mockResultCollector);
     when(mockResultCollector.getResult()).thenReturn(results);
 
-    final LuceneIndexCommands commands = createIndexCommands(mockCache, mockFunctionExecutor);
+    final LuceneIndexCommands commands = createIndexCommands(this.mockCache, mockFunctionExecutor);
 
     CommandResult result = (CommandResult) commands.listIndex(true);
     TabularResultData data = (TabularResultData) result.getResultData();
@@ -185,9 +193,8 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Test
   public void testCreateIndex() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class);
     final ResultCollector mockResultCollector = mock(ResultCollector.class);
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
     cliFunctionResults.add(new CliFunctionResult("member1", true, "Index Created"));
@@ -215,10 +222,9 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Test
   public void testDescribeIndex() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
     final String serverName = "mockServer";
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     String[] searchableFields = {"field1", "field2", "field3"};
     Map<String, Analyzer> fieldAnalyzers = new HashMap<>();
@@ -252,9 +258,8 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Test
   public void testSearchIndex() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     final List<Set<LuceneSearchResults>> queryResultsList = new ArrayList<>();
     HashSet<LuceneSearchResults> queryResults = new HashSet<>();
@@ -277,10 +282,9 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Ignore
   public void testSearchIndexWithPaging() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
     final Gfsh mockGfsh = mock(Gfsh.class);
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
     ArgumentCaptor<String> resultCaptor = ArgumentCaptor.forClass(String.class);
 
     LuceneSearchResults result1 = createQueryResults("A", "Result1", Float.valueOf("1.7"));
@@ -345,9 +349,8 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Test
   public void testSearchIndexWithKeysOnly() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     final List<Set<LuceneSearchResults>> queryResultsList = new ArrayList<>();
     HashSet<LuceneSearchResults> queryResults = new HashSet<>();
@@ -368,9 +371,8 @@ public class LuceneIndexCommandsJUnitTest {
 
   @Test
   public void testSearchIndexWhenSearchResultsHaveSameScore() throws Exception {
-    final InternalCache mockCache = mock(InternalCache.class, "InternalCache");
     final ResultCollector mockResultCollector = mock(ResultCollector.class, "ResultCollector");
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     final List<Set<LuceneSearchResults>> queryResultsList = new ArrayList<>();
     HashSet<LuceneSearchResults> queryResults = new HashSet<>();
@@ -545,9 +547,8 @@ public class LuceneIndexCommandsJUnitTest {
   }
 
   private LuceneIndexCommands createTestLuceneIndexCommandsForDestroyIndex() {
-    final InternalCache mockCache = mock(InternalCache.class);
     final ResultCollector mockResultCollector = mock(ResultCollector.class);
-    final LuceneIndexCommands commands = spy(createIndexCommands(mockCache, null));
+    final LuceneIndexCommands commands = spy(createIndexCommands(this.mockCache, null));
 
     final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
     cliFunctionResults.add(new CliFunctionResult("member", true, "Index Destroyed"));
@@ -656,7 +657,7 @@ public class LuceneIndexCommandsJUnitTest {
     @Override
     protected Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
       Assert.assertNotNull(members);
-      return functionExecutor;
+      return this.functionExecutor;
     }
   }
 


Mime
View raw message