http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientAuthDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientAuthDUnitTest.java
deleted file mode 100644
index a8ab5b7..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientAuthDUnitTest.java
+++ /dev/null
@@ -1,50 +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 com.googlecode.catchexception.CatchException.*;
-import static 
com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static org.assertj.core.api.Assertions.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientAuthDUnitTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void authWithCorrectPasswordShouldPass() {
-    client1.invoke("logging in super-user with correct password", () -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("super-user", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-    });
-  }
-
-  @Test
-  public void authWithIncorrectPasswordShouldFail() {
-    client2.invoke("logging in super-user with wrong password", () -> {
-      catchException(new ClientCacheFactory(createClientProperties("data", 
"wrong"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort)).create();
-      assertThat((Throwable) 
caughtException()).isInstanceOf(AuthenticationFailedException.class);
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientContainsKeyAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientContainsKeyAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientContainsKeyAuthDistributedTest.java
deleted file mode 100644
index 9a34198..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientContainsKeyAuthDistributedTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
- * agreements. See the NOTICE file distributed with this work for additional 
information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the 
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software 
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
- * or implied. See the License for the specific language governing permissions 
and limitations under
- * the License.
- */
-package org.apache.geode.security;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientContainsKeyAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testContainsKey() throws InterruptedException {
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", serverPort);
-      final Region region = cache.getRegion(REGION_NAME);
-      assertTrue(region.containsKeyOnServer("key1"));
-      assertNotAuthorized(() -> region.containsKeyOnServer("key3"), 
"DATA:READ:AuthRegion:key3");
-    });
-
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", 
serverPort);
-      final Region region = cache.getRegion(REGION_NAME);
-      region.containsKeyOnServer("key3");
-      assertTrue(region.containsKeyOnServer("key1"));
-    });
-
-    ai1.join();
-    ai2.join();
-    ai1.checkException();
-    ai2.checkException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
deleted file mode 100644
index 71a8156..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
+++ /dev/null
@@ -1,84 +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.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientDestroyInvalidateAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testDestroyInvalidate() throws InterruptedException {
-
-    // Delete one key and invalidate another key with an authorized user.
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("dataUser", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertTrue(region.containsKeyOnServer("key1"));
-
-      // Destroy key1
-      region.destroy("key1");
-      assertFalse(region.containsKeyOnServer("key1"));
-
-      // Invalidate key2
-      assertNotNull("Value of key2 should not be null", region.get("key2"));
-      region.invalidate("key2");
-      assertNull("Value of key2 should have been null", region.get("key2"));
-
-    });
-
-    // Delete one key and invalidate another key with an unauthorized user.
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionReader", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-
-      assertTrue(region.containsKeyOnServer("key3"));
-
-      // Destroy key1
-      assertNotAuthorized(() -> region.destroy("key3"), 
"DATA:WRITE:AuthRegion");
-      assertTrue(region.containsKeyOnServer("key3"));
-
-      // Invalidate key2
-      assertNotNull("Value of key4 should not be null", region.get("key4"));
-      assertNotAuthorized(() -> region.invalidate("key4"), 
"DATA:WRITE:AuthRegion");
-      assertNotNull("Value of key4 should not be null", region.get("key4"));
-    });
-
-    ai1.join();
-    ai2.join();
-    ai1.checkException();
-    ai2.checkException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyRegionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyRegionAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyRegionAuthDistributedTest.java
deleted file mode 100644
index 2366e3d..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientDestroyRegionAuthDistributedTest.java
+++ /dev/null
@@ -1,65 +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.assertj.core.api.Assertions.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientDestroyRegionAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testDestroyRegion() throws InterruptedException {
-    client1.invoke(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("dataWriter", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.destroyRegion(), "DATA:MANAGE");
-    });
-
-    client2.invoke(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionManager", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.destroyRegion(), "DATA:MANAGE");
-    });
-
-    client3.invoke(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("super-user", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.destroyRegion();
-      assertThat(region.isDestroyed()).isTrue();
-    });
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
deleted file mode 100644
index ad6b226..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
+++ /dev/null
@@ -1,69 +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 org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.cache.functions.TestFunction;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientExecuteFunctionAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  private final static Function function = new TestFunction(true, 
TestFunction.TEST_FUNCTION1);
-
-  @Test
-  public void testExecuteRegionFunctionWithClientRegistration() {
-
-    FunctionService.registerFunction(function);
-    client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", 
serverPort);
-
-      FunctionService.registerFunction(function);
-
-      assertNotAuthorized(() -> 
FunctionService.onServer(cache.getDefaultPool())
-          .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
-    });
-
-    client2.invoke("logging in with super-user", () -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-
-      FunctionService.registerFunction(function);
-      ResultCollector rc = 
FunctionService.onServer(cache.getDefaultPool()).withArgs(Boolean.TRUE)
-          .execute(function.getId());
-      rc.getResult();
-    });
-  }
-
-  @Test
-  // this would trigger the client to send a GetFunctionAttribute command 
before executing it
-  public void testExecuteRegionFunctionWithOutClientRegistration() {
-    FunctionService.registerFunction(function);
-    client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", 
serverPort);
-      assertNotAuthorized(() -> 
FunctionService.onServer(cache.getDefaultPool())
-          .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
deleted file mode 100644
index eb9de5d..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
+++ /dev/null
@@ -1,58 +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 org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.internal.cache.functions.TestFunction;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientExecuteRegionFunctionAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  private final static Function function = new TestFunction(true, 
TestFunction.TEST_FUNCTION1);
-
-  @Test
-  public void testExecuteRegionFunction() {
-
-    FunctionService.registerFunction(function);
-
-    client1.invoke("logging in with dataReader", () -> {
-      ClientCache cache = createClientCache("dataReader", "1234567", 
serverPort);
-
-      FunctionService.registerFunction(function);
-      assertNotAuthorized(() -> 
FunctionService.onRegion(cache.getRegion(REGION_NAME))
-          .withArgs(Boolean.TRUE).execute(function.getId()), "DATA:WRITE");
-    });
-
-    client2.invoke("logging in with super-user", () -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-
-      FunctionService.registerFunction(function);
-      ResultCollector rc = 
FunctionService.onRegion(cache.getRegion(REGION_NAME))
-          .withArgs(Boolean.TRUE).execute(function.getId());
-      rc.getResult();
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetAllAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetAllAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetAllAuthDistributedTest.java
deleted file mode 100644
index cec4de6..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetAllAuthDistributedTest.java
+++ /dev/null
@@ -1,55 +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.internal.Assert.assertTrue;
-import static org.jgroups.util.Util.*;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientGetAllAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testGetAll() {
-    client1.invoke("logging in Stranger", () -> {
-      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
-
-      Region region = cache.getRegion(REGION_NAME);
-      Map emptyMap = region.getAll(Arrays.asList("key1", "key2", "key3", 
"key4"));
-      assertTrue(emptyMap.isEmpty());
-    });
-
-    client2.invoke("logging in authRegionReader", () -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", 
serverPort);
-
-      Region region = cache.getRegion(REGION_NAME);
-      Map filledMap = region.getAll(Arrays.asList("key1", "key2", "key3", 
"key4"));
-      assertEquals("Map should contain 4 entries", 4, filledMap.size());
-      assertTrue(filledMap.containsKey("key1"));
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
deleted file mode 100644
index f4aa9c9..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
+++ /dev/null
@@ -1,67 +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 org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.cache.client.internal.ClientMetadataService;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientGetClientPRMetaDataAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  @Test
-  @Ignore("This is not a supported client message")
-  // this would fail sporadically because ServerConnection.isInternalMessage 
would return true for
-  // this message,
-  // and it won't bind the correct subject on the executing thread.
-  public void testGetClientPartitionAttrCmd() {
-    client1.invoke("logging in stranger", () -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-
-      ClientMetadataService service = ((GemFireCacheImpl) 
cache).getClientMetadataService();
-      assertNotAuthorized(
-          () -> service.getClientPRMetadata((LocalRegion) 
cache.getRegion(region.getName())),
-          "CLUSTER:READ");
-    });
-
-    client2.invoke("logging in super-user", () -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("super-user", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-
-      ClientMetadataService service = ((GemFireCacheImpl) 
cache).getClientMetadataService();
-      service.getClientPRMetadata((LocalRegion) 
cache.getRegion(region.getName()));
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
deleted file mode 100644
index 706e168..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
+++ /dev/null
@@ -1,52 +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 org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.internal.GetClientPartitionAttributesOp;
-import org.apache.geode.cache.client.internal.PoolImpl;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  @Test
-  @Ignore("This is not a supported client message")
-  // this would fail sporatically because ServerConnection.isInternalMessage 
would return true for
-  // this message,
-  // and it won't bind the correct subject on the executing thread.
-  public void testGetClientPartitionAttrCmd() {
-    client1.invoke("logging in stranger", () -> {
-      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
-
-      assertNotAuthorized(() -> GetClientPartitionAttributesOp
-          .execute((PoolImpl) cache.getDefaultPool(), REGION_NAME), 
"CLUSTER:READ");
-    });
-
-    client2.invoke("logging in super-user with correct password", () -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-
-      GetClientPartitionAttributesOp.execute((PoolImpl) 
cache.getDefaultPool(), REGION_NAME);
-    });
-  }
-}
-
-

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetEntryAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetEntryAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetEntryAuthDistributedTest.java
deleted file mode 100644
index 57fc263..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetEntryAuthDistributedTest.java
+++ /dev/null
@@ -1,75 +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 org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientGetEntryAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testGetEntry() throws InterruptedException {
-    // client1 connects to server as a user not authorized to do any operations
-
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      CacheTransactionManager transactionManager = 
cache.getCacheTransactionManager();
-      transactionManager.begin();
-      try {
-        Region region =
-            
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-        assertNotAuthorized(() -> region.getEntry("key3"), 
"DATA:READ:AuthRegion:key3");
-      } finally {
-        transactionManager.commit();
-      }
-
-    });
-
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionReader", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      CacheTransactionManager transactionManager = 
cache.getCacheTransactionManager();
-      transactionManager.begin();
-      try {
-        Region region =
-            
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-        region.getEntry("key3");
-      } finally {
-        transactionManager.commit();
-      }
-
-    });
-
-    ai1.join();
-    ai2.join();
-    ai1.checkException();
-    ai2.checkException();
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetPutAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetPutAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetPutAuthDistributedTest.java
deleted file mode 100644
index 2d5bfdc..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientGetPutAuthDistributedTest.java
+++ /dev/null
@@ -1,114 +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.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class, FlakyTest.class})
-public class IntegratedClientGetPutAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testGetPutAuthorization() throws InterruptedException {
-    Map<String, String> allValues = new HashMap<String, String>();
-    allValues.put("key1", "value1");
-    allValues.put("key2", "value2");
-
-    List<String> keys = new ArrayList<>();
-    keys.add("key1");
-    keys.add("key2");
-
-    // client1 connects to server as a user not authorized to do any operations
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
-      Region region = cache.getRegion(REGION_NAME);
-
-      assertNotAuthorized(() -> region.put("key3", "value3"), 
"DATA:WRITE:AuthRegion:key3");
-      assertNotAuthorized(() -> region.get("key3"), 
"DATA:READ:AuthRegion:key3");
-
-      // putall
-      assertNotAuthorized(() -> region.putAll(allValues), 
"DATA:WRITE:AuthRegion");
-
-      // not authorized for either keys, get no record back
-      Map keyValues = region.getAll(keys);
-      assertEquals(0, keyValues.size());
-
-      assertNotAuthorized(() -> region.keySetOnServer(), 
"DATA:READ:AuthRegion");
-    });
-
-
-    // client2 connects to user as a user authorized to use AuthRegion region
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionUser", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
-
-      region.put("key3", "value3");
-      assertEquals("value3", region.get("key3"));
-
-      // put all
-      region.putAll(allValues);
-
-      // get all
-      Map keyValues = region.getAll(keys);
-      assertEquals(2, keyValues.size());
-
-      // keyset
-      Set keySet = region.keySetOnServer();
-      assertEquals(5, keySet.size());
-    });
-
-    // client3 connects to user as a user authorized to use key1 in AuthRegion 
region
-    AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = createClientCache("key1User", "1234567", serverPort);
-      Region region = cache.getRegion(REGION_NAME);
-
-      assertNotAuthorized(() -> region.put("key2", "value1"), 
"DATA:WRITE:AuthRegion:key2");
-      assertNotAuthorized(() -> region.get("key2"), 
"DATA:READ:AuthRegion:key2");
-
-      assertNotAuthorized(() -> region.putAll(allValues), 
"DATA:WRITE:AuthRegion");
-
-      // only authorized for one recrod
-      Map keyValues = region.getAll(keys);
-      assertEquals(1, keyValues.size());
-
-      // keyset
-      assertNotAuthorized(() -> region.keySetOnServer(), 
"DATA:READ:AuthRegion");
-    });
-
-    ai1.join();
-    ai2.join();
-    ai3.join();
-
-    ai1.checkException();
-    ai2.checkException();
-    ai3.checkException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegionClearAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegionClearAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegionClearAuthDistributedTest.java
deleted file mode 100644
index d5dbbdb..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegionClearAuthDistributedTest.java
+++ /dev/null
@@ -1,64 +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 org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientRegionClearAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Category(FlakyTest.class) // GEODE-1876
-  @Test
-  public void testRegionClear() throws InterruptedException {
-    // Verify that an unauthorized user can't clear the region
-    SerializableRunnable clearUnauthorized = new SerializableRunnable() {
-      @Override
-      public void run() {
-        ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-            .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-        Region region =
-            
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-        assertNotAuthorized(() -> region.clear(), "DATA:WRITE:AuthRegion");
-      }
-    };
-    client1.invoke(clearUnauthorized);
-
-    // Verify that an authorized user can clear the region
-    SerializableRunnable clearAuthorized = new SerializableRunnable() {
-      @Override
-      public void run() {
-        ClientCache cache =
-            new ClientCacheFactory(createClientProperties("authRegionUser", 
"1234567"))
-                .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-        Region region =
-            
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-        region.clear();
-      }
-    };
-    client2.invoke(clearAuthorized);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegisterInterestAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegisterInterestAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegisterInterestAuthDistributedTest.java
deleted file mode 100644
index d74c7d0..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRegisterInterestAuthDistributedTest.java
+++ /dev/null
@@ -1,165 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientRegisterInterestAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-  @Test
-  public void testRegisterInterest() throws InterruptedException {
-    // client1 connects to server as a user not authorized to do any operations
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterest("key3"), 
"DATA:READ:AuthRegion:key3");
-    });
-
-    // client2 connects to user as a user authorized to use AuthRegion region
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionUser", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.registerInterest("key3"); // DATA:READ:AuthRegion:key3;
-    });
-
-    // client3 connects to user as a user authorized to use key1 in AuthRegion 
region
-    AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("key1User", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterest("key2"), 
"DATA:READ:AuthRegion:key2");
-    });
-
-    ai1.join();
-    ai2.join();
-    ai3.join();
-
-    ai1.checkException();
-    ai2.checkException();
-    ai3.checkException();
-  }
-
-  @Test
-  public void testRegisterInterestRegex() throws InterruptedException {
-    // client1 connects to server as a user not authorized to do any operations
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterestRegex("key.*"), 
"DATA:READ:AuthRegion");
-    });
-
-    // client2 connects to user as a user authorized to use AuthRegion region
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionUser", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.registerInterestRegex("key[0-9]+"); // DATA:READ:AuthRegion:key3;
-    });
-
-    // client3 connects to user as a user authorized to use key1 in AuthRegion 
region
-    AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("key1User", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterestRegex("key[0-9]+"), 
"DATA:READ:AuthRegion");
-      assertNotAuthorized(() -> region.registerInterestRegex("key1"), 
"DATA:READ:AuthRegion");
-    });
-
-    ai1.join();
-    ai2.join();
-    ai3.join();
-
-    ai1.checkException();
-    ai2.checkException();
-    ai3.checkException();
-  }
-
-  @Test
-  public void testRegisterInterestList() throws InterruptedException {
-    List<String> keys = new ArrayList<>();
-    keys.add("key1");
-    keys.add("key2");
-
-    // client1 connects to server as a user not authorized to do any operations
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterest(keys), 
"DATA:READ:AuthRegion");
-    });
-
-    // client2 connects to user as a user authorized to use AuthRegion region
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionUser", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.registerInterest(keys); // DATA:READ:AuthRegion;
-    });
-
-    // client3 connects to user as a user authorized to use key1 in AuthRegion 
region
-    AsyncInvocation ai3 = client3.invokeAsync(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("key1User", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.registerInterest(keys), 
"DATA:READ:AuthRegion");
-    });
-
-    ai1.join();
-    ai2.join();
-    ai3.join();
-
-    ai1.checkException();
-    ai2.checkException();
-    ai3.checkException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRemoveAllAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRemoveAllAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRemoveAllAuthDistributedTest.java
deleted file mode 100644
index ecb32a7..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientRemoveAllAuthDistributedTest.java
+++ /dev/null
@@ -1,66 +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.junit.Assert.*;
-
-import java.util.Arrays;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientRemoveAllAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testRemoveAll() throws InterruptedException {
-
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionReader", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      assertNotAuthorized(() -> region.removeAll(Arrays.asList("key1", "key2", 
"key3", "key4")),
-          "DATA:WRITE:AuthRegion");
-    });
-
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionWriter", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.removeAll(Arrays.asList("key1", "key2", "key3", "key4"));
-      assertFalse(region.containsKey("key1"));
-      assertNotAuthorized(() -> region.containsKeyOnServer("key1"), 
"DATA:READ:AuthRegion:key1");
-    });
-    ai1.join();
-    ai2.join();
-    ai1.checkException();
-    ai2.checkException();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientSizeAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientSizeAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientSizeAuthDistributedTest.java
deleted file mode 100644
index 84c0399..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientSizeAuthDistributedTest.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 org.apache.geode.security;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.internal.InternalPool;
-import org.apache.geode.cache.client.internal.SizeOp;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientSizeAuthDistributedTest extends 
AbstractSecureServerDUnitTest {
-
-  @Test
-  @Ignore("This is not a supported client message")
-  // this would fail sporadically because ServerConnection.isInternalMessage 
would return true for
-  // this message,
-  // and it won't bind the correct subject on the executing thread.
-  public void testSize() throws InterruptedException {
-
-    AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = createClientCache("dataWriter", "1234567", 
serverPort);
-      assertNotAuthorized(() -> SizeOp.execute((InternalPool) 
cache.getDefaultPool(), REGION_NAME),
-          "DATA:READ:AuthRegion");
-    });
-
-    AsyncInvocation ai2 = client2.invokeAsync(() -> {
-      ClientCache cache = createClientCache("authRegionReader", "1234567", 
serverPort);
-      SizeOp.execute((InternalPool) cache.getDefaultPool(), REGION_NAME);
-    });
-
-    ai1.join();
-    ai2.join();
-    ai1.checkException();
-    ai2.checkException();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
deleted file mode 100644
index 8b99d58..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
+++ /dev/null
@@ -1,48 +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 org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
-import org.apache.geode.cache.client.ClientRegionShortcut;
-import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.SecurityTest;
-
-@Category({DistributedTest.class, SecurityTest.class})
-public class IntegratedClientUnregisterInterestAuthDistributedTest
-    extends AbstractSecureServerDUnitTest {
-
-  @Test
-  public void testUnregisterInterest() throws InterruptedException {
-    // client2 connects to user as a user authorized to use AuthRegion region
-    AsyncInvocation ai1 = client2.invokeAsync(() -> {
-      ClientCache cache =
-          new ClientCacheFactory(createClientProperties("authRegionUser", 
"1234567"))
-              .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
-
-      Region region =
-          
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-      region.registerInterest("key3");
-      region.unregisterInterest("key3"); // DATA:READ:AuthRegion:key3;
-    });
-    ai1.join();
-    ai1.checkException();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
index f7a0885..480ab1c 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/NoShowValue1PostProcessorDUnitTest.java
@@ -14,32 +14,59 @@
  */
 package org.apache.geode.security;
 
+import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.apache.geode.security.SecurityTestUtil.createClientCache;
+import static org.apache.geode.security.SecurityTestUtil.createProxyRegion;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.cache.client.Pool;
 import org.apache.geode.cache.client.PoolManager;
 import org.apache.geode.cache.query.SelectResults;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 @Category({DistributedTest.class, SecurityTest.class})
-public class NoShowValue1PostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
+public class NoShowValue1PostProcessorDUnitTest extends 
JUnit4DistributedTestCase {
+
+  private static String REGION_NAME = "AuthRegion";
+
+  final Host host = Host.getHost(0);
+  final VM client1 = host.getVM(1);
+
+  @Rule
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, 
TestSecurityManager.class.getName())
+          .withProperty(TestSecurityManager.SECURITY_JSON,
+              
"org/apache/geode/management/internal/security/clientServer.json")
+          .withProperty(SECURITY_POST_PROCESSOR, 
NoShowValue1PostProcessor.class.getName())
+          .startServer();
 
-  public Properties getProperties() {
-    Properties properties = super.getProperties();
-    properties.setProperty(SECURITY_POST_PROCESSOR, 
NoShowValue1PostProcessor.class.getName());
-    return properties;
+  @Before
+  public void before() throws Exception {
+    Region region =
+        
server.getCache().createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME);
+    for (int i = 0; i < 5; i++) {
+      region.put("key" + i, "value" + i);
+    }
   }
 
   @Test
@@ -49,8 +76,8 @@ public class NoShowValue1PostProcessorDUnitTest extends 
AbstractSecureServerDUni
     keys.add("key2");
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for get
       assertEquals("value3", region.get("key3"));

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
index ae9b04f..c28f7aa 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
@@ -15,97 +15,65 @@
 
 package org.apache.geode.security;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.awaitility.Awaitility;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.cli.Result.Status;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.HeadlessGfsh;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.pdx.SimpleClass;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.Locator;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.dunit.rules.Server;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
+import org.awaitility.Awaitility;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
 
 @Category({DistributedTest.class, SecurityTest.class})
-public class PDXGfshPostProcessorOnRemoteServerTest extends 
JUnit4DistributedTestCase {
+public class PDXGfshPostProcessorOnRemoteServerTest {
   protected static final String REGION_NAME = "AuthRegion";
-  protected VM locator = null;
-  protected VM server = null;
-
-  @Before
-  public void before() throws Exception {
-    final Host host = Host.getHost(0);
-    this.locator = host.getVM(0);
-    this.server = host.getVM(1);
-  }
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
 
   @Test
   public void testGfshCommand() throws Exception {
-    // set up locator with security
-    int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
-    int locatorPort = ports[0];
-    int jmxPort = ports[1];
-    locator.invoke(() -> {
-      Properties props = new Properties();
-      props.setProperty(TestSecurityManager.SECURITY_JSON,
-          "org/apache/geode/management/internal/security/clientServer.json");
-      props.setProperty(SECURITY_MANAGER, TestSecurityManager.class.getName());
-      props.setProperty(MCAST_PORT, "0");
-      props.put(JMX_MANAGER, "true");
-      props.put(JMX_MANAGER_START, "true");
-      props.put(JMX_MANAGER_PORT, jmxPort + "");
-      props.setProperty(SECURITY_POST_PROCESSOR, 
PDXPostProcessor.class.getName());
-      Locator.startLocatorAndDS(locatorPort, new File("locator.log"), props);
-    });
-
-    // set up server with security
-    String locators = "localhost[" + locatorPort + "]";
-    server.invoke(() -> {
-      Properties props = new Properties();
-      props.setProperty(MCAST_PORT, "0");
-      props.setProperty(LOCATORS, locators);
-      props.setProperty(TestSecurityManager.SECURITY_JSON,
-          "org/apache/geode/management/internal/security/clientServer.json");
-      props.setProperty(SECURITY_MANAGER, TestSecurityManager.class.getName());
-      props.setProperty(SECURITY_POST_PROCESSOR, 
PDXPostProcessor.class.getName());
-      props.setProperty(USE_CLUSTER_CONFIGURATION, "true");
-
-      // the following are needed for peer-to-peer authentication
-      props.setProperty("security-username", "super-user");
-      props.setProperty("security-password", "1234567");
-      InternalDistributedSystem ds = getSystem(props);
-
-      Cache cache = CacheFactory.create(ds);
+    Properties locatorProps = new Properties();
+    locatorProps.setProperty(TestSecurityManager.SECURITY_JSON,
+        "org/apache/geode/management/internal/security/clientServer.json");
+    locatorProps.setProperty(SECURITY_MANAGER, 
TestSecurityManager.class.getName());
+    locatorProps.setProperty(SECURITY_POST_PROCESSOR, 
PDXPostProcessor.class.getName());
+
+    MemberVM<Locator> locatorVM = lsRule.startLocatorVM(0, locatorProps);
+
+    Properties serverProps = new Properties();
+    serverProps.setProperty(TestSecurityManager.SECURITY_JSON,
+        "org/apache/geode/management/internal/security/clientServer.json");
+    serverProps.setProperty("security-username", "super-user");
+    serverProps.setProperty("security-password", "1234567");
+    MemberVM<Server> serverVM = lsRule.startServerVM(1, serverProps, 
locatorVM.getPort());
+
+    serverVM.invoke(() -> {
+      Cache cache = LocatorServerStartupRule.serverStarter.getCache();
       Region region = 
cache.createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME);
-
-      CacheServer server = cache.addCacheServer();
-      server.setPort(0);
-      server.start();
-
       for (int i = 0; i < 5; i++) {
         SimpleClass obj = new SimpleClass(i, (byte) i);
         region.put("key" + i, obj);
@@ -113,7 +81,7 @@ public class PDXGfshPostProcessorOnRemoteServerTest extends 
JUnit4DistributedTes
     });
 
     // wait until the region bean is visible
-    locator.invoke(() -> {
+    locatorVM.invoke(() -> {
       Awaitility.await().pollInterval(500, TimeUnit.MICROSECONDS).atMost(5, 
TimeUnit.SECONDS)
           .until(() -> {
             Cache cache = CacheFactory.getAnyInstance();
@@ -123,33 +91,16 @@ public class PDXGfshPostProcessorOnRemoteServerTest 
extends JUnit4DistributedTes
           });
     });
 
-    // run gfsh command in this vm
-    CliUtil.isGfshVM = true;
-    String shellId = getClass().getSimpleName();
-    HeadlessGfsh gfsh = new HeadlessGfsh(shellId, 30, "gfsh_files");
-
-    // connect to the jmx server
-    final CommandStringBuilder connectCommand = new 
CommandStringBuilder(CliStrings.CONNECT);
-    connectCommand.addOption(CliStrings.CONNECT__USERNAME, "dataUser");
-    connectCommand.addOption(CliStrings.CONNECT__PASSWORD, "1234567");
-
-    String endpoint = "localhost[" + jmxPort + "]";
-    connectCommand.addOption(CliStrings.CONNECT__JMX_MANAGER, endpoint);
-
-    gfsh.executeCommand(connectCommand.toString());
-    CommandResult result = (CommandResult) gfsh.getResult();
+    gfsh.connectAndVerify(locatorVM.getJmxPort(), 
GfshShellConnectionRule.PortType.jmxManger,
+        CliStrings.CONNECT__USERNAME, "dataUser", 
CliStrings.CONNECT__PASSWORD, "1234567");
 
     // get command
-    gfsh.executeCommand("get --key=key1 --region=AuthRegion");
-    result = (CommandResult) gfsh.getResult();
-    assertEquals(result.getStatus(), Status.OK);
+    CommandResult result = gfsh.executeAndVerifyCommand("get --key=key1 
--region=AuthRegion");
     
assertTrue(result.getContent().toString().contains(SimpleClass.class.getName()));
 
-    gfsh.executeCommand("query --query=\"select * from /AuthRegion\"");
-    result = (CommandResult) gfsh.getResult();
+    gfsh.executeAndVerifyCommand("query --query=\"select * from 
/AuthRegion\"");
 
-    CliUtil.isGfshVM = false;
-    server.invoke(() -> {
+    serverVM.invoke(() -> {
       PDXPostProcessor pp =
           (PDXPostProcessor) 
SecurityService.getSecurityService().getPostProcessor();
       // verify that the post processor is called 6 times. (5 for the query, 1 
for the get)

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
index f8b17bc..ad72fab 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
@@ -15,52 +15,59 @@
 
 package org.apache.geode.security;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.awaitility.Awaitility;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
+import static org.apache.geode.security.SecurityTestUtil.createClientCache;
+import static org.apache.geode.security.SecurityTestUtil.createProxyRegion;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.client.ClientCache;
-import org.apache.geode.cache.client.ClientCacheFactory;
 import org.apache.geode.cache.client.ClientRegionFactory;
 import org.apache.geode.cache.client.ClientRegionShortcut;
 import org.apache.geode.cache.query.SelectResults;
 import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.cache.EntryEventImpl;
 import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.management.cli.Result.Status;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.HeadlessGfsh;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.pdx.SimpleClass;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import 
org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
+import org.awaitility.Awaitility;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
 
 @Category({DistributedTest.class, SecurityTest.class})
 @RunWith(Parameterized.class)
 
@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
-public class PDXPostProcessorDUnitTest extends AbstractSecureServerDUnitTest {
+public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
+  private static String REGION_NAME = "AuthRegion";
+
+  final Host host = Host.getHost(0);
+  final VM client1 = host.getVM(1);
+  final VM client2 = host.getVM(2);
+
+  private boolean pdxPersistent = false;
   private static byte[] BYTES = PDXPostProcessor.BYTES;
-  private int jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
   @Parameterized.Parameters
   public static Collection<Object[]> parameters() {
@@ -68,27 +75,24 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     return Arrays.asList(params);
   }
 
-  public Properties getProperties() {
-    Properties properties = super.getProperties();
-    properties.setProperty(SECURITY_POST_PROCESSOR, 
PDXPostProcessor.class.getName());
-    properties.setProperty(JMX_MANAGER_PORT, jmxPort + "");
-    properties.setProperty("security-pdx", pdxPersistent + "");
-    return properties;
-  }
-
-  public Map<String, String> getData() {
-    return new HashMap();
-  }
-
   public PDXPostProcessorDUnitTest(boolean pdxPersistent) {
     this.pdxPersistent = pdxPersistent;
   }
 
+  @Rule
+  public ServerStarterRule server =
+      new ServerStarterRule().withProperty(SECURITY_MANAGER, 
TestSecurityManager.class.getName())
+          .withProperty(TestSecurityManager.SECURITY_JSON,
+              
"org/apache/geode/management/internal/security/clientServer.json")
+          .withProperty(SECURITY_POST_PROCESSOR, 
PDXPostProcessor.class.getName())
+          .withProperty("security-pdx", pdxPersistent + 
"").withJMXManager().startServer()
+          .createRegion(RegionShortcut.REPLICATE, REGION_NAME);
+
   @Test
   public void testRegionGet() {
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
       // put in a byte value
@@ -96,8 +100,8 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     });
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for get the client domain object
       Object value = region.get("key1");
@@ -117,16 +121,16 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
   @Test
   public void testQuery() {
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
       region.put("key2", BYTES);
     });
 
     client1.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
 
       // post process for query
       String query = "select * from /AuthRegion";
@@ -149,12 +153,11 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     assertEquals(pp.getCount(), 2);
   }
 
-  @Category(FlakyTest.class) // GEODE-2204
   @Test
   public void testRegisterInterest() {
+    IgnoredException.addIgnoredException("NoAvailableServersException");
     client1.invoke(() -> {
-      ClientCache cache = new 
ClientCacheFactory(createClientProperties("super-user", "1234567"))
-          .setPoolSubscriptionEnabled(true).addPoolServer("localhost", 
serverPort).create();
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
 
       ClientRegionFactory factory = 
cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
       factory.addCacheListener(new CacheListenerAdapter() {
@@ -177,8 +180,8 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     });
 
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("dataUser", "1234567", serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("dataUser", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
       region.put("key2", BYTES);
@@ -191,13 +194,12 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     assertEquals(pp.getCount(), 2);
   }
 
-  @Category(FlakyTest.class) // GEODE-1719
   @Test
   public void testGfshCommand() {
     // have client2 input some domain data into the region
     client2.invoke(() -> {
-      ClientCache cache = createClientCache("super-user", "1234567", 
serverPort);
-      Region region = cache.getRegion(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", 
server.getPort());
+      Region region = createProxyRegion(cache, REGION_NAME);
       // put in a value that's a domain object
       region.put("key1", new SimpleClass(1, (byte) 1));
       // put in a byte value
@@ -205,39 +207,22 @@ public class PDXPostProcessorDUnitTest extends 
AbstractSecureServerDUnitTest {
     });
 
     client1.invoke(() -> {
-      CliUtil.isGfshVM = true;
-      String shellId = getClass().getSimpleName();
-      HeadlessGfsh gfsh = new HeadlessGfsh(shellId, 30, "gfsh_files");
-
-      // connect to the jmx server
-      final CommandStringBuilder connectCommand = new 
CommandStringBuilder(CliStrings.CONNECT);
-      connectCommand.addOption(CliStrings.CONNECT__USERNAME, "dataUser");
-      connectCommand.addOption(CliStrings.CONNECT__PASSWORD, "1234567");
-
-      String endpoint = "localhost[" + jmxPort + "]";
-      connectCommand.addOption(CliStrings.CONNECT__JMX_MANAGER, endpoint);
-
-      gfsh.executeCommand(connectCommand.toString());
-      CommandResult result = (CommandResult) gfsh.getResult();
+      GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+      gfsh.secureConnectAndVerify(server.getJmxPort(), 
GfshShellConnectionRule.PortType.jmxManger,
+          "dataUser", "1234567");
 
       // get command
-      gfsh.executeCommand("get --key=key1 --region=AuthRegion");
-      result = (CommandResult) gfsh.getResult();
-      assertEquals(result.getStatus(), Status.OK);
+      CommandResult result = gfsh.executeAndVerifyCommand("get --key=key1 
--region=AuthRegion");
       if (pdxPersistent)
-        assertTrue(result.getContent().toString()
-            .contains("org.apache.geode.pdx.internal.PdxInstanceImpl"));
+        
assertThat(gfsh.getGfshOutput().contains("org.apache.geode.pdx.internal.PdxInstanceImpl"));
       else
-        assertTrue(result.getContent().toString().contains("SimpleClass"));
+        assertThat(gfsh.getGfshOutput()).contains("SimpleClass");
 
-      gfsh.executeCommand("get --key=key2 --region=AuthRegion");
-      result = (CommandResult) gfsh.getResult();
-      assertEquals(result.getStatus(), Status.OK);
+      result = gfsh.executeAndVerifyCommand("get --key=key2 
--region=AuthRegion");
       assertTrue(result.getContent().toString().contains("byte[]"));
 
-      gfsh.executeCommand("query --query=\"select * from /AuthRegion\"");
-      result = (CommandResult) gfsh.getResult();
-      System.out.println("gfsh result: " + result);
+      gfsh.executeAndVerifyCommand("query --query=\"select * from 
/AuthRegion\"");
+      gfsh.close();
     });
 
     PDXPostProcessor pp =

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
index dd913c2..b977b50 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/PeerAuthenticatorDUnitTest.java
@@ -61,7 +61,6 @@ public class PeerAuthenticatorDUnitTest {
 
     server2.invoke(() -> {
       ServerStarterRule serverStarter = new ServerStarterRule();
-      serverStarter.before();
       LocatorServerStartupRule.serverStarter = serverStarter;
       assertThatThrownBy(() -> serverStarter.startServer(server2Props, 
locatorPort))
           
.isInstanceOf(GemFireSecurityException.class).hasMessageContaining("Invalid 
user name");

http://git-wip-us.apache.org/repos/asf/geode/blob/69dbc10f/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
index 9cfb5ec..f3d974e 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/PeerSecurityWithEmbeddedLocatorDUnitTest.java
@@ -62,7 +62,6 @@ public class PeerSecurityWithEmbeddedLocatorDUnitTest {
     VM server2 = getHost(0).getVM(2);
     server2.invoke(() -> {
       ServerStarterRule serverStarter = new ServerStarterRule();
-      serverStarter.before();
       LocatorServerStartupRule.serverStarter = serverStarter;
       assertThatThrownBy(() -> serverStarter.startServer(server2Props, 
locatorPort))
           .isInstanceOf(GemFireSecurityException.class)
@@ -94,7 +93,6 @@ public class PeerSecurityWithEmbeddedLocatorDUnitTest {
     VM server2 = getHost(0).getVM(2);
     server2.invoke(() -> {
       ServerStarterRule serverStarter = new ServerStarterRule();
-      serverStarter.before();
       LocatorServerStartupRule.serverStarter = serverStarter;
       assertThatThrownBy(() -> serverStarter.startServer(server2Props, 
locatorPort))
           
.isInstanceOf(GemFireSecurityException.class).hasMessageContaining("Invalid 
user name");

Reply via email to